pycoze 0.1.86__tar.gz → 0.1.87__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {pycoze-0.1.86 → pycoze-0.1.87}/PKG-INFO +1 -1
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/bot/agent/agent.py +1 -1
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/bot/agent/agent_types/openai_func_call_agent.py +6 -3
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/bot/agent/assistant.py +2 -2
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/bot/bot.py +8 -4
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze.egg-info/PKG-INFO +1 -1
- {pycoze-0.1.86 → pycoze-0.1.87}/setup.py +1 -1
- {pycoze-0.1.86 → pycoze-0.1.87}/LICENSE +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/README.md +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/__init__.py +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/access/__init__.py +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/access/tool_for_bot.py +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/ai/__init__.py +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/ai/comfyui.py +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/ai/vram_reserve.py +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/bot/__init__.py +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/bot/agent/__init__.py +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/bot/agent/agent_types/__init__.py +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/bot/agent/chat.py +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/module.py +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/ui/__init__.py +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/ui/base.py +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/ui/color.py +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/ui/typ.py +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/ui/ui_def.py +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/utils/__init__.py +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/utils/arg.py +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze/utils/text_or_file.py +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze.egg-info/SOURCES.txt +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze.egg-info/dependency_links.txt +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/pycoze.egg-info/top_level.txt +0 -0
- {pycoze-0.1.86 → pycoze-0.1.87}/setup.cfg +0 -0
@@ -34,7 +34,7 @@ def create_openai_func_call_agent_executor(
|
|
34
34
|
tools: list[BaseTool],
|
35
35
|
llm: LanguageModelLike,
|
36
36
|
system_message: str,
|
37
|
-
|
37
|
+
tool_compatibility_mode: str,
|
38
38
|
**kwargs
|
39
39
|
):
|
40
40
|
|
@@ -169,11 +169,14 @@ def create_openai_func_call_agent_executor(
|
|
169
169
|
additional_kwargs={"name": tool_call["function"]["name"]},
|
170
170
|
)
|
171
171
|
tool_messages.append(message)
|
172
|
-
if
|
172
|
+
if tool_compatibility_mode:
|
173
173
|
# HumanMessage
|
174
174
|
tool_msgs_str = repr(tool_messages)
|
175
175
|
tool_messages = [
|
176
|
-
HumanMessage(
|
176
|
+
HumanMessage(
|
177
|
+
content="The tool call is done, the result is as follows:\n"
|
178
|
+
+ tool_msgs_str
|
179
|
+
)
|
177
180
|
]
|
178
181
|
return tool_messages
|
179
182
|
|
@@ -18,11 +18,11 @@ class Runnable(RunnableBinding):
|
|
18
18
|
tools: Sequence[BaseTool],
|
19
19
|
llm: LanguageModelLike,
|
20
20
|
assistant_message: str,
|
21
|
-
|
21
|
+
tool_compatibility_mode: bool
|
22
22
|
) -> None:
|
23
23
|
|
24
24
|
agent_executor = create_openai_func_call_agent_executor(
|
25
|
-
tools, llm, assistant_message,
|
25
|
+
tools, llm, assistant_message, tool_compatibility_mode
|
26
26
|
)
|
27
27
|
agent_executor = agent_executor.with_config({"recursion_limit": 50})
|
28
28
|
super().__init__(
|
@@ -11,7 +11,6 @@ params = utils.arg.read_params_file()
|
|
11
11
|
llm_file = params["appPath"] + "/JsonStorage/llm.json"
|
12
12
|
with open(llm_file, "r", encoding="utf-8") as f:
|
13
13
|
cfg = json.load(f)
|
14
|
-
support_tools = not cfg["model"].startswith("yi-")
|
15
14
|
|
16
15
|
|
17
16
|
def load_role_setting(bot_setting_file: str):
|
@@ -48,9 +47,14 @@ def agent_chat(bot_setting_file, history):
|
|
48
47
|
], # 停用deepseek的工具调用标记,不然会虚构工具调用过程和结果
|
49
48
|
)
|
50
49
|
prompt = role_setting["prompt"]
|
51
|
-
if
|
50
|
+
if (
|
51
|
+
cfg["model"].startswith("deepseek")
|
52
|
+
or cfg["toolCompatibilityMode"]
|
53
|
+
and len(tools) > 0
|
54
|
+
):
|
52
55
|
prompt += """
|
53
|
-
|
56
|
+
如果不确定结果,请务必使用工具查询。
|
57
|
+
如果需要调用工具,请使用以正确markdown中的json代码格式进行结尾(务必保证json格式正确,不要出现反斜杠未转义等问题):
|
54
58
|
```json
|
55
59
|
{"name": 函数名, "parameters": 参数词典}
|
56
60
|
```
|
@@ -64,7 +68,7 @@ def agent_chat(bot_setting_file, history):
|
|
64
68
|
tools=tools,
|
65
69
|
llm=chat,
|
66
70
|
assistant_message=prompt,
|
67
|
-
|
71
|
+
tool_compatibility_mode=cfg["toolCompatibilityMode"],
|
68
72
|
)
|
69
73
|
return asyncio.run(run_agent(agent, history))
|
70
74
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|