update config templates
This commit is contained in:
parent
072e0a2a32
commit
89b07ba55d
|
|
@ -106,7 +106,7 @@ kbs_config = {
|
||||||
# TextSplitter配置项,如果你不明白其中的含义,就不要修改。
|
# TextSplitter配置项,如果你不明白其中的含义,就不要修改。
|
||||||
text_splitter_dict = {
|
text_splitter_dict = {
|
||||||
"ChineseRecursiveTextSplitter": {
|
"ChineseRecursiveTextSplitter": {
|
||||||
"source": "huggingface", ## 选择tiktoken则使用openai的方法
|
"source": "huggingface", # 选择tiktoken则使用openai的方法
|
||||||
"tokenizer_name_or_path": "",
|
"tokenizer_name_or_path": "",
|
||||||
},
|
},
|
||||||
"SpacyTextSplitter": {
|
"SpacyTextSplitter": {
|
||||||
|
|
|
||||||
|
|
@ -180,8 +180,8 @@ MODEL_PATH = {
|
||||||
|
|
||||||
"Qwen-72B": "Qwen/Qwen-72B",
|
"Qwen-72B": "Qwen/Qwen-72B",
|
||||||
"Qwen-72B-Chat": "Qwen/Qwen-72B-Chat",
|
"Qwen-72B-Chat": "Qwen/Qwen-72B-Chat",
|
||||||
"Qwen-72B-Chat-Int8":"Qwen/Qwen-72B-Chat-Int8"
|
"Qwen-72B-Chat-Int8": "Qwen/Qwen-72B-Chat-Int8",
|
||||||
"Qwen-72B-Chat-Int4":"Qwen/Qwen-72B-Chat-Int4"
|
"Qwen-72B-Chat-Int4": "Qwen/Qwen-72B-Chat-Int4",
|
||||||
|
|
||||||
"baichuan2-13b": "baichuan-inc/Baichuan2-13B-Chat",
|
"baichuan2-13b": "baichuan-inc/Baichuan2-13B-Chat",
|
||||||
"baichuan2-7b": "baichuan-inc/Baichuan2-7B-Chat",
|
"baichuan2-7b": "baichuan-inc/Baichuan2-7B-Chat",
|
||||||
|
|
@ -300,8 +300,8 @@ VLLM_MODEL_DICT = {
|
||||||
|
|
||||||
"Qwen-72B": "Qwen/Qwen-72B",
|
"Qwen-72B": "Qwen/Qwen-72B",
|
||||||
"Qwen-72B-Chat": "Qwen/Qwen-72B-Chat",
|
"Qwen-72B-Chat": "Qwen/Qwen-72B-Chat",
|
||||||
"Qwen-72B-Chat-Int8":"Qwen/Qwen-72B-Chat-Int8"
|
"Qwen-72B-Chat-Int8": "Qwen/Qwen-72B-Chat-Int8",
|
||||||
"Qwen-72B-Chat-Int4":"Qwen/Qwen-72B-Chat-Int4"
|
"Qwen-72B-Chat-Int4": "Qwen/Qwen-72B-Chat-Int4",
|
||||||
|
|
||||||
"agentlm-7b": "THUDM/agentlm-7b",
|
"agentlm-7b": "THUDM/agentlm-7b",
|
||||||
"agentlm-13b": "THUDM/agentlm-13b",
|
"agentlm-13b": "THUDM/agentlm-13b",
|
||||||
|
|
|
||||||
|
|
@ -16,122 +16,112 @@
|
||||||
# - input: 用户输入内容
|
# - input: 用户输入内容
|
||||||
# - agent_scratchpad: Agent的思维记录
|
# - agent_scratchpad: Agent的思维记录
|
||||||
|
|
||||||
PROMPT_TEMPLATES = {}
|
PROMPT_TEMPLATES = {
|
||||||
|
"llm_chat": {
|
||||||
|
"default":
|
||||||
|
'{{ input }}',
|
||||||
|
|
||||||
PROMPT_TEMPLATES["llm_chat"] = {
|
|
||||||
"default": "{{ input }}",
|
|
||||||
"with_history":
|
"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.
|
'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:',
|
||||||
|
|
||||||
Current conversation:
|
|
||||||
{history}
|
|
||||||
Human: {input}
|
|
||||||
AI:""",
|
|
||||||
"py":
|
"py":
|
||||||
"""
|
'你是一个聪明的代码助手,请你给我写出简单的py代码。 \n'
|
||||||
你是一个聪明的代码助手,请你给我写出简单的py代码。 \n
|
'{{ input }}',
|
||||||
{{ input }}
|
},
|
||||||
""",
|
|
||||||
}
|
|
||||||
|
|
||||||
PROMPT_TEMPLATES["knowledge_base_chat"] = {
|
|
||||||
|
"knowledge_base_chat": {
|
||||||
"default":
|
"default":
|
||||||
"""
|
'<指令>根据已知信息,简洁和专业的来回答问题。如果无法从中得到答案,请说 “根据已知信息无法回答该问题”,'
|
||||||
<指令>根据已知信息,简洁和专业的来回答问题。如果无法从中得到答案,请说 “根据已知信息无法回答该问题”,不允许在答案中添加编造成分,答案请使用中文。 </指令>
|
'不允许在答案中添加编造成分,答案请使用中文。 </指令>\n'
|
||||||
<已知信息>{{ context }}</已知信息>、
|
'<已知信息>{{ context }}</已知信息>\n'
|
||||||
<问题>{{ question }}</问题>
|
'<问题>{{ question }}</问题>\n',
|
||||||
""",
|
|
||||||
"text":
|
"text":
|
||||||
"""
|
'<指令>根据已知信息,简洁和专业的来回答问题。如果无法从中得到答案,请说 “根据已知信息无法回答该问题”,答案请使用中文。 </指令>\n'
|
||||||
<指令>根据已知信息,简洁和专业的来回答问题。如果无法从中得到答案,请说 “根据已知信息无法回答该问题”,答案请使用中文。 </指令>
|
'<已知信息>{{ context }}</已知信息>\n'
|
||||||
<已知信息>{{ context }}</已知信息>、
|
'<问题>{{ question }}</问题>\n',
|
||||||
<问题>{{ question }}</问题>
|
|
||||||
""",
|
|
||||||
"Empty": # 搜不到知识库的时候使用
|
"Empty": # 搜不到知识库的时候使用
|
||||||
"""
|
'请你回答我的问题:\n'
|
||||||
请你回答我的问题:
|
'{{ question }}\n\n',
|
||||||
{{ question }}
|
},
|
||||||
\n
|
|
||||||
""",
|
|
||||||
}
|
"search_engine_chat": {
|
||||||
PROMPT_TEMPLATES["search_engine_chat"] = {
|
|
||||||
"default":
|
"default":
|
||||||
"""
|
'<指令>这是我搜索到的互联网信息,请你根据这些信息进行提取并有调理,简洁的回答问题。'
|
||||||
<指令>这是我搜索到的互联网信息,请你根据这些信息进行提取并有调理,简洁的回答问题。如果无法从中得到答案,请说 “无法搜索到能回答问题的内容”。 </指令>
|
'如果无法从中得到答案,请说 “无法搜索到能回答问题的内容”。 </指令>\n'
|
||||||
<已知信息>{{ context }}</已知信息>
|
'<已知信息>{{ context }}</已知信息>\n'
|
||||||
<问题>{{ question }}</问题>
|
'<问题>{{ question }}</问题>\n',
|
||||||
""",
|
|
||||||
"search":
|
"search":
|
||||||
"""
|
'<指令>根据已知信息,简洁和专业的来回答问题。如果无法从中得到答案,请说 “根据已知信息无法回答该问题”,答案请使用中文。 </指令>\n'
|
||||||
<指令>根据已知信息,简洁和专业的来回答问题。如果无法从中得到答案,请说 “根据已知信息无法回答该问题”,答案请使用中文。 </指令>
|
'<已知信息>{{ context }}</已知信息>\n'
|
||||||
<已知信息>{{ context }}</已知信息>、
|
'<问题>{{ question }}</问题>\n',
|
||||||
<问题>{{ question }}</问题>
|
},
|
||||||
""",
|
|
||||||
}
|
|
||||||
PROMPT_TEMPLATES["agent_chat"] = {
|
"agent_chat": {
|
||||||
"default":
|
"default":
|
||||||
"""
|
'Answer the following questions as best you can. If it is in order, you can use some tools appropriately. '
|
||||||
Answer the following questions as best you can. If it is in order, you can use some tools appropriately.You have access to the following tools:
|
'You have access to the following tools:\n\n'
|
||||||
|
'{tools}\n\n'
|
||||||
{tools}
|
'Use the following format:\n'
|
||||||
|
'Question: the input question you must answer1\n'
|
||||||
Use the following format:
|
'Thought: you should always think about what to do and what tools to use.\n'
|
||||||
Question: the input question you must answer1
|
'Action: the action to take, should be one of [{tool_names}]\n'
|
||||||
Thought: you should always think about what to do and what tools to use.
|
'Action Input: the input to the action\n'
|
||||||
Action: the action to take, should be one of [{tool_names}]
|
'Observation: the result of the action\n'
|
||||||
Action Input: the input to the action
|
'... (this Thought/Action/Action Input/Observation can be repeated zero or more times)\n'
|
||||||
Observation: the result of the action
|
'Thought: I now know the final answer\n'
|
||||||
... (this Thought/Action/Action Input/Observation can be repeated zero or more times)
|
'Final Answer: the final answer to the original input question\n'
|
||||||
Thought: I now know the final answer
|
'Begin!\n\n'
|
||||||
Final Answer: the final answer to the original input question
|
'history: {history}\n\n'
|
||||||
Begin!
|
'Question: {input}\n\n'
|
||||||
|
'Thought: {agent_scratchpad}\n',
|
||||||
history: {history}
|
|
||||||
|
|
||||||
Question: {input}
|
|
||||||
|
|
||||||
Thought: {agent_scratchpad}
|
|
||||||
""",
|
|
||||||
|
|
||||||
"ChatGLM3":
|
"ChatGLM3":
|
||||||
"""
|
'You can answer using the tools, or answer directly using your knowledge without using the tools. '
|
||||||
You can answer using the tools, or answer directly using your knowledge without using the tools.Respond to the human as helpfully and accurately as possible.
|
'Respond to the human as helpfully and accurately as possible.\n'
|
||||||
You have access to the following tools:
|
'You have access to the following tools:\n'
|
||||||
{tools}
|
'{tools}\n'
|
||||||
Use a json blob to specify a tool by providing an action key (tool name) and an action_input key (tool input).
|
'Use a json blob to specify a tool by providing an action key (tool name) '
|
||||||
Valid "action" values: "Final Answer" or [{tool_names}]
|
'and an action_input key (tool input).\n'
|
||||||
Provide only ONE action per $JSON_BLOB, as shown:
|
'Valid "action" values: "Final Answer" or [{tool_names}]'
|
||||||
|
'Provide only ONE action per $JSON_BLOB, as shown:\n\n'
|
||||||
```
|
'```\n'
|
||||||
{{{{
|
'{{{{\n'
|
||||||
"action": $TOOL_NAME,
|
' "action": $TOOL_NAME,\n'
|
||||||
"action_input": $INPUT
|
' "action_input": $INPUT\n'
|
||||||
}}}}
|
'}}}}\n'
|
||||||
```
|
'```\n\n'
|
||||||
|
'Follow this format:\n\n'
|
||||||
Follow this format:
|
'Question: input question to answer\n'
|
||||||
|
'Thought: consider previous and subsequent steps\n'
|
||||||
Question: input question to answer
|
'Action:\n'
|
||||||
Thought: consider previous and subsequent steps
|
'```\n'
|
||||||
Action:
|
'$JSON_BLOB\n'
|
||||||
```
|
'```\n'
|
||||||
$JSON_BLOB
|
'Observation: action result\n'
|
||||||
```
|
'... (repeat Thought/Action/Observation N times)\n'
|
||||||
Observation: action result
|
'Thought: I know what to respond\n'
|
||||||
... (repeat Thought/Action/Observation N times)
|
'Action:\n'
|
||||||
Thought: I know what to respond
|
'```\n'
|
||||||
Action:
|
'{{{{\n'
|
||||||
```
|
' "action": "Final Answer",\n'
|
||||||
{{{{
|
' "action_input": "Final response to human"\n'
|
||||||
"action": "Final Answer",
|
'}}}}\n'
|
||||||
"action_input": "Final response to human"
|
'Begin! Reminder to ALWAYS respond with a valid json blob of a single action. Use tools if necessary. '
|
||||||
}}}}
|
'Respond directly if appropriate. Format is Action:```$JSON_BLOB```then Observation:.\n'
|
||||||
Begin! Reminder to ALWAYS respond with a valid json blob of a single action. Use tools if necessary. Respond directly if appropriate. Format is Action:```$JSON_BLOB```then Observation:.
|
'history: {history}\n\n'
|
||||||
|
'Question: {input}\n\n'
|
||||||
history: {history}
|
'Thought: {agent_scratchpad}',
|
||||||
|
}
|
||||||
Question: {input}
|
|
||||||
|
|
||||||
Thought: {agent_scratchpad}
|
|
||||||
""",
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue