acontext 0.0.4__py3-none-any.whl → 0.0.6__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.
@@ -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)
@@ -8,6 +8,8 @@ from typing import Any, List
8
8
  from .._utils import build_params
9
9
  from ..client_types import AsyncRequesterProtocol
10
10
  from ..types.space import (
11
+ ExperienceConfirmation,
12
+ ListExperienceConfirmationsOutput,
11
13
  ListSpacesOutput,
12
14
  SearchResultBlockItem,
13
15
  Space,
@@ -186,3 +188,60 @@ class AsyncSpacesAPI:
186
188
  "GET", f"/space/{space_id}/semantic_grep", params=params or None
187
189
  )
188
190
  return [SearchResultBlockItem.model_validate(item) for item in data]
191
+
192
+ async def get_unconfirmed_experiences(
193
+ self,
194
+ space_id: str,
195
+ *,
196
+ limit: int | None = None,
197
+ cursor: str | None = None,
198
+ time_desc: bool | None = None,
199
+ ) -> ListExperienceConfirmationsOutput:
200
+ """Get all unconfirmed experiences in a space with cursor-based pagination.
201
+
202
+ Args:
203
+ space_id: The UUID of the space.
204
+ limit: Maximum number of confirmations to return (1-200, default 20).
205
+ cursor: Cursor for pagination. Use the cursor from the previous response to get the next page.
206
+ time_desc: Order by created_at descending if True, ascending if False (default False).
207
+
208
+ Returns:
209
+ ListExperienceConfirmationsOutput containing the list of experience confirmations and pagination information.
210
+ """
211
+ params = build_params(limit=limit, cursor=cursor, time_desc=time_desc)
212
+ data = await self._requester.request(
213
+ "GET",
214
+ f"/space/{space_id}/experience_confirmations",
215
+ params=params or None,
216
+ )
217
+ return ListExperienceConfirmationsOutput.model_validate(data)
218
+
219
+ async def confirm_experience(
220
+ self,
221
+ space_id: str,
222
+ experience_id: str,
223
+ *,
224
+ save: bool,
225
+ ) -> ExperienceConfirmation | None:
226
+ """Confirm an experience confirmation.
227
+
228
+ If save is False, delete the row. If save is True, get the data first,
229
+ then delete the row.
230
+
231
+ Args:
232
+ space_id: The UUID of the space.
233
+ experience_id: The UUID of the experience confirmation.
234
+ save: If True, get data before deleting. If False, just delete.
235
+
236
+ Returns:
237
+ ExperienceConfirmation object if save is True, None otherwise.
238
+ """
239
+ payload = {"save": save}
240
+ data = await self._requester.request(
241
+ "PATCH",
242
+ f"/space/{space_id}/experience_confirmations/{experience_id}",
243
+ json_data=payload,
244
+ )
245
+ if data is None:
246
+ return None
247
+ return ExperienceConfirmation.model_validate(data)
@@ -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)
@@ -8,6 +8,8 @@ from typing import Any, List
8
8
  from .._utils import build_params
9
9
  from ..client_types import RequesterProtocol
10
10
  from ..types.space import (
11
+ ExperienceConfirmation,
12
+ ListExperienceConfirmationsOutput,
11
13
  ListSpacesOutput,
12
14
  SearchResultBlockItem,
13
15
  Space,
@@ -184,3 +186,60 @@ class SpacesAPI:
184
186
  "GET", f"/space/{space_id}/semantic_grep", params=params or None
185
187
  )
186
188
  return [SearchResultBlockItem.model_validate(item) for item in data]
