aient 1.0.29__py3-none-any.whl → 1.0.31__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.
aient/core/response.py CHANGED
@@ -156,8 +156,8 @@ async def fetch_gpt_response_stream(client, url, headers, payload):
156
156
  # logger.info("line: %s", repr(line))
157
157
  if line and line != "data: " and line != "data:" and not line.startswith(": ") and (result:=line.lstrip("data: ").strip()):
158
158
  if result.strip() == "[DONE]":
159
- yield "data: [DONE]" + end_of_line
160
- return
159
+ # yield "data: [DONE]" + end_of_line
160
+ break
161
161
  line = json.loads(result)
162
162
  line['id'] = f"chatcmpl-{random_str}"
163
163
 
@@ -242,6 +242,7 @@ async def fetch_gpt_response_stream(client, url, headers, payload):
242
242
  if no_stream_content:
243
243
  del line["choices"][0]["message"]
244
244
  yield "data: " + json.dumps(line).strip() + end_of_line
245
+ yield "data: [DONE]" + end_of_line
245
246
 
246
247
  async def fetch_azure_response_stream(client, url, headers, payload):
247
248
  timestamp = int(datetime.timestamp(datetime.now()))
@@ -264,8 +265,8 @@ async def fetch_azure_response_stream(client, url, headers, payload):
264
265
  if line and line != "data: " and line != "data:" and not line.startswith(": "):
265
266
  result = line.lstrip("data: ")
266
267
  if result.strip() == "[DONE]":
267
- yield "data: [DONE]" + end_of_line
268
- return
268
+ # yield "data: [DONE]" + end_of_line
269
+ break
269
270
  line = json.loads(result)
270
271
  no_stream_content = safe_get(line, "choices", 0, "message", "content", default="")
271
272
  content = safe_get(line, "choices", 0, "delta", "content", default="")
@@ -315,13 +316,14 @@ async def fetch_cloudflare_response_stream(client, url, headers, payload, model)
315
316
  if line.startswith("data:"):
316
317
  line = line.lstrip("data: ")
317
318
  if line == "[DONE]":
318
- yield "data: [DONE]" + end_of_line
319
- return
319
+ # yield "data: [DONE]" + end_of_line
320
+ break
320
321
  resp: dict = json.loads(line)
321
322
  message = resp.get("response")
322
323
  if message:
323
324
  sse_string = await generate_sse_response(timestamp, model, content=message)
324
325
  yield sse_string
326
+ yield "data: [DONE]" + end_of_line
325
327
 
326
328
  async def fetch_cohere_response_stream(client, url, headers, payload, model):
327
329
  timestamp = int(datetime.timestamp(datetime.now()))
@@ -339,12 +341,13 @@ async def fetch_cohere_response_stream(client, url, headers, payload, model):
339
341
  # logger.info("line: %s", repr(line))
340
342
  resp: dict = json.loads(line)
341
343
  if resp.get("is_finished") == True:
342
- yield "data: [DONE]" + end_of_line
343
- return
344
+ # yield "data: [DONE]" + end_of_line
345
+ break
344
346
  if resp.get("event_type") == "text-generation":
345
347
  message = resp.get("text")
346
348
  sse_string = await generate_sse_response(timestamp, model, content=message)
347
349
  yield sse_string
350
+ yield "data: [DONE]" + end_of_line
348
351
 
349
352
  async def fetch_claude_response_stream(client, url, headers, payload, model):
350
353
  timestamp = int(datetime.timestamp(datetime.now()))
@@ -115,10 +115,11 @@ def jina_ai_Web_crawler(url: str, isSearch=False) -> str:
115
115
  if result.count("\"") > 1000:
116
116
  result = ""
117
117
  except Exception as e:
118
- print('\033[31m')
119
- print("error: jina_ai_Web_crawler url", url)
120
- print("error", e)
121
- print('\033[0m')
118
+ # print('\033[31m')
119
+ # print("error: jina_ai_Web_crawler url", url)
120
+ # print("error", e)
121
+ # print('\033[0m')
122
+ pass
122
123
  # print(result + "\n\n")
123
124
  return result
124
125
 
