aient 1.0.95__py3-none-any.whl → 1.0.97__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/models/chatgpt.py +7 -2
- aient/plugins/websearch.py +4 -5
- {aient-1.0.95.dist-info → aient-1.0.97.dist-info}/METADATA +1 -2
- {aient-1.0.95.dist-info → aient-1.0.97.dist-info}/RECORD +7 -7
- {aient-1.0.95.dist-info → aient-1.0.97.dist-info}/WHEEL +1 -1
- {aient-1.0.95.dist-info → aient-1.0.97.dist-info}/licenses/LICENSE +0 -0
- {aient-1.0.95.dist-info → aient-1.0.97.dist-info}/top_level.txt +0 -0
aient/models/chatgpt.py
CHANGED
@@ -150,8 +150,12 @@ class chatgpt(BaseLLM):
|
|
150
150
|
})
|
151
151
|
self.conversation[convo_id].append({"role": role, "tool_call_id": function_call_id, "content": message})
|
152
152
|
else:
|
153
|
-
self.conversation[convo_id]
|
154
|
-
|
153
|
+
last_user_message = self.conversation[convo_id][-1]["content"]
|
154
|
+
if last_user_message != message:
|
155
|
+
self.conversation[convo_id].append({"role": "assistant", "content": convert_functions_to_xml(function_arguments)})
|
156
|
+
self.conversation[convo_id].append({"role": "user", "content": message})
|
157
|
+
else:
|
158
|
+
self.conversation[convo_id].append({"role": "assistant", "content": "我已经执行过这个工具了,接下来我需要做什么?"})
|
155
159
|
|
156
160
|
else:
|
157
161
|
print('\033[31m')
|
@@ -430,6 +434,7 @@ class chatgpt(BaseLLM):
|
|
430
434
|
response_role = "assistant"
|
431
435
|
|
432
436
|
if self.use_plugins == True:
|
437
|
+
full_response = full_response.replace("<tool_code>", "").replace("</tool_code>", "")
|
433
438
|
function_parameter = parse_function_xml(full_response)
|
434
439
|
if function_parameter:
|
435
440
|
invalid_tools = [tool_dict for tool_dict in function_parameter if tool_dict.get("function_name", "") not in self.plugins.keys()]
|
aient/plugins/websearch.py
CHANGED
@@ -5,7 +5,6 @@ import requests
|
|
5
5
|
import threading
|
6
6
|
import time as record_time
|
7
7
|
from itertools import islice
|
8
|
-
from bs4 import BeautifulSoup
|
9
8
|
from .registry import register_tool
|
10
9
|
|
11
10
|
class ThreadWithReturnValue(threading.Thread):
|
@@ -17,11 +16,7 @@ class ThreadWithReturnValue(threading.Thread):
|
|
17
16
|
super().join()
|
18
17
|
return self._return
|
19
18
|
|
20
|
-
import re
|
21
19
|
import httpx
|
22
|
-
import lxml.html
|
23
|
-
from lxml_html_clean import Cleaner
|
24
|
-
from html2text import HTML2Text
|
25
20
|
from textwrap import dedent
|
26
21
|
|
27
22
|
def url_to_markdown(url):
|
@@ -33,6 +28,7 @@ def url_to_markdown(url):
|
|
33
28
|
return "抱歉,目前无法访问该网页。"
|
34
29
|
# body = lxml.html.fromstring(text).xpath('//body')
|
35
30
|
|
31
|
+
import lxml.html
|
36
32
|
doc = lxml.html.fromstring(text)
|
37
33
|
# 检查是否是GitHub raw文件格式(body > pre)
|
38
34
|
if doc.xpath('//body/pre'):
|
@@ -44,6 +40,7 @@ def url_to_markdown(url):
|
|
44
40
|
return f'<pre>{body}</pre>'
|
45
41
|
# return body
|
46
42
|
else:
|
43
|
+
from lxml_html_clean import Cleaner
|
47
44
|
body = body[0]
|
48
45
|
body = Cleaner(javascript=True, style=True).clean_html(body)
|
49
46
|
return ''.join(lxml.html.tostring(c, encoding='unicode') for c in body)
|
@@ -56,6 +53,7 @@ def url_to_markdown(url):
|
|
56
53
|
|
57
54
|
# 将HTML转换为Markdown
|
58
55
|
def get_md(cts):
|
56
|
+
from html2text import HTML2Text
|
59
57
|
h2t = HTML2Text(bodywidth=5000)
|
60
58
|
h2t.ignore_links = True
|
61
59
|
h2t.mark_code = True
|
@@ -82,6 +80,7 @@ def jina_ai_Web_crawler(url: str, isSearch=False) -> str:
|
|
82
80
|
}
|
83
81
|
result = ''
|
84
82
|
try:
|
83
|
+
from bs4 import BeautifulSoup
|
85
84
|
requests.packages.urllib3.disable_warnings()
|
86
85
|
url = "https://r.jina.ai/" + url
|
87
86
|
response = requests.get(url, headers=headers, verify=False, timeout=5, stream=True)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: aient
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.97
|
4
4
|
Summary: Aient: The Awakening of Agent.
|
5
5
|
Description-Content-Type: text/markdown
|
6
6
|
License-File: LICENSE
|
@@ -9,7 +9,6 @@ Requires-Dist: httpx
|
|
9
9
|
Requires-Dist: pillow
|
10
10
|
Requires-Dist: msgspec
|
11
11
|
Requires-Dist: fastapi
|
12
|
-
Requires-Dist: PyExecJS
|
13
12
|
Requires-Dist: requests
|
14
13
|
Requires-Dist: html2text
|
15
14
|
Requires-Dist: httpx-socks
|
@@ -14,7 +14,7 @@ aient/core/test/test_payload.py,sha256=8jBiJY1uidm1jzL-EiK0s6UGmW9XkdsuuKFGrwFhF
|
|
14
14
|
aient/models/__init__.py,sha256=ouNDNvoBBpIFrLsk09Q_sq23HR0GbLAKfGLIFmfEuXE,219
|
15
15
|
aient/models/audio.py,sha256=kRd-8-WXzv4vwvsTGwnstK-WR8--vr9CdfCZzu8y9LA,1934
|
16
16
|
aient/models/base.py,sha256=z-Z0pJfTN2x0cuwfvu0BdMRY9O-RmLwHEnBIJN1x4Fg,6719
|
17
|
-
aient/models/chatgpt.py,sha256
|
17
|
+
aient/models/chatgpt.py,sha256=q8dx4PD57m4a3gJHrzJr7v_Pl8X0RKDBCZHZEtIMxkk,45480
|
18
18
|
aient/models/claude.py,sha256=JezghW7y0brl4Y5qiSHvnYR5prQCFywX4RViHt39pGI,26037
|
19
19
|
aient/models/duckduckgo.py,sha256=1l7vYCs9SG5SWPCbcl7q6pCcB5AUF_r-a4l9frz3Ogo,8115
|
20
20
|
aient/models/gemini.py,sha256=chGLc-8G_DAOxr10HPoOhvVFW1RvMgHd6mt--VyAW98,14730
|
@@ -30,15 +30,15 @@ aient/plugins/list_directory.py,sha256=5ubm-mfrj-tanGSDp4M_Tmb6vQb3dx2-XVfQ2yL2G
|
|
30
30
|
aient/plugins/read_file.py,sha256=cJxGnhcz1_gjkgeemVyixLUiCvf-dWm-UtDfrbFdlLE,4857
|
31
31
|
aient/plugins/registry.py,sha256=YknzhieU_8nQ3oKlUSSWDB4X7t2Jx0JnqT2Jd9Xsvfk,3574
|
32
32
|
aient/plugins/run_python.py,sha256=dgcUwBunMuDkaSKR5bToudVzSdrXVewktDDFUz_iIOQ,4589
|
33
|
-
aient/plugins/websearch.py,sha256=
|
33
|
+
aient/plugins/websearch.py,sha256=I4tYU7CGLdyG6Hd3yK19V-PoG5IbFI9FEEVggyrshRg,15227
|
34
34
|
aient/plugins/write_file.py,sha256=qmT6iQ3mDyVAa9Sld1jfJq0KPZj0w2kRIHq0JyjpGeA,1853
|
35
35
|
aient/prompt/__init__.py,sha256=GBtn6-JDT8KHFCcuPpfSNE_aGddg5p4FEyMCy4BfwGs,20
|
36
36
|
aient/prompt/agent.py,sha256=3VycHGnUq9OdR5pd_RM0AeLESlpAgBcmzrsesfq82X0,23856
|
37
37
|
aient/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
38
38
|
aient/utils/prompt.py,sha256=UcSzKkFE4-h_1b6NofI6xgk3GoleqALRKY8VBaXLjmI,11311
|
39
39
|
aient/utils/scripts.py,sha256=JbYHsU3LLtxBcuO_2MWbSgpHpCgtVQe9FGEFJpUyejc,25926
|
40
|
-
aient-1.0.
|
41
|
-
aient-1.0.
|
42
|
-
aient-1.0.
|
43
|
-
aient-1.0.
|
44
|
-
aient-1.0.
|
40
|
+
aient-1.0.97.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
|
41
|
+
aient-1.0.97.dist-info/METADATA,sha256=IsTDS3il2LcmMByG212pao-YUKmpHsZ-PCjFsV2n-dE,4945
|
42
|
+
aient-1.0.97.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
43
|
+
aient-1.0.97.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
|
44
|
+
aient-1.0.97.dist-info/RECORD,,
|
File without changes
|
File without changes
|