pycoze 0.1.301__py3-none-any.whl → 0.1.302__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pycoze/bot/agent_chat.py +8 -8
- pycoze/reference/tool.py +1 -1
- pycoze/reference/workflow.py +1 -1
- {pycoze-0.1.301.dist-info → pycoze-0.1.302.dist-info}/METADATA +1 -1
- {pycoze-0.1.301.dist-info → pycoze-0.1.302.dist-info}/RECORD +8 -8
- {pycoze-0.1.301.dist-info → pycoze-0.1.302.dist-info}/LICENSE +0 -0
- {pycoze-0.1.301.dist-info → pycoze-0.1.302.dist-info}/WHEEL +0 -0
- {pycoze-0.1.301.dist-info → pycoze-0.1.302.dist-info}/top_level.txt +0 -0
pycoze/bot/agent_chat.py
CHANGED
@@ -11,23 +11,23 @@ import os
|
|
11
11
|
|
12
12
|
cfg = utils.read_json_file("llm.json")
|
13
13
|
|
14
|
-
def
|
14
|
+
def load_bot_setting(bot_setting_file: str):
|
15
15
|
with open(bot_setting_file, "r", encoding="utf-8") as f:
|
16
16
|
return json.load(f)
|
17
17
|
|
18
18
|
|
19
19
|
def load_abilities(bot_setting_file: str):
|
20
20
|
with open(bot_setting_file, "r", encoding="utf-8") as f:
|
21
|
-
|
21
|
+
bot_setting = json.load(f)
|
22
22
|
|
23
23
|
abilities = []
|
24
|
-
for bot_id in
|
24
|
+
for bot_id in bot_setting["bots"]:
|
25
25
|
bot = ref_bot(bot_id, as_agent_tool=True)
|
26
26
|
if bot:
|
27
27
|
abilities.append(bot)
|
28
|
-
for tool_id in
|
28
|
+
for tool_id in bot_setting["tools"]:
|
29
29
|
abilities.extend(ref_tools(tool_id, as_agent_tool=True))
|
30
|
-
for workflow_id in
|
30
|
+
for workflow_id in bot_setting["workflows"]:
|
31
31
|
workflow = ref_workflow(workflow_id, as_agent_tool=True)
|
32
32
|
if workflow:
|
33
33
|
abilities.append(workflow)
|
@@ -67,20 +67,20 @@ async def run_with_interrupt_check(agent, history, tool_compatibility_mode, inte
|
|
67
67
|
pass # 忽略取消错误
|
68
68
|
|
69
69
|
async def agent_chat(bot_setting_file, history):
|
70
|
-
|
70
|
+
bot_setting = load_bot_setting(bot_setting_file)
|
71
71
|
abilities = load_abilities(bot_setting_file)
|
72
72
|
|
73
73
|
chat = ChatOpenAI(
|
74
74
|
api_key=cfg["apiKey"],
|
75
75
|
base_url=cfg["baseURL"],
|
76
76
|
model=cfg["model"],
|
77
|
-
temperature=
|
77
|
+
temperature=bot_setting["temperature"],
|
78
78
|
stop_sequences=[
|
79
79
|
"tool▁calls▁end",
|
80
80
|
"tool▁call▁end",
|
81
81
|
], # 不然会虚构工具调用过程和结果
|
82
82
|
)
|
83
|
-
prompt =
|
83
|
+
prompt = bot_setting["prompt"]
|
84
84
|
if cfg["toolCompatibilityMode"] and len(abilities) > 0:
|
85
85
|
prompt += """
|
86
86
|
作为一个AI,你如果不确定结果,请务必使用工具查询。
|
pycoze/reference/tool.py
CHANGED
@@ -30,6 +30,6 @@ def ref_tools(tool_id, workspace_path=None):
|
|
30
30
|
for tool in export_tools:
|
31
31
|
tool = wrapped_func(tool, module_path)
|
32
32
|
if tool.__doc__ is None:
|
33
|
-
tool.__doc__ = "This tool is used to " + tool.
|
33
|
+
tool.__doc__ = "This tool is used to " + tool.__name__.split("_") + "."
|
34
34
|
|
35
35
|
return [tool.func for tool in export_tools]
|
pycoze/reference/workflow.py
CHANGED
@@ -30,7 +30,7 @@ def _ref_workflows(workflow_id, workspace_path=None):
|
|
30
30
|
for tool in export_tools:
|
31
31
|
tool = wrapped_func(tool, module_path)
|
32
32
|
if tool.__doc__ is None:
|
33
|
-
tool.__doc__ = "This tool is used to " + tool.
|
33
|
+
tool.__doc__ = "This tool is used to " + tool.__name__.split("_") + "."
|
34
34
|
|
35
35
|
return [tool.func for tool in export_tools]
|
36
36
|
|
@@ -12,7 +12,7 @@ pycoze/api/lib/view.py,sha256=_PIpTfeuTPPlMDKshMGsqFQYMq7ZiO4Hg5XwHwDoU60,7357
|
|
12
12
|
pycoze/api/lib/web.py,sha256=GWgtiTJOolKOX2drXcwuyqTcbo5FQVxa1NuBGcNyjyc,223
|
13
13
|
pycoze/api/lib/window.py,sha256=bTkQCzQZ7i3pYXB70bUSTBNJ9C4TW_X3yMae1VkquGk,1944
|
14
14
|
pycoze/bot/__init__.py,sha256=JxnRoCCqx_LFyVb3pLu0qYCsH8ZLuAaMXAtvVUuCHuE,78
|
15
|
-
pycoze/bot/agent_chat.py,sha256=
|
15
|
+
pycoze/bot/agent_chat.py,sha256=Wqv0xMb9SFqf-G0__uXyFz6579u_QUe0EqbhP9IS3yc,4160
|
16
16
|
pycoze/bot/bot.py,sha256=_qmUTZ09FmRLifHrW5stDZWGVK6yuMEMBC3fmeYJnqk,844
|
17
17
|
pycoze/bot/agent/__init__.py,sha256=3wE8_FFQS8j2BY-g9Cr-onV0POEvDRZaw_NCzpqrNus,265
|
18
18
|
pycoze/bot/agent/agent.py,sha256=qkLIRgSMNT1VD_UD0e6kYUuOTOqylQiYSCay6HZ12LA,3653
|
@@ -24,8 +24,8 @@ pycoze/bot/agent/agent_types/openai_func_call_agent.py,sha256=3qOyrddujtJ50W9SbH
|
|
24
24
|
pycoze/reference/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
25
|
pycoze/reference/bot.py,sha256=pxHVYo0G3P3YZ--vBYbMEiEyBoxxPwaO5dMTf9WFMSc,2014
|
26
26
|
pycoze/reference/lib.py,sha256=CCqJFUXy0v9x8A54uDERmKjJQcteWBEGev6sTQQjH-I,2105
|
27
|
-
pycoze/reference/tool.py,sha256=
|
28
|
-
pycoze/reference/workflow.py,sha256=
|
27
|
+
pycoze/reference/tool.py,sha256=HDXZ1q8Bha9uX6TiZJlcKOM9LP2L9zuW5K16DBLrzQ4,1056
|
28
|
+
pycoze/reference/workflow.py,sha256=QQcJg-yYm-dpPkaR-gHm6NYY2dzXvLHaPWXlu8-HCRs,1305
|
29
29
|
pycoze/ui/__init__.py,sha256=uaXet23wUk64TcZjpBX8qOx4aUhwA_ucrmcxy7Q4Qr4,929
|
30
30
|
pycoze/ui/base.py,sha256=bz9mHZwIXA8LErEHTIonH347u6LP7rxV2EADMMjNZos,1081
|
31
31
|
pycoze/ui/color.py,sha256=cT9Ib8uNzkOKxyW0IwVj46o4LwdB1xgNCj1_Rou9d_4,854
|
@@ -36,8 +36,8 @@ pycoze/utils/arg.py,sha256=jop1tBfe5hYkHW1NSpCeaZBEznkgguBscj_7M2dWfrs,503
|
|
36
36
|
pycoze/utils/env.py,sha256=5pWlXfM1F5ZU9hhv1rHlDEanjEW5wf0nbyez9bNRqqA,559
|
37
37
|
pycoze/utils/socket.py,sha256=bZbFFRH4mfThzRqt55BAAGQ6eICx_ja4x8UGGrUdAm8,2428
|
38
38
|
pycoze/utils/text_or_file.py,sha256=gpxZVWt2DW6YiEg_MnMuwg36VNf3TX383QD_1oZNB0Y,551
|
39
|
-
pycoze-0.1.
|
40
|
-
pycoze-0.1.
|
41
|
-
pycoze-0.1.
|
42
|
-
pycoze-0.1.
|
43
|
-
pycoze-0.1.
|
39
|
+
pycoze-0.1.302.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
|
40
|
+
pycoze-0.1.302.dist-info/METADATA,sha256=8T5wWUH_McOeJREatzZjSh10q43-GUn-BLiYW3pbaFE,854
|
41
|
+
pycoze-0.1.302.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
42
|
+
pycoze-0.1.302.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
|
43
|
+
pycoze-0.1.302.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|