sovant 1.3.1__py3-none-any.whl → 1.3.3__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.
sovant/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  from .client import Sovant, SovantError
2
2
  from .models import MemoryCreate, MemoryResult, SearchQuery
3
3
 
4
- __version__ = "1.3.1"
4
+ __version__ = "1.3.3"
sovant/client.py CHANGED
@@ -5,6 +5,9 @@ import httpx
5
5
  from typing import Any, Dict, Optional, Callable
6
6
  from .models import MemoryCreate, SearchQuery
7
7
 
8
+ # SDK version — used for X-Sovant-Client header
9
+ SDK_VERSION = "1.3.3"
10
+
8
11
  class SovantError(Exception):
9
12
  def __init__(self, message: str, code: str, status: int | None = None, details: Any | None = None):
10
13
  super().__init__(message)
@@ -38,7 +41,8 @@ class Sovant:
38
41
  timeout=self.timeout,
39
42
  headers={
40
43
  "authorization": f"Bearer {self.api_key}",
41
- "content-type": "application/json"
44
+ "content-type": "application/json",
45
+ "x-sovant-client": f"python-sdk/{SDK_VERSION}"
42
46
  }
43
47
  )
44
48
 
@@ -193,6 +197,61 @@ class Sovant:
193
197
  def memory_delete(self, id: str):
194
198
  return self._request("DELETE", f"{self.base_url}/api/v1/memories/{id}")
195
199
 
200
+ def memory_list(
201
+ self,
202
+ limit: int | None = None,
203
+ offset: int | None = None,
204
+ thread_id: str | None = None,
205
+ type: str | None = None,
206
+ tags: list[str] | None = None,
207
+ is_pinned: bool | None = None,
208
+ is_archived: bool | None = None,
209
+ sort_by: str | None = None,
210
+ sort_order: str | None = None,
211
+ ):
212
+ """
213
+ List memories with filtering and pagination
214
+
215
+ Returns memories ordered by sort criteria (default: created_at desc).
216
+ Use list() to fetch recent memories or filter by criteria.
217
+ Use memory_search() for semantic/vector-based queries.
218
+ Use memory_recall() for conversational AI queries.
219
+
220
+ Args:
221
+ limit: Maximum memories to return (default: 20, max: 100)
222
+ offset: Number of memories to skip for pagination (default: 0)
223
+ thread_id: Filter by thread ID
224
+ type: Filter by memory type ('journal', 'insight', 'observation', 'task', 'preference')
225
+ tags: Filter by tags (memories must have all specified tags)
226
+ is_pinned: Filter by pinned status
227
+ is_archived: Filter by archived status
228
+ sort_by: Sort field ('created_at', 'updated_at', 'importance', 'type')
229
+ sort_order: Sort direction ('asc' or 'desc')
230
+
231
+ Returns:
232
+ Dict with 'memories', 'total', 'limit', 'offset', 'has_more'
233
+ """
234
+ params = {}
235
+ if limit is not None:
236
+ params['limit'] = str(limit)
237
+ if offset is not None:
238
+ params['offset'] = str(offset)
239
+ if thread_id:
240
+ params['thread_id'] = thread_id
241
+ if type:
242
+ params['type'] = type
243
+ if tags:
244
+ params['tags'] = ','.join(tags)
245
+ if is_pinned is not None:
246
+ params['is_pinned'] = str(is_pinned).lower()
247
+ if is_archived is not None:
248
+ params['is_archived'] = str(is_archived).lower()
249
+ if sort_by:
250
+ params['sort_by'] = sort_by
251
+ if sort_order:
252
+ params['sort_order'] = sort_order
253
+ return self._request("GET", f"{self.base_url}/api/v1/memory", params=params)
254
+
196
255
  def memory_create_batch(self, memories: list[Dict[str, Any]]):
