pycoze 0.1.237__py3-none-any.whl → 0.1.239__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/agent_types/openai_func_call_agent.py +1 -43
- {pycoze-0.1.237.dist-info → pycoze-0.1.239.dist-info}/METADATA +1 -1
- {pycoze-0.1.237.dist-info → pycoze-0.1.239.dist-info}/RECORD +6 -6
- {pycoze-0.1.237.dist-info → pycoze-0.1.239.dist-info}/LICENSE +0 -0
- {pycoze-0.1.237.dist-info → pycoze-0.1.239.dist-info}/WHEEL +0 -0
- {pycoze-0.1.237.dist-info → pycoze-0.1.239.dist-info}/top_level.txt +0 -0
@@ -34,41 +34,7 @@ def get_tools(last_message):
|
|
34
34
|
if "tool_calls" in last_message.additional_kwargs:
|
35
35
|
return last_message.additional_kwargs["tool_calls"]
|
36
36
|
else:
|
37
|
-
|
38
|
-
if '"name"' in last_message.content and '"parameters":' in last_message.content:
|
39
|
-
print("name 和 paremeters 模式")
|
40
|
-
all_json = get_all_markdown_json(last_message.content)
|
41
|
-
tool_calls = []
|
42
|
-
for tool_call in all_json:
|
43
|
-
if "name" not in tool_call or "parameters" not in tool_call:
|
44
|
-
return "end"
|
45
|
-
tool_call["arguments"] = json.dumps(tool_call["parameters"])
|
46
|
-
tool_call.pop("parameters")
|
47
|
-
tool_calls.append(
|
48
|
-
{
|
49
|
-
"function": tool_call,
|
50
|
-
"id": random.randint(0, 1000000),
|
51
|
-
}
|
52
|
-
)
|
53
|
-
if "<|tool▁sep|>" in last_message.content:
|
54
|
-
print("deepseek的bug: <|tool▁sep|> 模式")
|
55
|
-
name = (
|
56
|
-
last_message.content.split("<|tool▁sep|>")[1].split("```")[0].strip()
|
57
|
-
)
|
58
|
-
all_json = get_all_markdown_json(last_message.content)
|
59
|
-
tool_calls = []
|
60
|
-
for argument in all_json:
|
61
|
-
tool_calls.append(
|
62
|
-
{
|
63
|
-
"function": {
|
64
|
-
"name": name,
|
65
|
-
"arguments": json.dumps(argument),
|
66
|
-
},
|
67
|
-
"id": random.randint(0, 1000000),
|
68
|
-
}
|
69
|
-
)
|
70
|
-
|
71
|
-
return tool_calls
|
37
|
+
return None
|
72
38
|
|
73
39
|
|
74
40
|
def create_openai_func_call_agent_executor(
|
@@ -120,14 +86,6 @@ def create_openai_func_call_agent_executor(
|
|
120
86
|
for tool_call in get_tools(last_message):
|
121
87
|
function = tool_call["function"]
|
122
88
|
function_name = function["name"]
|
123
|
-
if function_name == "a_delay_function":
|
124
|
-
return [
|
125
|
-
ToolMessage(
|
126
|
-
tool_call_id=tool_call["id"],
|
127
|
-
content="a_delay_function只是一个占位符,请忽略重新调用工具",
|
128
|
-
additional_kwargs={"name": tool_call["function"]["name"]},
|
129
|
-
)
|
130
|
-
]
|
131
89
|
|
132
90
|
_tool_input = json.loads(function["arguments"] or "{}")
|
133
91
|
# We construct an ToolInvocation from the function_call
|
@@ -17,7 +17,7 @@ pycoze/bot/agent/assistant.py,sha256=s1y_gR_9UK_jzjX6YztXK5JNhnV-_YvUA6vv1lToS-k
|
|
17
17
|
pycoze/bot/agent/chat.py,sha256=mubOCAHvA6VtyE6N40elI6KrP6A69uB_G6ihE3G_Vi4,860
|
18
18
|
pycoze/bot/agent/agent_types/__init__.py,sha256=zmU2Kmrv5mCdfg-QlPn2H6pWxbGeq8s7YTqLhpzJC6k,179
|
19
19
|
pycoze/bot/agent/agent_types/const.py,sha256=BfUKPrhAHREoMLHuFNG2bCIEkC1-f7K0LEqNg4RwiRE,70
|
20
|
-
pycoze/bot/agent/agent_types/openai_func_call_agent.py,sha256=
|
20
|
+
pycoze/bot/agent/agent_types/openai_func_call_agent.py,sha256=mox9zwOrWqhx32QcE1f8YEPYLPlT1mZ6_qESKIGQdRM,4585
|
21
21
|
pycoze/reference/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
22
|
pycoze/reference/bot.py,sha256=BDflTV3zYoZqWnJpD5lMM_1vU_5b20M3XiFt1p-RHWM,2427
|
23
23
|
pycoze/reference/lib.py,sha256=0xQJTLTHedGzQBsjuTFNBVqYc4-8Yl65gGCrAhWyOX8,2155
|
@@ -32,8 +32,8 @@ pycoze/utils/__init__.py,sha256=Gi5EnrWZGMD2JRejgV4c_VLCXyvA2wwBFI_niDF5MUE,110
|
|
32
32
|
pycoze/utils/arg.py,sha256=GtfGbMTMdaK75Fwh6MpUe1pCA5X6Ep4LFG7a72YrzjI,525
|
33
33
|
pycoze/utils/env.py,sha256=W04lhvTHhAAC6EldP6kk2xrctqtu8K6kl1vDLZDNeh8,561
|
34
34
|
pycoze/utils/text_or_file.py,sha256=gpxZVWt2DW6YiEg_MnMuwg36VNf3TX383QD_1oZNB0Y,551
|
35
|
-
pycoze-0.1.
|
36
|
-
pycoze-0.1.
|
37
|
-
pycoze-0.1.
|
38
|
-
pycoze-0.1.
|
39
|
-
pycoze-0.1.
|
35
|
+
pycoze-0.1.239.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
|
36
|
+
pycoze-0.1.239.dist-info/METADATA,sha256=x-hNHu5AujB6cF2ozwr_JR5JPQEK5bUt0qMgdGB1etE,699
|
37
|
+
pycoze-0.1.239.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
38
|
+
pycoze-0.1.239.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
|
39
|
+
pycoze-0.1.239.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|