acontext 0.0.4__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.
- acontext/resources/async_sessions.py +15 -0
- acontext/resources/sessions.py +15 -0
- acontext/types/__init__.py +2 -0
- acontext/types/session.py +6 -0
- {acontext-0.0.4.dist-info → acontext-0.0.5.dist-info}/METADATA +1 -1
- {acontext-0.0.4.dist-info → acontext-0.0.5.dist-info}/RECORD +7 -7
- {acontext-0.0.4.dist-info → acontext-0.0.5.dist-info}/WHEEL +1 -1
|
@@ -15,6 +15,7 @@ from ..types.session import (
|
|
|
15
15
|
ListSessionsOutput,
|
|
16
16
|
Message,
|
|
17
17
|
Session,
|
|
18
|
+
TokenCounts,
|
|
18
19
|
)
|
|
19
20
|
from ..uploads import FileUpload, normalize_file_upload
|
|
20
21
|
from pydantic import BaseModel
|
|
@@ -321,3 +322,17 @@ class AsyncSessionsAPI:
|
|
|
321
322
|
"GET", f"/session/{session_id}/get_learning_status"
|
|
322
323
|
)
|
|
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)
|
acontext/resources/sessions.py
CHANGED
|
@@ -15,6 +15,7 @@ from ..types.session import (
|
|
|
15
15
|
ListSessionsOutput,
|
|
16
16
|
Message,
|
|
17
17
|
Session,
|
|
18
|
+
TokenCounts,
|
|
18
19
|
)
|
|
19
20
|
from ..uploads import FileUpload, normalize_file_upload
|
|
20
21
|
from pydantic import BaseModel
|
|
@@ -321,3 +322,17 @@ class SessionsAPI:
|
|
|
321
322
|
"GET", f"/session/{session_id}/get_learning_status"
|
|
322
323
|
)
|
|
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)
|
acontext/types/__init__.py
CHANGED
|
@@ -20,6 +20,7 @@ from .session import (
|
|
|
20
20
|
PublicURL,
|
|
21
21
|
Session,
|
|
22
22
|
Task,
|
|
23
|
+
TokenCounts,
|
|
23
24
|
)
|
|
24
25
|
from .block import Block
|
|
25
26
|
from .space import (
|
|
@@ -55,6 +56,7 @@ __all__ = [
|
|
|
55
56
|
"PublicURL",
|
|
56
57
|
"Session",
|
|
57
58
|
"Task",
|
|
59
|
+
"TokenCounts",
|
|
58
60
|
# Space types
|
|
59
61
|
"ListSpacesOutput",
|
|
60
62
|
"SearchResultBlockItem",
|
acontext/types/session.py
CHANGED
|
@@ -133,3 +133,9 @@ class LearningStatus(BaseModel):
|
|
|
133
133
|
not_space_digested_count: int = Field(
|
|
134
134
|
..., description="Number of tasks that are not space digested"
|
|
135
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")
|
|
@@ -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=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=
|
|
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=
|
|
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=
|
|
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.
|
|
29
|
-
acontext-0.0.
|
|
30
|
-
acontext-0.0.
|
|
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,,
|