Langchain-Chatchat/configs/prompt_config.py.example
zR 253168a187 Dev (#2280)
* 修复Azure 不设置Max token的bug

* 重写agent

1. 修改Agent实现方式,支持多参数,仅剩 ChatGLM3-6b和 OpenAI GPT4 支持,剩余模型将在暂时缺席Agent功能
2. 删除agent_chat 集成到llm_chat中
3. 重写大部分工具,适应新Agent

* 更新架构

* 删除web_chat,自动融合

* 移除所有聊天,都变成Agent控制

* 更新配置文件

* 更新配置模板和提示词

* 更改参数选择bug
2024-03-06 13:32:36 +08:00

94 lines
4.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

PROMPT_TEMPLATES = {
"preprocess_model": {
"default":
'请你根据我的描述和我们对话的历史来判断本次跟我交流是否需要使用工具还是可以直接凭借你的知识或者历史记录跟我对话。你只要回答一个数字。1 或者 01代表需要使用工具0代表不需要使用工具。\n'
'以下几种情况要使用工具,请返回1\n'
'1. 实时性的问题,例如天气,日期,地点等信息\n'
'2. 需要数学计算的问题\n'
'3. 需要查询数据,地点等精确数据\n'
'4. 需要行业知识的问题\n'
'<question>'
'{input}'
'</question>'
},
"llm_model": {
"default":
'{{ input }}',
"with_history":
'The following is a friendly conversation between a human and an AI. '
'The AI is talkative and provides lots of specific details from its context. '
'If the AI does not know the answer to a question, it truthfully says it does not know.\n\n'
'Current conversation:\n'
'{history}\n'
'Human: {input}\n'
'AI:',
},
"action_model": {
"GPT-4":
'Answer the following questions as best you can. You have access to the following tools:\n'
'The way you use the tools is by specifying a json blob.\n'
'Specifically, this json should have a `action` key (with the name of the tool to use) and a `action_input` key (with the input to the tool going here).\n'
'The only values that should be in the "action" field are: {tool_names}\n'
'The $JSON_BLOB should only contain a SINGLE action, do NOT return a list of multiple actions. Here is an example of a valid $JSON_BLOB:\n'
'```\n\n'
'{{{{\n'
' "action": $TOOL_NAME,\n'
' "action_input": $INPUT\n'
'}}}}\n'
'```\n\n'
'ALWAYS use the following format:\n'
'Question: the input question you must answer\n'
'Thought: you should always think about what to do\n'
'Action:\n'
'```\n\n'
'$JSON_BLOB'
'```\n\n'
'Observation: the result of the action\n'
'... (this Thought/Action/Observation can repeat N times)\n'
'Thought: I now know the final answer\n'
'Final Answer: the final answer to the original input question\n'
'Begin! Reminder to always use the exact characters `Final Answer` when responding.\n'
'history: {history}\n'
'Question:{input}\n'
'Thought:{agent_scratchpad}\n',
"ChatGLM3":
'You can answer using the tools.Respond to the human as helpfully and accurately as possible.\n'
'You have access to the following tools:\n'
'{tools}\n'
'Use a json blob to specify a tool by providing an action key (tool name)\n'
'and an action_input key (tool input).\n'
'Valid "action" values: "Final Answer" or [{tool_names}]\n'
'Provide only ONE action per $JSON_BLOB, as shown:\n\n'
'```\n'
'{{{{\n'
' "action": $TOOL_NAME,\n'
' "action_input": $INPUT\n'
'}}}}\n'
'```\n\n'
'Follow this format:\n\n'
'Question: input question to answer\n'
'Thought: consider previous and subsequent steps\n'
'Action:\n'
'```\n'
'$JSON_BLOB\n'
'```\n'
'Observation: action result\n'
'... (repeat Thought/Action/Observation N times)\n'
'Thought: I know what to respond\n'
'Action:\n'
'```\n'
'{{{{\n'
' "action": "Final Answer",\n'
' "action_input": "Final response to human"\n'
'}}}}\n'
'Begin! Reminder to ALWAYS respond with a valid json blob of a single action. Use tools if necessary.\n'
'Respond directly if appropriate. Format is Action:```$JSON_BLOB```then Observation:.\n'
'history: {history}\n\n'
'Question: {input}\n\n'
'Thought: {agent_scratchpad}\n',
},
"postprocess_model": {
"default": "{{input}}",
}
}