197
256
  """
198
257
  Batch create multiple memories in a single request
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sovant
3
- Version: 1.3.1
3
+ Version: 1.3.3
4
4
  Summary: Sovant Python SDK — governed AI memory layer for AI agents and applications
5
5
  Author: Sovant
6
6
  License-Expression: MIT
@@ -251,6 +251,42 @@ results = client.memory_create_batch([
251
251
  ])
252
252
  ```
253
253
 
254
+ #### List Memories
255
+
256
+ Fetch memories with filtering and pagination. Use `memory_list()` to retrieve recent memories or filter by criteria — it's more efficient than `memory_search()` when you don't need vector similarity.
257
+
258
+ ```python
259
+ # List recent memories
260
+ result = client.memory_list(limit=20, offset=0)
261
+ for mem in result["memories"]:
262
+ print(mem["content"])
263
+
264
+ # Filter by thread
265
+ thread_mems = client.memory_list(thread_id="thread-uuid", limit=50)
266
+
267
+ # Filter by type and tags
268
+ prefs = client.memory_list(
269
+ type="preference",
270
+ tags=["settings"],
271
+ sort_by="updated_at",
272
+ sort_order="desc",
273
+ )
274
+
275
+ # Pinned memories only
276
+ pinned = client.memory_list(is_pinned=True)
277
+ ```
278
+
279
+ **Available parameters:**
280
+ - `limit` — max results (default: 20, max: 100)
281
+ - `offset` — pagination offset
282
+ - `thread_id` — filter by thread
283
+ - `type` — filter by memory type
284
+ - `tags` — filter by tags (must have all)
285
+ - `is_pinned` — filter by pinned status
286
+ - `is_archived` — filter by archived status
287
+ - `sort_by` — `created_at`, `updated_at`, `importance`, or `type`
288
+ - `sort_order` — `asc` or `desc`
289
+
254
290
  ### Thread Management
255
291
 
256
292
  ```python
@@ -1,14 +1,14 @@
1
- sovant/__init__.py,sha256=t0XgMU44um_gJBNGkg8QnaEC1SXsIh56IF2TrdDgbuY,122
1
+ sovant/__init__.py,sha256=3gd4GM34YftQwmaHd5OojDa2WskrgGABzr78RvRK49s,122
2
2
  sovant/base_client.py,sha256=Vmn6OGywGwLbH5cEeflSjVOFwn5iX_YdfTdUq9pWWxA,8778
3
- sovant/client.py,sha256=8VnTPSli1QgRky9PqUb9OAKdbMPTfXlGoUkmAYsFfCw,11804
3
+ sovant/client.py,sha256=zl3rCfuOFxpvZIOmrwtwf4U-vjeKi7YbPF09kXrBuvs,14112
4
4
  sovant/exceptions.py,sha256=MQMSgk7ckXnAbe7hPPpbKOnRBHSPxuCY7WSjqfJAvd0,1557
5
5
  sovant/models.py,sha256=avDAITMptDDdDfNH_ed854Q7kF6z_1OzjwJ9Xeft_-8,979
6
6
  sovant/types.py,sha256=gnvdXksJt8LObti7nc6eHSBCB7Pz7SNpS5o_HRTq_kA,6098
7
7
  sovant/resources/__init__.py,sha256=cPFIM7h8duviDdeHudnVEAmv3F89RHQxdH5BCRWFteQ,193
8
8
  sovant/resources/memories.py,sha256=bKKE0uWqFkPa1OEvbK1LrdSD7v6N04RhJ_2VDoPPQBA,11379
9
9
  sovant/resources/threads.py,sha256=mN29xP0JODmZBKyfhpeqJyViUWNVMAx3TlYAW-1ruTs,12558
10
- sovant-1.3.1.dist-info/licenses/LICENSE,sha256=rnNP6-elrMIlQ9jf2aqnHZMyyQ_wvF3y1hTpVUusCWU,1062
11
- sovant-1.3.1.dist-info/METADATA,sha256=ej271WYl3oSvAlmWRCVIjr_ebFSkgzw4-C3NVCOm01k,9515
12
- sovant-1.3.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
13
- sovant-1.3.1.dist-info/top_level.txt,sha256=za6eVEsYd_ZQQs8vrmEWNcAR58r1wCDge_jA60e4CvQ,7
14
- sovant-1.3.1.dist-info/RECORD,,
10
+ sovant-1.3.3.dist-info/licenses/LICENSE,sha256=rnNP6-elrMIlQ9jf2aqnHZMyyQ_wvF3y1hTpVUusCWU,1062
11
+ sovant-1.3.3.dist-info/METADATA,sha256=s_57kPXW1hivUFm30aA81MurmKYoBJgkCPMqc8BcUqk,10604
12
+ sovant-1.3.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
13
+ sovant-1.3.3.dist-info/top_level.txt,sha256=za6eVEsYd_ZQQs8vrmEWNcAR58r1wCDge_jA60e4CvQ,7
14
+ sovant-1.3.3.dist-info/RECORD,,
File without changes