pycoze 0.1.315__py3-none-any.whl → 0.1.316__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/chat_base.py +6 -2
- pycoze/bot/tools.py +7 -7
- {pycoze-0.1.315.dist-info → pycoze-0.1.316.dist-info}/METADATA +1 -1
- {pycoze-0.1.315.dist-info → pycoze-0.1.316.dist-info}/RECORD +7 -7
- {pycoze-0.1.315.dist-info → pycoze-0.1.316.dist-info}/LICENSE +0 -0
- {pycoze-0.1.315.dist-info → pycoze-0.1.316.dist-info}/WHEEL +0 -0
- {pycoze-0.1.315.dist-info → pycoze-0.1.316.dist-info}/top_level.txt +0 -0
pycoze/bot/chat_base.py
CHANGED
@@ -206,14 +206,18 @@ async def handle_user_inputs(conversation_history, user_input, cwd, abilities, b
|
|
206
206
|
)
|
207
207
|
continue
|
208
208
|
|
209
|
-
result = ToolExecutor.execute_tool(cwd, tool_request, abilities)
|
209
|
+
ok, result = ToolExecutor.execute_tool(cwd, tool_request, abilities)
|
210
|
+
if ok:
|
211
|
+
info("assistant", "✅\n")
|
212
|
+
else:
|
213
|
+
info("assistant", "❌\n")
|
210
214
|
assistant_content = (
|
211
215
|
"Executing tool: "
|
212
216
|
+ dumps_markdown_json(tool_request)
|
213
217
|
+ "\n\nResult: "
|
214
218
|
+ result
|
215
219
|
)
|
216
|
-
info("assistant", "
|
220
|
+
info("assistant", "```text\n" + result + "\n```\n\n")
|
217
221
|
conversation_history.append(
|
218
222
|
{"role": "assistant", "content": assistant_content}
|
219
223
|
)
|
pycoze/bot/tools.py
CHANGED
@@ -259,7 +259,7 @@ class ToolExecutor:
|
|
259
259
|
tool_name = list(tool_request.keys())[0]
|
260
260
|
params = tool_request[tool_name]
|
261
261
|
if not tool_name:
|
262
|
-
return "Error: Tool type is empty"
|
262
|
+
return False, "Error: Tool type is empty"
|
263
263
|
if tool_name in cls.TOOL_MAP:
|
264
264
|
tool_class = cls.TOOL_MAP[tool_name]
|
265
265
|
elif tool_name in [a.__name__ for a in abilities]:
|
@@ -267,13 +267,13 @@ class ToolExecutor:
|
|
267
267
|
try:
|
268
268
|
result = func(**params)
|
269
269
|
except Exception as e:
|
270
|
-
return traceback.format_exc()
|
271
|
-
return str(result)
|
270
|
+
return False, traceback.format_exc()
|
271
|
+
return True, str(result)
|
272
272
|
else:
|
273
|
-
return f"Unknown tool: {tool_name}, the first key of output json ({tool_name}) will be recognized as a tool, so do not output other json except for executing tools."
|
273
|
+
return False, f"Unknown tool: {tool_name}, the first key of output json ({tool_name}) will be recognized as a tool, so do not output other json except for executing tools."
|
274
274
|
tool = tool_class(params, cwd)
|
275
275
|
if not tool.validate():
|
276
|
-
return "Tool parameter validation failed."
|
277
|
-
return tool.execute()
|
276
|
+
return False, "Tool parameter validation failed."
|
277
|
+
return True, tool.execute()
|
278
278
|
except Exception as e:
|
279
|
-
return f"Tool execution failed: {str(e)}"
|
279
|
+
return False, f"Tool execution failed: {str(e)}"
|
@@ -13,11 +13,11 @@ 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=rL3Q-ycczRpSFfKn84fg3QBl5k22WpyeIU5qOEjEby8,79
|
15
15
|
pycoze/bot/chat.py,sha256=cYMXFe0hgN0CTcI5BiUtte2eTZwgYLKq1vBDQ-eqB5c,3246
|
16
|
-
pycoze/bot/chat_base.py,sha256=
|
16
|
+
pycoze/bot/chat_base.py,sha256=czmOKUum3Rwo4lAOJtfslxaF8RKauWzj26s_WMmQa48,9180
|
17
17
|
pycoze/bot/lib.py,sha256=IIihXPODCbM29TlxS0lhm2Fw3GWm2MzUeAn9LGa86lg,6889
|
18
18
|
pycoze/bot/message.py,sha256=Zq-_k8HztBMOUIs3hbOvWvwHBNopn4UJJBliCROIGcc,718
|
19
19
|
pycoze/bot/prompt.md,sha256=ehjdvZ-se9NaH0OSiDEvrFE9kvdj9MTZlWZUTxPY780,15743
|
20
|
-
pycoze/bot/tools.py,sha256=
|
20
|
+
pycoze/bot/tools.py,sha256=987hUTy-kZfTwUUd3WStPhNUPkOIGCVm-JWL3Qh70pg,9648
|
21
21
|
pycoze/reference/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
22
|
pycoze/reference/bot.py,sha256=pxHVYo0G3P3YZ--vBYbMEiEyBoxxPwaO5dMTf9WFMSc,2014
|
23
23
|
pycoze/reference/lib.py,sha256=6jvowP2LqjyV21ppRhmtxHxnQJHCbHmlpbj9btV2RQ4,2191
|
@@ -33,8 +33,8 @@ pycoze/utils/arg.py,sha256=jop1tBfe5hYkHW1NSpCeaZBEznkgguBscj_7M2dWfrs,503
|
|
33
33
|
pycoze/utils/env.py,sha256=5pWlXfM1F5ZU9hhv1rHlDEanjEW5wf0nbyez9bNRqqA,559
|
34
34
|
pycoze/utils/socket.py,sha256=bZbFFRH4mfThzRqt55BAAGQ6eICx_ja4x8UGGrUdAm8,2428
|
35
35
|
pycoze/utils/text_or_file.py,sha256=gpxZVWt2DW6YiEg_MnMuwg36VNf3TX383QD_1oZNB0Y,551
|
36
|
-
pycoze-0.1.
|
37
|
-
pycoze-0.1.
|
38
|
-
pycoze-0.1.
|
39
|
-
pycoze-0.1.
|
40
|
-
pycoze-0.1.
|
36
|
+
pycoze-0.1.316.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
|
37
|
+
pycoze-0.1.316.dist-info/METADATA,sha256=-Shyz80jC19pUcPlpYDC8TkkDYCmsYeOnQpNYxnEp7U,854
|
38
|
+
pycoze-0.1.316.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
39
|
+
pycoze-0.1.316.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
|
40
|
+
pycoze-0.1.316.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|