集成
LlamaIndex 回调处理器
集成
LlamaIndex 回调处理器
回调处理器,使 Chainlit 能够在 UI 中显示中间步骤。
用法
代码示例
from llama_index.core.callbacks import CallbackManager
from llama_index.core.service_context import ServiceContext
import chainlit as cl
@cl.on_chat_start
async def start():
service_context = ServiceContext.from_defaults(callback_manager=CallbackManager([cl.LlamaIndexCallbackHandler()]))
# use the service context to create the predictor
页面目录