aient 1.0.57__py3-none-any.whl → 1.0.59__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/models.py CHANGED
@@ -162,6 +162,7 @@ class AudioTranscriptionRequest(BaseRequest):
162
162
  response_format: Optional[str] = None
163
163
  temperature: Optional[float] = None
164
164
  stream: bool = False
165
+ timestamp_granularities: Optional[List[str]] = Field(default=["segment"])
165
166
 
166
167
  class Config:
167
168
  arbitrary_types_allowed = True
aient/core/request.py CHANGED
@@ -1273,6 +1273,10 @@ async def get_whisper_payload(request, engine, provider, api_key=None):
1273
1273
  if request.language:
1274
1274
  payload["language"] = request.language
1275
1275
 
1276
+ # https://platform.openai.com/docs/api-reference/audio/createTranscription
1277
+ if request.timestamp_granularities:
1278
+ payload["timestamp_granularities[]"] = request.timestamp_granularities
1279
+
1276
1280
  return url, headers, payload
1277
1281
 
1278
1282
  async def get_moderation_payload(request, engine, provider, api_key=None):
aient/core/response.py CHANGED
@@ -46,7 +46,10 @@ async def fetch_gemini_response_stream(client, url, headers, payload, model):
46
46
  line, buffer = buffer.split("\n", 1)
47
47
  # line_index += 1
48
48
 
49
+ # https://ai.google.dev/api/generate-content?hl=zh-cn#FinishReason
49
50
  if line and '\"finishReason\": \"' in line:
51
+ if "stop" not in line.lower():
52
+ logger.error(f"finishReason: {line}")
50
53
  is_finish = True
51
54
  if is_finish and '\"promptTokenCount\": ' in line:
52
55
  json_data = parse_json_safely( "{" + line + "}")
@@ -0,0 +1,51 @@
1
+ from .registry import register_tool
2
+
3
+ import os
4
+
5
+ @register_tool()
6
+ def write_to_file(path, content, mode='w'):
7
+ """
8
+ ## write_to_file
9
+ Description: Request to write full content to a file at the specified path. If the file exists, it will be overwritten with the provided content. If the file doesn't exist, it will be created. This tool will automatically create any directories needed to write the file.
10
+ Parameters:
11
+ - path: (required) The path of the file to write to (relative to the current working directory ${args.cwd})
12
+ - content: (required) The content to write to the file. ALWAYS provide the COMPLETE intended content of the file, without any truncation or omissions. You MUST include ALL parts of the file, even if they haven't been modified. Do NOT include the line numbers in the content though, just the actual content of the file.
13
+ - mode: (optional) The mode to write to the file. Default is 'w'. 'w' for write, 'a' for append.
14
+ Usage:
15
+ <write_to_file>
16
+ <path>File path here</path>
17
+ <content>
18
+ Your file content here
19
+ </content>
20
+ <mode>w</mode>
21
+ </write_to_file>
22
+
23
+ Example: Requesting to write to frontend-config.json
24
+ <write_to_file>
25
+ <path>frontend-config.json</path>
26
+ <content>
27
+ {
28
+ "apiEndpoint": "https://api.example.com",
29
+ "theme": {
30
+ "primaryColor": "#007bff",
31
+ "secondaryColor": "#6c757d",
32
+ "fontFamily": "Arial, sans-serif"
33
+ },
34
+ "features": {
35
+ "darkMode": true,
36
+ "notifications": true,
37
+ "analytics": false
38
+ },
39
+ "version": "1.0.0"
40
+ }
41
+ </content>
42
+ </write_to_file>
43
+ """
44
+ # 确保目录存在
45
+ os.makedirs(os.path.dirname(path) or '.', exist_ok=True)
46
+
47
+ # 写入文件
48
+ with open(path, mode, encoding='utf-8') as file:
49
+ file.write(content)
50
+
51
+ return f"文件已成功写入:{path}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aient
3
- Version: 1.0.57
3
+ Version: 1.0.59
4
4
  Summary: Aient: The Awakening of Agent.
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -2,9 +2,9 @@ aient/__init__.py,sha256=SRfF7oDVlOOAi6nGKiJIUK6B_arqYLO9iSMp-2IZZps,21
2
2
  aient/core/.git,sha256=lrAcW1SxzRBUcUiuKL5tS9ykDmmTXxyLP3YYU-Y-Q-I,45
