Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Trace LlamaIndex LLM calls, tool use, and agent steps with Zespan using the callback handler.
pip install zespan llama-index
ZespanLlamaIndexCallbackHandler
import zespan from zespan import ZespanLlamaIndexCallbackHandler from llama_index.core import Settings from llama_index.core.callbacks import CallbackManager zespan.init(api_key="zsp_your_api_key_here") handler = ZespanLlamaIndexCallbackHandler() Settings.callback_manager = CallbackManager([handler])
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader documents = SimpleDirectoryReader("data").load_data() index = VectorStoreIndex.from_documents(documents) query_engine = index.as_query_engine() response = query_engine.query("What are the key points?") print(response)
npm install @zespan/sdk llamaindex
ZespanLlamaIndexHandler
import { ZespanLlamaIndexHandler, zespan } from "@zespan/sdk"; import { Settings } from "llamaindex"; zespan.init({ apiKey: process.env.ZESPAN_API_KEY! }); const handler = new ZespanLlamaIndexHandler(); handler.attach(Settings.callbackManager);
import { VectorStoreIndex, SimpleDirectoryReader } from "llamaindex"; const documents = await new SimpleDirectoryReader().loadData({ directoryPath: "./data" }); const index = await VectorStoreIndex.fromDocuments(documents); const queryEngine = index.asQueryEngine(); const response = await queryEngine.query({ query: "What are the key points?" }); console.log(response.toString());
handler.detach(Settings.callbackManager);
Was this page helpful?