acontext 0.0.2a1__py3-none-any.whl → 0.0.4__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/async_client.py +1 -1
- acontext/client.py +2 -2
- acontext/resources/async_sessions.py +19 -1
- acontext/resources/sessions.py +21 -3
- acontext/types/__init__.py +2 -0
- acontext/types/session.py +11 -0
- {acontext-0.0.2a1.dist-info → acontext-0.0.4.dist-info}/METADATA +1 -1
- {acontext-0.0.2a1.dist-info → acontext-0.0.4.dist-info}/RECORD +9 -9
- {acontext-0.0.2a1.dist-info → acontext-0.0.4.dist-info}/WHEEL +1 -1
acontext/async_client.py
CHANGED
|
@@ -26,7 +26,7 @@ class AcontextAsyncClient:
|
|
|
26
26
|
*,
|
|
27
27
|
api_key: str | None = None,
|
|
28
28
|
base_url: str | None = None,
|
|
29
|
-
timeout: float | httpx.Timeout | None =
|
|
29
|
+
timeout: float | httpx.Timeout | None = 32.0,
|
|
30
30
|
user_agent: str | None = None,
|
|
31
31
|
client: httpx.AsyncClient | None = None,
|
|
32
32
|
) -> None:
|
acontext/client.py
CHANGED
|
@@ -26,7 +26,7 @@ class AcontextClient:
|
|
|
26
26
|
*,
|
|
27
27
|
api_key: str | None = None,
|
|
28
28
|
base_url: str | None = None,
|
|
29
|
-
timeout: float | httpx.Timeout | None =
|
|
29
|
+
timeout: float | httpx.Timeout | None = 32.0,
|
|
30
30
|
user_agent: str | None = None,
|
|
31
31
|
client: httpx.Client | None = None,
|
|
32
32
|
) -> None:
|
|
@@ -36,7 +36,7 @@ class AcontextClient:
|
|
|
36
36
|
Args:
|
|
37
37
|
api_key: API key for authentication. Can also be set via ACONTEXT_API_KEY env var.
|
|
38
38
|
base_url: Base URL for the API. Defaults to DEFAULT_BASE_URL. Can also be set via ACONTEXT_BASE_URL env var.
|
|
39
|
-
timeout: Request timeout in seconds. Defaults to
|
|
39
|
+
timeout: Request timeout in seconds. Defaults to 32.0. Can also be set via ACONTEXT_TIMEOUT env var.
|
|
40
40
|
Can also be an httpx.Timeout object.
|
|
41
41
|
user_agent: Custom user agent string. Can also be set via ACONTEXT_USER_AGENT env var.
|
|
42
42
|
client: Optional httpx.Client instance to reuse. If provided, headers and base_url
|
|
@@ -11,6 +11,7 @@ from ..messages import AcontextMessage
|
|
|
11
11
|
from ..types.session import (
|
|
12
12
|
GetMessagesOutput,
|
|
13
13
|
GetTasksOutput,
|
|
14
|
+
LearningStatus,
|
|
14
15
|
ListSessionsOutput,
|
|
15
16
|
Message,
|
|
16
17
|
Session,
|
|
@@ -260,7 +261,7 @@ class AsyncSessionsAPI:
|
|
|
260
261
|
limit: int | None = None,
|
|
261
262
|
cursor: str | None = None,
|
|
262
263
|
with_asset_public_url: bool | None = None,
|
|
263
|
-
format: Literal["acontext", "openai", "anthropic"] = "
|
|
264
|
+
format: Literal["acontext", "openai", "anthropic"] = "openai",
|
|
264
265
|
time_desc: bool | None = None,
|
|
265
266
|
) -> GetMessagesOutput:
|
|
266
267
|
"""Get messages for a session.
|
|
@@ -303,3 +304,20 @@ class AsyncSessionsAPI:
|
|
|
303
304
|
"""
|
|
304
305
|
data = await self._requester.request("POST", f"/session/{session_id}/flush")
|
|
305
306
|
return data # type: ignore
|
|
307
|
+
|
|
308
|
+
async def get_learning_status(self, session_id: str) -> LearningStatus:
|
|
309
|
+
"""Get learning status for a session.
|
|
310
|
+
|
|
311
|
+
Returns the count of space digested tasks and not space digested tasks.
|
|
312
|
+
If the session is not connected to a space, returns 0 and 0.
|
|
313
|
+
|
|
314
|
+
Args:
|
|
315
|
+
session_id: The UUID of the session.
|
|
316
|
+
|
|
317
|
+
Returns:
|
|
318
|
+
LearningStatus object containing space_digested_count and not_space_digested_count.
|
|
319
|
+
"""
|
|
320
|
+
data = await self._requester.request(
|
|
321
|
+
"GET", f"/session/{session_id}/get_learning_status"
|
|
322
|
+
)
|
|
323
|
+
return LearningStatus.model_validate(data)
|
acontext/resources/sessions.py
CHANGED
|
@@ -11,6 +11,7 @@ from ..messages import AcontextMessage
|
|
|
11
11
|
from ..types.session import (
|
|
12
12
|
GetMessagesOutput,
|
|
13
13
|
GetTasksOutput,
|
|
14
|
+
LearningStatus,
|
|
14
15
|
ListSessionsOutput,
|
|
15
16
|
Message,
|
|
16
17
|
Session,
|
|
@@ -18,12 +19,12 @@ from ..types.session import (
|
|
|
18
19
|
from ..uploads import FileUpload, normalize_file_upload
|
|
19
20
|
from pydantic import BaseModel
|
|
20
21
|
from openai.types.chat import ChatCompletionMessageParam
|
|
21
|
-
from anthropic.types import
|
|
22
|
+
from anthropic.types import MessageParam
|
|
22
23
|
|
|
23
24
|
UploadPayload = (
|
|
24
25
|
FileUpload | tuple[str, BinaryIO | bytes] | tuple[str, BinaryIO | bytes, str | None]
|
|
25
26
|
)
|
|
26
|
-
MessageBlob = AcontextMessage | ChatCompletionMessageParam |
|
|
27
|
+
MessageBlob = AcontextMessage | ChatCompletionMessageParam | MessageParam
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
class SessionsAPI:
|
|
@@ -260,7 +261,7 @@ class SessionsAPI:
|
|
|
260
261
|
limit: int | None = None,
|
|
261
262
|
cursor: str | None = None,
|
|
262
263
|
with_asset_public_url: bool | None = None,
|
|
263
|
-
format: Literal["acontext", "openai", "anthropic"] = "
|
|
264
|
+
format: Literal["acontext", "openai", "anthropic"] = "openai",
|
|
264
265
|
time_desc: bool | None = None,
|
|
265
266
|
) -> GetMessagesOutput:
|
|
266
267
|
"""Get messages for a session.
|
|
@@ -303,3 +304,20 @@ class SessionsAPI:
|
|
|
303
304
|
"""
|
|
304
305
|
data = self._requester.request("POST", f"/session/{session_id}/flush")
|
|
305
306
|
return data # type: ignore
|
|
307
|
+
|
|
308
|
+
def get_learning_status(self, session_id: str) -> LearningStatus:
|
|
309
|
+
"""Get learning status for a session.
|
|
310
|
+
|
|
311
|
+
Returns the count of space digested tasks and not space digested tasks.
|
|
312
|
+
If the session is not connected to a space, returns 0 and 0.
|
|
313
|
+
|
|
314
|
+
Args:
|
|
315
|
+
session_id: The UUID of the session.
|
|
316
|
+
|
|
317
|
+
Returns:
|
|
318
|
+
LearningStatus object containing space_digested_count and not_space_digested_count.
|
|
319
|
+
"""
|
|
320
|
+
data = self._requester.request(
|
|
321
|
+
"GET", f"/session/{session_id}/get_learning_status"
|
|
322
|
+
)
|
|
323
|
+
return LearningStatus.model_validate(data)
|
acontext/types/__init__.py
CHANGED
|
@@ -13,6 +13,7 @@ from .session import (
|
|
|
13
13
|
Asset,
|
|
14
14
|
GetMessagesOutput,
|
|
15
15
|
GetTasksOutput,
|
|
16
|
+
LearningStatus,
|
|
16
17
|
ListSessionsOutput,
|
|
17
18
|
Message,
|
|
18
19
|
Part,
|
|
@@ -47,6 +48,7 @@ __all__ = [
|
|
|
47
48
|
"Asset",
|
|
48
49
|
"GetMessagesOutput",
|
|
49
50
|
"GetTasksOutput",
|
|
51
|
+
"LearningStatus",
|
|
50
52
|
"ListSessionsOutput",
|
|
51
53
|
"Message",
|
|
52
54
|
"Part",
|
acontext/types/session.py
CHANGED
|
@@ -122,3 +122,14 @@ class GetTasksOutput(BaseModel):
|
|
|
122
122
|
items: list[Task] = Field(..., description="List of tasks")
|
|
123
123
|
next_cursor: str | None = Field(None, description="Cursor for pagination")
|
|
124
124
|
has_more: bool = Field(..., description="Whether there are more items")
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
class LearningStatus(BaseModel):
|
|
128
|
+
"""Response model for learning status."""
|
|
129
|
+
|
|
130
|
+
space_digested_count: int = Field(
|
|
131
|
+
..., description="Number of tasks that are space digested"
|
|
132
|
+
)
|
|
133
|
+
not_space_digested_count: int = Field(
|
|
134
|
+
..., description="Number of tasks that are not space digested"
|
|
135
|
+
)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
acontext/__init__.py,sha256=CZzHIZ2VEtNQFj0MkH3eDx-A78fSCYsUklDvhYUsD2Y,965
|
|
2
2
|
acontext/_constants.py,sha256=-OxfFwn4UdkQiNkyWhBmpM7KnZv6SgR-gMPEkjLKtDA,362
|
|
3
3
|
acontext/_utils.py,sha256=GKQH45arKh0sDu64u-5jwrII_ctnU_oChYlgR5lRkfE,1250
|
|
4
|
-
acontext/async_client.py,sha256=
|
|
5
|
-
acontext/client.py,sha256
|
|
4
|
+
acontext/async_client.py,sha256=mfyR-WVy_LEOXjrkTcXLNaPDC5euaZ9zFI_5e1gapGs,8153
|
|
5
|
+
acontext/client.py,sha256=jFr5-Q8obdcZBamUNtY3fCklpOJiNiIKLzEApTmbnTg,7920
|
|
6
6
|
acontext/client_types.py,sha256=uVBWzLbZyXrqkljG49ojdQL_xX6N3n_HGt4Bs_TEE48,987
|
|
7
7
|
acontext/errors.py,sha256=W9i7_t46q9kbci3XAyZiyQhS154d4R9rSon3na-gjgs,1296
|
|
8
8
|
acontext/messages.py,sha256=L-fCnnZ9OIzK3zmumAhHhQ4YdBgoFdDXrb91yz5hGXk,2350
|
|
@@ -10,21 +10,21 @@ acontext/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
10
10
|
acontext/resources/__init__.py,sha256=KSVQ3YJ-wuU6OWGWJ47gDGbjjetP102aEsVSR8JUb_4,721
|
|
11
11
|
acontext/resources/async_blocks.py,sha256=e_iJpgcAdwS2tXQ16MMCnySlddp5JV3BadN_EyqZSF4,5555
|
|
12
12
|
acontext/resources/async_disks.py,sha256=2JjLpUkz5YZEkLt_jCts_khTG_b7lvf4cUMfoaJcnI8,6471
|
|
13
|
-
acontext/resources/async_sessions.py,sha256=
|
|
13
|
+
acontext/resources/async_sessions.py,sha256=B7GgGV5M2wH1t9wyJdvdsCxrBfXxBKCAd6V6IGHAS2Y,11414
|
|
14
14
|
acontext/resources/async_spaces.py,sha256=MnHJ6c8bqT2RgSsDeyYS8fgrvnMxZ3yOkd5d9hSHjPE,6414
|
|
15
15
|
acontext/resources/async_tools.py,sha256=RbGaF2kX65Mun-q-Fp5H1J8waWTLIdCOfbdY19jpn1o,1091
|
|
16
16
|
acontext/resources/blocks.py,sha256=HJdAy5HdyTcHCYCPmqNdvApYKZ6aWs-ORIi_wQt3TUM,5447
|
|
17
17
|
acontext/resources/disks.py,sha256=BjVhVXoujHWhg6L0TG9GmW9HLTTldJYEPxCbuppRkc4,6336
|
|
18
|
-
acontext/resources/sessions.py,sha256=
|
|
18
|
+
acontext/resources/sessions.py,sha256=0t2EREueidwSz0bXycmaysNmA4AT7EXKVGKr8C09X2w,11247
|
|
19
19
|
acontext/resources/spaces.py,sha256=ugmma1jY3k4i87MdgBSoCTP_Slxg895qeWtiKNM5SqQ,6273
|
|
20
20
|
acontext/resources/tools.py,sha256=II_185B0HYKSP43hizE6C1zs7kjkkPLKihuEG8s-DRY,1046
|
|
21
|
-
acontext/types/__init__.py,sha256=
|
|
21
|
+
acontext/types/__init__.py,sha256=vTSOk8ByG2qUJF9CRj73wYefQAxaFiqSKrMLClWb0hY,1244
|
|
22
22
|
acontext/types/block.py,sha256=CzKByunk642rWXNNnh8cx67UzKLKDAxODmC_whwjP90,1078
|
|
23
23
|
acontext/types/disk.py,sha256=g9u3rgCh05rK-gay19NUi-WyzI5Vt1GQwcyKv-5TSC4,2361
|
|
24
|
-
acontext/types/session.py,sha256=
|
|
24
|
+
acontext/types/session.py,sha256=_suqVE_bgaQ6vGX0sgTuICREPZwWKG8cRy6aXoEee-w,5466
|
|
25
25
|
acontext/types/space.py,sha256=lhik5PMG0CthQAqgfi9MSlsP1N_sD7ubBbgAldFtO7s,1589
|
|
26
26
|
acontext/types/tool.py,sha256=-mVn-vgk2SENK0Ubt-ZgWFZxKa-ddABqcAgXQ69YY-E,805
|
|
27
27
|
acontext/uploads.py,sha256=6twnqQOY_eerNuEjeSKsE_3S0IfJUiczXtAy4aXqDl8,1379
|
|
28
|
-
acontext-0.0.
|
|
29
|
-
acontext-0.0.
|
|
30
|
-
acontext-0.0.
|
|
28
|
+
acontext-0.0.4.dist-info/WHEEL,sha256=YUH1mBqsx8Dh2cQG2rlcuRYUhJddG9iClegy4IgnHik,79
|
|
29
|
+
acontext-0.0.4.dist-info/METADATA,sha256=gNQPNnyKjtZFInTRTl4eIraKn-cHHq_T0UOGI3G6Lqg,11648
|
|
30
|
+
acontext-0.0.4.dist-info/RECORD,,
|