acontext 0.0.3__py3-none-any.whl → 0.0.5__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.
@@ -11,9 +11,11 @@ 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
+ TokenCounts,
17
19
  )
18
20
  from ..uploads import FileUpload, normalize_file_upload
19
21
  from pydantic import BaseModel
@@ -303,3 +305,34 @@ class AsyncSessionsAPI:
303
305
  """
304
306
  data = await self._requester.request("POST", f"/session/{session_id}/flush")
305
307
  return data # type: ignore
308
+
309
+ async def get_learning_status(self, session_id: str) -> LearningStatus:
310
+ """Get learning status for a session.
311
+
312
+ Returns the count of space digested tasks and not space digested tasks.
313
+ If the session is not connected to a space, returns 0 and 0.
314
+
315
+ Args:
316
+ session_id: The UUID of the session.
317
+
318
+ Returns:
319
+ LearningStatus object containing space_digested_count and not_space_digested_count.
320
+ """
321
+ data = await self._requester.request(
322
+ "GET", f"/session/{session_id}/get_learning_status"
323
+ )
324
+ return LearningStatus.model_validate(data)
325
+
326
+ async def get_token_counts(self, session_id: str) -> TokenCounts:
327
+ """Get total token counts for all text and tool-call parts in a session.
328
+
329
+ Args:
330
+ session_id: The UUID of the session.
331
+
332
+ Returns:
333
+ TokenCounts object containing total_tokens.
334
+ """
335
+ data = await self._requester.request(
336
+ "GET", f"/session/{session_id}/token_counts"
337
+ )
338
+ return TokenCounts.model_validate(data)
@@ -11,19 +11,21 @@ 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
+ TokenCounts,
17
19
  )
18
20
  from ..uploads import FileUpload, normalize_file_upload
19
21
  from pydantic import BaseModel
20
22
  from openai.types.chat import ChatCompletionMessageParam
21
- from anthropic.types import Message as AnthropicMessage
23
+ from anthropic.types import MessageParam
22
24
 
23
25
  UploadPayload = (
24
26
  FileUpload | tuple[str, BinaryIO | bytes] | tuple[str, BinaryIO | bytes, str | None]
25
27
  )
26
- MessageBlob = AcontextMessage | ChatCompletionMessageParam | AnthropicMessage
28
+ MessageBlob = AcontextMessage | ChatCompletionMessageParam | MessageParam
27
29
 
28
30
 
29
31
  class SessionsAPI:
@@ -303,3 +305,34 @@ class SessionsAPI:
303
305
  """
304
306
  data = self._requester.request("POST", f"/session/{session_id}/flush")
305
307
  return data # type: ignore
308
+
309
+ def get_learning_status(self, session_id: str) -> LearningStatus:
310
+ """Get learning status for a session.
311
+
312
+ Returns the count of space digested tasks and not space digested tasks.
313
+ If the session is not connected to a space, returns 0 and 0.
314
+
315
+ Args:
316
+ session_id: The UUID of the session.
317
+
318
+ Returns:
319
+ LearningStatus object containing space_digested_count and not_space_digested_count.
320
+ """
321
+ data = self._requester.request(
322
+ "GET", f"/session/{session_id}/get_learning_status"
323
+ )
324
+ return LearningStatus.model_validate(data)
325
+
326
+ def get_token_counts(self, session_id: str) -> TokenCounts:
327
+ """Get total token counts for all text and tool-call parts in a session.
328
+
329
+ Args:
330
+ session_id: The UUID of the session.
331
+
332
+ Returns:
333
+ TokenCounts object containing total_tokens.
334
+ """
335
+ data = self._requester.request(
336
+ "GET", f"/session/{session_id}/token_counts"
337
+ )
338
+ return TokenCounts.model_validate(data)
@@ -13,12 +13,14 @@ from .session import (
13
13
  Asset,
14
14
  GetMessagesOutput,
15
15
  GetTasksOutput,
16
+ LearningStatus,
16
17
  ListSessionsOutput,
17
18
  Message,
18
19
  Part,
19
20
  PublicURL,
20
21
  Session,
21
22
  Task,
23
+ TokenCounts,
22
24
  )
23
25
  from .block import Block
24
26
  from .space import (
@@ -47,12 +49,14 @@ __all__ = [
47
49
  "Asset",
48
50
  "GetMessagesOutput",
49
51
  "GetTasksOutput",
52
+ "LearningStatus",
50
53
  "ListSessionsOutput",
51
54
  "Message",
52
55
  "Part",
53
56
  "PublicURL",
54
57
  "Session",
55
58
  "Task",
59
+ "TokenCounts",
56
60
  # Space types
57
61
  "ListSpacesOutput",
58
62
  "SearchResultBlockItem",
acontext/types/session.py CHANGED
@@ -122,3 +122,20 @@ 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
+ )
136
+
137
+
138
+ class TokenCounts(BaseModel):
139
+ """Response model for token counts."""
140
+
141
+ total_tokens: int = Field(..., description="Total token count for all text and tool-call parts in a session")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: acontext
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: Python SDK for the Acontext API
5
5
  Keywords: acontext,sdk,client,api
6
6
  Requires-Dist: httpx>=0.28.1
@@ -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=ls_s9r4St-XPE9pB5nUOTYnqIWXN4MOdM0skvY9i-NI,10760
13
+ acontext/resources/async_sessions.py,sha256=b5oha4np1-RmNf2eRsnuJ2UJjdPyztExYQF-7_1pIAc,11894
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=gWrwQeBUEmI8yOK9-ByGGFff5SmEApH8JqZd9VHZlfg,10624
18
+ acontext/resources/sessions.py,sha256=9iVd_2ZCxwuUFIfdsp1lRSTHb9JoFTHFkhzT7065kwY,11715
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=tlxMx78rn7Bybcxv5KIhzAmWidUsriz0wF4TNEqaY5A,1202
21
+ acontext/types/__init__.py,sha256=B5ydKtwbiyoX6ZxtHzeLXF0FrYRuotM9U1ByTUlHzRI,1280
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=o4IEvRumgvQVnx4hpjXU16qzSXV30vOYrDwnKEP54XY,5152
24
+ acontext/types/session.py,sha256=OprkkCsEbDHrQ_Kpd6yv8lcyoCfV54IcTmNft-gAyPI,5656
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.3.dist-info/WHEEL,sha256=w4ZtLaDgMAZW2MMZZwtH8zENekoQYBCeullI-zsXJQk,78
29
- acontext-0.0.3.dist-info/METADATA,sha256=gvgo15nko-Yqxb4qfpcP4allp8xX6EA-bX48lE8R_90,11648
30
- acontext-0.0.3.dist-info/RECORD,,
28
+ acontext-0.0.5.dist-info/WHEEL,sha256=AaqHSNJgTyoT6I9ETCXrbV_7cVSjA_q07lkDGeNjGdQ,79
29
+ acontext-0.0.5.dist-info/METADATA,sha256=GkLxYWgnBJXR9uPOccdQIAlWlUfuIC_OP-9frA0i9D4,11648
30
+ acontext-0.0.5.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: uv 0.9.9
2
+ Generator: uv 0.9.12
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any