@@ -132,9 +133,9 @@ def get_url_content(url: str) -> str:
132
133
  """
133
134
  markdown_content = url_to_markdown(url)
134
135
  # print(markdown_content)
135
- print('-----------------------------')
136
+ # print('-----------------------------')
136
137
  jina_content = jina_ai_Web_crawler(url)
137
- print('-----------------------------')
138
+ # print('-----------------------------')
138
139
 
139
140
  # 定义评分函数
140
141
  def score_content(content):
@@ -162,17 +163,17 @@ def get_url_content(url: str) -> str:
162
163
  else:
163
164
  jina_score = score_content(jina_content)
164
165
 
165
- print(f"url_to_markdown 得分: {markdown_score}")
166
- print(f"jina_ai_Web_crawler 得分: {jina_score}")
166
+ # print(f"url_to_markdown 得分: {markdown_score}")
167
+ # print(f"jina_ai_Web_crawler 得分: {jina_score}")
167
168
 
168
169
  if markdown_score > jina_score:
169
- print("choose: 选择 url_to_markdown 的结果")
170
+ # print("choose: 选择 url_to_markdown 的结果")
170
171
  return markdown_content
171
172
  elif markdown_score == jina_score and jina_score < 0:
172
173
  print("choose: 两者都无法访问")
173
174
  return ""
174
175
  else:
175
- print("choose: 选择 jina_ai_Web_crawler 的结果")
176
+ # print("choose: 选择 jina_ai_Web_crawler 的结果")
176
177
  return jina_content
177
178
 
178
179
  def getddgsearchurl(query, max_results=4):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aient
3
- Version: 1.0.29
3
+ Version: 1.0.31
4
4
  Summary: Aient: The Awakening of Agent.
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -4,7 +4,7 @@ aient/core/__init__.py,sha256=NxjebTlku35S4Dzr16rdSqSTWUvvwEeACe8KvHJnjPg,34
4
4
  aient/core/log_config.py,sha256=kz2_yJv1p-o3lUQOwA3qh-LSc3wMHv13iCQclw44W9c,274
5
5
  aient/core/models.py,sha256=8MsuiYHBHVR5UMQ_cNLkvntoxalS7NpVwaNwHA0iZmk,7379
6
6
  aient/core/request.py,sha256=Tk8ylLBHPsrA4C_fb2XUEz_ZM7tR4691mlIxn7x8LUU,48249
7
- aient/core/response.py,sha256=jE2d-X-ukP5Jy5FCG2VHw5VZgPzhH56_N0gQPqIVggA,26351
7
+ aient/core/response.py,sha256=buyzyD971msbPgNCiTlCGX13RGI90u4_qOejqERdrVU,26484
8
8
  aient/core/utils.py,sha256=i9ZwyywBLIhRM0fNmFSD3jF3dBL5QqVMOtSlG_ddv-I,24101
9
9
  aient/core/test/test_base_api.py,sha256=CjfFzMG26r8C4xCPoVkKb3Ac6pp9gy5NUCbZJHoSSsM,393
10
10
  aient/core/test/test_image.py,sha256=_T4peNGdXKBHHxyQNx12u-NTyFE8TlYI6NvvagsG2LE,319
@@ -25,12 +25,12 @@ aient/plugins/image.py,sha256=ZElCIaZznE06TN9xW3DrSukS7U3A5_cjk1Jge4NzPxw,2072
25
25
  aient/plugins/registry.py,sha256=YknzhieU_8nQ3oKlUSSWDB4X7t2Jx0JnqT2Jd9Xsvfk,3574
26
26
  aient/plugins/run_python.py,sha256=dgcUwBunMuDkaSKR5bToudVzSdrXVewktDDFUz_iIOQ,4589
27
27
  aient/plugins/today.py,sha256=btnXJNqWorJDKPvH9PBTdHaExpVI1YPuSAeRrq-fg9A,667
28
- aient/plugins/websearch.py,sha256=RY0BaYgPC3OTTTDlezakXm6JvXixMEXUqHN5MXpXijw,15144
28
+ aient/plugins/websearch.py,sha256=k23xymhf3xxdc3hc0_0FFZTI9OaThCYM6csYsygCHs8,15177
29
29
  aient/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
30
  aient/utils/prompt.py,sha256=UcSzKkFE4-h_1b6NofI6xgk3GoleqALRKY8VBaXLjmI,11311
31
31
  aient/utils/scripts.py,sha256=O-0IXN3mezPauFs6fw83WDDgklpXTDvcbJBNTDrsIG0,8201
32
- aient-1.0.29.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
33
- aient-1.0.29.dist-info/METADATA,sha256=BmMRouk-Oict-XOBDYh8toZrKz54jBi2r9XHtzceiOY,4986
34
- aient-1.0.29.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
35
- aient-1.0.29.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
36
- aient-1.0.29.dist-info/RECORD,,
32
+ aient-1.0.31.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
33
+ aient-1.0.31.dist-info/METADATA,sha256=NnEBkrEZDpwteENWvGWy0fdljoc3fJl_SoMba_7ebPc,4986
34
+ aient-1.0.31.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
35
+ aient-1.0.31.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
36
+ aient-1.0.31.dist-info/RECORD,,
File without changes