3
3
  aient/core/__init__.py,sha256=NxjebTlku35S4Dzr16rdSqSTWUvvwEeACe8KvHJnjPg,34
4
4
  aient/core/log_config.py,sha256=kz2_yJv1p-o3lUQOwA3qh-LSc3wMHv13iCQclw44W9c,274
5
- aient/core/models.py,sha256=H3_XuWA7aS25MWZPK1c-5RBiiuxWJbTfE3RAk0Pkc9A,7504
6
- aient/core/request.py,sha256=c963OuUEBe7j1jxiiwipUyzGrbsCwXQIw_XGF_KdL-4,49491
7
- aient/core/response.py,sha256=iu_sWRWdy-Xs2CpEwhDXC_OLLnOc4sRwg28xZ2Qa69E,27772
5
+ aient/core/models.py,sha256=_1wYZg_n9kb2A3C8xCboyqleH2iHc9scwOvtx9DPeok,7582
6
+ aient/core/request.py,sha256=oavFyF5P0BL-85cse_lhyfP3UErFzeSdj6kTaSWzQrg,49690
7
+ aient/core/response.py,sha256=xuGpA_0_W3iz-hL3oCoMR0tXSTUlwk_1M1s7nyNZ87I,27968
8
8
  aient/core/utils.py,sha256=DFpFU8Y-8lzgQlhaDUnao8HmviGoh3-oN8jZR3Dha7E,26150
9
9
  aient/core/test/test_base_api.py,sha256=CjfFzMG26r8C4xCPoVkKb3Ac6pp9gy5NUCbZJHoSSsM,393
10
10
  aient/core/test/test_image.py,sha256=_T4peNGdXKBHHxyQNx12u-NTyFE8TlYI6NvvagsG2LE,319
@@ -29,13 +29,14 @@ aient/plugins/read_file.py,sha256=kjHqtAGSy6AV8kFpv342x6yWGYfvZ9LGmxFZXJ3XzQI,23
29
29
  aient/plugins/registry.py,sha256=YknzhieU_8nQ3oKlUSSWDB4X7t2Jx0JnqT2Jd9Xsvfk,3574
30
30
  aient/plugins/run_python.py,sha256=dgcUwBunMuDkaSKR5bToudVzSdrXVewktDDFUz_iIOQ,4589
31
31
  aient/plugins/websearch.py,sha256=yiBzqXK5X220ibR-zko3VDsn4QOnLu1k6E2YOygCeTQ,15185
32
+ aient/plugins/write_file.py,sha256=qYbNvcDTGs00pWYb0UOSYSeN4kw5_DMDxjaSlxtlAkU,1732
32
33
  aient/prompt/__init__.py,sha256=GBtn6-JDT8KHFCcuPpfSNE_aGddg5p4FEyMCy4BfwGs,20
33
34
  aient/prompt/agent.py,sha256=h39WOoafv0_lh2coBCiG9k-VWa3Yi9HRZV0hnvsc4gs,23598
34
35
  aient/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
36
  aient/utils/prompt.py,sha256=UcSzKkFE4-h_1b6NofI6xgk3GoleqALRKY8VBaXLjmI,11311
36
37
  aient/utils/scripts.py,sha256=n0jR5eXCBIK12W4bIx-xU1FVl1hZ4zDC7hq_BWQHYJU,27537
37
- aient-1.0.57.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
38
- aient-1.0.57.dist-info/METADATA,sha256=N_MGVOSo2bcpuO4S4S_5iaNgMCRf3G-wENZu1w97C0Q,4973
39
- aient-1.0.57.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
40
- aient-1.0.57.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
41
- aient-1.0.57.dist-info/RECORD,,
38
+ aient-1.0.59.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
39
+ aient-1.0.59.dist-info/METADATA,sha256=RV6ienIwh5Di8AZCGBEROc6-MMppQTfhJch7jkqYaDQ,4973
40
+ aient-1.0.59.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
41
+ aient-1.0.59.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
42
+ aient-1.0.59.dist-info/RECORD,,
File without changes