pycoze 0.1.86__tar.gz → 0.1.88__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. {pycoze-0.1.86 → pycoze-0.1.88}/PKG-INFO +1 -1
  2. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/bot/agent/agent.py +1 -1
  3. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/bot/agent/agent_types/openai_func_call_agent.py +6 -3
  4. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/bot/agent/assistant.py +2 -2
  5. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/bot/bot.py +8 -4
  6. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze.egg-info/PKG-INFO +1 -1
  7. {pycoze-0.1.86 → pycoze-0.1.88}/setup.py +1 -1
  8. {pycoze-0.1.86 → pycoze-0.1.88}/LICENSE +0 -0
  9. {pycoze-0.1.86 → pycoze-0.1.88}/README.md +0 -0
  10. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/__init__.py +0 -0
  11. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/access/__init__.py +0 -0
  12. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/access/tool_for_bot.py +0 -0
  13. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/ai/__init__.py +0 -0
  14. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/ai/comfyui.py +0 -0
  15. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/ai/vram_reserve.py +0 -0
  16. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/bot/__init__.py +0 -0
  17. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/bot/agent/__init__.py +0 -0
  18. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/bot/agent/agent_types/__init__.py +0 -0
  19. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/bot/agent/chat.py +0 -0
  20. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/module.py +0 -0
  21. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/ui/__init__.py +0 -0
  22. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/ui/base.py +0 -0
  23. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/ui/color.py +0 -0
  24. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/ui/typ.py +0 -0
  25. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/ui/ui_def.py +0 -0
  26. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/utils/__init__.py +0 -0
  27. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/utils/arg.py +0 -0
  28. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze/utils/text_or_file.py +0 -0
  29. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze.egg-info/SOURCES.txt +0 -0
  30. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze.egg-info/dependency_links.txt +0 -0
  31. {pycoze-0.1.86 → pycoze-0.1.88}/pycoze.egg-info/top_level.txt +0 -0
  32. {pycoze-0.1.86 → pycoze-0.1.88}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycoze
3
- Version: 0.1.86
3
+ Version: 0.1.88
4
4
  Summary: Package for pycoze only!
5
5
  Author: Yuan Jie Xiong
6
6
  Author-email: aiqqqqqqq@qq.com
@@ -83,7 +83,7 @@ if __name__ == "__main__":
83
83
  tools=[python_tool],
84
84
  llm=chat,
85
85
  assistant_message="请以女友的口吻回答,输出不小于100字,可以随便说点其他的",
86
- support_tools=True,
86
+ tool_compatibility_mode=False,
87
87
  )
88
88
 
89
89
  inputs = [HumanMessage(content="计算根号7+根号88")]
@@ -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
- support_tools: str,
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 not support_tools:
172
+ if tool_compatibility_mode:
173
173
  # HumanMessage
174
174
  tool_msgs_str = repr(tool_messages)
175
175
  tool_messages = [
176
- HumanMessage(content="工具调用结束,结果如下:\n" + tool_msgs_str)
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
- support_tools: bool
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, support_tools
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 cfg["model"].startswith("deepseek") or not support_tools and len(tools) > 0:
50
+ if (
51
+ cfg["model"].startswith("deepseek")
52
+ or cfg["toolCompatibilityMode"]
53
+ and len(tools) > 0
54
+ ):
52
55
  prompt += """
53
- 如果需要调用工具,请使用以正确的json格式进行结尾(务必保证json格式正确,不要出现反斜杠未转义等问题):
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
- support_tools=support_tools,
71
+ tool_compatibility_mode=cfg["toolCompatibilityMode"],
68
72
  )
69
73
  return asyncio.run(run_agent(agent, history))
70
74
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycoze
3
- Version: 0.1.86
3
+ Version: 0.1.88
4
4
  Summary: Package for pycoze only!
5
5
  Author: Yuan Jie Xiong
6
6
  Author-email: aiqqqqqqq@qq.com
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="pycoze",
5
- version="0.1.86",
5
+ version="0.1.88",
6
6
  packages=find_packages(),
7
7
  install_requires=[],
8
8
  author="Yuan Jie Xiong",
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