from llama_index.callbacks import CallbackManager, LlamaDebugHandler, CBEventType # Set up the LlamaDebugHandler llama_debug = LlamaDebugHandler(print_trace_on_end=True) callback_manager = CallbackManager([llama_debug]) # Create a ServiceContext with the CallbackManager service_context = ServiceContext.from_defaults(callback_manager=callback_manager) # Trigger the callback with a query index = VectorStoreIndex.from_documents(docs, service_context=service_context) query_engine = index.as_query_engine() response = query_engine.query("What did the author do growing up?")