We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
chatchat已经部署好了,请问如何实现我调知识库,通过几行代码传入“问题”,chatchat直接返回检索的top3文档?
请问如何实现这一过程,现在只有web界面,我想把chatchat返回的内容作为我另一个需求的输入。@dosu-bot
The text was updated successfully, but these errors were encountered:
要通过代码从 chatchat 检索并返回 top3 文档,可以使用 kb_chat 函数,并设置 top_k 参数为 3。以下是一个示例代码片段,展示如何实现这一过程:
kb_chat
top_k
from fastapi import Body # 假设你已经设置了其他必要的参数 query = "你的查询内容" kb_name = "你的知识库名称" # 调用 kb_chat 函数,设置 top_k 为 3 response = await kb_chat( query=Body(query), mode=Body("local_kb"), kb_name=Body(kb_name), top_k=Body(3), # 设置为3以返回top3文档 score_threshold=Body(0.5), # 可根据需要调整 return_direct=Body(True) # 直接返回检索结果 ) # 处理返回的文档 for doc in response: print(doc)
在这个代码片段中,top_k 参数被设置为 3,以确保返回的文档数量为 top3。return_direct 参数被设置为 True,以便直接返回检索结果而不经过 LLM 处理[1].
return_direct
True
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other
Sorry, something went wrong.
No branches or pull requests
chatchat已经部署好了,请问如何实现我调知识库,通过几行代码传入“问题”,chatchat直接返回检索的top3文档?
请问如何实现这一过程,现在只有web界面,我想把chatchat返回的内容作为我另一个需求的输入。@dosu-bot
The text was updated successfully, but these errors were encountered: