修改,格式了部分Agent工具 (#1823)
* 支持了agentlm * 支持了agentlm和相关提示词 * 修改了Agent的一些功能,加入了Embed方面的一个优化 * 修改了部分Agent的工具 --------- Co-authored-by: zR <zRzRzRzRzRzRzR>
This commit is contained in:
parent
1b50547e60
commit
303c9d94df
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import json
|
||||
import re
|
||||
import warnings
|
||||
|
|
@ -265,7 +266,7 @@ class LLMKnowledgeChain(LLMChain):
|
|||
llm: BaseLanguageModel,
|
||||
prompt: BasePromptTemplate = PROMPT,
|
||||
**kwargs: Any,
|
||||
):
|
||||
) -> LLMKnowledgeChain:
|
||||
llm_chain = LLMChain(llm=llm, prompt=prompt)
|
||||
return cls(llm_chain=llm_chain, **kwargs)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import re
|
||||
import warnings
|
||||
from typing import Dict
|
||||
|
|
@ -212,7 +213,7 @@ class LLMKnowledgeChain(LLMChain):
|
|||
llm: BaseLanguageModel,
|
||||
prompt: BasePromptTemplate = PROMPT,
|
||||
**kwargs: Any,
|
||||
):
|
||||
) -> LLMKnowledgeChain:
|
||||
llm_chain = LLMChain(llm=llm, prompt=prompt)
|
||||
return cls(llm_chain=llm_chain, **kwargs)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,10 @@
|
|||
## 使用和风天气API查询天气,这个模型仅仅对免费的API进行了适配,建议使用GPT4等高级模型进行适配
|
||||
from __future__ import annotations
|
||||
|
||||
## 单独运行的时候需要添加
|
||||
import sys
|
||||
import os
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
|
||||
|
||||
import re
|
||||
import warnings
|
||||
from typing import Dict
|
||||
|
|
@ -22,6 +28,8 @@ from server.agent import model_container
|
|||
KEY = "ac880e5a877042809ac7ffdd19d95b0d"
|
||||
#key长这样,这里提供了示例的key,这个key没法使用,你需要自己去注册和风天气的账号,然后在这里填入你的key
|
||||
|
||||
|
||||
|
||||
_PROMPT_TEMPLATE = """
|
||||
用户会提出一个关于天气的问题,你的目标是拆分出用户问题中的区,市 并按照我提供的工具回答。
|
||||
例如 用户提出的问题是: 上海浦东未来1小时天气情况?
|
||||
|
|
|
|||
|
|
@ -68,4 +68,4 @@ tools = [
|
|||
),
|
||||
]
|
||||
|
||||
tool_names = [tool.name for tool in tools]
|
||||
tool_names = [tool.name for tool in tools]
|
||||
Loading…
Reference in New Issue