usecortex-ai 0.2.1__py3-none-any.whl → 0.3.0__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.
- usecortex_ai/__init__.py +18 -3
- usecortex_ai/client.py +3 -0
- usecortex_ai/document/__init__.py +4 -0
- usecortex_ai/document/client.py +139 -0
- usecortex_ai/document/raw_client.py +312 -0
- usecortex_ai/embeddings/client.py +48 -78
- usecortex_ai/embeddings/raw_client.py +44 -74
- usecortex_ai/fetch/client.py +2 -2
- usecortex_ai/search/client.py +88 -84
- usecortex_ai/search/raw_client.py +82 -78
- usecortex_ai/sources/client.py +26 -157
- usecortex_ai/sources/raw_client.py +22 -501
- usecortex_ai/tenant/client.py +154 -6
- usecortex_ai/tenant/raw_client.py +502 -4
- usecortex_ai/types/__init__.py +16 -2
- usecortex_ai/types/add_user_memory_response.py +36 -0
- usecortex_ai/types/app_sources_upload_data.py +10 -2
- usecortex_ai/types/attachment_model.py +34 -7
- usecortex_ai/types/batch_upload_data.py +10 -2
- usecortex_ai/types/body_scrape_webpage_upload_scrape_webpage_post.py +0 -2
- usecortex_ai/types/body_update_scrape_job_upload_update_webpage_patch.py +0 -2
- usecortex_ai/types/content_model.py +33 -6
- usecortex_ai/types/delete_memory_request.py +14 -3
- usecortex_ai/types/delete_sources.py +20 -0
- usecortex_ai/types/delete_sub_tenant_data.py +42 -0
- usecortex_ai/types/delete_user_memory_response.py +31 -0
- usecortex_ai/types/embeddings_create_collection_data.py +19 -4
- usecortex_ai/types/embeddings_delete_data.py +19 -4
- usecortex_ai/types/embeddings_get_data.py +19 -4
- usecortex_ai/types/embeddings_search_data.py +19 -4
- usecortex_ai/types/error_response.py +0 -1
- usecortex_ai/types/fetch_content_data.py +19 -5
- usecortex_ai/types/file_upload_result.py +9 -2
- usecortex_ai/types/generate_user_memory_response.py +32 -0
- usecortex_ai/types/list_sources_response.py +14 -3
- usecortex_ai/types/list_user_memories_response.py +32 -0
- usecortex_ai/types/markdown_upload_request.py +23 -5
- usecortex_ai/types/processing_status.py +14 -3
- usecortex_ai/types/relations.py +9 -2
- usecortex_ai/types/retrieve_user_memory_response.py +32 -0
- usecortex_ai/types/search_chunk.py +54 -17
- usecortex_ai/types/single_upload_data.py +10 -2
- usecortex_ai/types/source.py +34 -15
- usecortex_ai/types/source_model.py +63 -14
- usecortex_ai/types/sub_tenant_ids_data.py +29 -5
- usecortex_ai/types/tenant_create_data.py +19 -4
- usecortex_ai/types/tenant_stats.py +24 -5
- usecortex_ai/types/user_memory.py +31 -0
- usecortex_ai/upload/client.py +486 -111
- usecortex_ai/upload/raw_client.py +458 -103
- usecortex_ai/user/client.py +30 -10
- usecortex_ai/user/raw_client.py +22 -6
- usecortex_ai/user_memory/client.py +200 -56
- usecortex_ai/user_memory/raw_client.py +921 -94
- {usecortex_ai-0.2.1.dist-info → usecortex_ai-0.3.0.dist-info}/METADATA +1 -1
- usecortex_ai-0.3.0.dist-info/RECORD +101 -0
- usecortex_ai/types/source_content.py +0 -26
- usecortex_ai-0.2.1.dist-info/RECORD +0 -91
- {usecortex_ai-0.2.1.dist-info → usecortex_ai-0.3.0.dist-info}/WHEEL +0 -0
- {usecortex_ai-0.2.1.dist-info → usecortex_ai-0.3.0.dist-info}/licenses/LICENSE +0 -0
- {usecortex_ai-0.2.1.dist-info → usecortex_ai-0.3.0.dist-info}/top_level.txt +0 -0
|
@@ -4,8 +4,16 @@ import typing
|
|
|
4
4
|
|
|
5
5
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
6
|
from ..core.request_options import RequestOptions
|
|
7
|
+
from ..types.add_user_memory_response import AddUserMemoryResponse
|
|
8
|
+
from ..types.delete_user_memory_response import DeleteUserMemoryResponse
|
|
9
|
+
from ..types.generate_user_memory_response import GenerateUserMemoryResponse
|
|
10
|
+
from ..types.list_user_memories_response import ListUserMemoriesResponse
|
|
11
|
+
from ..types.retrieve_user_memory_response import RetrieveUserMemoryResponse
|
|
7
12
|
from .raw_client import AsyncRawUserMemoryClient, RawUserMemoryClient
|
|
8
13
|
|
|
14
|
+
# this is used as the default value for optional parameters
|
|
15
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
16
|
+
|
|
9
17
|
|
|
10
18
|
class UserMemoryClient:
|
|
11
19
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
@@ -23,21 +31,35 @@ class UserMemoryClient:
|
|
|
23
31
|
return self._raw_client
|
|
24
32
|
|
|
25
33
|
def list_user_memories(
|
|
26
|
-
self,
|
|
27
|
-
|
|
34
|
+
self,
|
|
35
|
+
*,
|
|
36
|
+
tenant_id: str,
|
|
37
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
38
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
39
|
+
) -> ListUserMemoriesResponse:
|
|
28
40
|
"""
|
|
41
|
+
Retrieve all stored user memories for your tenant.
|
|
42
|
+
|
|
43
|
+
This endpoint returns a comprehensive list of all user memories that have been stored,
|
|
44
|
+
whether they were added manually or generated through AI. User memories help personalize
|
|
45
|
+
your experience by storing context, preferences, and important information.
|
|
46
|
+
|
|
47
|
+
You can optionally specify a sub-tenant to filter memories within that specific scope.
|
|
48
|
+
|
|
29
49
|
Parameters
|
|
30
50
|
----------
|
|
31
51
|
tenant_id : str
|
|
52
|
+
Unique identifier for the tenant/organization
|
|
32
53
|
|
|
33
|
-
sub_tenant_id : str
|
|
54
|
+
sub_tenant_id : typing.Optional[str]
|
|
55
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
34
56
|
|
|
35
57
|
request_options : typing.Optional[RequestOptions]
|
|
36
58
|
Request-specific configuration.
|
|
37
59
|
|
|
38
60
|
Returns
|
|
39
61
|
-------
|
|
40
|
-
|
|
62
|
+
ListUserMemoriesResponse
|
|
41
63
|
Successful Response
|
|
42
64
|
|
|
43
65
|
Examples
|
|
@@ -45,7 +67,7 @@ class UserMemoryClient:
|
|
|
45
67
|
from usecortex-ai import CortexAI
|
|
46
68
|
|
|
47
69
|
client = CortexAI(token="YOUR_TOKEN", )
|
|
48
|
-
client.user_memory.list_user_memories(tenant_id='
|
|
70
|
+
client.user_memory.list_user_memories(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
|
|
49
71
|
"""
|
|
50
72
|
_response = self._raw_client.list_user_memories(
|
|
51
73
|
tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
@@ -57,24 +79,35 @@ class UserMemoryClient:
|
|
|
57
79
|
*,
|
|
58
80
|
tenant_id: str,
|
|
59
81
|
memory_id: str,
|
|
60
|
-
sub_tenant_id: str,
|
|
82
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
61
83
|
request_options: typing.Optional[RequestOptions] = None,
|
|
62
|
-
) ->
|
|
84
|
+
) -> DeleteUserMemoryResponse:
|
|
63
85
|
"""
|
|
86
|
+
Permanently remove a specific user memory from storage.
|
|
87
|
+
|
|
88
|
+
This endpoint allows you to delete a user memory by its unique identifier.
|
|
89
|
+
Once deleted, the memory cannot be recovered, so use this operation carefully.
|
|
90
|
+
|
|
91
|
+
The memory will be removed from your tenant's storage and will no longer
|
|
92
|
+
appear in search results or memory listings.
|
|
93
|
+
|
|
64
94
|
Parameters
|
|
65
95
|
----------
|
|
66
96
|
tenant_id : str
|
|
97
|
+
Unique identifier for the tenant/organization
|
|
67
98
|
|
|
68
99
|
memory_id : str
|
|
100
|
+
Unique identifier of the memory to delete
|
|
69
101
|
|
|
70
|
-
sub_tenant_id : str
|
|
102
|
+
sub_tenant_id : typing.Optional[str]
|
|
103
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
71
104
|
|
|
72
105
|
request_options : typing.Optional[RequestOptions]
|
|
73
106
|
Request-specific configuration.
|
|
74
107
|
|
|
75
108
|
Returns
|
|
76
109
|
-------
|
|
77
|
-
|
|
110
|
+
DeleteUserMemoryResponse
|
|
78
111
|
Successful Response
|
|
79
112
|
|
|
80
113
|
Examples
|
|
@@ -82,7 +115,7 @@ class UserMemoryClient:
|
|
|
82
115
|
from usecortex-ai import CortexAI
|
|
83
116
|
|
|
84
117
|
client = CortexAI(token="YOUR_TOKEN", )
|
|
85
|
-
client.user_memory.delete_user_memory(tenant_id='
|
|
118
|
+
client.user_memory.delete_user_memory(tenant_id='tenant_1234', memory_id='memory_1234', sub_tenant_id='sub_tenant_4567', )
|
|
86
119
|
"""
|
|
87
120
|
_response = self._raw_client.delete_user_memory(
|
|
88
121
|
tenant_id=tenant_id, memory_id=memory_id, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
@@ -94,27 +127,44 @@ class UserMemoryClient:
|
|
|
94
127
|
*,
|
|
95
128
|
tenant_id: str,
|
|
96
129
|
query: str,
|
|
97
|
-
sub_tenant_id: str,
|
|
130
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
98
131
|
max_count: typing.Optional[int] = None,
|
|
132
|
+
user_name: typing.Optional[str] = OMIT,
|
|
99
133
|
request_options: typing.Optional[RequestOptions] = None,
|
|
100
|
-
) ->
|
|
134
|
+
) -> RetrieveUserMemoryResponse:
|
|
101
135
|
"""
|
|
136
|
+
Find relevant user memories using semantic search.
|
|
137
|
+
|
|
138
|
+
This endpoint performs a semantic search across all your stored user memories
|
|
139
|
+
to find the most relevant ones based on your query. The results are ranked by
|
|
140
|
+
similarity score, with the most relevant memories returned first.
|
|
141
|
+
|
|
142
|
+
Use this to recall past preferences, context, or information that might be
|
|
143
|
+
relevant to your current task or query.
|
|
144
|
+
|
|
102
145
|
Parameters
|
|
103
146
|
----------
|
|
104
147
|
tenant_id : str
|
|
148
|
+
Unique identifier for the tenant/organization
|
|
105
149
|
|
|
106
150
|
query : str
|
|
151
|
+
Search query to find relevant user memories
|
|
107
152
|
|
|
108
|
-
sub_tenant_id : str
|
|
153
|
+
sub_tenant_id : typing.Optional[str]
|
|
154
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
109
155
|
|
|
110
156
|
max_count : typing.Optional[int]
|
|
157
|
+
Maximum number of memories to return (default: 5)
|
|
158
|
+
|
|
159
|
+
user_name : typing.Optional[str]
|
|
160
|
+
User's name to enhance personalisation
|
|
111
161
|
|
|
112
162
|
request_options : typing.Optional[RequestOptions]
|
|
113
163
|
Request-specific configuration.
|
|
114
164
|
|
|
115
165
|
Returns
|
|
116
166
|
-------
|
|
117
|
-
|
|
167
|
+
RetrieveUserMemoryResponse
|
|
118
168
|
Successful Response
|
|
119
169
|
|
|
120
170
|
Examples
|
|
@@ -122,13 +172,14 @@ class UserMemoryClient:
|
|
|
122
172
|
from usecortex-ai import CortexAI
|
|
123
173
|
|
|
124
174
|
client = CortexAI(token="YOUR_TOKEN", )
|
|
125
|
-
client.user_memory.retrieve_user_memory(tenant_id='
|
|
175
|
+
client.user_memory.retrieve_user_memory(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', max_count=5, query='Which mode does user prefer', )
|
|
126
176
|
"""
|
|
127
177
|
_response = self._raw_client.retrieve_user_memory(
|
|
128
178
|
tenant_id=tenant_id,
|
|
129
179
|
query=query,
|
|
130
180
|
sub_tenant_id=sub_tenant_id,
|
|
131
181
|
max_count=max_count,
|
|
182
|
+
user_name=user_name,
|
|
132
183
|
request_options=request_options,
|
|
133
184
|
)
|
|
134
185
|
return _response.data
|
|
@@ -137,28 +188,41 @@ class UserMemoryClient:
|
|
|
137
188
|
self,
|
|
138
189
|
*,
|
|
139
190
|
tenant_id: str,
|
|
140
|
-
|
|
191
|
+
user_message: str,
|
|
141
192
|
user_name: str,
|
|
142
|
-
sub_tenant_id: str,
|
|
193
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
143
194
|
request_options: typing.Optional[RequestOptions] = None,
|
|
144
|
-
) ->
|
|
195
|
+
) -> GenerateUserMemoryResponse:
|
|
145
196
|
"""
|
|
197
|
+
Generate AI-powered user memories from your query and context.
|
|
198
|
+
|
|
199
|
+
This endpoint uses artificial intelligence to create personalized memories
|
|
200
|
+
based on your query and user context. The AI analyzes your input and generates
|
|
201
|
+
relevant, contextual memories that can help improve future interactions.
|
|
202
|
+
|
|
203
|
+
Generated memories are automatically stored and can be retrieved through
|
|
204
|
+
the standard memory search endpoints.
|
|
205
|
+
|
|
146
206
|
Parameters
|
|
147
207
|
----------
|
|
148
208
|
tenant_id : str
|
|
209
|
+
Unique identifier for the tenant/organization
|
|
149
210
|
|
|
150
|
-
|
|
211
|
+
user_message : str
|
|
212
|
+
Your query or context for AI memory generation
|
|
151
213
|
|
|
152
214
|
user_name : str
|
|
215
|
+
Your name to personalize the generated memories
|
|
153
216
|
|
|
154
|
-
sub_tenant_id : str
|
|
217
|
+
sub_tenant_id : typing.Optional[str]
|
|
218
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
155
219
|
|
|
156
220
|
request_options : typing.Optional[RequestOptions]
|
|
157
221
|
Request-specific configuration.
|
|
158
222
|
|
|
159
223
|
Returns
|
|
160
224
|
-------
|
|
161
|
-
|
|
225
|
+
GenerateUserMemoryResponse
|
|
162
226
|
Successful Response
|
|
163
227
|
|
|
164
228
|
Examples
|
|
@@ -166,11 +230,11 @@ class UserMemoryClient:
|
|
|
166
230
|
from usecortex-ai import CortexAI
|
|
167
231
|
|
|
168
232
|
client = CortexAI(token="YOUR_TOKEN", )
|
|
169
|
-
client.user_memory.generate_user_memory(tenant_id='
|
|
233
|
+
client.user_memory.generate_user_memory(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', user_message='I prefer detailed technical explanations and works in the Pacific timezone', user_name='John Doe', )
|
|
170
234
|
"""
|
|
171
235
|
_response = self._raw_client.generate_user_memory(
|
|
172
236
|
tenant_id=tenant_id,
|
|
173
|
-
|
|
237
|
+
user_message=user_message,
|
|
174
238
|
user_name=user_name,
|
|
175
239
|
sub_tenant_id=sub_tenant_id,
|
|
176
240
|
request_options=request_options,
|
|
@@ -182,24 +246,36 @@ class UserMemoryClient:
|
|
|
182
246
|
*,
|
|
183
247
|
tenant_id: str,
|
|
184
248
|
user_memory: str,
|
|
185
|
-
sub_tenant_id: str,
|
|
249
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
186
250
|
request_options: typing.Optional[RequestOptions] = None,
|
|
187
|
-
) ->
|
|
251
|
+
) -> AddUserMemoryResponse:
|
|
188
252
|
"""
|
|
253
|
+
Store a new user memory for future reference.
|
|
254
|
+
|
|
255
|
+
This endpoint allows you to manually add a memory that will be stored and
|
|
256
|
+
can be retrieved later through memory search. Use this to save important
|
|
257
|
+
preferences, context, or information that you want the system to remember.
|
|
258
|
+
|
|
259
|
+
The stored memory will be indexed and available for semantic search, making
|
|
260
|
+
it accessible when relevant to future queries or interactions.
|
|
261
|
+
|
|
189
262
|
Parameters
|
|
190
263
|
----------
|
|
191
264
|
tenant_id : str
|
|
265
|
+
Unique identifier for the tenant/organization
|
|
192
266
|
|
|
193
267
|
user_memory : str
|
|
268
|
+
The memory content to store for future reference
|
|
194
269
|
|
|
195
|
-
sub_tenant_id : str
|
|
270
|
+
sub_tenant_id : typing.Optional[str]
|
|
271
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
196
272
|
|
|
197
273
|
request_options : typing.Optional[RequestOptions]
|
|
198
274
|
Request-specific configuration.
|
|
199
275
|
|
|
200
276
|
Returns
|
|
201
277
|
-------
|
|
202
|
-
|
|
278
|
+
AddUserMemoryResponse
|
|
203
279
|
Successful Response
|
|
204
280
|
|
|
205
281
|
Examples
|
|
@@ -207,7 +283,7 @@ class UserMemoryClient:
|
|
|
207
283
|
from usecortex-ai import CortexAI
|
|
208
284
|
|
|
209
285
|
client = CortexAI(token="YOUR_TOKEN", )
|
|
210
|
-
client.user_memory.add_user_memory(tenant_id='
|
|
286
|
+
client.user_memory.add_user_memory(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', user_memory='I prefer detailed technical explanations and works in the Pacific timezone', )
|
|
211
287
|
"""
|
|
212
288
|
_response = self._raw_client.add_user_memory(
|
|
213
289
|
tenant_id=tenant_id, user_memory=user_memory, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
@@ -231,21 +307,35 @@ class AsyncUserMemoryClient:
|
|
|
231
307
|
return self._raw_client
|
|
232
308
|
|
|
233
309
|
async def list_user_memories(
|
|
234
|
-
self,
|
|
235
|
-
|
|
310
|
+
self,
|
|
311
|
+
*,
|
|
312
|
+
tenant_id: str,
|
|
313
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
314
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
315
|
+
) -> ListUserMemoriesResponse:
|
|
236
316
|
"""
|
|
317
|
+
Retrieve all stored user memories for your tenant.
|
|
318
|
+
|
|
319
|
+
This endpoint returns a comprehensive list of all user memories that have been stored,
|
|
320
|
+
whether they were added manually or generated through AI. User memories help personalize
|
|
321
|
+
your experience by storing context, preferences, and important information.
|
|
322
|
+
|
|
323
|
+
You can optionally specify a sub-tenant to filter memories within that specific scope.
|
|
324
|
+
|
|
237
325
|
Parameters
|
|
238
326
|
----------
|
|
239
327
|
tenant_id : str
|
|
328
|
+
Unique identifier for the tenant/organization
|
|
240
329
|
|
|
241
|
-
sub_tenant_id : str
|
|
330
|
+
sub_tenant_id : typing.Optional[str]
|
|
331
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
242
332
|
|
|
243
333
|
request_options : typing.Optional[RequestOptions]
|
|
244
334
|
Request-specific configuration.
|
|
245
335
|
|
|
246
336
|
Returns
|
|
247
337
|
-------
|
|
248
|
-
|
|
338
|
+
ListUserMemoriesResponse
|
|
249
339
|
Successful Response
|
|
250
340
|
|
|
251
341
|
Examples
|
|
@@ -256,7 +346,7 @@ class AsyncUserMemoryClient:
|
|
|
256
346
|
|
|
257
347
|
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
258
348
|
async def main() -> None:
|
|
259
|
-
await client.user_memory.list_user_memories(tenant_id='
|
|
349
|
+
await client.user_memory.list_user_memories(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
|
|
260
350
|
asyncio.run(main())
|
|
261
351
|
"""
|
|
262
352
|
_response = await self._raw_client.list_user_memories(
|
|
@@ -269,24 +359,35 @@ class AsyncUserMemoryClient:
|
|
|
269
359
|
*,
|
|
270
360
|
tenant_id: str,
|
|
271
361
|
memory_id: str,
|
|
272
|
-
sub_tenant_id: str,
|
|
362
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
273
363
|
request_options: typing.Optional[RequestOptions] = None,
|
|
274
|
-
) ->
|
|
364
|
+
) -> DeleteUserMemoryResponse:
|
|
275
365
|
"""
|
|
366
|
+
Permanently remove a specific user memory from storage.
|
|
367
|
+
|
|
368
|
+
This endpoint allows you to delete a user memory by its unique identifier.
|
|
369
|
+
Once deleted, the memory cannot be recovered, so use this operation carefully.
|
|
370
|
+
|
|
371
|
+
The memory will be removed from your tenant's storage and will no longer
|
|
372
|
+
appear in search results or memory listings.
|
|
373
|
+
|
|
276
374
|
Parameters
|
|
277
375
|
----------
|
|
278
376
|
tenant_id : str
|
|
377
|
+
Unique identifier for the tenant/organization
|
|
279
378
|
|
|
280
379
|
memory_id : str
|
|
380
|
+
Unique identifier of the memory to delete
|
|
281
381
|
|
|
282
|
-
sub_tenant_id : str
|
|
382
|
+
sub_tenant_id : typing.Optional[str]
|
|
383
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
283
384
|
|
|
284
385
|
request_options : typing.Optional[RequestOptions]
|
|
285
386
|
Request-specific configuration.
|
|
286
387
|
|
|
287
388
|
Returns
|
|
288
389
|
-------
|
|
289
|
-
|
|
390
|
+
DeleteUserMemoryResponse
|
|
290
391
|
Successful Response
|
|
291
392
|
|
|
292
393
|
Examples
|
|
@@ -297,7 +398,7 @@ class AsyncUserMemoryClient:
|
|
|
297
398
|
|
|
298
399
|
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
299
400
|
async def main() -> None:
|
|
300
|
-
await client.user_memory.delete_user_memory(tenant_id='
|
|
401
|
+
await client.user_memory.delete_user_memory(tenant_id='tenant_1234', memory_id='memory_1234', sub_tenant_id='sub_tenant_4567', )
|
|
301
402
|
asyncio.run(main())
|
|
302
403
|
"""
|
|
303
404
|
_response = await self._raw_client.delete_user_memory(
|
|
@@ -310,27 +411,44 @@ class AsyncUserMemoryClient:
|
|
|
310
411
|
*,
|
|
311
412
|
tenant_id: str,
|
|
312
413
|
query: str,
|
|
313
|
-
sub_tenant_id: str,
|
|
414
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
314
415
|
max_count: typing.Optional[int] = None,
|
|
416
|
+
user_name: typing.Optional[str] = OMIT,
|
|
315
417
|
request_options: typing.Optional[RequestOptions] = None,
|
|
316
|
-
) ->
|
|
418
|
+
) -> RetrieveUserMemoryResponse:
|
|
317
419
|
"""
|
|
420
|
+
Find relevant user memories using semantic search.
|
|
421
|
+
|
|
422
|
+
This endpoint performs a semantic search across all your stored user memories
|
|
423
|
+
to find the most relevant ones based on your query. The results are ranked by
|
|
424
|
+
similarity score, with the most relevant memories returned first.
|
|
425
|
+
|
|
426
|
+
Use this to recall past preferences, context, or information that might be
|
|
427
|
+
relevant to your current task or query.
|
|
428
|
+
|
|
318
429
|
Parameters
|
|
319
430
|
----------
|
|
320
431
|
tenant_id : str
|
|
432
|
+
Unique identifier for the tenant/organization
|
|
321
433
|
|
|
322
434
|
query : str
|
|
435
|
+
Search query to find relevant user memories
|
|
323
436
|
|
|
324
|
-
sub_tenant_id : str
|
|
437
|
+
sub_tenant_id : typing.Optional[str]
|
|
438
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
325
439
|
|
|
326
440
|
max_count : typing.Optional[int]
|
|
441
|
+
Maximum number of memories to return (default: 5)
|
|
442
|
+
|
|
443
|
+
user_name : typing.Optional[str]
|
|
444
|
+
User's name to enhance personalisation
|
|
327
445
|
|
|
328
446
|
request_options : typing.Optional[RequestOptions]
|
|
329
447
|
Request-specific configuration.
|
|
330
448
|
|
|
331
449
|
Returns
|
|
332
450
|
-------
|
|
333
|
-
|
|
451
|
+
RetrieveUserMemoryResponse
|
|
334
452
|
Successful Response
|
|
335
453
|
|
|
336
454
|
Examples
|
|
@@ -341,7 +459,7 @@ class AsyncUserMemoryClient:
|
|
|
341
459
|
|
|
342
460
|
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
343
461
|
async def main() -> None:
|
|
344
|
-
await client.user_memory.retrieve_user_memory(tenant_id='
|
|
462
|
+
await client.user_memory.retrieve_user_memory(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', max_count=5, query='Which mode does user prefer', )
|
|
345
463
|
asyncio.run(main())
|
|
346
464
|
"""
|
|
347
465
|
_response = await self._raw_client.retrieve_user_memory(
|
|
@@ -349,6 +467,7 @@ class AsyncUserMemoryClient:
|
|
|
349
467
|
query=query,
|
|
350
468
|
sub_tenant_id=sub_tenant_id,
|
|
351
469
|
max_count=max_count,
|
|
470
|
+
user_name=user_name,
|
|
352
471
|
request_options=request_options,
|
|
353
472
|
)
|
|
354
473
|
return _response.data
|
|
@@ -357,28 +476,41 @@ class AsyncUserMemoryClient:
|
|
|
357
476
|
self,
|
|
358
477
|
*,
|
|
359
478
|
tenant_id: str,
|
|
360
|
-
|
|
479
|
+
user_message: str,
|
|
361
480
|
user_name: str,
|
|
362
|
-
sub_tenant_id: str,
|
|
481
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
363
482
|
request_options: typing.Optional[RequestOptions] = None,
|
|
364
|
-
) ->
|
|
483
|
+
) -> GenerateUserMemoryResponse:
|
|
365
484
|
"""
|
|
485
|
+
Generate AI-powered user memories from your query and context.
|
|
486
|
+
|
|
487
|
+
This endpoint uses artificial intelligence to create personalized memories
|
|
488
|
+
based on your query and user context. The AI analyzes your input and generates
|
|
489
|
+
relevant, contextual memories that can help improve future interactions.
|
|
490
|
+
|
|
491
|
+
Generated memories are automatically stored and can be retrieved through
|
|
492
|
+
the standard memory search endpoints.
|
|
493
|
+
|
|
366
494
|
Parameters
|
|
367
495
|
----------
|
|
368
496
|
tenant_id : str
|
|
497
|
+
Unique identifier for the tenant/organization
|
|
369
498
|
|
|
370
|
-
|
|
499
|
+
user_message : str
|
|
500
|
+
Your query or context for AI memory generation
|
|
371
501
|
|
|
372
502
|
user_name : str
|
|
503
|
+
Your name to personalize the generated memories
|
|
373
504
|
|
|
374
|
-
sub_tenant_id : str
|
|
505
|
+
sub_tenant_id : typing.Optional[str]
|
|
506
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
375
507
|
|
|
376
508
|
request_options : typing.Optional[RequestOptions]
|
|
377
509
|
Request-specific configuration.
|
|
378
510
|
|
|
379
511
|
Returns
|
|
380
512
|
-------
|
|
381
|
-
|
|
513
|
+
GenerateUserMemoryResponse
|
|
382
514
|
Successful Response
|
|
383
515
|
|
|
384
516
|
Examples
|
|
@@ -389,12 +521,12 @@ class AsyncUserMemoryClient:
|
|
|
389
521
|
|
|
390
522
|
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
391
523
|
async def main() -> None:
|
|
392
|
-
await client.user_memory.generate_user_memory(tenant_id='
|
|
524
|
+
await client.user_memory.generate_user_memory(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', user_message='I prefer detailed technical explanations and works in the Pacific timezone', user_name='John Doe', )
|
|
393
525
|
asyncio.run(main())
|
|
394
526
|
"""
|
|
395
527
|
_response = await self._raw_client.generate_user_memory(
|
|
396
528
|
tenant_id=tenant_id,
|
|
397
|
-
|
|
529
|
+
user_message=user_message,
|
|
398
530
|
user_name=user_name,
|
|
399
531
|
sub_tenant_id=sub_tenant_id,
|
|
400
532
|
request_options=request_options,
|
|
@@ -406,24 +538,36 @@ class AsyncUserMemoryClient:
|
|
|
406
538
|
*,
|
|
407
539
|
tenant_id: str,
|
|
408
540
|
user_memory: str,
|
|
409
|
-
sub_tenant_id: str,
|
|
541
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
410
542
|
request_options: typing.Optional[RequestOptions] = None,
|
|
411
|
-
) ->
|
|
543
|
+
) -> AddUserMemoryResponse:
|
|
412
544
|
"""
|
|
545
|
+
Store a new user memory for future reference.
|
|
546
|
+
|
|
547
|
+
This endpoint allows you to manually add a memory that will be stored and
|
|
548
|
+
can be retrieved later through memory search. Use this to save important
|
|
549
|
+
preferences, context, or information that you want the system to remember.
|
|
550
|
+
|
|
551
|
+
The stored memory will be indexed and available for semantic search, making
|
|
552
|
+
it accessible when relevant to future queries or interactions.
|
|
553
|
+
|
|
413
554
|
Parameters
|
|
414
555
|
----------
|
|
415
556
|
tenant_id : str
|
|
557
|
+
Unique identifier for the tenant/organization
|
|
416
558
|
|
|
417
559
|
user_memory : str
|
|
560
|
+
The memory content to store for future reference
|
|
418
561
|
|
|
419
|
-
sub_tenant_id : str
|
|
562
|
+
sub_tenant_id : typing.Optional[str]
|
|
563
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
420
564
|
|
|
421
565
|
request_options : typing.Optional[RequestOptions]
|
|
422
566
|
Request-specific configuration.
|
|
423
567
|
|
|
424
568
|
Returns
|
|
425
569
|
-------
|
|
426
|
-
|
|
570
|
+
AddUserMemoryResponse
|
|
427
571
|
Successful Response
|
|
428
572
|
|
|
429
573
|
Examples
|
|
@@ -434,7 +578,7 @@ class AsyncUserMemoryClient:
|
|
|
434
578
|
|
|
435
579
|
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
436
580
|
async def main() -> None:
|
|
437
|
-
await client.user_memory.add_user_memory(tenant_id='
|
|
581
|
+
await client.user_memory.add_user_memory(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', user_memory='I prefer detailed technical explanations and works in the Pacific timezone', )
|
|
438
582
|
asyncio.run(main())
|
|
439
583
|
"""
|
|
440
584
|
_response = await self._raw_client.add_user_memory(
|