mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-02-08 07:53:29 +08:00
Agent提示词更改,增加图片 (#1667)
* 更新上agent提示词代码 * 更新部分文档,修复了issue中提到的bge匹配超过1 的bug * 按需修改 * 解决了部分最新用户用依赖的bug,加了两个工具,移除google工具 * Agent大幅度优化 1. 修改了UI界面 (1)高亮所有没有进行agent对齐的模型, (2)优化输出体验和逻辑,使用markdown 2. 降低天气工具使用门槛 3. 依赖更新 (1) vllm 更新到0.2.0,增加了一些参数 (2) torch 建议更新到2.1 (3)pydantic不要更新到1.10.12 * 更新了一些注释
This commit is contained in:
parent
2c8fc95f7a
commit
7475205eca
@ -47,3 +47,60 @@ PROMPT_TEMPLATES = {
|
|||||||
Thought: {agent_scratchpad}
|
Thought: {agent_scratchpad}
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## GPT或Qwen 的Prompt
|
||||||
|
# """
|
||||||
|
# Answer the following questions as best you can. You have access to the following tools:
|
||||||
|
#
|
||||||
|
# {tools}
|
||||||
|
#
|
||||||
|
# Please note that the "知识库查询工具" is information about the "西交利物浦大学" ,and if a question is asked about it, you must answer with the knowledge base
|
||||||
|
#
|
||||||
|
# Use the following format:
|
||||||
|
#
|
||||||
|
# Question: the input question you must answer
|
||||||
|
# Thought: you should always think about what to do
|
||||||
|
# Action: the action to take, should be one of [{tool_names}]
|
||||||
|
# Action Input: the input to the action
|
||||||
|
# Observation: the result of the action
|
||||||
|
# ... (this Thought/Action/Action Input/Observation can be repeated zero or more times)
|
||||||
|
# Thought: I now know the final answer
|
||||||
|
# Final Answer: the final answer to the original input question
|
||||||
|
#
|
||||||
|
# Begin!
|
||||||
|
#
|
||||||
|
# history:
|
||||||
|
# {history}
|
||||||
|
#
|
||||||
|
# Question: {input}
|
||||||
|
# Thought: {agent_scratchpad}
|
||||||
|
# """
|
||||||
|
|
||||||
|
|
||||||
|
## ChatGLM-Pro的Prompt
|
||||||
|
|
||||||
|
# """
|
||||||
|
# 请请严格按照提供的思维方式来思考。你的知识不一定正确,所以你一定要用提供的工具来思考,并给出用户答案。
|
||||||
|
# 你有以下工具可以使用:
|
||||||
|
# {tools}
|
||||||
|
# ```
|
||||||
|
# Question: 用户的提问或者观察到的信息,
|
||||||
|
# Thought: 你应该思考该做什么,是根据工具的结果来回答问题,还是决定使用什么工具。
|
||||||
|
# Action: 需要使用的工具,应该是在[{tool_names}]中的一个。
|
||||||
|
# Action Input: 传入工具的内容
|
||||||
|
# Observation: 工具给出的答案(不是你生成的)
|
||||||
|
# ... (this Thought/Action/Action Input/Observation can be repeated zero or more times)
|
||||||
|
# Thought: 通过工具给出的答案,你是否能回答Question。
|
||||||
|
# Final Answer是你的答案
|
||||||
|
#
|
||||||
|
# 现在,我们开始!
|
||||||
|
# 你和用户的历史记录:
|
||||||
|
# History:
|
||||||
|
# {history}
|
||||||
|
#
|
||||||
|
# 用户开始以提问:
|
||||||
|
# Question: {input}
|
||||||
|
# Thought: {agent_scratchpad}
|
||||||
|
#
|
||||||
|
# """
|
||||||
|
|||||||
BIN
img/agent_continue.png
Normal file
BIN
img/agent_continue.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 101 KiB |
BIN
img/agent_success.png
Normal file
BIN
img/agent_success.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 84 KiB |
@ -52,13 +52,9 @@ class CustomOutputParser(AgentOutputParser):
|
|||||||
llm_output = llm_output[:min_index]
|
llm_output = llm_output[:min_index]
|
||||||
|
|
||||||
if "Final Answer:" in llm_output:
|
if "Final Answer:" in llm_output:
|
||||||
output = llm_output.split("Final Answer:", 1)[-1].strip()
|
|
||||||
self.begin = True
|
self.begin = True
|
||||||
return AgentFinish(
|
return AgentFinish(
|
||||||
# Return values is generally always a dictionary with a single `output` key
|
return_values={"output": llm_output.split("Final Answer:", 1)[-1].strip()},
|
||||||
# It is not recommended to try anything else at the moment :)
|
|
||||||
# return_values={"output": llm_output.replace("Final Answer:", "").strip()},
|
|
||||||
return_values={"output": output},
|
|
||||||
log=llm_output,
|
log=llm_output,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -34,6 +34,7 @@ from langchain.prompts import PromptTemplate
|
|||||||
|
|
||||||
## 使用和风天气API查询天气
|
## 使用和风天气API查询天气
|
||||||
KEY = "ac880e5a877042809ac7ffdd19d95b0d"
|
KEY = "ac880e5a877042809ac7ffdd19d95b0d"
|
||||||
|
#key长这样,这里提供了示例的key,这个key没法使用,你需要自己去注册和风天气的账号,然后在这里填入你的key
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user