Skip to main content

Installation

pip install zespan llama-index

Usage

Register LumiqLlamaIndexCallbackHandler with LlamaIndex’s global callback manager.
import zespan
from zespan import LumiqLlamaIndexCallbackHandler
from llama_index.core import Settings
from llama_index.core.callbacks import CallbackManager

zespan.init(api_key="zsp_your_api_key_here")

handler = LumiqLlamaIndexCallbackHandler()
Settings.callback_manager = CallbackManager([handler])
All LlamaIndex LLM calls, retrievals, and agent steps made after this point are traced automatically.
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)