aient 1.1.65__py3-none-any.whl → 1.1.66__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 +21 -18
- {aient-1.1.65.dist-info → aient-1.1.66.dist-info}/METADATA +1 -1
- {aient-1.1.65.dist-info → aient-1.1.66.dist-info}/RECORD +6 -6
- {aient-1.1.65.dist-info → aient-1.1.66.dist-info}/WHEEL +0 -0
- {aient-1.1.65.dist-info → aient-1.1.66.dist-info}/licenses/LICENSE +0 -0
- {aient-1.1.65.dist-info → aient-1.1.66.dist-info}/top_level.txt +0 -0
aient/core/request.py
CHANGED
@@ -27,8 +27,6 @@ from .utils import (
|
|
27
27
|
gemini_max_token_65k_models = ["gemini-2.5-pro", "gemini-2.0-pro", "gemini-2.0-flash-thinking", "gemini-2.5-flash"]
|
28
28
|
|
29
29
|
async def get_gemini_payload(request, engine, provider, api_key=None):
|
30
|
-
import re
|
31
|
-
|
32
30
|
headers = {
|
33
31
|
'Content-Type': 'application/json'
|
34
32
|
}
|
@@ -176,6 +174,24 @@ async def get_gemini_payload(request, engine, provider, api_key=None):
|
|
176
174
|
]
|
177
175
|
generation_config = {}
|
178
176
|
|
177
|
+
def process_tool_parameters(data):
|
178
|
+
if isinstance(data, dict):
|
179
|
+
# 移除 Gemini 不支持的 'additionalProperties'
|
180
|
+
data.pop("additionalProperties", None)
|
181
|
+
|
182
|
+
# 将 'default' 值移入 'description'
|
183
|
+
if "default" in data:
|
184
|
+
default_value = data.pop("default")
|
185
|
+
description = data.get("description", "")
|
186
|
+
data["description"] = f"{description}\nDefault: {default_value}"
|
187
|
+
|
188
|
+
# 递归处理
|
189
|
+
for value in data.values():
|
190
|
+
process_tool_parameters(value)
|
191
|
+
elif isinstance(data, list):
|
192
|
+
for item in data:
|
193
|
+
process_tool_parameters(item)
|
194
|
+
|
179
195
|
for field, value in request.model_dump(exclude_unset=True).items():
|
180
196
|
if field not in miss_fields and value is not None:
|
181
197
|
if field == "tools" and "gemini-2.0-flash-thinking" in original_model:
|
@@ -185,22 +201,9 @@ async def get_gemini_payload(request, engine, provider, api_key=None):
|
|
185
201
|
processed_tools = []
|
186
202
|
for tool in value:
|
187
203
|
function_def = tool["function"]
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
# 处理 parameters.properties 中的 default 字段
|
193
|
-
if safe_get(function_def, "parameters", "properties", default=None):
|
194
|
-
for prop_value in function_def["parameters"]["properties"].values():
|
195
|
-
if "additionalProperties" in prop_value:
|
196
|
-
del prop_value["additionalProperties"]
|
197
|
-
if "default" in prop_value:
|
198
|
-
# 将 default 值添加到 description 中
|
199
|
-
default_value = prop_value["default"]
|
200
|
-
description = prop_value.get("description", "")
|
201
|
-
prop_value["description"] = f"{description}\nDefault: {default_value}"
|
202
|
-
# 删除 default 字段
|
203
|
-
del prop_value["default"]
|
204
|
+
if "parameters" in function_def:
|
205
|
+
process_tool_parameters(function_def["parameters"])
|
206
|
+
|
204
207
|
if function_def["name"] != "googleSearch" and function_def["name"] != "googleSearch":
|
205
208
|
processed_tools.append({"function": function_def})
|
206
209
|
|
@@ -2,7 +2,7 @@ aient/__init__.py,sha256=SRfF7oDVlOOAi6nGKiJIUK6B_arqYLO9iSMp-2IZZps,21
|
|
2
2
|
aient/core/__init__.py,sha256=NxjebTlku35S4Dzr16rdSqSTWUvvwEeACe8KvHJnjPg,34
|
3
3
|
aient/core/log_config.py,sha256=kz2_yJv1p-o3lUQOwA3qh-LSc3wMHv13iCQclw44W9c,274
|
4
4
|
aient/core/models.py,sha256=d4MISNezTSe0ls0-fjuToI2SoT-sk5fWqAJuKVinIlo,7502
|
5
|
-
aient/core/request.py,sha256=
|
5
|
+
aient/core/request.py,sha256=4FFCwQ7h7b6bqtrA8qw-DPJVXZTj2i1CkYccFeEwUPw,76552
|
6
6
|
aient/core/response.py,sha256=sPcNV9qLosj3lIXElezUZEjIyglspdkBg-EsIUhr9bQ,33203
|
7
7
|
aient/core/utils.py,sha256=D98d5Cy1h4ejKtuxS0EEDtL4YqpaZLB5tuXoVP0IBWQ,28462
|
8
8
|
aient/core/test/test_base_api.py,sha256=pWnycRJbuPSXKKU9AQjWrMAX1wiLC_014Qc9hh5C2Pw,524
|
@@ -30,8 +30,8 @@ aient/plugins/write_file.py,sha256=Jt8fOEwqhYiSWpCbwfAr1xoi_BmFnx3076GMhuL06uI,3
|
|
30
30
|
aient/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
31
31
|
aient/utils/prompt.py,sha256=UcSzKkFE4-h_1b6NofI6xgk3GoleqALRKY8VBaXLjmI,11311
|
32
32
|
aient/utils/scripts.py,sha256=VqtK4RFEx7KxkmcqG3lFDS1DxoNlFFGErEjopVcc8IE,40974
|
33
|
-
aient-1.1.
|
34
|
-
aient-1.1.
|
35
|
-
aient-1.1.
|
36
|
-
aient-1.1.
|
37
|
-
aient-1.1.
|
33
|
+
aient-1.1.66.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
|
34
|
+
aient-1.1.66.dist-info/METADATA,sha256=sAVJU71_BYtagFIvhB9RefiumnVUFPTA9vrhOba01R8,4842
|
35
|
+
aient-1.1.66.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
36
|
+
aient-1.1.66.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
|
37
|
+
aient-1.1.66.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|