修复glm3 agent被注释的agent会话文本结构解析代码

看起来输出的文本占位符如下,目前解析代码是有问题的
Thought <|assistant|> Action\r
```python
tool_call(action_input)
```<|observation|>
This commit is contained in:
glide-the 2024-03-07 13:54:33 +08:00
parent 51301dfe6a
commit 87c912087c
2 changed files with 4 additions and 2 deletions

View File

@ -9,6 +9,7 @@ from langchain_core.prompts import ChatPromptTemplate
from langchain_core.tools import BaseTool
from server.agent.agent_factory import ( create_structured_qwen_chat_agent)
from server.agent.agent_factory.glm3_agent import create_structured_glm3_chat_agent
def agents_registry(
@ -23,8 +24,8 @@ def agents_registry(
# Write any optimized method here.
if "glm3" in llm.model_name.lower():
# An optimized method of langchain Agent that uses the glm3 series model
# agent = create_structured_glm3_chat_agent(llm=llm, tools=tools)
pass
agent = create_structured_glm3_chat_agent(llm=llm, tools=tools)
# pass
elif "qwen" in llm.model_name.lower():
agent = create_structured_qwen_chat_agent(llm=llm, tools=tools)
else:

View File

@ -1,6 +1,7 @@
from langchain_core.pydantic_v1 import *
from pydantic.fields import FieldInfo
from pydantic.schema import model_schema
from pydantic.typing import typing
# from pydantic.v1 import *
# from pydantic.v1.fields import FieldInfo