acontext 0.0.9__tar.gz → 0.0.11__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.
- acontext-0.0.11/PKG-INFO +34 -0
- acontext-0.0.11/README.md +19 -0
- {acontext-0.0.9 → acontext-0.0.11}/pyproject.toml +1 -1
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/resources/async_sessions.py +21 -2
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/resources/sessions.py +20 -2
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/types/session.py +49 -1
- acontext-0.0.9/PKG-INFO +0 -661
- acontext-0.0.9/README.md +0 -646
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/__init__.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/_constants.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/_utils.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/agent/__init__.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/agent/base.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/agent/disk.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/async_client.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/client.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/client_types.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/errors.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/messages.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/py.typed +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/resources/__init__.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/resources/async_blocks.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/resources/async_disks.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/resources/async_spaces.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/resources/async_tools.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/resources/blocks.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/resources/disks.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/resources/spaces.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/resources/tools.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/types/__init__.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/types/block.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/types/disk.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/types/space.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/types/tool.py +0 -0
- {acontext-0.0.9 → acontext-0.0.11}/src/acontext/uploads.py +0 -0
acontext-0.0.11/PKG-INFO
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: acontext
|
|
3
|
+
Version: 0.0.11
|
|
4
|
+
Summary: Python SDK for the Acontext API
|
|
5
|
+
Keywords: acontext,sdk,client,api
|
|
6
|
+
Requires-Dist: httpx>=0.28.1
|
|
7
|
+
Requires-Dist: openai>=2.6.1
|
|
8
|
+
Requires-Dist: anthropic>=0.72.0
|
|
9
|
+
Requires-Dist: pydantic>=2.12.3
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Project-URL: Homepage, https://github.com/memodb-io/Acontext
|
|
12
|
+
Project-URL: Issues, https://github.com/memodb-io/Acontext/issues
|
|
13
|
+
Project-URL: Repository, https://github.com/memodb-io/Acontext
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
## acontext client for python
|
|
17
|
+
|
|
18
|
+
Python SDK for interacting with the Acontext REST API.
|
|
19
|
+
|
|
20
|
+
### Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install acontext
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
> Requires Python 3.10 or newer.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# 🔍 Document
|
|
33
|
+
|
|
34
|
+
To understand more about this SDK, please view [our docs](https://docs.acontext.io/) and [api references](https://docs.acontext.io/api-reference/introduction)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
## acontext client for python
|
|
2
|
+
|
|
3
|
+
Python SDK for interacting with the Acontext REST API.
|
|
4
|
+
|
|
5
|
+
### Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install acontext
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
> Requires Python 3.10 or newer.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# 🔍 Document
|
|
18
|
+
|
|
19
|
+
To understand more about this SDK, please view [our docs](https://docs.acontext.io/) and [api references](https://docs.acontext.io/api-reference/introduction)
|
|
@@ -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
|
)
|
|
@@ -167,7 +168,7 @@ class AsyncSessionsAPI:
|
|
|
167
168
|
)
|
|
168
169
|
return GetTasksOutput.model_validate(data)
|
|
169
170
|
|
|
170
|
-
async def
|
|
171
|
+
async def store_message(
|
|
171
172
|
self,
|
|
172
173
|
session_id: str,
|
|
173
174
|
*,
|
|
@@ -181,7 +182,7 @@ class AsyncSessionsAPI:
|
|
|
181
182
|
| None
|
|
182
183
|
) = None,
|
|
183
184
|
) -> Message:
|
|
184
|
-
"""
|
|
185
|
+
"""Store a message to a session.
|
|
185
186
|
|
|
186
187
|
Args:
|
|
187
188
|
session_id: The UUID of the session.
|
|
@@ -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)
|
|
@@ -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
|
)
|
|
@@ -171,7 +172,7 @@ class SessionsAPI:
|
|
|
171
172
|
)
|
|
172
173
|
return GetTasksOutput.model_validate(data)
|
|
173
174
|
|
|
174
|
-
def
|
|
175
|
+
def store_message(
|
|
175
176
|
self,
|
|
176
177
|
session_id: str,
|
|
177
178
|
*,
|
|
@@ -185,7 +186,7 @@ class SessionsAPI:
|
|
|
185
186
|
| None
|
|
186
187
|
) = None,
|
|
187
188
|
) -> Message:
|
|
188
|
-
"""
|
|
189
|
+
"""Store a message to a session.
|
|
189
190
|
|
|
190
191
|
Args:
|
|
191
192
|
session_id: The UUID of the session.
|
|
@@ -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)
|
|
@@ -30,6 +30,34 @@ class RemoveToolResultStrategy(TypedDict):
|
|
|
30
30
|
params: RemoveToolResultParams
|
|
31
31
|
|
|
32
32
|
|
|
33
|
+
class RemoveToolCallParamsParams(TypedDict, total=False):
|
|
34
|
+
"""Parameters for the remove_tool_call_params edit strategy.
|
|
35
|
+
|
|
36
|
+
Attributes:
|
|
37
|
+
keep_recent_n_tool_calls: Number of most recent tool calls to keep with full parameters.
|
|
38
|
+
Defaults to 3 if not specified.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
keep_recent_n_tool_calls: NotRequired[int]
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class RemoveToolCallParamsStrategy(TypedDict):
|
|
46
|
+
"""Edit strategy to remove parameters from old tool-call parts.
|
|
47
|
+
|
|
48
|
+
Keeps the most recent N tool calls with full parameters, replacing older
|
|
49
|
+
tool call arguments with empty JSON "{}". The tool call ID and name remain
|
|
50
|
+
intact so tool-results can still reference them.
|
|
51
|
+
|
|
52
|
+
Example:
|
|
53
|
+
{"type": "remove_tool_call_params", "params": {"keep_recent_n_tool_calls": 5}}
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
type: Literal["remove_tool_call_params"]
|
|
57
|
+
params: RemoveToolCallParamsParams
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
33
61
|
class TokenLimitParams(TypedDict):
|
|
34
62
|
"""Parameters for the token_limit edit strategy.
|
|
35
63
|
|
|
@@ -59,7 +87,7 @@ class TokenLimitStrategy(TypedDict):
|
|
|
59
87
|
|
|
60
88
|
# Union type for all edit strategies
|
|
61
89
|
# When adding new strategies, add them to this Union: EditStrategy = Union[RemoveToolResultStrategy, OtherStrategy, ...]
|
|
62
|
-
EditStrategy = Union[RemoveToolResultStrategy, TokenLimitStrategy]
|
|
90
|
+
EditStrategy = Union[RemoveToolResultStrategy, RemoveToolCallParamsStrategy, TokenLimitStrategy]
|
|
63
91
|
|
|
64
92
|
|
|
65
93
|
class Asset(BaseModel):
|
|
@@ -187,6 +215,10 @@ class GetMessagesOutput(BaseModel):
|
|
|
187
215
|
...,
|
|
188
216
|
description="List of messages in the requested format (Message, OpenAI format, or Anthropic format)",
|
|
189
217
|
)
|
|
218
|
+
ids: list[str] = Field(
|
|
219
|
+
...,
|
|
220
|
+
description="List of message UUIDs corresponding to each item in the same order",
|
|
221
|
+
)
|
|
190
222
|
next_cursor: str | None = Field(None, description="Cursor for pagination")
|
|
191
223
|
has_more: bool = Field(..., description="Whether there are more items")
|
|
192
224
|
public_urls: dict[str, PublicURL] | None = Field(
|
|
@@ -221,3 +253,19 @@ class TokenCounts(BaseModel):
|
|
|
221
253
|
...,
|
|
222
254
|
description="Total token count for all text and tool-call parts in a session",
|
|
223
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
|
+
)
|