知识库通过tool 调用你的模板优化
This commit is contained in:
parent
889e54fe12
commit
1470ac1739
|
|
@ -16,11 +16,11 @@ from chatchat.server.utils import get_tool_config
|
|||
# "this knowledge use this tool. The 'database' should be one of the above [{key}]."
|
||||
# )
|
||||
template = (
|
||||
"使用本地知识库里\n{KB_info}\n去查与大模型技术栈相关的问题时,只有当用户的问题在本地知识库里时才使用这个工具查询"
|
||||
"'database' 应该是上面的 [{key}] 之一."
|
||||
"使用本地知识库里\n{KB_info}\n查国家电网各部门规章制度、安徽送变电规章制度等相关的问题时,只有当用户的问题在本地知识库里时才使用这个工具查询"
|
||||
"'database' 应该是上面的 [{key}] 之一."
|
||||
)
|
||||
KB_info_str = "\n".join([f"{key}: {value}" for key, value in Settings.kb_settings.KB_INFO.items()])
|
||||
template_knowledge = template.format(KB_info=KB_info_str, key="samples")
|
||||
template_knowledge = template.format(KB_info=KB_info_str, key="test")
|
||||
|
||||
print(f"template_knowledge 模版:{template_knowledge}")
|
||||
|
||||
|
|
|
|||
|
|
@ -865,7 +865,7 @@ def update_search_local_knowledgebase_tool():
|
|||
|
||||
kbs = list_kbs_from_db()
|
||||
#template = "Use local knowledgebase from one or more of these:\n{KB_info}\n to get information,Only local data on this knowledge use this tool. The 'database' should be one of the above [{key}]."
|
||||
template = "使用本地知识库里\n{KB_info}\n去查与大模型技术栈相关的问题时,只有当用户的问题在本地知识库里时才使用这个工具查询.'database' 应该是上面的 [{key}] 之一"
|
||||
template = "使用本地知识库里\n{KB_info}\n去查1)国家电网各部门规章制度、安全生产、合同管控等 2)安徽送变电规章制度、安全生产、合同管控等 3)国网基建数字化管理 4)国网输变电工程管理等相关的问题时,只有当用户的问题在本地知识库里时才使用这个工具查询.'database' 应该是上面的 [{key}] 之一"
|
||||
KB_info_str = "\n".join([f"{kb.kb_name}: {kb.kb_info}" for kb in kbs])
|
||||
KB_name_info_str = "\n".join([f"{kb.kb_name}" for kb in kbs])
|
||||
template_knowledge = template.format(KB_info=KB_info_str, key=KB_name_info_str)
|
||||
|
|
|
|||
Loading…
Reference in New Issue