← nopea.tech
ScaneaConsenteaMaskeaBundlesPricing
Agent frameworks

LlamaIndex LLM

@llamaindex/openai's llm.chat() is an instance method like OpenAI's own SDK -- bind it the same way.

← All recipes
import { OpenAI } from "@llamaindex/openai";
import { Maskea, retries, pii } from "@nopeatech/maskea";

const llm = new OpenAI({ model: "gpt-4o" });

const maskea = new Maskea()
  .use(retries({ max: 3 }))
  .use(pii({ mode: "mask" }));

const chat = maskea.wrap(llm.chat.bind(llm));

const response = await chat({
  messages: [{ content: "Tell me a joke.", role: "user" }],
});

Checked against the shipped @nopeatech/maskea API. Full docs at nopea.tech/maskea/docs.

More in Agent frameworks

LangChain agent →