beswarm 0.1.18__py3-none-any.whl → 0.1.20__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.
- beswarm/aient/setup.py +1 -1
- beswarm/aient/src/aient/models/chatgpt.py +2 -0
- beswarm/aient/src/aient/plugins/read_file.py +42 -1
- beswarm/tools/worker.py +2 -0
- {beswarm-0.1.18.dist-info → beswarm-0.1.20.dist-info}/METADATA +1 -1
- {beswarm-0.1.18.dist-info → beswarm-0.1.20.dist-info}/RECORD +8 -8
- {beswarm-0.1.18.dist-info → beswarm-0.1.20.dist-info}/WHEEL +0 -0
- {beswarm-0.1.18.dist-info → beswarm-0.1.20.dist-info}/top_level.txt +0 -0
beswarm/aient/setup.py
CHANGED
@@ -4,7 +4,7 @@ from setuptools import setup, find_packages
|
|
4
4
|
|
5
5
|
setup(
|
6
6
|
name="aient",
|
7
|
-
version="1.0.
|
7
|
+
version="1.0.79",
|
8
8
|
description="Aient: The Awakening of Agent.",
|
9
9
|
long_description=Path.open(Path("README.md"), encoding="utf-8").read(),
|
10
10
|
long_description_content_type="text/markdown",
|
@@ -412,9 +412,11 @@ class chatgpt(BaseLLM):
|
|
412
412
|
for tool_dict in function_parameter:
|
413
413
|
if tool_dict.get("function_name", "") not in self.plugins.keys():
|
414
414
|
function_parameter.remove(tool_dict)
|
415
|
+
full_response = full_response + f"\n\nFunction: {tool_dict.get('function_name', '')} does not exist! I must use existing functions. I need to try again."
|
415
416
|
if function_parameter:
|
416
417
|
need_function_call = True
|
417
418
|
else:
|
419
|
+
need_function_call = False
|
418
420
|
if self.print_log:
|
419
421
|
print("Failed to parse function_parameter", function_parameter)
|
420
422
|
print("full_response", full_response)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import os
|
2
|
+
import json
|
2
3
|
from pdfminer.high_level import extract_text
|
3
4
|
|
4
5
|
from .registry import register_tool
|
@@ -63,6 +64,40 @@ Examples:
|
|
63
64
|
# 如果提取结果为空
|
64
65
|
if not text_content:
|
65
66
|
return f"错误: 无法从 '{file_path}' 提取文本内容"
|
67
|
+
elif file_path.lower().endswith('.ipynb'):
|
68
|
+
try:
|
69
|
+
with open(file_path, 'r', encoding='utf-8') as file:
|
70
|
+
notebook_content = json.load(file)
|
71
|
+
|
72
|
+
for cell in notebook_content.get('cells', []):
|
73
|
+
if cell.get('cell_type') == 'code' and 'outputs' in cell:
|
74
|
+
filtered_outputs = []
|
75
|
+
for output in cell.get('outputs', []):
|
76
|
+
new_output = output.copy()
|
77
|
+
if 'data' in new_output:
|
78
|
+
original_data = new_output['data']
|
79
|
+
filtered_data = {}
|
80
|
+
for key, value in original_data.items():
|
81
|
+
if key.startswith('image/'):
|
82
|
+
continue
|
83
|
+
if key == 'text/html':
|
84
|
+
html_content = "".join(value) if isinstance(value, list) else value
|
85
|
+
if isinstance(html_content, str) and '<table class="show_videos"' in html_content:
|
86
|
+
continue
|
87
|
+
filtered_data[key] = value
|
88
|
+
if filtered_data:
|
89
|
+
new_output['data'] = filtered_data
|
90
|
+
filtered_outputs.append(new_output)
|
91
|
+
elif 'output_type' in new_output and new_output['output_type'] in ['stream', 'error']:
|
92
|
+
filtered_outputs.append(new_output)
|
93
|
+
|
94
|
+
cell['outputs'] = filtered_outputs
|
95
|
+
|
96
|
+
text_content = json.dumps(notebook_content, indent=2, ensure_ascii=False)
|
97
|
+
except json.JSONDecodeError:
|
98
|
+
return f"错误: 文件 '{file_path}' 不是有效的JSON格式 (IPython Notebook)。"
|
99
|
+
except Exception as e:
|
100
|
+
return f"处理IPython Notebook文件 '{file_path}' 时发生错误: {e}"
|
66
101
|
else:
|
67
102
|
# 读取文件内容
|
68
103
|
with open(file_path, 'r', encoding='utf-8') as file:
|
@@ -76,4 +111,10 @@ Examples:
|
|
76
111
|
except UnicodeDecodeError:
|
77
112
|
return f"错误: 文件 '{file_path}' 不是文本文件或编码不是UTF-8"
|
78
113
|
except Exception as e:
|
79
|
-
return f"读取文件时发生错误: {e}"
|
114
|
+
return f"读取文件时发生错误: {e}"
|
115
|
+
|
116
|
+
if __name__ == "__main__":
|
117
|
+
# python -m beswarm.aient.src.aient.plugins.read_file
|
118
|
+
result = read_file("./work/cax/Lenia Notebook.ipynb")
|
119
|
+
print(result)
|
120
|
+
print(len(result))
|
beswarm/tools/worker.py
CHANGED
@@ -92,6 +92,8 @@ async def worker(goal, tools, work_dir, cache_messages=None):
|
|
92
92
|
print("\n🤖 指令智能体生成的下一步指令:", next_instruction)
|
93
93
|
if "fetch_gpt_response_stream HTTP Error', 'status_code': 404" in next_instruction:
|
94
94
|
raise Exception(f"Model: {instruction_agent_config['engine']} not found!")
|
95
|
+
if "'status_code': 413" in next_instruction:
|
96
|
+
raise Exception(f"The request body is too long, please try again.")
|
95
97
|
next_instruction = extract_xml_content(next_instruction, "instructions")
|
96
98
|
if not next_instruction:
|
97
99
|
print("\n❌ 指令智能体生成的指令不符合要求,请重新生成。")
|
@@ -1,7 +1,7 @@
|
|
1
1
|
beswarm/__init__.py,sha256=HZjUOJtZR5QhMuDbq-wukQQn1VrBusNWai_ysGo-VVI,20
|
2
2
|
beswarm/utils.py,sha256=AdDCcqAIIKQEMl7PfryVgeT9G5sHe7QNsZnrvmTGA8E,283
|
3
3
|
beswarm/aient/main.py,sha256=SiYAIgQlLJqYusnTVEJOx1WNkSJKMImhgn5aWjfroxg,3814
|
4
|
-
beswarm/aient/setup.py,sha256=
|
4
|
+
beswarm/aient/setup.py,sha256=EzoroFZIKVg3AI6yCw9_O8zbBKEUmPzLYs5ls_Gdh9E,487
|
5
5
|
beswarm/aient/src/aient/__init__.py,sha256=SRfF7oDVlOOAi6nGKiJIUK6B_arqYLO9iSMp-2IZZps,21
|
6
6
|
beswarm/aient/src/aient/core/__init__.py,sha256=NxjebTlku35S4Dzr16rdSqSTWUvvwEeACe8KvHJnjPg,34
|
7
7
|
beswarm/aient/src/aient/core/log_config.py,sha256=kz2_yJv1p-o3lUQOwA3qh-LSc3wMHv13iCQclw44W9c,274
|
@@ -15,7 +15,7 @@ beswarm/aient/src/aient/core/test/test_payload.py,sha256=8jBiJY1uidm1jzL-EiK0s6U
|
|
15
15
|
beswarm/aient/src/aient/models/__init__.py,sha256=ouNDNvoBBpIFrLsk09Q_sq23HR0GbLAKfGLIFmfEuXE,219
|
16
16
|
beswarm/aient/src/aient/models/audio.py,sha256=kRd-8-WXzv4vwvsTGwnstK-WR8--vr9CdfCZzu8y9LA,1934
|
17
17
|
beswarm/aient/src/aient/models/base.py,sha256=z-Z0pJfTN2x0cuwfvu0BdMRY9O-RmLwHEnBIJN1x4Fg,6719
|
18
|
-
beswarm/aient/src/aient/models/chatgpt.py,sha256=
|
18
|
+
beswarm/aient/src/aient/models/chatgpt.py,sha256=fWow2ezxduRU3sQxjoK7ZTOAQeY0byP-lCwYf-JcJUM,43105
|
19
19
|
beswarm/aient/src/aient/models/claude.py,sha256=thK9P8qkaaoUN3OOJ9Shw4KDs-pAGKPoX4FOPGFXva8,28597
|
20
20
|
beswarm/aient/src/aient/models/duckduckgo.py,sha256=1l7vYCs9SG5SWPCbcl7q6pCcB5AUF_r-a4l9frz3Ogo,8115
|
21
21
|
beswarm/aient/src/aient/models/gemini.py,sha256=chGLc-8G_DAOxr10HPoOhvVFW1RvMgHd6mt--VyAW98,14730
|
@@ -28,7 +28,7 @@ beswarm/aient/src/aient/plugins/excute_command.py,sha256=0sQZGLCaRfh0yMM63fXU8XZ
|
|
28
28
|
beswarm/aient/src/aient/plugins/get_time.py,sha256=Ih5XIW5SDAIhrZ9W4Qe5Hs1k4ieKPUc_LAd6ySNyqZk,654
|
29
29
|
beswarm/aient/src/aient/plugins/image.py,sha256=ZElCIaZznE06TN9xW3DrSukS7U3A5_cjk1Jge4NzPxw,2072
|
30
30
|
beswarm/aient/src/aient/plugins/list_directory.py,sha256=5ubm-mfrj-tanGSDp4M_Tmb6vQb3dx2-XVfQ2yL2G8A,1394
|
31
|
-
beswarm/aient/src/aient/plugins/read_file.py,sha256=
|
31
|
+
beswarm/aient/src/aient/plugins/read_file.py,sha256=v07127SXOhS8YGJ6X82Gw2xlk-nlKvX7SdxzZVe1z0Y,4625
|
32
32
|
beswarm/aient/src/aient/plugins/registry.py,sha256=YknzhieU_8nQ3oKlUSSWDB4X7t2Jx0JnqT2Jd9Xsvfk,3574
|
33
33
|
beswarm/aient/src/aient/plugins/run_python.py,sha256=dgcUwBunMuDkaSKR5bToudVzSdrXVewktDDFUz_iIOQ,4589
|
34
34
|
beswarm/aient/src/aient/plugins/websearch.py,sha256=yiBzqXK5X220ibR-zko3VDsn4QOnLu1k6E2YOygCeTQ,15185
|
@@ -124,8 +124,8 @@ beswarm/tools/planner.py,sha256=lguBCS6kpwNPoXQvqH-WySabVubT82iyWOkJnjt6dXw,1265
|
|
124
124
|
beswarm/tools/repomap.py,sha256=CwvwoN5Swr42EzrORTTeV8MMb7mPviy4a4b0fxBu50k,40828
|
125
125
|
beswarm/tools/search_arxiv.py,sha256=9slwBemXjEqrd7-YgVmyMijPXlkhZCybEDRVhWVQ9B0,7937
|
126
126
|
beswarm/tools/think.py,sha256=WLw-7jNIsnS6n8MMSYUin_f-BGLENFmnKM2LISEp0co,1760
|
127
|
-
beswarm/tools/worker.py,sha256=
|
128
|
-
beswarm-0.1.
|
129
|
-
beswarm-0.1.
|
130
|
-
beswarm-0.1.
|
131
|
-
beswarm-0.1.
|
127
|
+
beswarm/tools/worker.py,sha256=JZkMT4JAkrV_0-CBATLAPVZzVGEMMEM2XUTTMGmED0E,5245
|
128
|
+
beswarm-0.1.20.dist-info/METADATA,sha256=k7N6PewO59xBaDZoNU2ZfhzIdx8E3RQu2K7iVCZs0ug,2870
|
129
|
+
beswarm-0.1.20.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
130
|
+
beswarm-0.1.20.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
|
131
|
+
beswarm-0.1.20.dist-info/RECORD,,
|
File without changes
|
File without changes
|