acontext 0.0.11__py3-none-any.whl → 0.0.13__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.
- acontext/_constants.py +1 -1
- acontext/agent/base.py +17 -0
- acontext/resources/async_sessions.py +6 -6
- acontext/resources/sessions.py +6 -6
- {acontext-0.0.11.dist-info → acontext-0.0.13.dist-info}/METADATA +1 -1
- {acontext-0.0.11.dist-info → acontext-0.0.13.dist-info}/RECORD +7 -7
- {acontext-0.0.11.dist-info → acontext-0.0.13.dist-info}/WHEEL +1 -1
acontext/_constants.py
CHANGED
acontext/agent/base.py
CHANGED
|
@@ -9,6 +9,9 @@ class BaseConverter:
|
|
|
9
9
|
def to_anthropic_tool_schema(self) -> dict:
|
|
10
10
|
raise NotImplementedError
|
|
11
11
|
|
|
12
|
+
def to_gemini_tool_schema(self) -> dict:
|
|
13
|
+
raise NotImplementedError
|
|
14
|
+
|
|
12
15
|
|
|
13
16
|
class BaseTool(BaseConverter):
|
|
14
17
|
@property
|
|
@@ -55,6 +58,17 @@ class BaseTool(BaseConverter):
|
|
|
55
58
|
},
|
|
56
59
|
}
|
|
57
60
|
|
|
61
|
+
def to_gemini_tool_schema(self) -> dict:
|
|
62
|
+
return {
|
|
63
|
+
"name": self.name,
|
|
64
|
+
"description": self.description,
|
|
65
|
+
"parameters": {
|
|
66
|
+
"type": "object",
|
|
67
|
+
"properties": self.arguments,
|
|
68
|
+
"required": self.required_arguments,
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
|
|
58
72
|
|
|
59
73
|
class BaseToolPool(BaseConverter):
|
|
60
74
|
def __init__(self):
|
|
@@ -85,5 +99,8 @@ class BaseToolPool(BaseConverter):
|
|
|
85
99
|
def to_anthropic_tool_schema(self) -> list[dict]:
|
|
86
100
|
return [tool.to_anthropic_tool_schema() for tool in self.tools.values()]
|
|
87
101
|
|
|
102
|
+
def to_gemini_tool_schema(self) -> list[dict]:
|
|
103
|
+
return [tool.to_gemini_tool_schema() for tool in self.tools.values()]
|
|
104
|
+
|
|
88
105
|
def format_context(self, *args, **kwargs) -> BaseContext:
|
|
89
106
|
raise NotImplementedError
|
|
@@ -173,7 +173,7 @@ class AsyncSessionsAPI:
|
|
|
173
173
|
session_id: str,
|
|
174
174
|
*,
|
|
175
175
|
blob: MessageBlob,
|
|
176
|
-
format: Literal["acontext", "openai", "anthropic"] = "openai",
|
|
176
|
+
format: Literal["acontext", "openai", "anthropic", "gemini"] = "openai",
|
|
177
177
|
file_field: str | None = None,
|
|
178
178
|
file: (
|
|
179
179
|
FileUpload
|
|
@@ -186,7 +186,7 @@ class AsyncSessionsAPI:
|
|
|
186
186
|
|
|
187
187
|
Args:
|
|
188
188
|
session_id: The UUID of the session.
|
|
189
|
-
blob: The message blob in Acontext, OpenAI, or
|
|
189
|
+
blob: The message blob in Acontext, OpenAI, Anthropic, or Gemini format.
|
|
190
190
|
format: The format of the message blob. Defaults to "openai".
|
|
191
191
|
file_field: The field name for file upload. Only used when format is "acontext".
|
|
192
192
|
Required if file is provided. Defaults to None.
|
|
@@ -199,9 +199,9 @@ class AsyncSessionsAPI:
|
|
|
199
199
|
ValueError: If format is invalid, file/file_field provided for non-acontext format,
|
|
200
200
|
or file is provided without file_field for acontext format.
|
|
201
201
|
"""
|
|
202
|
-
if format not in {"acontext", "openai", "anthropic"}:
|
|
202
|
+
if format not in {"acontext", "openai", "anthropic", "gemini"}:
|
|
203
203
|
raise ValueError(
|
|
204
|
-
"format must be one of {'acontext', 'openai', 'anthropic'}"
|
|
204
|
+
"format must be one of {'acontext', 'openai', 'anthropic', 'gemini'}"
|
|
205
205
|
)
|
|
206
206
|
|
|
207
207
|
# File upload is only supported for acontext format
|
|
@@ -264,7 +264,7 @@ class AsyncSessionsAPI:
|
|
|
264
264
|
limit: int | None = None,
|
|
265
265
|
cursor: str | None = None,
|
|
266
266
|
with_asset_public_url: bool | None = None,
|
|
267
|
-
format: Literal["acontext", "openai", "anthropic"] = "openai",
|
|
267
|
+
format: Literal["acontext", "openai", "anthropic", "gemini"] = "openai",
|
|
268
268
|
time_desc: bool | None = None,
|
|
269
269
|
edit_strategies: Optional[List[EditStrategy]] = None,
|
|
270
270
|
) -> GetMessagesOutput:
|
|
@@ -275,7 +275,7 @@ class AsyncSessionsAPI:
|
|
|
275
275
|
limit: Maximum number of messages to return. Defaults to None.
|
|
276
276
|
cursor: Cursor for pagination. Defaults to None.
|
|
277
277
|
with_asset_public_url: Whether to include presigned URLs for assets. Defaults to None.
|
|
278
|
-
format: The format of the messages. Defaults to "openai".
|
|
278
|
+
format: The format of the messages. Defaults to "openai". Supports "acontext", "openai", "anthropic", or "gemini".
|
|
279
279
|
time_desc: Order by created_at descending if True, ascending if False. Defaults to None.
|
|
280
280
|
edit_strategies: Optional list of edit strategies to apply before format conversion.
|
|
281
281
|
Each strategy is a dict with 'type' and 'params' keys.
|
acontext/resources/sessions.py
CHANGED
|
@@ -177,7 +177,7 @@ class SessionsAPI:
|
|
|
177
177
|
session_id: str,
|
|
178
178
|
*,
|
|
179
179
|
blob: MessageBlob,
|
|
180
|
-
format: Literal["acontext", "openai", "anthropic"] = "openai",
|
|
180
|
+
format: Literal["acontext", "openai", "anthropic", "gemini"] = "openai",
|
|
181
181
|
file_field: str | None = None,
|
|
182
182
|
file: (
|
|
183
183
|
FileUpload
|
|
@@ -190,7 +190,7 @@ class SessionsAPI:
|
|
|
190
190
|
|
|
191
191
|
Args:
|
|
192
192
|
session_id: The UUID of the session.
|
|
193
|
-
blob: The message blob in Acontext, OpenAI, or
|
|
193
|
+
blob: The message blob in Acontext, OpenAI, Anthropic, or Gemini format.
|
|
194
194
|
format: The format of the message blob. Defaults to "openai".
|
|
195
195
|
file_field: The field name for file upload. Only used when format is "acontext".
|
|
196
196
|
Required if file is provided. Defaults to None.
|
|
@@ -203,9 +203,9 @@ class SessionsAPI:
|
|
|
203
203
|
ValueError: If format is invalid, file/file_field provided for non-acontext format,
|
|
204
204
|
or file is provided without file_field for acontext format.
|
|
205
205
|
"""
|
|
206
|
-
if format not in {"acontext", "openai", "anthropic"}:
|
|
206
|
+
if format not in {"acontext", "openai", "anthropic", "gemini"}:
|
|
207
207
|
raise ValueError(
|
|
208
|
-
"format must be one of {'acontext', 'openai', 'anthropic'}"
|
|
208
|
+
"format must be one of {'acontext', 'openai', 'anthropic', 'gemini'}"
|
|
209
209
|
)
|
|
210
210
|
|
|
211
211
|
# File upload is only supported for acontext format
|
|
@@ -268,7 +268,7 @@ class SessionsAPI:
|
|
|
268
268
|
limit: int | None = None,
|
|
269
269
|
cursor: str | None = None,
|
|
270
270
|
with_asset_public_url: bool | None = None,
|
|
271
|
-
format: Literal["acontext", "openai", "anthropic"] = "openai",
|
|
271
|
+
format: Literal["acontext", "openai", "anthropic", "gemini"] = "openai",
|
|
272
272
|
time_desc: bool | None = None,
|
|
273
273
|
edit_strategies: Optional[List[EditStrategy]] = None,
|
|
274
274
|
) -> GetMessagesOutput:
|
|
@@ -279,7 +279,7 @@ class SessionsAPI:
|
|
|
279
279
|
limit: Maximum number of messages to return. Defaults to None.
|
|
280
280
|
cursor: Cursor for pagination. Defaults to None.
|
|
281
281
|
with_asset_public_url: Whether to include presigned URLs for assets. Defaults to None.
|
|
282
|
-
format: The format of the messages. Defaults to "openai".
|
|
282
|
+
format: The format of the messages. Defaults to "openai". Supports "acontext", "openai", "anthropic", or "gemini".
|
|
283
283
|
time_desc: Order by created_at descending if True, ascending if False. Defaults to None.
|
|
284
284
|
edit_strategies: Optional list of edit strategies to apply before format conversion.
|
|
285
285
|
Each strategy is a dict with 'type' and 'params' keys.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
acontext/__init__.py,sha256=jAgRawWIjyMd6g3gq7Xm_3vNB31cPj8rMFPO4LGQKdM,1027
|
|
2
|
-
acontext/_constants.py,sha256
|
|
2
|
+
acontext/_constants.py,sha256=Ikuy_Wz3CPmXjKPLXb4Y580-fe54o1hZ2ZB1Bpw3sFE,363
|
|
3
3
|
acontext/_utils.py,sha256=GKQH45arKh0sDu64u-5jwrII_ctnU_oChYlgR5lRkfE,1250
|
|
4
4
|
acontext/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
acontext/agent/base.py,sha256=
|
|
5
|
+
acontext/agent/base.py,sha256=kN2KzV6fOlvmMSi_0yu2QqwVLtHh09TznAy_SDtC8iM,2998
|
|
6
6
|
acontext/agent/disk.py,sha256=tYSvdWKjJ6KIvAk3UzJaQABB4rOL7GAMvEVmI715-hw,10566
|
|
7
7
|
acontext/async_client.py,sha256=mfyR-WVy_LEOXjrkTcXLNaPDC5euaZ9zFI_5e1gapGs,8153
|
|
8
8
|
acontext/client.py,sha256=jFr5-Q8obdcZBamUNtY3fCklpOJiNiIKLzEApTmbnTg,7920
|
|
@@ -13,12 +13,12 @@ acontext/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
13
13
|
acontext/resources/__init__.py,sha256=KSVQ3YJ-wuU6OWGWJ47gDGbjjetP102aEsVSR8JUb_4,721
|
|
14
14
|
acontext/resources/async_blocks.py,sha256=e_iJpgcAdwS2tXQ16MMCnySlddp5JV3BadN_EyqZSF4,5555
|
|
15
15
|
acontext/resources/async_disks.py,sha256=2JjLpUkz5YZEkLt_jCts_khTG_b7lvf4cUMfoaJcnI8,6471
|
|
16
|
-
acontext/resources/async_sessions.py,sha256=
|
|
16
|
+
acontext/resources/async_sessions.py,sha256=660qEvz9aG_Nn3XiKKj9AbWizMstHhUsQN2m3W8ZGJ4,13357
|
|
17
17
|
acontext/resources/async_spaces.py,sha256=5lIZjI8GmgoMBcftAMD2vDj2FmbLZ6pi1-yNCWKv4cM,6408
|
|
18
18
|
acontext/resources/async_tools.py,sha256=RbGaF2kX65Mun-q-Fp5H1J8waWTLIdCOfbdY19jpn1o,1091
|
|
19
19
|
acontext/resources/blocks.py,sha256=HJdAy5HdyTcHCYCPmqNdvApYKZ6aWs-ORIi_wQt3TUM,5447
|
|
20
20
|
acontext/resources/disks.py,sha256=BjVhVXoujHWhg6L0TG9GmW9HLTTldJYEPxCbuppRkc4,6336
|
|
21
|
-
acontext/resources/sessions.py,sha256=
|
|
21
|
+
acontext/resources/sessions.py,sha256=9qfEMVmiJGmhAqKYQ89yYa14SDZ-dyol1-rPXU3wSI0,13441
|
|
22
22
|
acontext/resources/spaces.py,sha256=LJP9krygZGdktMDtYGudCpk7yBxe_4v34QLk3SdejwQ,6267
|
|
23
23
|
acontext/resources/tools.py,sha256=II_185B0HYKSP43hizE6C1zs7kjkkPLKihuEG8s-DRY,1046
|
|
24
24
|
acontext/types/__init__.py,sha256=QWNLmdSnLE2b5XRXxnI2OKnHVdKQPJH0nJvvOYwhB1o,1448
|
|
@@ -28,6 +28,6 @@ acontext/types/session.py,sha256=H_n4vZJ02ZO5flqGZ8R5AYVSScxScf2r7UgsN5LRIa0,996
|
|
|
28
28
|
acontext/types/space.py,sha256=uxbPrOHYpsntPHqhMCLQ2KovM7BngHC5Q2j7qexVrN8,2537
|
|
29
29
|
acontext/types/tool.py,sha256=-mVn-vgk2SENK0Ubt-ZgWFZxKa-ddABqcAgXQ69YY-E,805
|
|
30
30
|
acontext/uploads.py,sha256=6twnqQOY_eerNuEjeSKsE_3S0IfJUiczXtAy4aXqDl8,1379
|
|
31
|
-
acontext-0.0.
|
|
32
|
-
acontext-0.0.
|
|
33
|
-
acontext-0.0.
|
|
31
|
+
acontext-0.0.13.dist-info/WHEEL,sha256=RRVLqVugUmFOqBedBFAmA4bsgFcROUBiSUKlERi0Hcg,79
|
|
32
|
+
acontext-0.0.13.dist-info/METADATA,sha256=xB8jBuzFtOiOMcXpOTvFgb-pvVPx7nwxtdd8cXhaMaE,859
|
|
33
|
+
acontext-0.0.13.dist-info/RECORD,,
|