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 { Klaro, retries, pii } from "@klaroshield/sdk";
const llm = new OpenAI({ model: "gpt-4o" });
const klaro = new Klaro()
.use(retries({ max: 3 }))
.use(pii({ mode: "mask" }));
const chat = klaro.wrap(llm.chat.bind(llm));
const response = await chat({
messages: [{ content: "Tell me a joke.", role: "user" }],
});Checked against the shipped @klaroshield/sdk API. Full docs at klaro.services/klaroshield/docs.