189
+
190
+ def get_unconfirmed_experiences(
191
+ self,
192
+ space_id: str,
193
+ *,
194
+ limit: int | None = None,
195
+ cursor: str | None = None,
196
+ time_desc: bool | None = None,
197
+ ) -> ListExperienceConfirmationsOutput:
198
+ """Get all unconfirmed experiences in a space with cursor-based pagination.
199
+
200
+ Args:
201
+ space_id: The UUID of the space.
202
+ limit: Maximum number of confirmations to return (1-200, default 20).
203
+ cursor: Cursor for pagination. Use the cursor from the previous response to get the next page.
204
+ time_desc: Order by created_at descending if True, ascending if False (default False).
205
+
206
+ Returns:
207
+ ListExperienceConfirmationsOutput containing the list of experience confirmations and pagination information.
208
+ """
209
+ params = build_params(limit=limit, cursor=cursor, time_desc=time_desc)
210
+ data = self._requester.request(
211
+ "GET",
212
+ f"/space/{space_id}/experience_confirmations",
213
+ params=params or None,
214
+ )
215
+ return ListExperienceConfirmationsOutput.model_validate(data)
216
+
217
+ def confirm_experience(
218
+ self,
219
+ space_id: str,
220
+ experience_id: str,
221
+ *,
222
+ save: bool,
223
+ ) -> ExperienceConfirmation | None:
224
+ """Confirm an experience confirmation.
225
+
226
+ If save is False, delete the row. If save is True, get the data first,
227
+ then delete the row.
228
+
229
+ Args:
230
+ space_id: The UUID of the space.
231
+ experience_id: The UUID of the experience confirmation.
232
+ save: If True, get data before deleting. If False, just delete.
233
+
234
+ Returns:
235
+ ExperienceConfirmation object if save is True, None otherwise.
236
+ """
237
+ payload = {"save": save}
238
+ data = self._requester.request(
239
+ "PATCH",
240
+ f"/space/{space_id}/experience_confirmations/{experience_id}",
241
+ json_data=payload,
242
+ )
243
+ if data is None:
244
+ return None
245
+ return ExperienceConfirmation.model_validate(data)
@@ -20,9 +20,12 @@ 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 (
27
+ ExperienceConfirmation,
28
+ ListExperienceConfirmationsOutput,
26
29
  ListSpacesOutput,
27
30
  SearchResultBlockItem,
28
31
  Space,
@@ -55,7 +58,10 @@ __all__ = [
55
58
  "PublicURL",
56
59
  "Session",
57
60
  "Task",
61
+ "TokenCounts",
58
62
  # Space types
63
+ "ExperienceConfirmation",
64
+ "ListExperienceConfirmationsOutput",
59
65
  "ListSpacesOutput",
60
66
  "SearchResultBlockItem",
61
67
  "Space",
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")
acontext/types/space.py CHANGED
@@ -44,3 +44,26 @@ class SpaceSearchResult(BaseModel):
44
44
  ..., description="List of cited blocks"
45
45
  )
46
46
  final_answer: str | None = Field(None, description="AI-generated final answer")
47
+
48
+
49
+ class ExperienceConfirmation(BaseModel):
50
+ """Experience confirmation model."""
51
+
52
+ id: str = Field(..., description="Experience confirmation UUID")
53
+ space_id: str = Field(..., description="Space UUID")
54
+ task_id: str | None = Field(None, description="Task UUID (optional)")
55
+ experience_data: dict[str, Any] = Field(
56
+ ..., description="Experience data dictionary"
57
+ )
58
+ created_at: str = Field(..., description="ISO 8601 formatted creation timestamp")
59
+ updated_at: str = Field(..., description="ISO 8601 formatted update timestamp")
60
+
61
+
62
+ class ListExperienceConfirmationsOutput(BaseModel):
63
+ """Response model for listing experience confirmations."""
64
+
65
+ items: list[ExperienceConfirmation] = Field(
66
+ ..., description="List of experience confirmations"
67
+ )
68
+ next_cursor: str | None = Field(None, description="Cursor for pagination")
69
+ has_more: bool = Field(..., description="Whether there are more items")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: acontext
3
- Version: 0.0.4
3
+ Version: 0.0.6
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=B7GgGV5M2wH1t9wyJdvdsCxrBfXxBKCAd6V6IGHAS2Y,11414
14
- acontext/resources/async_spaces.py,sha256=MnHJ6c8bqT2RgSsDeyYS8fgrvnMxZ3yOkd5d9hSHjPE,6414
13
+ acontext/resources/async_sessions.py,sha256=b5oha4np1-RmNf2eRsnuJ2UJjdPyztExYQF-7_1pIAc,11894
14
+ acontext/resources/async_spaces.py,sha256=GTQIDLA_rDWB6AVP__jLpV7kfw9og021DD5N67gZYEE,8587
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=0t2EREueidwSz0bXycmaysNmA4AT7EXKVGKr8C09X2w,11247
19
- acontext/resources/spaces.py,sha256=ugmma1jY3k4i87MdgBSoCTP_Slxg895qeWtiKNM5SqQ,6273
18
+ acontext/resources/sessions.py,sha256=9iVd_2ZCxwuUFIfdsp1lRSTHb9JoFTHFkhzT7065kwY,11715
19
+ acontext/resources/spaces.py,sha256=h9-nQ_snz5YFc-ooPYBfFk28i-C8DHmdFMjrddiKnAw,8422
20
20
  acontext/resources/tools.py,sha256=II_185B0HYKSP43hizE6C1zs7kjkkPLKihuEG8s-DRY,1046
21
- acontext/types/__init__.py,sha256=vTSOk8ByG2qUJF9CRj73wYefQAxaFiqSKrMLClWb0hY,1244
21
+ acontext/types/__init__.py,sha256=vrKXYUO8zZ4uIBFqRdnp-DRY0tzTDk7rNSUn0bdpTA8,1418
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=_suqVE_bgaQ6vGX0sgTuICREPZwWKG8cRy6aXoEee-w,5466
25
- acontext/types/space.py,sha256=lhik5PMG0CthQAqgfi9MSlsP1N_sD7ubBbgAldFtO7s,1589
24
+ acontext/types/session.py,sha256=OprkkCsEbDHrQ_Kpd6yv8lcyoCfV54IcTmNft-gAyPI,5656
25
+ acontext/types/space.py,sha256=uxbPrOHYpsntPHqhMCLQ2KovM7BngHC5Q2j7qexVrN8,2537
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.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,,
28
+ acontext-0.0.6.dist-info/WHEEL,sha256=3id4o64OvRm9dUknh3mMJNcfoTRK08ua5cU6DFyVy-4,79
29
+ acontext-0.0.6.dist-info/METADATA,sha256=2-rXug4Y_HWeXvvA-zUEnetakYXGqvddOrzGKpVY46I,11648
30
+ acontext-0.0.6.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: uv 0.9.11
2
+ Generator: uv 0.9.13
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any