aient 1.2.28__py3-none-any.whl → 1.2.30__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/request.py +4 -2
- aient/core/utils.py +6 -1
- aient/models/audio.py +2 -2
- aient/models/base.py +2 -2
- aient/models/chatgpt.py +2 -2
- aient/plugins/image.py +2 -2
- aient/utils/prompt.py +0 -4
- aient/utils/scripts.py +0 -8
- {aient-1.2.28.dist-info → aient-1.2.30.dist-info}/METADATA +1 -1
- {aient-1.2.28.dist-info → aient-1.2.30.dist-info}/RECORD +13 -13
- {aient-1.2.28.dist-info → aient-1.2.30.dist-info}/WHEEL +0 -0
- {aient-1.2.28.dist-info → aient-1.2.30.dist-info}/licenses/LICENSE +0 -0
- {aient-1.2.28.dist-info → aient-1.2.30.dist-info}/top_level.txt +0 -0
aient/core/request.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import re
|
2
2
|
import json
|
3
|
+
import copy
|
3
4
|
import httpx
|
4
5
|
import base64
|
5
6
|
import asyncio
|
@@ -57,7 +58,7 @@ async def get_gemini_payload(request, engine, provider, api_key=None):
|
|
57
58
|
try:
|
58
59
|
request_messages = [Message(role="user", content=request.prompt)]
|
59
60
|
except:
|
60
|
-
request_messages = request.messages
|
61
|
+
request_messages = copy.deepcopy(request.messages)
|
61
62
|
for msg in request_messages:
|
62
63
|
if msg.role == "assistant":
|
63
64
|
msg.role = "model"
|
@@ -399,7 +400,8 @@ async def get_vertex_gemini_payload(request, engine, provider, api_key=None):
|
|
399
400
|
systemInstruction = None
|
400
401
|
system_prompt = ""
|
401
402
|
function_arguments = None
|
402
|
-
|
403
|
+
request_messages = copy.deepcopy(request.messages)
|
404
|
+
for msg in request_messages:
|
403
405
|
if msg.role == "assistant":
|
404
406
|
msg.role = "model"
|
405
407
|
tool_calls = None
|
aient/core/utils.py
CHANGED
@@ -228,7 +228,12 @@ async def update_initial_model(provider):
|
|
228
228
|
def safe_get(data, *keys, default=None):
|
229
229
|
for key in keys:
|
230
230
|
try:
|
231
|
-
|
231
|
+
if isinstance(data, (dict, list)):
|
232
|
+
data = data[key]
|
233
|
+
elif isinstance(key, str) and hasattr(data, key):
|
234
|
+
data = getattr(data, key)
|
235
|
+
else:
|
236
|
+
data = data.get(key)
|
232
237
|
except (KeyError, IndexError, AttributeError, TypeError):
|
233
238
|
return default
|
234
239
|
if not data:
|
aient/models/audio.py
CHANGED
@@ -4,13 +4,13 @@ import json
|
|
4
4
|
from .base import BaseLLM
|
5
5
|
|
6
6
|
API = os.environ.get('API', None)
|
7
|
-
|
7
|
+
BASE_URL = os.environ.get('BASE_URL', None)
|
8
8
|
|
9
9
|
class whisper(BaseLLM):
|
10
10
|
def __init__(
|
11
11
|
self,
|
12
12
|
api_key: str,
|
13
|
-
api_url: str = (os.environ.get("
|
13
|
+
api_url: str = (os.environ.get("BASE_URL") or "https://api.openai.com/v1/audio/transcriptions"),
|
14
14
|
timeout: float = 20,
|
15
15
|
):
|
16
16
|
super().__init__(api_key, api_url=api_url, timeout=timeout)
|
aient/models/base.py
CHANGED
@@ -11,8 +11,8 @@ class BaseLLM:
|
|
11
11
|
def __init__(
|
12
12
|
self,
|
13
13
|
api_key: str = None,
|
14
|
-
engine: str = os.environ.get("
|
15
|
-
api_url: str = (os.environ.get("
|
14
|
+
engine: str = os.environ.get("MODEL") or "gpt-3.5-turbo",
|
15
|
+
api_url: str = (os.environ.get("BASE_URL", None) or "https://api.openai.com/v1/chat/completions"),
|
16
16
|
system_prompt: str = prompt.chatgpt_system_prompt,
|
17
17
|
proxy: str = None,
|
18
18
|
timeout: float = 600,
|
aient/models/chatgpt.py
CHANGED
@@ -74,8 +74,8 @@ class chatgpt(BaseLLM):
|
|
74
74
|
def __init__(
|
75
75
|
self,
|
76
76
|
api_key: str = None,
|
77
|
-
engine: str = os.environ.get("
|
78
|
-
api_url: str = (os.environ.get("
|
77
|
+
engine: str = os.environ.get("MODEL") or "gpt-4o",
|
78
|
+
api_url: str = (os.environ.get("BASE_URL") or "https://api.openai.com/v1/chat/completions"),
|
79
79
|
system_prompt: str = "You are ChatGPT, a large language model trained by OpenAI. Respond conversationally",
|
80
80
|
proxy: str = None,
|
81
81
|
timeout: float = 600,
|
aient/plugins/image.py
CHANGED
@@ -5,13 +5,13 @@ from ..models.base import BaseLLM
|
|
5
5
|
from .registry import register_tool
|
6
6
|
|
7
7
|
API = os.environ.get('API', None)
|
8
|
-
|
8
|
+
BASE_URL = os.environ.get('BASE_URL', None)
|
9
9
|
|
10
10
|
class dalle3(BaseLLM):
|
11
11
|
def __init__(
|
12
12
|
self,
|
13
13
|
api_key: str,
|
14
|
-
api_url: str = (os.environ.get("
|
14
|
+
api_url: str = (os.environ.get("BASE_URL") or "https://api.openai.com/v1/images/generations"),
|
15
15
|
timeout: float = 20,
|
16
16
|
):
|
17
17
|
super().__init__(api_key, api_url=api_url, timeout=timeout)
|
aient/utils/prompt.py
CHANGED
@@ -90,10 +90,6 @@ chatgpt_system_prompt = (
|
|
90
90
|
"You are ChatGPT, a large language model trained by OpenAI. Use simple characters to represent mathematical symbols. Do not use LaTeX commands. Respond conversationally"
|
91
91
|
)
|
92
92
|
|
93
|
-
claude_system_prompt = (
|
94
|
-
"You are Claude, a large language model trained by Anthropic. Use simple characters to represent mathematical symbols. Do not use LaTeX commands. Respond conversationally in {}."
|
95
|
-
)
|
96
|
-
|
97
93
|
search_system_prompt = (
|
98
94
|
"You are ChatGPT, a large language model trained by OpenAI. Respond conversationally in {}."
|
99
95
|
"You can break down the task into multiple steps and search the web to answer my questions one by one."
|
aient/utils/scripts.py
CHANGED
@@ -134,14 +134,6 @@ def is_surrounded_by_chinese(text, index):
|
|
134
134
|
def replace_char(string, index, new_char):
|
135
135
|
return string[:index] + new_char + string[index+1:]
|
136
136
|
|
137
|
-
def claude_replace(text):
|
138
|
-
Punctuation_mapping = {",": ",", ":": ":", "!": "!", "?": "?", ";": ";"}
|
139
|
-
key_list = list(Punctuation_mapping.keys())
|
140
|
-
for i in range(len(text)):
|
141
|
-
if is_surrounded_by_chinese(text, i) and (text[i] in key_list):
|
142
|
-
text = replace_char(text, i, Punctuation_mapping[text[i]])
|
143
|
-
return text
|
144
|
-
|
145
137
|
def safe_get(data, *keys, default=None):
|
146
138
|
for key in keys:
|
147
139
|
try:
|
@@ -7,23 +7,23 @@ aient/architext/test/test_save_load.py,sha256=o8DqH6gDYZkFkQy-a7blqLtJTRj5e4a-Li
|
|
7
7
|
aient/core/__init__.py,sha256=NxjebTlku35S4Dzr16rdSqSTWUvvwEeACe8KvHJnjPg,34
|
8
8
|
aient/core/log_config.py,sha256=kz2_yJv1p-o3lUQOwA3qh-LSc3wMHv13iCQclw44W9c,274
|
9
9
|
aient/core/models.py,sha256=KMlCRLjtq1wQHZTJGqnbWhPS2cHq6eLdnk7peKDrzR8,7490
|
10
|
-
aient/core/request.py,sha256
|
10
|
+
aient/core/request.py,sha256=-KEBd4jWLVC9QYUhb1ZfgkLf4nKE7HKL0A58iULkY7o,76757
|
11
11
|
aient/core/response.py,sha256=Z9geTfh2LkGHKAqjelgeleQtfOAYIyM82t9AVB4xsgE,36407
|
12
|
-
aient/core/utils.py,sha256=
|
12
|
+
aient/core/utils.py,sha256=Z8vTH9w3uS8uubBa65c_aJ11A3OKGYEzm4q0brNZDSk,31594
|
13
13
|
aient/core/test/test_base_api.py,sha256=pWnycRJbuPSXKKU9AQjWrMAX1wiLC_014Qc9hh5C2Pw,524
|
14
14
|
aient/core/test/test_geminimask.py,sha256=HFX8jDbNg_FjjgPNxfYaR-0-roUrOO-ND-FVsuxSoiw,13254
|
15
15
|
aient/core/test/test_image.py,sha256=_T4peNGdXKBHHxyQNx12u-NTyFE8TlYI6NvvagsG2LE,319
|
16
16
|
aient/core/test/test_payload.py,sha256=8jBiJY1uidm1jzL-EiK0s6UGmW9XkdsuuKFGrwFhFkw,2755
|
17
17
|
aient/models/__init__.py,sha256=ZTiZgbfBPTjIPSKURE7t6hlFBVLRS9lluGbmqc1WjxQ,43
|
18
|
-
aient/models/audio.py,sha256=
|
19
|
-
aient/models/base.py,sha256
|
20
|
-
aient/models/chatgpt.py,sha256=
|
18
|
+
aient/models/audio.py,sha256=FNW4lxG1IhxOU7L8mvcbaeC1nXk_lpUZQlg9ijQ0h_Q,1937
|
19
|
+
aient/models/base.py,sha256=HWIGfa2A7OTccvHK0wG1-UlHB-yaWRC7hbi4oR1Mu1Y,7228
|
20
|
+
aient/models/chatgpt.py,sha256=A8tZl-a00EZxGYKQBOiNh-kG-YjU-zsj0XbeIzcbf6o,42916
|
21
21
|
aient/plugins/__init__.py,sha256=p3KO6Aa3Lupos4i2SjzLQw1hzQTigOAfEHngsldrsyk,986
|
22
22
|
aient/plugins/arXiv.py,sha256=yHjb6PS3GUWazpOYRMKMzghKJlxnZ5TX8z9F6UtUVow,1461
|
23
23
|
aient/plugins/config.py,sha256=TGgZ5SnNKZ8MmdznrZ-TEq7s2ulhAAwTSKH89bci3dA,7079
|
24
24
|
aient/plugins/excute_command.py,sha256=b-rxsyFN6_HnZJAhUi9Qsp8iJ6XTf-zU-CIUIxeQO98,10869
|
25
25
|
aient/plugins/get_time.py,sha256=Ih5XIW5SDAIhrZ9W4Qe5Hs1k4ieKPUc_LAd6ySNyqZk,654
|
26
|
-
aient/plugins/image.py,sha256=
|
26
|
+
aient/plugins/image.py,sha256=JR4iJ--uUk1abICwQjd9tVIk0-Vs8qMxn6z2lJwuQ4U,2075
|
27
27
|
aient/plugins/list_directory.py,sha256=V_uKkLx_fQDL5z__bSDC-PqAP-o32KmQW6Pdhx0Fx0s,1433
|
28
28
|
aient/plugins/read_file.py,sha256=qHAhdesOr1VMOCDkeHNvI8UV2ZI98HmJl6GhN4Aq9dU,9183
|
29
29
|
aient/plugins/read_image.py,sha256=4FbIiMNVFUQpNyiH5ApGSRvOD9ujcXGyuqlGTJMd7ac,4017
|
@@ -33,10 +33,10 @@ aient/plugins/run_python.py,sha256=MohvdtZUTDLrHBDtJ9L2_Qu1pWAGrkbzsGmmn5tMN20,4
|
|
33
33
|
aient/plugins/websearch.py,sha256=aPsBjUQ3zQ4gzNrbVq7BMh28ENj9h_fSAeJFF2h9TNk,15334
|
34
34
|
aient/plugins/write_file.py,sha256=Jt8fOEwqhYiSWpCbwfAr1xoi_BmFnx3076GMhuL06uI,3949
|
35
35
|
aient/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
36
|
-
aient/utils/prompt.py,sha256=
|
37
|
-
aient/utils/scripts.py,sha256=
|
38
|
-
aient-1.2.
|
39
|
-
aient-1.2.
|
40
|
-
aient-1.2.
|
41
|
-
aient-1.2.
|
42
|
-
aient-1.2.
|
36
|
+
aient/utils/prompt.py,sha256=ZvGAt_ImJ_CGbDnWgpsWskfSV5fCkpFKRpNQjYL7M7s,11100
|
37
|
+
aient/utils/scripts.py,sha256=Q0tS7E9AmdikO7GeDBd_3Ii5opXHCvKjDGqHsXen6_A,40622
|
38
|
+
aient-1.2.30.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
|
39
|
+
aient-1.2.30.dist-info/METADATA,sha256=uFCKPmb6M_-Fehq-bpgkcFhK6zu6IqlVnGVKsgZH_8g,4842
|
40
|
+
aient-1.2.30.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
41
|
+
aient-1.2.30.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
|
42
|
+
aient-1.2.30.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|