aient 1.0.89__tar.gz → 1.0.91__tar.gz
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-1.0.89/src/aient.egg-info → aient-1.0.91}/PKG-INFO +1 -1
- {aient-1.0.89 → aient-1.0.91}/setup.py +1 -1
- {aient-1.0.89 → aient-1.0.91}/src/aient/core/request.py +8 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/core/response.py +4 -1
- {aient-1.0.89 → aient-1.0.91}/src/aient/models/chatgpt.py +19 -28
- {aient-1.0.89 → aient-1.0.91/src/aient.egg-info}/PKG-INFO +1 -1
- {aient-1.0.89 → aient-1.0.91}/LICENSE +0 -0
- {aient-1.0.89 → aient-1.0.91}/MANIFEST.in +0 -0
- {aient-1.0.89 → aient-1.0.91}/README.md +0 -0
- {aient-1.0.89 → aient-1.0.91}/setup.cfg +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/__init__.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/core/.git +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/core/.gitignore +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/core/__init__.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/core/log_config.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/core/models.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/core/test/test_base_api.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/core/test/test_image.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/core/test/test_payload.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/core/utils.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/models/__init__.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/models/audio.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/models/base.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/models/claude.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/models/duckduckgo.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/models/gemini.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/models/groq.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/models/vertex.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/plugins/__init__.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/plugins/arXiv.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/plugins/config.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/plugins/excute_command.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/plugins/get_time.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/plugins/image.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/plugins/list_directory.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/plugins/read_file.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/plugins/registry.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/plugins/run_python.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/plugins/websearch.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/plugins/write_file.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/prompt/__init__.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/prompt/agent.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/utils/__init__.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/utils/prompt.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient/utils/scripts.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient.egg-info/SOURCES.txt +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient.egg-info/dependency_links.txt +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient.egg-info/requires.txt +0 -0
- {aient-1.0.89 → aient-1.0.91}/src/aient.egg-info/top_level.txt +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_API.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_Deepbricks.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_Web_crawler.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_aiwaves.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_aiwaves_arxiv.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_ask_gemini.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_class.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_claude.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_claude_zh_char.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_ddg_search.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_download_pdf.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_gemini.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_get_token_dict.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_google_search.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_jieba.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_json.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_langchain_search_old.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_logging.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_ollama.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_plugin.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_py_run.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_requests.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_search.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_tikitoken.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_token.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_url.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_whisper.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_wildcard.py +0 -0
- {aient-1.0.89 → aient-1.0.91}/test/test_yjh.py +0 -0
@@ -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.91",
|
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",
|
@@ -995,6 +995,10 @@ async def get_gpt_payload(request, engine, provider, api_key=None):
|
|
995
995
|
}
|
996
996
|
})
|
997
997
|
|
998
|
+
if safe_get(provider, "preferences", "post_body_parameter_overrides", default=None):
|
999
|
+
for key, value in safe_get(provider, "preferences", "post_body_parameter_overrides", default={}).items():
|
1000
|
+
payload[key] = value
|
1001
|
+
|
998
1002
|
return url, headers, payload
|
999
1003
|
|
1000
1004
|
def build_azure_endpoint(base_url, deployment_id, api_version="2025-01-01-preview"):
|
@@ -1085,6 +1089,10 @@ async def get_azure_payload(request, engine, provider, api_key=None):
|
|
1085
1089
|
payload.pop("tools", None)
|
1086
1090
|
payload.pop("tool_choice", None)
|
1087
1091
|
|
1092
|
+
if safe_get(provider, "preferences", "post_body_parameter_overrides", default=None):
|
1093
|
+
for key, value in safe_get(provider, "preferences", "post_body_parameter_overrides", default={}).items():
|
1094
|
+
payload[key] = value
|
1095
|
+
|
1088
1096
|
return url, headers, payload
|
1089
1097
|
|
1090
1098
|
async def get_openrouter_payload(request, engine, provider, api_key=None):
|
@@ -327,7 +327,10 @@ async def fetch_azure_response_stream(client, url, headers, payload):
|
|
327
327
|
continue
|
328
328
|
|
329
329
|
if no_stream_content or content or sse_string:
|
330
|
-
|
330
|
+
input_tokens = safe_get(line, "usage", "prompt_tokens", default=0)
|
331
|
+
output_tokens = safe_get(line, "usage", "completion_tokens", default=0)
|
332
|
+
total_tokens = safe_get(line, "usage", "total_tokens", default=0)
|
333
|
+
sse_string = await generate_sse_response(timestamp, safe_get(line, "model", default=None), content=no_stream_content or content, total_tokens=total_tokens, prompt_tokens=input_tokens, completion_tokens=output_tokens)
|
331
334
|
yield sse_string
|
332
335
|
else:
|
333
336
|
if no_stream_content:
|
@@ -125,9 +125,9 @@ class chatgpt(BaseLLM):
|
|
125
125
|
# print("role", role, "function_name", function_name, "message", message)
|
126
126
|
if convo_id not in self.conversation:
|
127
127
|
self.reset(convo_id=convo_id)
|
128
|
-
if function_name == "" and message
|
128
|
+
if function_name == "" and message:
|
129
129
|
self.conversation[convo_id].append({"role": role, "content": message})
|
130
|
-
elif function_name != "" and message
|
130
|
+
elif function_name != "" and message:
|
131
131
|
# 删除从 cut_history_by_function_name 以后的所有历史记录
|
132
132
|
if function_name == self.cut_history_by_function_name:
|
133
133
|
matching_message = next(filter(lambda x: safe_get(x, "tool_calls", 0, "function", "name", default="") == 'get_next_pdf', self.conversation[convo_id]), None)
|
@@ -429,40 +429,31 @@ class chatgpt(BaseLLM):
|
|
429
429
|
if response_role is None:
|
430
430
|
response_role = "assistant"
|
431
431
|
|
432
|
-
|
433
|
-
|
434
|
-
print("function_parameter1", function_parameter)
|
435
|
-
function_parameter = [tool_dict for tool_dict in function_parameter if tool_dict.get("function_name", "") in self.plugins.keys()]
|
436
|
-
invalid_tools = [tool_dict for tool_dict in function_parameter if tool_dict.get("function_name", "") not in self.plugins.keys()]
|
437
|
-
for tool_dict in invalid_tools:
|
438
|
-
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."
|
439
|
-
print("function_parameter2", self.print_log, function_parameter)
|
440
|
-
if self.print_log:
|
441
|
-
print("invalid_tools", invalid_tools)
|
442
|
-
print("full_response", full_response)
|
432
|
+
if self.use_plugins == True:
|
433
|
+
function_parameter = parse_function_xml(full_response)
|
443
434
|
if function_parameter:
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
435
|
+
invalid_tools = [tool_dict for tool_dict in function_parameter if tool_dict.get("function_name", "") not in self.plugins.keys()]
|
436
|
+
function_parameter = [tool_dict for tool_dict in function_parameter if tool_dict.get("function_name", "") in self.plugins.keys()]
|
437
|
+
for tool_dict in invalid_tools:
|
438
|
+
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."
|
439
|
+
if self.print_log and invalid_tools:
|
440
|
+
print("invalid_tools", invalid_tools)
|
441
|
+
print("function_parameter", function_parameter)
|
449
442
|
print("full_response", full_response)
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
443
|
+
if function_parameter:
|
444
|
+
need_function_call = True
|
445
|
+
else:
|
446
|
+
need_function_call = False
|
447
|
+
if self.print_log:
|
448
|
+
print("Failed to parse function_parameter full_response", full_response)
|
449
|
+
full_response = ""
|
454
450
|
|
455
451
|
# 处理函数调用
|
456
|
-
if need_function_call and self.use_plugins
|
452
|
+
if need_function_call and self.use_plugins == True:
|
457
453
|
if self.print_log:
|
458
454
|
print("function_parameter", function_parameter)
|
459
455
|
print("function_full_response", function_full_response)
|
460
456
|
|
461
|
-
function_parameter = [tool_dict for tool_dict in function_parameter if tool_dict.get("function_name", "") in self.plugins.keys()]
|
462
|
-
|
463
|
-
if self.print_log:
|
464
|
-
print("function_parameter3", function_parameter)
|
465
|
-
|
466
457
|
function_response = ""
|
467
458
|
# 定义处理单个工具调用的辅助函数
|
468
459
|
async def process_single_tool_call(tool_name, tool_args, tool_id):
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|