acontext 0.0.10__py3-none-any.whl → 0.0.12__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/agent/base.py +17 -0
- acontext/resources/async_sessions.py +25 -6
- acontext/resources/sessions.py +24 -6
- acontext/types/session.py +16 -0
- {acontext-0.0.10.dist-info → acontext-0.0.12.dist-info}/METADATA +1 -1
- {acontext-0.0.10.dist-info → acontext-0.0.12.dist-info}/RECORD +7 -7
- {acontext-0.0.10.dist-info → acontext-0.0.12.dist-info}/WHEEL +0 -0
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
|
|
@@ -15,6 +15,7 @@ from ..types.session import (
|
|
|
15
15
|
LearningStatus,
|
|
16
16
|
ListSessionsOutput,
|
|
17
17
|
Message,
|
|
18
|
+
MessageObservingStatus,
|
|
18
19
|
Session,
|
|
19
20
|
TokenCounts,
|
|
20
21
|
)
|
|
@@ -172,7 +173,7 @@ class AsyncSessionsAPI:
|
|
|
172
173
|
session_id: str,
|
|
173
174
|
*,
|
|
174
175
|
blob: MessageBlob,
|
|
175
|
-
format: Literal["acontext", "openai", "anthropic"] = "openai",
|
|
176
|
+
format: Literal["acontext", "openai", "anthropic", "gemini"] = "openai",
|
|
176
177
|
file_field: str | None = None,
|
|
177
178
|
file: (
|
|
178
179
|
FileUpload
|
|
@@ -185,7 +186,7 @@ class AsyncSessionsAPI:
|
|
|
185
186
|
|
|
186
187
|
Args:
|
|
187
188
|
session_id: The UUID of the session.
|
|
188
|
-
blob: The message blob in Acontext, OpenAI, or
|
|
189
|
+
blob: The message blob in Acontext, OpenAI, Anthropic, or Gemini format.
|
|
189
190
|
format: The format of the message blob. Defaults to "openai".
|
|
190
191
|
file_field: The field name for file upload. Only used when format is "acontext".
|
|
191
192
|
Required if file is provided. Defaults to None.
|
|
@@ -198,9 +199,9 @@ class AsyncSessionsAPI:
|
|
|
198
199
|
ValueError: If format is invalid, file/file_field provided for non-acontext format,
|
|
199
200
|
or file is provided without file_field for acontext format.
|
|
200
201
|
"""
|
|
201
|
-
if format not in {"acontext", "openai", "anthropic"}:
|
|
202
|
+
if format not in {"acontext", "openai", "anthropic", "gemini"}:
|
|
202
203
|
raise ValueError(
|
|
203
|
-
"format must be one of {'acontext', 'openai', 'anthropic'}"
|
|
204
|
+
"format must be one of {'acontext', 'openai', 'anthropic', 'gemini'}"
|
|
204
205
|
)
|
|
205
206
|
|
|
206
207
|
# File upload is only supported for acontext format
|
|
@@ -263,7 +264,7 @@ class AsyncSessionsAPI:
|
|
|
263
264
|
limit: int | None = None,
|
|
264
265
|
cursor: str | None = None,
|
|
265
266
|
with_asset_public_url: bool | None = None,
|
|
266
|
-
format: Literal["acontext", "openai", "anthropic"] = "openai",
|
|
267
|
+
format: Literal["acontext", "openai", "anthropic", "gemini"] = "openai",
|
|
267
268
|
time_desc: bool | None = None,
|
|
268
269
|
edit_strategies: Optional[List[EditStrategy]] = None,
|
|
269
270
|
) -> GetMessagesOutput:
|
|
@@ -274,7 +275,7 @@ class AsyncSessionsAPI:
|
|
|
274
275
|
limit: Maximum number of messages to return. Defaults to None.
|
|
275
276
|
cursor: Cursor for pagination. Defaults to None.
|
|
276
277
|
with_asset_public_url: Whether to include presigned URLs for assets. Defaults to None.
|
|
277
|
-
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".
|
|
278
279
|
time_desc: Order by created_at descending if True, ascending if False. Defaults to None.
|
|
279
280
|
edit_strategies: Optional list of edit strategies to apply before format conversion.
|
|
280
281
|
Each strategy is a dict with 'type' and 'params' keys.
|
|
@@ -346,3 +347,21 @@ class AsyncSessionsAPI:
|
|
|
346
347
|
"GET", f"/session/{session_id}/token_counts"
|
|
347
348
|
)
|
|
348
349
|
return TokenCounts.model_validate(data)
|
|
350
|
+
|
|
351
|
+
async def messages_observing_status(self, session_id: str) -> MessageObservingStatus:
|
|
352
|
+
"""Get message observing status counts for a session.
|
|
353
|
+
|
|
354
|
+
Returns the count of messages by their observing status:
|
|
355
|
+
observed, in_process, and pending.
|
|
356
|
+
|
|
357
|
+
Args:
|
|
358
|
+
session_id: The UUID of the session.
|
|
359
|
+
|
|
360
|
+
Returns:
|
|
361
|
+
MessageObservingStatus object containing observed, in_process,
|
|
362
|
+
pending counts and updated_at timestamp.
|
|
363
|
+
"""
|
|
364
|
+
data = await self._requester.request(
|
|
365
|
+
"GET", f"/session/{session_id}/observing_status"
|
|
366
|
+
)
|
|
367
|
+
return MessageObservingStatus.model_validate(data)
|
acontext/resources/sessions.py
CHANGED
|
@@ -15,6 +15,7 @@ from ..types.session import (
|
|
|
15
15
|
LearningStatus,
|
|
16
16
|
ListSessionsOutput,
|
|
17
17
|
Message,
|
|
18
|
+
MessageObservingStatus,
|
|
18
19
|
Session,
|
|
19
20
|
TokenCounts,
|
|
20
21
|
)
|
|
@@ -176,7 +177,7 @@ class SessionsAPI:
|
|
|
176
177
|
session_id: str,
|
|
177
178
|
*,
|
|
178
179
|
blob: MessageBlob,
|
|
179
|
-
format: Literal["acontext", "openai", "anthropic"] = "openai",
|
|
180
|
+
format: Literal["acontext", "openai", "anthropic", "gemini"] = "openai",
|
|
180
181
|
file_field: str | None = None,
|
|
181
182
|
file: (
|
|
182
183
|
FileUpload
|
|
@@ -189,7 +190,7 @@ class SessionsAPI:
|
|
|
189
190
|
|
|
190
191
|
Args:
|
|
191
192
|
session_id: The UUID of the session.
|
|
192
|
-
blob: The message blob in Acontext, OpenAI, or
|
|
193
|
+
blob: The message blob in Acontext, OpenAI, Anthropic, or Gemini format.
|
|
193
194
|
format: The format of the message blob. Defaults to "openai".
|
|
194
195
|
file_field: The field name for file upload. Only used when format is "acontext".
|
|
195
196
|
Required if file is provided. Defaults to None.
|
|
@@ -202,9 +203,9 @@ class SessionsAPI:
|
|
|
202
203
|
ValueError: If format is invalid, file/file_field provided for non-acontext format,
|
|
203
204
|
or file is provided without file_field for acontext format.
|
|
204
205
|
"""
|
|
205
|
-
if format not in {"acontext", "openai", "anthropic"}:
|
|
206
|
+
if format not in {"acontext", "openai", "anthropic", "gemini"}:
|
|
206
207
|
raise ValueError(
|
|
207
|
-
"format must be one of {'acontext', 'openai', 'anthropic'}"
|
|
208
|
+
"format must be one of {'acontext', 'openai', 'anthropic', 'gemini'}"
|
|
208
209
|
)
|
|
209
210
|
|
|
210
211
|
# File upload is only supported for acontext format
|
|
@@ -267,7 +268,7 @@ class SessionsAPI:
|
|
|
267
268
|
limit: int | None = None,
|
|
268
269
|
cursor: str | None = None,
|
|
269
270
|
with_asset_public_url: bool | None = None,
|
|
270
|
-
format: Literal["acontext", "openai", "anthropic"] = "openai",
|
|
271
|
+
format: Literal["acontext", "openai", "anthropic", "gemini"] = "openai",
|
|
271
272
|
time_desc: bool | None = None,
|
|
272
273
|
edit_strategies: Optional[List[EditStrategy]] = None,
|
|
273
274
|
) -> GetMessagesOutput:
|
|
@@ -278,7 +279,7 @@ class SessionsAPI:
|
|
|
278
279
|
limit: Maximum number of messages to return. Defaults to None.
|
|
279
280
|
cursor: Cursor for pagination. Defaults to None.
|
|
280
281
|
with_asset_public_url: Whether to include presigned URLs for assets. Defaults to None.
|
|
281
|
-
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".
|
|
282
283
|
time_desc: Order by created_at descending if True, ascending if False. Defaults to None.
|
|
283
284
|
edit_strategies: Optional list of edit strategies to apply before format conversion.
|
|
284
285
|
Each strategy is a dict with 'type' and 'params' keys.
|
|
@@ -348,3 +349,20 @@ class SessionsAPI:
|
|
|
348
349
|
"""
|
|
349
350
|
data = self._requester.request("GET", f"/session/{session_id}/token_counts")
|
|
350
351
|
return TokenCounts.model_validate(data)
|
|
352
|
+
def messages_observing_status(self, session_id: str) -> MessageObservingStatus:
|
|
353
|
+
"""Get message observing status counts for a session.
|
|
354
|
+
|
|
355
|
+
Returns the count of messages by their observing status:
|
|
356
|
+
observed, in_process, and pending.
|
|
357
|
+
|
|
358
|
+
Args:
|
|
359
|
+
session_id: The UUID of the session.
|
|
360
|
+
|
|
361
|
+
Returns:
|
|
362
|
+
MessageObservingStatus object containing observed, in_process,
|
|
363
|
+
pending counts and updated_at timestamp.
|
|
364
|
+
"""
|
|
365
|
+
data = self._requester.request(
|
|
366
|
+
"GET", f"/session/{session_id}/observing_status"
|
|
367
|
+
)
|
|
368
|
+
return MessageObservingStatus.model_validate(data)
|
acontext/types/session.py
CHANGED
|
@@ -253,3 +253,19 @@ class TokenCounts(BaseModel):
|
|
|
253
253
|
...,
|
|
254
254
|
description="Total token count for all text and tool-call parts in a session",
|
|
255
255
|
)
|
|
256
|
+
|
|
257
|
+
class MessageObservingStatus(BaseModel):
|
|
258
|
+
"""Response model for message observing status."""
|
|
259
|
+
|
|
260
|
+
observed: int = Field(
|
|
261
|
+
..., description="Number of messages with observed status"
|
|
262
|
+
)
|
|
263
|
+
in_process: int = Field(
|
|
264
|
+
..., description="Number of messages with in_process status"
|
|
265
|
+
)
|
|
266
|
+
pending: int = Field(
|
|
267
|
+
..., description="Number of messages with pending status"
|
|
268
|
+
)
|
|
269
|
+
updated_at: str = Field(
|
|
270
|
+
..., description="Timestamp when the status was retrieved"
|
|
271
|
+
)
|
|
@@ -2,7 +2,7 @@ acontext/__init__.py,sha256=jAgRawWIjyMd6g3gq7Xm_3vNB31cPj8rMFPO4LGQKdM,1027
|
|
|
2
2
|
acontext/_constants.py,sha256=-OxfFwn4UdkQiNkyWhBmpM7KnZv6SgR-gMPEkjLKtDA,362
|
|
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,21 +13,21 @@ 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
|
|
25
25
|
acontext/types/block.py,sha256=CzKByunk642rWXNNnh8cx67UzKLKDAxODmC_whwjP90,1078
|
|
26
26
|
acontext/types/disk.py,sha256=g9u3rgCh05rK-gay19NUi-WyzI5Vt1GQwcyKv-5TSC4,2361
|
|
27
|
-
acontext/types/session.py,sha256=
|
|
27
|
+
acontext/types/session.py,sha256=H_n4vZJ02ZO5flqGZ8R5AYVSScxScf2r7UgsN5LRIa0,9965
|
|
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.12.dist-info/WHEEL,sha256=ZyFSCYkV2BrxH6-HRVRg3R9Fo7MALzer9KiPYqNxSbo,79
|
|
32
|
+
acontext-0.0.12.dist-info/METADATA,sha256=05rhidnf8L4vxn5eZJeUWymZazwCI6FWr7fFzuFrqhs,859
|
|
33
|
+
acontext-0.0.12.dist-info/RECORD,,
|
|
File without changes
|