beswarm 0.2.20__py3-none-any.whl → 0.2.22__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/core/request.py +3 -1
- beswarm/aient/src/aient/core/response.py +8 -2
- beswarm/tools/search_web.py +8 -3
- beswarm/tools/worker.py +2 -2
- {beswarm-0.2.20.dist-info → beswarm-0.2.22.dist-info}/METADATA +1 -1
- {beswarm-0.2.20.dist-info → beswarm-0.2.22.dist-info}/RECORD +9 -9
- {beswarm-0.2.20.dist-info → beswarm-0.2.22.dist-info}/WHEEL +0 -0
- {beswarm-0.2.20.dist-info → beswarm-0.2.22.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.1.
|
7
|
+
version="1.1.46",
|
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",
|
@@ -70,9 +70,11 @@ async def get_gemini_payload(request, engine, provider, api_key=None):
|
|
70
70
|
elif item.type == "image_url" and provider.get("image", True):
|
71
71
|
image_message = await get_image_message(item.image_url.url, engine)
|
72
72
|
content.append(image_message)
|
73
|
-
|
73
|
+
elif msg.content:
|
74
74
|
content = [{"text": msg.content}]
|
75
75
|
tool_calls = msg.tool_calls
|
76
|
+
elif msg.content is None:
|
77
|
+
continue
|
76
78
|
|
77
79
|
if tool_calls:
|
78
80
|
tool_call = tool_calls[0]
|
@@ -28,6 +28,7 @@ async def fetch_gemini_response_stream(client, url, headers, payload, model):
|
|
28
28
|
yield error_message
|
29
29
|
return
|
30
30
|
buffer = ""
|
31
|
+
cache_buffer = ""
|
31
32
|
revicing_function_call = False
|
32
33
|
function_full_response = "{"
|
33
34
|
need_function_call = False
|
@@ -45,6 +46,7 @@ async def fetch_gemini_response_stream(client, url, headers, payload, model):
|
|
45
46
|
# is_thinking = False
|
46
47
|
async for chunk in response.aiter_text():
|
47
48
|
buffer += chunk
|
49
|
+
cache_buffer += chunk
|
48
50
|
|
49
51
|
while "\n" in buffer:
|
50
52
|
line, buffer = buffer.split("\n", 1)
|
@@ -139,8 +141,12 @@ async def fetch_gemini_response_stream(client, url, headers, payload, model):
|
|
139
141
|
sse_string = await generate_sse_response(timestamp, model, content=None, tools_id="chatcmpl-9inWv0yEtgn873CxMBzHeCeiHctTV", function_call_name=None, function_call_content=function_full_response)
|
140
142
|
yield sse_string
|
141
143
|
|
142
|
-
|
143
|
-
|
144
|
+
if cache_buffer == "[]":
|
145
|
+
sse_string = await generate_sse_response(timestamp, model, stop="PROHIBITED_CONTENT")
|
146
|
+
yield sse_string
|
147
|
+
else:
|
148
|
+
sse_string = await generate_sse_response(timestamp, model, stop="stop")
|
149
|
+
yield sse_string
|
144
150
|
|
145
151
|
sse_string = await generate_sse_response(timestamp, model, None, None, None, None, None, totalTokenCount, promptTokenCount, candidatesTokenCount)
|
146
152
|
yield sse_string
|
beswarm/tools/search_web.py
CHANGED
@@ -2,6 +2,7 @@ import re
|
|
2
2
|
import os
|
3
3
|
import json
|
4
4
|
import httpx
|
5
|
+
from urllib.parse import quote_plus
|
5
6
|
import threading
|
6
7
|
|
7
8
|
from ..aient.src.aient.plugins import register_tool, get_url_content # Assuming a similar plugin structure
|
@@ -36,7 +37,7 @@ async def search_web(query: str):
|
|
36
37
|
"Authorization": f"Bearer {api_key}" # 请注意:硬编码的 API 密钥
|
37
38
|
}
|
38
39
|
payload = {
|
39
|
-
"url": f"https://www.google.com/search?q={query}"
|
40
|
+
"url": f"https://www.google.com/search?q={quote_plus(query)}"
|
40
41
|
}
|
41
42
|
results = []
|
42
43
|
|
@@ -76,7 +77,10 @@ async def search_web(query: str):
|
|
76
77
|
raise Exception(f"Error fetching search results for '{query}':")
|
77
78
|
else:
|
78
79
|
# print(f"Search results for '{query}':")
|
79
|
-
html_content = results.get("
|
80
|
+
html_content = results.get("html", "")
|
81
|
+
# print(html_content)
|
82
|
+
if "Your search did not match any documents" in html_content:
|
83
|
+
return "Your search did not match any documents"
|
80
84
|
if html_content:
|
81
85
|
# 使用正则表达式查找所有 URL
|
82
86
|
# 导入 html 和 urllib.parse 模块
|
@@ -284,7 +288,8 @@ if __name__ == '__main__':
|
|
284
288
|
|
285
289
|
async def main():
|
286
290
|
# 示例用法
|
287
|
-
search_query = "美国"
|
291
|
+
# search_query = "美国"
|
292
|
+
search_query = "machine learning models for higher heating value prediction using proximate vs ultimate analysis"
|
288
293
|
print(f"Performing web search for: '{search_query}'")
|
289
294
|
results = await search_web(search_query) # results is a list of URLs
|
290
295
|
|
beswarm/tools/worker.py
CHANGED
@@ -158,7 +158,7 @@ async def worker(goal, tools, work_dir, cache_messages=None):
|
|
158
158
|
"在 tag <work_agent_conversation_start>...</work_agent_conversation_end> 之前的对话历史都是工作智能体的对话历史。\n\n",
|
159
159
|
"根据以上对话历史和目标,请生成下一步指令。如果任务已完成,请回复'任务已完成'。\n\n",
|
160
160
|
])
|
161
|
-
if last_instruction:
|
161
|
+
if last_instruction and 'fetch_gpt_response_stream HTTP Error' not in last_instruction:
|
162
162
|
instruction_prompt = (
|
163
163
|
f"{instruction_prompt}\n\n"
|
164
164
|
"你生成的指令格式错误,必须把给assistant的指令放在<instructions>...</instructions>标签内。请重新生成格式正确的指令。"
|
@@ -358,7 +358,7 @@ async def worker_gen(goal, tools, work_dir, cache_messages=None):
|
|
358
358
|
"在 tag <work_agent_conversation_start>...</work_agent_conversation_end> 之前的对话历史都是工作智能体的对话历史。\n\n",
|
359
359
|
"根据以上对话历史和目标,请生成下一步指令。如果任务已完成,请回复'任务已完成'。\n\n",
|
360
360
|
])
|
361
|
-
if last_instruction:
|
361
|
+
if last_instruction and 'fetch_gpt_response_stream HTTP Error' not in last_instruction:
|
362
362
|
instruction_prompt = (
|
363
363
|
f"{instruction_prompt}\n\n"
|
364
364
|
"你生成的指令格式错误,必须把给assistant的指令放在<instructions>...</instructions>标签内。请重新生成格式正确的指令。"
|
@@ -2,13 +2,13 @@ beswarm/__init__.py,sha256=HZjUOJtZR5QhMuDbq-wukQQn1VrBusNWai_ysGo-VVI,20
|
|
2
2
|
beswarm/prompt.py,sha256=_hYKZ0MUiMRs3C-1PMlFKIVgTKFcp_irla3p3wQNF3c,32015
|
3
3
|
beswarm/utils.py,sha256=xxbNifOPlfcVkKmF_qFzuEnZgF3MQg3mnOfz1EF0Qss,6697
|
4
4
|
beswarm/aient/main.py,sha256=SiYAIgQlLJqYusnTVEJOx1WNkSJKMImhgn5aWjfroxg,3814
|
5
|
-
beswarm/aient/setup.py,sha256=
|
5
|
+
beswarm/aient/setup.py,sha256=TTd2yaKXQpCf2v-b35OeJhLMXEJ-QRkhO48wTq7edKk,487
|
6
6
|
beswarm/aient/src/aient/__init__.py,sha256=SRfF7oDVlOOAi6nGKiJIUK6B_arqYLO9iSMp-2IZZps,21
|
7
7
|
beswarm/aient/src/aient/core/__init__.py,sha256=NxjebTlku35S4Dzr16rdSqSTWUvvwEeACe8KvHJnjPg,34
|
8
8
|
beswarm/aient/src/aient/core/log_config.py,sha256=kz2_yJv1p-o3lUQOwA3qh-LSc3wMHv13iCQclw44W9c,274
|
9
9
|
beswarm/aient/src/aient/core/models.py,sha256=d4MISNezTSe0ls0-fjuToI2SoT-sk5fWqAJuKVinIlo,7502
|
10
|
-
beswarm/aient/src/aient/core/request.py,sha256=
|
11
|
-
beswarm/aient/src/aient/core/response.py,sha256=
|
10
|
+
beswarm/aient/src/aient/core/request.py,sha256=r8IvC62GZ6NuBXx82Fd0hiPjYrtqhW3hKz2jdqVY8L0,72473
|
11
|
+
beswarm/aient/src/aient/core/response.py,sha256=_FVvvakplKAvBMljXy8jm9hMGJ8xgHGrsU8Aio9Xk1o,35408
|
12
12
|
beswarm/aient/src/aient/core/utils.py,sha256=NcXdb8zBN0GE01OGaUzg8U34RaraoFf2MaLDDGFvvC4,27492
|
13
13
|
beswarm/aient/src/aient/core/test/test_base_api.py,sha256=pWnycRJbuPSXKKU9AQjWrMAX1wiLC_014Qc9hh5C2Pw,524
|
14
14
|
beswarm/aient/src/aient/core/test/test_geminimask.py,sha256=HFX8jDbNg_FjjgPNxfYaR-0-roUrOO-ND-FVsuxSoiw,13254
|
@@ -133,10 +133,10 @@ beswarm/tools/repomap.py,sha256=YsTPq5MXfn_Ds5begcvHDnY_Xp2d4jH-xmWqNMHnNHY,4523
|
|
133
133
|
beswarm/tools/request_input.py,sha256=gXNAJPOJektMqxJVyzNTFOeMQ7xUkO-wWMYH-r2Rdwk,942
|
134
134
|
beswarm/tools/screenshot.py,sha256=u6t8FCgW5YHJ_Oc4coo8e0F3wTusWE_-H8dFh1rBq9Q,1011
|
135
135
|
beswarm/tools/search_arxiv.py,sha256=caVIUOzMhFu-r_gVgJZrH2EO9xI5iV_qLAg0b3Ie9Xg,8095
|
136
|
-
beswarm/tools/search_web.py,sha256=
|
136
|
+
beswarm/tools/search_web.py,sha256=tLdw63doMTorrCG3ZoQkKvQPYBdx-m-SJskAXxfdim8,11958
|
137
137
|
beswarm/tools/taskmanager.py,sha256=oB_768qy6Lb58JNIcSLVgbPrgNB3duIq9DawbVHRbrg,6270
|
138
|
-
beswarm/tools/worker.py,sha256=
|
139
|
-
beswarm-0.2.
|
140
|
-
beswarm-0.2.
|
141
|
-
beswarm-0.2.
|
142
|
-
beswarm-0.2.
|
138
|
+
beswarm/tools/worker.py,sha256=Rxc8OnbqSrNeZc1ZvEPSKgFHbJnlG_fO6NF61m6f4OU,23808
|
139
|
+
beswarm-0.2.22.dist-info/METADATA,sha256=62WXG9mPgoiF0gsEpdQfzpTueuvBJIi_5W4r4uVD2yc,3847
|
140
|
+
beswarm-0.2.22.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
141
|
+
beswarm-0.2.22.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
|
142
|
+
beswarm-0.2.22.dist-info/RECORD,,
|
File without changes
|
File without changes
|