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
|
@@ -8,7 +8,22 @@ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
|
8
8
|
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
9
9
|
from ..core.pydantic_utilities import parse_obj_as
|
|
10
10
|
from ..core.request_options import RequestOptions
|
|
11
|
+
from ..errors.bad_request_error import BadRequestError
|
|
12
|
+
from ..errors.forbidden_error import ForbiddenError
|
|
13
|
+
from ..errors.internal_server_error import InternalServerError
|
|
14
|
+
from ..errors.not_found_error import NotFoundError
|
|
15
|
+
from ..errors.service_unavailable_error import ServiceUnavailableError
|
|
16
|
+
from ..errors.unauthorized_error import UnauthorizedError
|
|
11
17
|
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
18
|
+
from ..types.actual_error_response import ActualErrorResponse
|
|
19
|
+
from ..types.add_user_memory_response import AddUserMemoryResponse
|
|
20
|
+
from ..types.delete_user_memory_response import DeleteUserMemoryResponse
|
|
21
|
+
from ..types.generate_user_memory_response import GenerateUserMemoryResponse
|
|
22
|
+
from ..types.list_user_memories_response import ListUserMemoriesResponse
|
|
23
|
+
from ..types.retrieve_user_memory_response import RetrieveUserMemoryResponse
|
|
24
|
+
|
|
25
|
+
# this is used as the default value for optional parameters
|
|
26
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
12
27
|
|
|
13
28
|
|
|
14
29
|
class RawUserMemoryClient:
|
|
@@ -16,21 +31,35 @@ class RawUserMemoryClient:
|
|
|
16
31
|
self._client_wrapper = client_wrapper
|
|
17
32
|
|
|
18
33
|
def list_user_memories(
|
|
19
|
-
self,
|
|
20
|
-
|
|
34
|
+
self,
|
|
35
|
+
*,
|
|
36
|
+
tenant_id: str,
|
|
37
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
38
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
39
|
+
) -> HttpResponse[ListUserMemoriesResponse]:
|
|
21
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
|
+
|
|
22
49
|
Parameters
|
|
23
50
|
----------
|
|
24
51
|
tenant_id : str
|
|
52
|
+
Unique identifier for the tenant/organization
|
|
25
53
|
|
|
26
|
-
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.
|
|
27
56
|
|
|
28
57
|
request_options : typing.Optional[RequestOptions]
|
|
29
58
|
Request-specific configuration.
|
|
30
59
|
|
|
31
60
|
Returns
|
|
32
61
|
-------
|
|
33
|
-
HttpResponse[
|
|
62
|
+
HttpResponse[ListUserMemoriesResponse]
|
|
34
63
|
Successful Response
|
|
35
64
|
"""
|
|
36
65
|
_response = self._client_wrapper.httpx_client.request(
|
|
@@ -43,17 +72,59 @@ class RawUserMemoryClient:
|
|
|
43
72
|
request_options=request_options,
|
|
44
73
|
)
|
|
45
74
|
try:
|
|
46
|
-
if _response is None or not _response.text.strip():
|
|
47
|
-
return HttpResponse(response=_response, data=None)
|
|
48
75
|
if 200 <= _response.status_code < 300:
|
|
49
76
|
_data = typing.cast(
|
|
50
|
-
|
|
77
|
+
ListUserMemoriesResponse,
|
|
51
78
|
parse_obj_as(
|
|
52
|
-
type_=
|
|
79
|
+
type_=ListUserMemoriesResponse, # type: ignore
|
|
53
80
|
object_=_response.json(),
|
|
54
81
|
),
|
|
55
82
|
)
|
|
56
83
|
return HttpResponse(response=_response, data=_data)
|
|
84
|
+
if _response.status_code == 400:
|
|
85
|
+
raise BadRequestError(
|
|
86
|
+
headers=dict(_response.headers),
|
|
87
|
+
body=typing.cast(
|
|
88
|
+
ActualErrorResponse,
|
|
89
|
+
parse_obj_as(
|
|
90
|
+
type_=ActualErrorResponse, # type: ignore
|
|
91
|
+
object_=_response.json(),
|
|
92
|
+
),
|
|
93
|
+
),
|
|
94
|
+
)
|
|
95
|
+
if _response.status_code == 401:
|
|
96
|
+
raise UnauthorizedError(
|
|
97
|
+
headers=dict(_response.headers),
|
|
98
|
+
body=typing.cast(
|
|
99
|
+
ActualErrorResponse,
|
|
100
|
+
parse_obj_as(
|
|
101
|
+
type_=ActualErrorResponse, # type: ignore
|
|
102
|
+
object_=_response.json(),
|
|
103
|
+
),
|
|
104
|
+
),
|
|
105
|
+
)
|
|
106
|
+
if _response.status_code == 403:
|
|
107
|
+
raise ForbiddenError(
|
|
108
|
+
headers=dict(_response.headers),
|
|
109
|
+
body=typing.cast(
|
|
110
|
+
ActualErrorResponse,
|
|
111
|
+
parse_obj_as(
|
|
112
|
+
type_=ActualErrorResponse, # type: ignore
|
|
113
|
+
object_=_response.json(),
|
|
114
|
+
),
|
|
115
|
+
),
|
|
116
|
+
)
|
|
117
|
+
if _response.status_code == 404:
|
|
118
|
+
raise NotFoundError(
|
|
119
|
+
headers=dict(_response.headers),
|
|
120
|
+
body=typing.cast(
|
|
121
|
+
ActualErrorResponse,
|
|
122
|
+
parse_obj_as(
|
|
123
|
+
type_=ActualErrorResponse, # type: ignore
|
|
124
|
+
object_=_response.json(),
|
|
125
|
+
),
|
|
126
|
+
),
|
|
127
|
+
)
|
|
57
128
|
if _response.status_code == 422:
|
|
58
129
|
raise UnprocessableEntityError(
|
|
59
130
|
headers=dict(_response.headers),
|
|
@@ -65,6 +136,28 @@ class RawUserMemoryClient:
|
|
|
65
136
|
),
|
|
66
137
|
),
|
|
67
138
|
)
|
|
139
|
+
if _response.status_code == 500:
|
|
140
|
+
raise InternalServerError(
|
|
141
|
+
headers=dict(_response.headers),
|
|
142
|
+
body=typing.cast(
|
|
143
|
+
ActualErrorResponse,
|
|
144
|
+
parse_obj_as(
|
|
145
|
+
type_=ActualErrorResponse, # type: ignore
|
|
146
|
+
object_=_response.json(),
|
|
147
|
+
),
|
|
148
|
+
),
|
|
149
|
+
)
|
|
150
|
+
if _response.status_code == 503:
|
|
151
|
+
raise ServiceUnavailableError(
|
|
152
|
+
headers=dict(_response.headers),
|
|
153
|
+
body=typing.cast(
|
|
154
|
+
ActualErrorResponse,
|
|
155
|
+
parse_obj_as(
|
|
156
|
+
type_=ActualErrorResponse, # type: ignore
|
|
157
|
+
object_=_response.json(),
|
|
158
|
+
),
|
|
159
|
+
),
|
|
160
|
+
)
|
|
68
161
|
_response_json = _response.json()
|
|
69
162
|
except JSONDecodeError:
|
|
70
163
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
@@ -75,24 +168,35 @@ class RawUserMemoryClient:
|
|
|
75
168
|
*,
|
|
76
169
|
tenant_id: str,
|
|
77
170
|
memory_id: str,
|
|
78
|
-
sub_tenant_id: str,
|
|
171
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
79
172
|
request_options: typing.Optional[RequestOptions] = None,
|
|
80
|
-
) -> HttpResponse[
|
|
173
|
+
) -> HttpResponse[DeleteUserMemoryResponse]:
|
|
81
174
|
"""
|
|
175
|
+
Permanently remove a specific user memory from storage.
|
|
176
|
+
|
|
177
|
+
This endpoint allows you to delete a user memory by its unique identifier.
|
|
178
|
+
Once deleted, the memory cannot be recovered, so use this operation carefully.
|
|
179
|
+
|
|
180
|
+
The memory will be removed from your tenant's storage and will no longer
|
|
181
|
+
appear in search results or memory listings.
|
|
182
|
+
|
|
82
183
|
Parameters
|
|
83
184
|
----------
|
|
84
185
|
tenant_id : str
|
|
186
|
+
Unique identifier for the tenant/organization
|
|
85
187
|
|
|
86
188
|
memory_id : str
|
|
189
|
+
Unique identifier of the memory to delete
|
|
87
190
|
|
|
88
|
-
sub_tenant_id : str
|
|
191
|
+
sub_tenant_id : typing.Optional[str]
|
|
192
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
89
193
|
|
|
90
194
|
request_options : typing.Optional[RequestOptions]
|
|
91
195
|
Request-specific configuration.
|
|
92
196
|
|
|
93
197
|
Returns
|
|
94
198
|
-------
|
|
95
|
-
HttpResponse[
|
|
199
|
+
HttpResponse[DeleteUserMemoryResponse]
|
|
96
200
|
Successful Response
|
|
97
201
|
"""
|
|
98
202
|
_response = self._client_wrapper.httpx_client.request(
|
|
@@ -106,17 +210,59 @@ class RawUserMemoryClient:
|
|
|
106
210
|
request_options=request_options,
|
|
107
211
|
)
|
|
108
212
|
try:
|
|
109
|
-
if _response is None or not _response.text.strip():
|
|
110
|
-
return HttpResponse(response=_response, data=None)
|
|
111
213
|
if 200 <= _response.status_code < 300:
|
|
112
214
|
_data = typing.cast(
|
|
113
|
-
|
|
215
|
+
DeleteUserMemoryResponse,
|
|
114
216
|
parse_obj_as(
|
|
115
|
-
type_=
|
|
217
|
+
type_=DeleteUserMemoryResponse, # type: ignore
|
|
116
218
|
object_=_response.json(),
|
|
117
219
|
),
|
|
118
220
|
)
|
|
119
221
|
return HttpResponse(response=_response, data=_data)
|
|
222
|
+
if _response.status_code == 400:
|
|
223
|
+
raise BadRequestError(
|
|
224
|
+
headers=dict(_response.headers),
|
|
225
|
+
body=typing.cast(
|
|
226
|
+
ActualErrorResponse,
|
|
227
|
+
parse_obj_as(
|
|
228
|
+
type_=ActualErrorResponse, # type: ignore
|
|
229
|
+
object_=_response.json(),
|
|
230
|
+
),
|
|
231
|
+
),
|
|
232
|
+
)
|
|
233
|
+
if _response.status_code == 401:
|
|
234
|
+
raise UnauthorizedError(
|
|
235
|
+
headers=dict(_response.headers),
|
|
236
|
+
body=typing.cast(
|
|
237
|
+
ActualErrorResponse,
|
|
238
|
+
parse_obj_as(
|
|
239
|
+
type_=ActualErrorResponse, # type: ignore
|
|
240
|
+
object_=_response.json(),
|
|
241
|
+
),
|
|
242
|
+
),
|
|
243
|
+
)
|
|
244
|
+
if _response.status_code == 403:
|
|
245
|
+
raise ForbiddenError(
|
|
246
|
+
headers=dict(_response.headers),
|
|
247
|
+
body=typing.cast(
|
|
248
|
+
ActualErrorResponse,
|
|
249
|
+
parse_obj_as(
|
|
250
|
+
type_=ActualErrorResponse, # type: ignore
|
|
251
|
+
object_=_response.json(),
|
|
252
|
+
),
|
|
253
|
+
),
|
|
254
|
+
)
|
|
255
|
+
if _response.status_code == 404:
|
|
256
|
+
raise NotFoundError(
|
|
257
|
+
headers=dict(_response.headers),
|
|
258
|
+
body=typing.cast(
|
|
259
|
+
ActualErrorResponse,
|
|
260
|
+
parse_obj_as(
|
|
261
|
+
type_=ActualErrorResponse, # type: ignore
|
|
262
|
+
object_=_response.json(),
|
|
263
|
+
),
|
|
264
|
+
),
|
|
265
|
+
)
|
|
120
266
|
if _response.status_code == 422:
|
|
121
267
|
raise UnprocessableEntityError(
|
|
122
268
|
headers=dict(_response.headers),
|
|
@@ -128,6 +274,28 @@ class RawUserMemoryClient:
|
|
|
128
274
|
),
|
|
129
275
|
),
|
|
130
276
|
)
|
|
277
|
+
if _response.status_code == 500:
|
|
278
|
+
raise InternalServerError(
|
|
279
|
+
headers=dict(_response.headers),
|
|
280
|
+
body=typing.cast(
|
|
281
|
+
ActualErrorResponse,
|
|
282
|
+
parse_obj_as(
|
|
283
|
+
type_=ActualErrorResponse, # type: ignore
|
|
284
|
+
object_=_response.json(),
|
|
285
|
+
),
|
|
286
|
+
),
|
|
287
|
+
)
|
|
288
|
+
if _response.status_code == 503:
|
|
289
|
+
raise ServiceUnavailableError(
|
|
290
|
+
headers=dict(_response.headers),
|
|
291
|
+
body=typing.cast(
|
|
292
|
+
ActualErrorResponse,
|
|
293
|
+
parse_obj_as(
|
|
294
|
+
type_=ActualErrorResponse, # type: ignore
|
|
295
|
+
object_=_response.json(),
|
|
296
|
+
),
|
|
297
|
+
),
|
|
298
|
+
)
|
|
131
299
|
_response_json = _response.json()
|
|
132
300
|
except JSONDecodeError:
|
|
133
301
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
@@ -138,52 +306,118 @@ class RawUserMemoryClient:
|
|
|
138
306
|
*,
|
|
139
307
|
tenant_id: str,
|
|
140
308
|
query: str,
|
|
141
|
-
sub_tenant_id: str,
|
|
309
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
142
310
|
max_count: typing.Optional[int] = None,
|
|
311
|
+
user_name: typing.Optional[str] = OMIT,
|
|
143
312
|
request_options: typing.Optional[RequestOptions] = None,
|
|
144
|
-
) -> HttpResponse[
|
|
313
|
+
) -> HttpResponse[RetrieveUserMemoryResponse]:
|
|
145
314
|
"""
|
|
315
|
+
Find relevant user memories using semantic search.
|
|
316
|
+
|
|
317
|
+
This endpoint performs a semantic search across all your stored user memories
|
|
318
|
+
to find the most relevant ones based on your query. The results are ranked by
|
|
319
|
+
similarity score, with the most relevant memories returned first.
|
|
320
|
+
|
|
321
|
+
Use this to recall past preferences, context, or information that might be
|
|
322
|
+
relevant to your current task or query.
|
|
323
|
+
|
|
146
324
|
Parameters
|
|
147
325
|
----------
|
|
148
326
|
tenant_id : str
|
|
327
|
+
Unique identifier for the tenant/organization
|
|
149
328
|
|
|
150
329
|
query : str
|
|
330
|
+
Search query to find relevant user memories
|
|
151
331
|
|
|
152
|
-
sub_tenant_id : str
|
|
332
|
+
sub_tenant_id : typing.Optional[str]
|
|
333
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
153
334
|
|
|
154
335
|
max_count : typing.Optional[int]
|
|
336
|
+
Maximum number of memories to return (default: 5)
|
|
337
|
+
|
|
338
|
+
user_name : typing.Optional[str]
|
|
339
|
+
User's name to enhance personalisation
|
|
155
340
|
|
|
156
341
|
request_options : typing.Optional[RequestOptions]
|
|
157
342
|
Request-specific configuration.
|
|
158
343
|
|
|
159
344
|
Returns
|
|
160
345
|
-------
|
|
161
|
-
HttpResponse[
|
|
346
|
+
HttpResponse[RetrieveUserMemoryResponse]
|
|
162
347
|
Successful Response
|
|
163
348
|
"""
|
|
164
349
|
_response = self._client_wrapper.httpx_client.request(
|
|
165
350
|
"user_memory/retrieve_user_memory",
|
|
166
|
-
method="
|
|
351
|
+
method="POST",
|
|
167
352
|
params={
|
|
168
353
|
"tenant_id": tenant_id,
|
|
169
|
-
"query": query,
|
|
170
354
|
"sub_tenant_id": sub_tenant_id,
|
|
171
355
|
"max_count": max_count,
|
|
172
356
|
},
|
|
357
|
+
json={
|
|
358
|
+
"query": query,
|
|
359
|
+
"user_name": user_name,
|
|
360
|
+
},
|
|
361
|
+
headers={
|
|
362
|
+
"content-type": "application/json",
|
|
363
|
+
},
|
|
173
364
|
request_options=request_options,
|
|
365
|
+
omit=OMIT,
|
|
174
366
|
)
|
|
175
367
|
try:
|
|
176
|
-
if _response is None or not _response.text.strip():
|
|
177
|
-
return HttpResponse(response=_response, data=None)
|
|
178
368
|
if 200 <= _response.status_code < 300:
|
|
179
369
|
_data = typing.cast(
|
|
180
|
-
|
|
370
|
+
RetrieveUserMemoryResponse,
|
|
181
371
|
parse_obj_as(
|
|
182
|
-
type_=
|
|
372
|
+
type_=RetrieveUserMemoryResponse, # type: ignore
|
|
183
373
|
object_=_response.json(),
|
|
184
374
|
),
|
|
185
375
|
)
|
|
186
376
|
return HttpResponse(response=_response, data=_data)
|
|
377
|
+
if _response.status_code == 400:
|
|
378
|
+
raise BadRequestError(
|
|
379
|
+
headers=dict(_response.headers),
|
|
380
|
+
body=typing.cast(
|
|
381
|
+
ActualErrorResponse,
|
|
382
|
+
parse_obj_as(
|
|
383
|
+
type_=ActualErrorResponse, # type: ignore
|
|
384
|
+
object_=_response.json(),
|
|
385
|
+
),
|
|
386
|
+
),
|
|
387
|
+
)
|
|
388
|
+
if _response.status_code == 401:
|
|
389
|
+
raise UnauthorizedError(
|
|
390
|
+
headers=dict(_response.headers),
|
|
391
|
+
body=typing.cast(
|
|
392
|
+
ActualErrorResponse,
|
|
393
|
+
parse_obj_as(
|
|
394
|
+
type_=ActualErrorResponse, # type: ignore
|
|
395
|
+
object_=_response.json(),
|
|
396
|
+
),
|
|
397
|
+
),
|
|
398
|
+
)
|
|
399
|
+
if _response.status_code == 403:
|
|
400
|
+
raise ForbiddenError(
|
|
401
|
+
headers=dict(_response.headers),
|
|
402
|
+
body=typing.cast(
|
|
403
|
+
ActualErrorResponse,
|
|
404
|
+
parse_obj_as(
|
|
405
|
+
type_=ActualErrorResponse, # type: ignore
|
|
406
|
+
object_=_response.json(),
|
|
407
|
+
),
|
|
408
|
+
),
|
|
409
|
+
)
|
|
410
|
+
if _response.status_code == 404:
|
|
411
|
+
raise NotFoundError(
|
|
412
|
+
headers=dict(_response.headers),
|
|
413
|
+
body=typing.cast(
|
|
414
|
+
ActualErrorResponse,
|
|
415
|
+
parse_obj_as(
|
|
416
|
+
type_=ActualErrorResponse, # type: ignore
|
|
417
|
+
object_=_response.json(),
|
|
418
|
+
),
|
|
419
|
+
),
|
|
420
|
+
)
|
|
187
421
|
if _response.status_code == 422:
|
|
188
422
|
raise UnprocessableEntityError(
|
|
189
423
|
headers=dict(_response.headers),
|
|
@@ -195,6 +429,28 @@ class RawUserMemoryClient:
|
|
|
195
429
|
),
|
|
196
430
|
),
|
|
197
431
|
)
|
|
432
|
+
if _response.status_code == 500:
|
|
433
|
+
raise InternalServerError(
|
|
434
|
+
headers=dict(_response.headers),
|
|
435
|
+
body=typing.cast(
|
|
436
|
+
ActualErrorResponse,
|
|
437
|
+
parse_obj_as(
|
|
438
|
+
type_=ActualErrorResponse, # type: ignore
|
|
439
|
+
object_=_response.json(),
|
|
440
|
+
),
|
|
441
|
+
),
|
|
442
|
+
)
|
|
443
|
+
if _response.status_code == 503:
|
|
444
|
+
raise ServiceUnavailableError(
|
|
445
|
+
headers=dict(_response.headers),
|
|
446
|
+
body=typing.cast(
|
|
447
|
+
ActualErrorResponse,
|
|
448
|
+
parse_obj_as(
|
|
449
|
+
type_=ActualErrorResponse, # type: ignore
|
|
450
|
+
object_=_response.json(),
|
|
451
|
+
),
|
|
452
|
+
),
|
|
453
|
+
)
|
|
198
454
|
_response_json = _response.json()
|
|
199
455
|
except JSONDecodeError:
|
|
200
456
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
@@ -204,28 +460,41 @@ class RawUserMemoryClient:
|
|
|
204
460
|
self,
|
|
205
461
|
*,
|
|
206
462
|
tenant_id: str,
|
|
207
|
-
|
|
463
|
+
user_message: str,
|
|
208
464
|
user_name: str,
|
|
209
|
-
sub_tenant_id: str,
|
|
465
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
210
466
|
request_options: typing.Optional[RequestOptions] = None,
|
|
211
|
-
) -> HttpResponse[
|
|
467
|
+
) -> HttpResponse[GenerateUserMemoryResponse]:
|
|
212
468
|
"""
|
|
469
|
+
Generate AI-powered user memories from your query and context.
|
|
470
|
+
|
|
471
|
+
This endpoint uses artificial intelligence to create personalized memories
|
|
472
|
+
based on your query and user context. The AI analyzes your input and generates
|
|
473
|
+
relevant, contextual memories that can help improve future interactions.
|
|
474
|
+
|
|
475
|
+
Generated memories are automatically stored and can be retrieved through
|
|
476
|
+
the standard memory search endpoints.
|
|
477
|
+
|
|
213
478
|
Parameters
|
|
214
479
|
----------
|
|
215
480
|
tenant_id : str
|
|
481
|
+
Unique identifier for the tenant/organization
|
|
216
482
|
|
|
217
|
-
|
|
483
|
+
user_message : str
|
|
484
|
+
Your query or context for AI memory generation
|
|
218
485
|
|
|
219
486
|
user_name : str
|
|
487
|
+
Your name to personalize the generated memories
|
|
220
488
|
|
|
221
|
-
sub_tenant_id : str
|
|
489
|
+
sub_tenant_id : typing.Optional[str]
|
|
490
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
222
491
|
|
|
223
492
|
request_options : typing.Optional[RequestOptions]
|
|
224
493
|
Request-specific configuration.
|
|
225
494
|
|
|
226
495
|
Returns
|
|
227
496
|
-------
|
|
228
|
-
HttpResponse[
|
|
497
|
+
HttpResponse[GenerateUserMemoryResponse]
|
|
229
498
|
Successful Response
|
|
230
499
|
"""
|
|
231
500
|
_response = self._client_wrapper.httpx_client.request(
|
|
@@ -233,24 +502,72 @@ class RawUserMemoryClient:
|
|
|
233
502
|
method="POST",
|
|
234
503
|
params={
|
|
235
504
|
"tenant_id": tenant_id,
|
|
236
|
-
"user_query": user_query,
|
|
237
|
-
"user_name": user_name,
|
|
238
505
|
"sub_tenant_id": sub_tenant_id,
|
|
239
506
|
},
|
|
507
|
+
json={
|
|
508
|
+
"user_message": user_message,
|
|
509
|
+
"user_name": user_name,
|
|
510
|
+
},
|
|
511
|
+
headers={
|
|
512
|
+
"content-type": "application/json",
|
|
513
|
+
},
|
|
240
514
|
request_options=request_options,
|
|
515
|
+
omit=OMIT,
|
|
241
516
|
)
|
|
242
517
|
try:
|
|
243
|
-
if _response is None or not _response.text.strip():
|
|
244
|
-
return HttpResponse(response=_response, data=None)
|
|
245
518
|
if 200 <= _response.status_code < 300:
|
|
246
519
|
_data = typing.cast(
|
|
247
|
-
|
|
520
|
+
GenerateUserMemoryResponse,
|
|
248
521
|
parse_obj_as(
|
|
249
|
-
type_=
|
|
522
|
+
type_=GenerateUserMemoryResponse, # type: ignore
|
|
250
523
|
object_=_response.json(),
|
|
251
524
|
),
|
|
252
525
|
)
|
|
253
526
|
return HttpResponse(response=_response, data=_data)
|
|
527
|
+
if _response.status_code == 400:
|
|
528
|
+
raise BadRequestError(
|
|
529
|
+
headers=dict(_response.headers),
|
|
530
|
+
body=typing.cast(
|
|
531
|
+
ActualErrorResponse,
|
|
532
|
+
parse_obj_as(
|
|
533
|
+
type_=ActualErrorResponse, # type: ignore
|
|
534
|
+
object_=_response.json(),
|
|
535
|
+
),
|
|
536
|
+
),
|
|
537
|
+
)
|
|
538
|
+
if _response.status_code == 401:
|
|
539
|
+
raise UnauthorizedError(
|
|
540
|
+
headers=dict(_response.headers),
|
|
541
|
+
body=typing.cast(
|
|
542
|
+
ActualErrorResponse,
|
|
543
|
+
parse_obj_as(
|
|
544
|
+
type_=ActualErrorResponse, # type: ignore
|
|
545
|
+
object_=_response.json(),
|
|
546
|
+
),
|
|
547
|
+
),
|
|
548
|
+
)
|
|
549
|
+
if _response.status_code == 403:
|
|
550
|
+
raise ForbiddenError(
|
|
551
|
+
headers=dict(_response.headers),
|
|
552
|
+
body=typing.cast(
|
|
553
|
+
ActualErrorResponse,
|
|
554
|
+
parse_obj_as(
|
|
555
|
+
type_=ActualErrorResponse, # type: ignore
|
|
556
|
+
object_=_response.json(),
|
|
557
|
+
),
|
|
558
|
+
),
|
|
559
|
+
)
|
|
560
|
+
if _response.status_code == 404:
|
|
561
|
+
raise NotFoundError(
|
|
562
|
+
headers=dict(_response.headers),
|
|
563
|
+
body=typing.cast(
|
|
564
|
+
ActualErrorResponse,
|
|
565
|
+
parse_obj_as(
|
|
566
|
+
type_=ActualErrorResponse, # type: ignore
|
|
567
|
+
object_=_response.json(),
|
|
568
|
+
),
|
|
569
|
+
),
|
|
570
|
+
)
|
|
254
571
|
if _response.status_code == 422:
|
|
255
572
|
raise UnprocessableEntityError(
|
|
256
573
|
headers=dict(_response.headers),
|
|
@@ -262,6 +579,28 @@ class RawUserMemoryClient:
|
|
|
262
579
|
),
|
|
263
580
|
),
|
|
264
581
|
)
|
|
582
|
+
if _response.status_code == 500:
|
|
583
|
+
raise InternalServerError(
|
|
584
|
+
headers=dict(_response.headers),
|
|
585
|
+
body=typing.cast(
|
|
586
|
+
ActualErrorResponse,
|
|
587
|
+
parse_obj_as(
|
|
588
|
+
type_=ActualErrorResponse, # type: ignore
|
|
589
|
+
object_=_response.json(),
|
|
590
|
+
),
|
|
591
|
+
),
|
|
592
|
+
)
|
|
593
|
+
if _response.status_code == 503:
|
|
594
|
+
raise ServiceUnavailableError(
|
|
595
|
+
headers=dict(_response.headers),
|
|
596
|
+
body=typing.cast(
|
|
597
|
+
ActualErrorResponse,
|
|
598
|
+
parse_obj_as(
|
|
599
|
+
type_=ActualErrorResponse, # type: ignore
|
|
600
|
+
object_=_response.json(),
|
|
601
|
+
),
|
|
602
|
+
),
|
|
603
|
+
)
|
|
265
604
|
_response_json = _response.json()
|
|
266
605
|
except JSONDecodeError:
|
|
267
606
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
@@ -272,24 +611,36 @@ class RawUserMemoryClient:
|
|
|
272
611
|
*,
|
|
273
612
|
tenant_id: str,
|
|
274
613
|
user_memory: str,
|
|
275
|
-
sub_tenant_id: str,
|
|
614
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
276
615
|
request_options: typing.Optional[RequestOptions] = None,
|
|
277
|
-
) -> HttpResponse[
|
|
616
|
+
) -> HttpResponse[AddUserMemoryResponse]:
|
|
278
617
|
"""
|
|
618
|
+
Store a new user memory for future reference.
|
|
619
|
+
|
|
620
|
+
This endpoint allows you to manually add a memory that will be stored and
|
|
621
|
+
can be retrieved later through memory search. Use this to save important
|
|
622
|
+
preferences, context, or information that you want the system to remember.
|
|
623
|
+
|
|
624
|
+
The stored memory will be indexed and available for semantic search, making
|
|
625
|
+
it accessible when relevant to future queries or interactions.
|
|
626
|
+
|
|
279
627
|
Parameters
|
|
280
628
|
----------
|
|
281
629
|
tenant_id : str
|
|
630
|
+
Unique identifier for the tenant/organization
|
|
282
631
|
|
|
283
632
|
user_memory : str
|
|
633
|
+
The memory content to store for future reference
|
|
284
634
|
|
|
285
|
-
sub_tenant_id : str
|
|
635
|
+
sub_tenant_id : typing.Optional[str]
|
|
636
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
286
637
|
|
|
287
638
|
request_options : typing.Optional[RequestOptions]
|
|
288
639
|
Request-specific configuration.
|
|
289
640
|
|
|
290
641
|
Returns
|
|
291
642
|
-------
|
|
292
|
-
HttpResponse[
|
|
643
|
+
HttpResponse[AddUserMemoryResponse]
|
|
293
644
|
Successful Response
|
|
294
645
|
"""
|
|
295
646
|
_response = self._client_wrapper.httpx_client.request(
|
|
@@ -297,23 +648,71 @@ class RawUserMemoryClient:
|
|
|
297
648
|
method="POST",
|
|
298
649
|
params={
|
|
299
650
|
"tenant_id": tenant_id,
|
|
300
|
-
"user_memory": user_memory,
|
|
301
651
|
"sub_tenant_id": sub_tenant_id,
|
|
302
652
|
},
|
|
653
|
+
json={
|
|
654
|
+
"user_memory": user_memory,
|
|
655
|
+
},
|
|
656
|
+
headers={
|
|
657
|
+
"content-type": "application/json",
|
|
658
|
+
},
|
|
303
659
|
request_options=request_options,
|
|
660
|
+
omit=OMIT,
|
|
304
661
|
)
|
|
305
662
|
try:
|
|
306
|
-
if _response is None or not _response.text.strip():
|
|
307
|
-
return HttpResponse(response=_response, data=None)
|
|
308
663
|
if 200 <= _response.status_code < 300:
|
|
309
664
|
_data = typing.cast(
|
|
310
|
-
|
|
665
|
+
AddUserMemoryResponse,
|
|
311
666
|
parse_obj_as(
|
|
312
|
-
type_=
|
|
667
|
+
type_=AddUserMemoryResponse, # type: ignore
|
|
313
668
|
object_=_response.json(),
|
|
314
669
|
),
|
|
315
670
|
)
|
|
316
671
|
return HttpResponse(response=_response, data=_data)
|
|
672
|
+
if _response.status_code == 400:
|
|
673
|
+
raise BadRequestError(
|
|
674
|
+
headers=dict(_response.headers),
|
|
675
|
+
body=typing.cast(
|
|
676
|
+
ActualErrorResponse,
|
|
677
|
+
parse_obj_as(
|
|
678
|
+
type_=ActualErrorResponse, # type: ignore
|
|
679
|
+
object_=_response.json(),
|
|
680
|
+
),
|
|
681
|
+
),
|
|
682
|
+
)
|
|
683
|
+
if _response.status_code == 401:
|
|
684
|
+
raise UnauthorizedError(
|
|
685
|
+
headers=dict(_response.headers),
|
|
686
|
+
body=typing.cast(
|
|
687
|
+
ActualErrorResponse,
|
|
688
|
+
parse_obj_as(
|
|
689
|
+
type_=ActualErrorResponse, # type: ignore
|
|
690
|
+
object_=_response.json(),
|
|
691
|
+
),
|
|
692
|
+
),
|
|
693
|
+
)
|
|
694
|
+
if _response.status_code == 403:
|
|
695
|
+
raise ForbiddenError(
|
|
696
|
+
headers=dict(_response.headers),
|
|
697
|
+
body=typing.cast(
|
|
698
|
+
ActualErrorResponse,
|
|
699
|
+
parse_obj_as(
|
|
700
|
+
type_=ActualErrorResponse, # type: ignore
|
|
701
|
+
object_=_response.json(),
|
|
702
|
+
),
|
|
703
|
+
),
|
|
704
|
+
)
|
|
705
|
+
if _response.status_code == 404:
|
|
706
|
+
raise NotFoundError(
|
|
707
|
+
headers=dict(_response.headers),
|
|
708
|
+
body=typing.cast(
|
|
709
|
+
ActualErrorResponse,
|
|
710
|
+
parse_obj_as(
|
|
711
|
+
type_=ActualErrorResponse, # type: ignore
|
|
712
|
+
object_=_response.json(),
|
|
713
|
+
),
|
|
714
|
+
),
|
|
715
|
+
)
|
|
317
716
|
if _response.status_code == 422:
|
|
318
717
|
raise UnprocessableEntityError(
|
|
319
718
|
headers=dict(_response.headers),
|
|
@@ -325,6 +724,28 @@ class RawUserMemoryClient:
|
|
|
325
724
|
),
|
|
326
725
|
),
|
|
327
726
|
)
|
|
727
|
+
if _response.status_code == 500:
|
|
728
|
+
raise InternalServerError(
|
|
729
|
+
headers=dict(_response.headers),
|
|
730
|
+
body=typing.cast(
|
|
731
|
+
ActualErrorResponse,
|
|
732
|
+
parse_obj_as(
|
|
733
|
+
type_=ActualErrorResponse, # type: ignore
|
|
734
|
+
object_=_response.json(),
|
|
735
|
+
),
|
|
736
|
+
),
|
|
737
|
+
)
|
|
738
|
+
if _response.status_code == 503:
|
|
739
|
+
raise ServiceUnavailableError(
|
|
740
|
+
headers=dict(_response.headers),
|
|
741
|
+
body=typing.cast(
|
|
742
|
+
ActualErrorResponse,
|
|
743
|
+
parse_obj_as(
|
|
744
|
+
type_=ActualErrorResponse, # type: ignore
|
|
745
|
+
object_=_response.json(),
|
|
746
|
+
),
|
|
747
|
+
),
|
|
748
|
+
)
|
|
328
749
|
_response_json = _response.json()
|
|
329
750
|
except JSONDecodeError:
|
|
330
751
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
@@ -336,21 +757,35 @@ class AsyncRawUserMemoryClient:
|
|
|
336
757
|
self._client_wrapper = client_wrapper
|
|
337
758
|
|
|
338
759
|
async def list_user_memories(
|
|
339
|
-
self,
|
|
340
|
-
|
|
760
|
+
self,
|
|
761
|
+
*,
|
|
762
|
+
tenant_id: str,
|
|
763
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
764
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
765
|
+
) -> AsyncHttpResponse[ListUserMemoriesResponse]:
|
|
341
766
|
"""
|
|
767
|
+
Retrieve all stored user memories for your tenant.
|
|
768
|
+
|
|
769
|
+
This endpoint returns a comprehensive list of all user memories that have been stored,
|
|
770
|
+
whether they were added manually or generated through AI. User memories help personalize
|
|
771
|
+
your experience by storing context, preferences, and important information.
|
|
772
|
+
|
|
773
|
+
You can optionally specify a sub-tenant to filter memories within that specific scope.
|
|
774
|
+
|
|
342
775
|
Parameters
|
|
343
776
|
----------
|
|
344
777
|
tenant_id : str
|
|
778
|
+
Unique identifier for the tenant/organization
|
|
345
779
|
|
|
346
|
-
sub_tenant_id : str
|
|
780
|
+
sub_tenant_id : typing.Optional[str]
|
|
781
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
347
782
|
|
|
348
783
|
request_options : typing.Optional[RequestOptions]
|
|
349
784
|
Request-specific configuration.
|
|
350
785
|
|
|
351
786
|
Returns
|
|
352
787
|
-------
|
|
353
|
-
AsyncHttpResponse[
|
|
788
|
+
AsyncHttpResponse[ListUserMemoriesResponse]
|
|
354
789
|
Successful Response
|
|
355
790
|
"""
|
|
356
791
|
_response = await self._client_wrapper.httpx_client.request(
|
|
@@ -363,17 +798,59 @@ class AsyncRawUserMemoryClient:
|
|
|
363
798
|
request_options=request_options,
|
|
364
799
|
)
|
|
365
800
|
try:
|
|
366
|
-
if _response is None or not _response.text.strip():
|
|
367
|
-
return AsyncHttpResponse(response=_response, data=None)
|
|
368
801
|
if 200 <= _response.status_code < 300:
|
|
369
802
|
_data = typing.cast(
|
|
370
|
-
|
|
803
|
+
ListUserMemoriesResponse,
|
|
371
804
|
parse_obj_as(
|
|
372
|
-
type_=
|
|
805
|
+
type_=ListUserMemoriesResponse, # type: ignore
|
|
373
806
|
object_=_response.json(),
|
|
374
807
|
),
|
|
375
808
|
)
|
|
376
809
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
810
|
+
if _response.status_code == 400:
|
|
811
|
+
raise BadRequestError(
|
|
812
|
+
headers=dict(_response.headers),
|
|
813
|
+
body=typing.cast(
|
|
814
|
+
ActualErrorResponse,
|
|
815
|
+
parse_obj_as(
|
|
816
|
+
type_=ActualErrorResponse, # type: ignore
|
|
817
|
+
object_=_response.json(),
|
|
818
|
+
),
|
|
819
|
+
),
|
|
820
|
+
)
|
|
821
|
+
if _response.status_code == 401:
|
|
822
|
+
raise UnauthorizedError(
|
|
823
|
+
headers=dict(_response.headers),
|
|
824
|
+
body=typing.cast(
|
|
825
|
+
ActualErrorResponse,
|
|
826
|
+
parse_obj_as(
|
|
827
|
+
type_=ActualErrorResponse, # type: ignore
|
|
828
|
+
object_=_response.json(),
|
|
829
|
+
),
|
|
830
|
+
),
|
|
831
|
+
)
|
|
832
|
+
if _response.status_code == 403:
|
|
833
|
+
raise ForbiddenError(
|
|
834
|
+
headers=dict(_response.headers),
|
|
835
|
+
body=typing.cast(
|
|
836
|
+
ActualErrorResponse,
|
|
837
|
+
parse_obj_as(
|
|
838
|
+
type_=ActualErrorResponse, # type: ignore
|
|
839
|
+
object_=_response.json(),
|
|
840
|
+
),
|
|
841
|
+
),
|
|
842
|
+
)
|
|
843
|
+
if _response.status_code == 404:
|
|
844
|
+
raise NotFoundError(
|
|
845
|
+
headers=dict(_response.headers),
|
|
846
|
+
body=typing.cast(
|
|
847
|
+
ActualErrorResponse,
|
|
848
|
+
parse_obj_as(
|
|
849
|
+
type_=ActualErrorResponse, # type: ignore
|
|
850
|
+
object_=_response.json(),
|
|
851
|
+
),
|
|
852
|
+
),
|
|
853
|
+
)
|
|
377
854
|
if _response.status_code == 422:
|
|
378
855
|
raise UnprocessableEntityError(
|
|
379
856
|
headers=dict(_response.headers),
|
|
@@ -385,6 +862,28 @@ class AsyncRawUserMemoryClient:
|
|
|
385
862
|
),
|
|
386
863
|
),
|
|
387
864
|
)
|
|
865
|
+
if _response.status_code == 500:
|
|
866
|
+
raise InternalServerError(
|
|
867
|
+
headers=dict(_response.headers),
|
|
868
|
+
body=typing.cast(
|
|
869
|
+
ActualErrorResponse,
|
|
870
|
+
parse_obj_as(
|
|
871
|
+
type_=ActualErrorResponse, # type: ignore
|
|
872
|
+
object_=_response.json(),
|
|
873
|
+
),
|
|
874
|
+
),
|
|
875
|
+
)
|
|
876
|
+
if _response.status_code == 503:
|
|
877
|
+
raise ServiceUnavailableError(
|
|
878
|
+
headers=dict(_response.headers),
|
|
879
|
+
body=typing.cast(
|
|
880
|
+
ActualErrorResponse,
|
|
881
|
+
parse_obj_as(
|
|
882
|
+
type_=ActualErrorResponse, # type: ignore
|
|
883
|
+
object_=_response.json(),
|
|
884
|
+
),
|
|
885
|
+
),
|
|
886
|
+
)
|
|
388
887
|
_response_json = _response.json()
|
|
389
888
|
except JSONDecodeError:
|
|
390
889
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
@@ -395,24 +894,35 @@ class AsyncRawUserMemoryClient:
|
|
|
395
894
|
*,
|
|
396
895
|
tenant_id: str,
|
|
397
896
|
memory_id: str,
|
|
398
|
-
sub_tenant_id: str,
|
|
897
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
399
898
|
request_options: typing.Optional[RequestOptions] = None,
|
|
400
|
-
) -> AsyncHttpResponse[
|
|
899
|
+
) -> AsyncHttpResponse[DeleteUserMemoryResponse]:
|
|
401
900
|
"""
|
|
901
|
+
Permanently remove a specific user memory from storage.
|
|
902
|
+
|
|
903
|
+
This endpoint allows you to delete a user memory by its unique identifier.
|
|
904
|
+
Once deleted, the memory cannot be recovered, so use this operation carefully.
|
|
905
|
+
|
|
906
|
+
The memory will be removed from your tenant's storage and will no longer
|
|
907
|
+
appear in search results or memory listings.
|
|
908
|
+
|
|
402
909
|
Parameters
|
|
403
910
|
----------
|
|
404
911
|
tenant_id : str
|
|
912
|
+
Unique identifier for the tenant/organization
|
|
405
913
|
|
|
406
914
|
memory_id : str
|
|
915
|
+
Unique identifier of the memory to delete
|
|
407
916
|
|
|
408
|
-
sub_tenant_id : str
|
|
917
|
+
sub_tenant_id : typing.Optional[str]
|
|
918
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
409
919
|
|
|
410
920
|
request_options : typing.Optional[RequestOptions]
|
|
411
921
|
Request-specific configuration.
|
|
412
922
|
|
|
413
923
|
Returns
|
|
414
924
|
-------
|
|
415
|
-
AsyncHttpResponse[
|
|
925
|
+
AsyncHttpResponse[DeleteUserMemoryResponse]
|
|
416
926
|
Successful Response
|
|
417
927
|
"""
|
|
418
928
|
_response = await self._client_wrapper.httpx_client.request(
|
|
@@ -426,17 +936,59 @@ class AsyncRawUserMemoryClient:
|
|
|
426
936
|
request_options=request_options,
|
|
427
937
|
)
|
|
428
938
|
try:
|
|
429
|
-
if _response is None or not _response.text.strip():
|
|
430
|
-
return AsyncHttpResponse(response=_response, data=None)
|
|
431
939
|
if 200 <= _response.status_code < 300:
|
|
432
940
|
_data = typing.cast(
|
|
433
|
-
|
|
941
|
+
DeleteUserMemoryResponse,
|
|
434
942
|
parse_obj_as(
|
|
435
|
-
type_=
|
|
943
|
+
type_=DeleteUserMemoryResponse, # type: ignore
|
|
436
944
|
object_=_response.json(),
|
|
437
945
|
),
|
|
438
946
|
)
|
|
439
947
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
948
|
+
if _response.status_code == 400:
|
|
949
|
+
raise BadRequestError(
|
|
950
|
+
headers=dict(_response.headers),
|
|
951
|
+
body=typing.cast(
|
|
952
|
+
ActualErrorResponse,
|
|
953
|
+
parse_obj_as(
|
|
954
|
+
type_=ActualErrorResponse, # type: ignore
|
|
955
|
+
object_=_response.json(),
|
|
956
|
+
),
|
|
957
|
+
),
|
|
958
|
+
)
|
|
959
|
+
if _response.status_code == 401:
|
|
960
|
+
raise UnauthorizedError(
|
|
961
|
+
headers=dict(_response.headers),
|
|
962
|
+
body=typing.cast(
|
|
963
|
+
ActualErrorResponse,
|
|
964
|
+
parse_obj_as(
|
|
965
|
+
type_=ActualErrorResponse, # type: ignore
|
|
966
|
+
object_=_response.json(),
|
|
967
|
+
),
|
|
968
|
+
),
|
|
969
|
+
)
|
|
970
|
+
if _response.status_code == 403:
|
|
971
|
+
raise ForbiddenError(
|
|
972
|
+
headers=dict(_response.headers),
|
|
973
|
+
body=typing.cast(
|
|
974
|
+
ActualErrorResponse,
|
|
975
|
+
parse_obj_as(
|
|
976
|
+
type_=ActualErrorResponse, # type: ignore
|
|
977
|
+
object_=_response.json(),
|
|
978
|
+
),
|
|
979
|
+
),
|
|
980
|
+
)
|
|
981
|
+
if _response.status_code == 404:
|
|
982
|
+
raise NotFoundError(
|
|
983
|
+
headers=dict(_response.headers),
|
|
984
|
+
body=typing.cast(
|
|
985
|
+
ActualErrorResponse,
|
|
986
|
+
parse_obj_as(
|
|
987
|
+
type_=ActualErrorResponse, # type: ignore
|
|
988
|
+
object_=_response.json(),
|
|
989
|
+
),
|
|
990
|
+
),
|
|
991
|
+
)
|
|
440
992
|
if _response.status_code == 422:
|
|
441
993
|
raise UnprocessableEntityError(
|
|
442
994
|
headers=dict(_response.headers),
|
|
@@ -448,6 +1000,28 @@ class AsyncRawUserMemoryClient:
|
|
|
448
1000
|
),
|
|
449
1001
|
),
|
|
450
1002
|
)
|
|
1003
|
+
if _response.status_code == 500:
|
|
1004
|
+
raise InternalServerError(
|
|
1005
|
+
headers=dict(_response.headers),
|
|
1006
|
+
body=typing.cast(
|
|
1007
|
+
ActualErrorResponse,
|
|
1008
|
+
parse_obj_as(
|
|
1009
|
+
type_=ActualErrorResponse, # type: ignore
|
|
1010
|
+
object_=_response.json(),
|
|
1011
|
+
),
|
|
1012
|
+
),
|
|
1013
|
+
)
|
|
1014
|
+
if _response.status_code == 503:
|
|
1015
|
+
raise ServiceUnavailableError(
|
|
1016
|
+
headers=dict(_response.headers),
|
|
1017
|
+
body=typing.cast(
|
|
1018
|
+
ActualErrorResponse,
|
|
1019
|
+
parse_obj_as(
|
|
1020
|
+
type_=ActualErrorResponse, # type: ignore
|
|
1021
|
+
object_=_response.json(),
|
|
1022
|
+
),
|
|
1023
|
+
),
|
|
1024
|
+
)
|
|
451
1025
|
_response_json = _response.json()
|
|
452
1026
|
except JSONDecodeError:
|
|
453
1027
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
@@ -458,52 +1032,118 @@ class AsyncRawUserMemoryClient:
|
|
|
458
1032
|
*,
|
|
459
1033
|
tenant_id: str,
|
|
460
1034
|
query: str,
|
|
461
|
-
sub_tenant_id: str,
|
|
1035
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
462
1036
|
max_count: typing.Optional[int] = None,
|
|
1037
|
+
user_name: typing.Optional[str] = OMIT,
|
|
463
1038
|
request_options: typing.Optional[RequestOptions] = None,
|
|
464
|
-
) -> AsyncHttpResponse[
|
|
1039
|
+
) -> AsyncHttpResponse[RetrieveUserMemoryResponse]:
|
|
465
1040
|
"""
|
|
1041
|
+
Find relevant user memories using semantic search.
|
|
1042
|
+
|
|
1043
|
+
This endpoint performs a semantic search across all your stored user memories
|
|
1044
|
+
to find the most relevant ones based on your query. The results are ranked by
|
|
1045
|
+
similarity score, with the most relevant memories returned first.
|
|
1046
|
+
|
|
1047
|
+
Use this to recall past preferences, context, or information that might be
|
|
1048
|
+
relevant to your current task or query.
|
|
1049
|
+
|
|
466
1050
|
Parameters
|
|
467
1051
|
----------
|
|
468
1052
|
tenant_id : str
|
|
1053
|
+
Unique identifier for the tenant/organization
|
|
469
1054
|
|
|
470
1055
|
query : str
|
|
1056
|
+
Search query to find relevant user memories
|
|
471
1057
|
|
|
472
|
-
sub_tenant_id : str
|
|
1058
|
+
sub_tenant_id : typing.Optional[str]
|
|
1059
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
473
1060
|
|
|
474
1061
|
max_count : typing.Optional[int]
|
|
1062
|
+
Maximum number of memories to return (default: 5)
|
|
1063
|
+
|
|
1064
|
+
user_name : typing.Optional[str]
|
|
1065
|
+
User's name to enhance personalisation
|
|
475
1066
|
|
|
476
1067
|
request_options : typing.Optional[RequestOptions]
|
|
477
1068
|
Request-specific configuration.
|
|
478
1069
|
|
|
479
1070
|
Returns
|
|
480
1071
|
-------
|
|
481
|
-
AsyncHttpResponse[
|
|
1072
|
+
AsyncHttpResponse[RetrieveUserMemoryResponse]
|
|
482
1073
|
Successful Response
|
|
483
1074
|
"""
|
|
484
1075
|
_response = await self._client_wrapper.httpx_client.request(
|
|
485
1076
|
"user_memory/retrieve_user_memory",
|
|
486
|
-
method="
|
|
1077
|
+
method="POST",
|
|
487
1078
|
params={
|
|
488
1079
|
"tenant_id": tenant_id,
|
|
489
|
-
"query": query,
|
|
490
1080
|
"sub_tenant_id": sub_tenant_id,
|
|
491
1081
|
"max_count": max_count,
|
|
492
1082
|
},
|
|
1083
|
+
json={
|
|
1084
|
+
"query": query,
|
|
1085
|
+
"user_name": user_name,
|
|
1086
|
+
},
|
|
1087
|
+
headers={
|
|
1088
|
+
"content-type": "application/json",
|
|
1089
|
+
},
|
|
493
1090
|
request_options=request_options,
|
|
1091
|
+
omit=OMIT,
|
|
494
1092
|
)
|
|
495
1093
|
try:
|
|
496
|
-
if _response is None or not _response.text.strip():
|
|
497
|
-
return AsyncHttpResponse(response=_response, data=None)
|
|
498
1094
|
if 200 <= _response.status_code < 300:
|
|
499
1095
|
_data = typing.cast(
|
|
500
|
-
|
|
1096
|
+
RetrieveUserMemoryResponse,
|
|
501
1097
|
parse_obj_as(
|
|
502
|
-
type_=
|
|
1098
|
+
type_=RetrieveUserMemoryResponse, # type: ignore
|
|
503
1099
|
object_=_response.json(),
|
|
504
1100
|
),
|
|
505
1101
|
)
|
|
506
1102
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
1103
|
+
if _response.status_code == 400:
|
|
1104
|
+
raise BadRequestError(
|
|
1105
|
+
headers=dict(_response.headers),
|
|
1106
|
+
body=typing.cast(
|
|
1107
|
+
ActualErrorResponse,
|
|
1108
|
+
parse_obj_as(
|
|
1109
|
+
type_=ActualErrorResponse, # type: ignore
|
|
1110
|
+
object_=_response.json(),
|
|
1111
|
+
),
|
|
1112
|
+
),
|
|
1113
|
+
)
|
|
1114
|
+
if _response.status_code == 401:
|
|
1115
|
+
raise UnauthorizedError(
|
|
1116
|
+
headers=dict(_response.headers),
|
|
1117
|
+
body=typing.cast(
|
|
1118
|
+
ActualErrorResponse,
|
|
1119
|
+
parse_obj_as(
|
|
1120
|
+
type_=ActualErrorResponse, # type: ignore
|
|
1121
|
+
object_=_response.json(),
|
|
1122
|
+
),
|
|
1123
|
+
),
|
|
1124
|
+
)
|
|
1125
|
+
if _response.status_code == 403:
|
|
1126
|
+
raise ForbiddenError(
|
|
1127
|
+
headers=dict(_response.headers),
|
|
1128
|
+
body=typing.cast(
|
|
1129
|
+
ActualErrorResponse,
|
|
1130
|
+
parse_obj_as(
|
|
1131
|
+
type_=ActualErrorResponse, # type: ignore
|
|
1132
|
+
object_=_response.json(),
|
|
1133
|
+
),
|
|
1134
|
+
),
|
|
1135
|
+
)
|
|
1136
|
+
if _response.status_code == 404:
|
|
1137
|
+
raise NotFoundError(
|
|
1138
|
+
headers=dict(_response.headers),
|
|
1139
|
+
body=typing.cast(
|
|
1140
|
+
ActualErrorResponse,
|
|
1141
|
+
parse_obj_as(
|
|
1142
|
+
type_=ActualErrorResponse, # type: ignore
|
|
1143
|
+
object_=_response.json(),
|
|
1144
|
+
),
|
|
1145
|
+
),
|
|
1146
|
+
)
|
|
507
1147
|
if _response.status_code == 422:
|
|
508
1148
|
raise UnprocessableEntityError(
|
|
509
1149
|
headers=dict(_response.headers),
|
|
@@ -515,6 +1155,28 @@ class AsyncRawUserMemoryClient:
|
|
|
515
1155
|
),
|
|
516
1156
|
),
|
|
517
1157
|
)
|
|
1158
|
+
if _response.status_code == 500:
|
|
1159
|
+
raise InternalServerError(
|
|
1160
|
+
headers=dict(_response.headers),
|
|
1161
|
+
body=typing.cast(
|
|
1162
|
+
ActualErrorResponse,
|
|
1163
|
+
parse_obj_as(
|
|
1164
|
+
type_=ActualErrorResponse, # type: ignore
|
|
1165
|
+
object_=_response.json(),
|
|
1166
|
+
),
|
|
1167
|
+
),
|
|
1168
|
+
)
|
|
1169
|
+
if _response.status_code == 503:
|
|
1170
|
+
raise ServiceUnavailableError(
|
|
1171
|
+
headers=dict(_response.headers),
|
|
1172
|
+
body=typing.cast(
|
|
1173
|
+
ActualErrorResponse,
|
|
1174
|
+
parse_obj_as(
|
|
1175
|
+
type_=ActualErrorResponse, # type: ignore
|
|
1176
|
+
object_=_response.json(),
|
|
1177
|
+
),
|
|
1178
|
+
),
|
|
1179
|
+
)
|
|
518
1180
|
_response_json = _response.json()
|
|
519
1181
|
except JSONDecodeError:
|
|
520
1182
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
@@ -524,28 +1186,41 @@ class AsyncRawUserMemoryClient:
|
|
|
524
1186
|
self,
|
|
525
1187
|
*,
|
|
526
1188
|
tenant_id: str,
|
|
527
|
-
|
|
1189
|
+
user_message: str,
|
|
528
1190
|
user_name: str,
|
|
529
|
-
sub_tenant_id: str,
|
|
1191
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
530
1192
|
request_options: typing.Optional[RequestOptions] = None,
|
|
531
|
-
) -> AsyncHttpResponse[
|
|
1193
|
+
) -> AsyncHttpResponse[GenerateUserMemoryResponse]:
|
|
532
1194
|
"""
|
|
1195
|
+
Generate AI-powered user memories from your query and context.
|
|
1196
|
+
|
|
1197
|
+
This endpoint uses artificial intelligence to create personalized memories
|
|
1198
|
+
based on your query and user context. The AI analyzes your input and generates
|
|
1199
|
+
relevant, contextual memories that can help improve future interactions.
|
|
1200
|
+
|
|
1201
|
+
Generated memories are automatically stored and can be retrieved through
|
|
1202
|
+
the standard memory search endpoints.
|
|
1203
|
+
|
|
533
1204
|
Parameters
|
|
534
1205
|
----------
|
|
535
1206
|
tenant_id : str
|
|
1207
|
+
Unique identifier for the tenant/organization
|
|
536
1208
|
|
|
537
|
-
|
|
1209
|
+
user_message : str
|
|
1210
|
+
Your query or context for AI memory generation
|
|
538
1211
|
|
|
539
1212
|
user_name : str
|
|
1213
|
+
Your name to personalize the generated memories
|
|
540
1214
|
|
|
541
|
-
sub_tenant_id : str
|
|
1215
|
+
sub_tenant_id : typing.Optional[str]
|
|
1216
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
542
1217
|
|
|
543
1218
|
request_options : typing.Optional[RequestOptions]
|
|
544
1219
|
Request-specific configuration.
|
|
545
1220
|
|
|
546
1221
|
Returns
|
|
547
1222
|
-------
|
|
548
|
-
AsyncHttpResponse[
|
|
1223
|
+
AsyncHttpResponse[GenerateUserMemoryResponse]
|
|
549
1224
|
Successful Response
|
|
550
1225
|
"""
|
|
551
1226
|
_response = await self._client_wrapper.httpx_client.request(
|
|
@@ -553,24 +1228,72 @@ class AsyncRawUserMemoryClient:
|
|
|
553
1228
|
method="POST",
|
|
554
1229
|
params={
|
|
555
1230
|
"tenant_id": tenant_id,
|
|
556
|
-
"user_query": user_query,
|
|
557
|
-
"user_name": user_name,
|
|
558
1231
|
"sub_tenant_id": sub_tenant_id,
|
|
559
1232
|
},
|
|
1233
|
+
json={
|
|
1234
|
+
"user_message": user_message,
|
|
1235
|
+
"user_name": user_name,
|
|
1236
|
+
},
|
|
1237
|
+
headers={
|
|
1238
|
+
"content-type": "application/json",
|
|
1239
|
+
},
|
|
560
1240
|
request_options=request_options,
|
|
1241
|
+
omit=OMIT,
|
|
561
1242
|
)
|
|
562
1243
|
try:
|
|
563
|
-
if _response is None or not _response.text.strip():
|
|
564
|
-
return AsyncHttpResponse(response=_response, data=None)
|
|
565
1244
|
if 200 <= _response.status_code < 300:
|
|
566
1245
|
_data = typing.cast(
|
|
567
|
-
|
|
1246
|
+
GenerateUserMemoryResponse,
|
|
568
1247
|
parse_obj_as(
|
|
569
|
-
type_=
|
|
1248
|
+
type_=GenerateUserMemoryResponse, # type: ignore
|
|
570
1249
|
object_=_response.json(),
|
|
571
1250
|
),
|
|
572
1251
|
)
|
|
573
1252
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
1253
|
+
if _response.status_code == 400:
|
|
1254
|
+
raise BadRequestError(
|
|
1255
|
+
headers=dict(_response.headers),
|
|
1256
|
+
body=typing.cast(
|
|
1257
|
+
ActualErrorResponse,
|
|
1258
|
+
parse_obj_as(
|
|
1259
|
+
type_=ActualErrorResponse, # type: ignore
|
|
1260
|
+
object_=_response.json(),
|
|
1261
|
+
),
|
|
1262
|
+
),
|
|
1263
|
+
)
|
|
1264
|
+
if _response.status_code == 401:
|
|
1265
|
+
raise UnauthorizedError(
|
|
1266
|
+
headers=dict(_response.headers),
|
|
1267
|
+
body=typing.cast(
|
|
1268
|
+
ActualErrorResponse,
|
|
1269
|
+
parse_obj_as(
|
|
1270
|
+
type_=ActualErrorResponse, # type: ignore
|
|
1271
|
+
object_=_response.json(),
|
|
1272
|
+
),
|
|
1273
|
+
),
|
|
1274
|
+
)
|
|
1275
|
+
if _response.status_code == 403:
|
|
1276
|
+
raise ForbiddenError(
|
|
1277
|
+
headers=dict(_response.headers),
|
|
1278
|
+
body=typing.cast(
|
|
1279
|
+
ActualErrorResponse,
|
|
1280
|
+
parse_obj_as(
|
|
1281
|
+
type_=ActualErrorResponse, # type: ignore
|
|
1282
|
+
object_=_response.json(),
|
|
1283
|
+
),
|
|
1284
|
+
),
|
|
1285
|
+
)
|
|
1286
|
+
if _response.status_code == 404:
|
|
1287
|
+
raise NotFoundError(
|
|
1288
|
+
headers=dict(_response.headers),
|
|
1289
|
+
body=typing.cast(
|
|
1290
|
+
ActualErrorResponse,
|
|
1291
|
+
parse_obj_as(
|
|
1292
|
+
type_=ActualErrorResponse, # type: ignore
|
|
1293
|
+
object_=_response.json(),
|
|
1294
|
+
),
|
|
1295
|
+
),
|
|
1296
|
+
)
|
|
574
1297
|
if _response.status_code == 422:
|
|
575
1298
|
raise UnprocessableEntityError(
|
|
576
1299
|
headers=dict(_response.headers),
|
|
@@ -582,6 +1305,28 @@ class AsyncRawUserMemoryClient:
|
|
|
582
1305
|
),
|
|
583
1306
|
),
|
|
584
1307
|
)
|
|
1308
|
+
if _response.status_code == 500:
|
|
1309
|
+
raise InternalServerError(
|
|
1310
|
+
headers=dict(_response.headers),
|
|
1311
|
+
body=typing.cast(
|
|
1312
|
+
ActualErrorResponse,
|
|
1313
|
+
parse_obj_as(
|
|
1314
|
+
type_=ActualErrorResponse, # type: ignore
|
|
1315
|
+
object_=_response.json(),
|
|
1316
|
+
),
|
|
1317
|
+
),
|
|
1318
|
+
)
|
|
1319
|
+
if _response.status_code == 503:
|
|
1320
|
+
raise ServiceUnavailableError(
|
|
1321
|
+
headers=dict(_response.headers),
|
|
1322
|
+
body=typing.cast(
|
|
1323
|
+
ActualErrorResponse,
|
|
1324
|
+
parse_obj_as(
|
|
1325
|
+
type_=ActualErrorResponse, # type: ignore
|
|
1326
|
+
object_=_response.json(),
|
|
1327
|
+
),
|
|
1328
|
+
),
|
|
1329
|
+
)
|
|
585
1330
|
_response_json = _response.json()
|
|
586
1331
|
except JSONDecodeError:
|
|
587
1332
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
@@ -592,24 +1337,36 @@ class AsyncRawUserMemoryClient:
|
|
|
592
1337
|
*,
|
|
593
1338
|
tenant_id: str,
|
|
594
1339
|
user_memory: str,
|
|
595
|
-
sub_tenant_id: str,
|
|
1340
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
596
1341
|
request_options: typing.Optional[RequestOptions] = None,
|
|
597
|
-
) -> AsyncHttpResponse[
|
|
1342
|
+
) -> AsyncHttpResponse[AddUserMemoryResponse]:
|
|
598
1343
|
"""
|
|
1344
|
+
Store a new user memory for future reference.
|
|
1345
|
+
|
|
1346
|
+
This endpoint allows you to manually add a memory that will be stored and
|
|
1347
|
+
can be retrieved later through memory search. Use this to save important
|
|
1348
|
+
preferences, context, or information that you want the system to remember.
|
|
1349
|
+
|
|
1350
|
+
The stored memory will be indexed and available for semantic search, making
|
|
1351
|
+
it accessible when relevant to future queries or interactions.
|
|
1352
|
+
|
|
599
1353
|
Parameters
|
|
600
1354
|
----------
|
|
601
1355
|
tenant_id : str
|
|
1356
|
+
Unique identifier for the tenant/organization
|
|
602
1357
|
|
|
603
1358
|
user_memory : str
|
|
1359
|
+
The memory content to store for future reference
|
|
604
1360
|
|
|
605
|
-
sub_tenant_id : str
|
|
1361
|
+
sub_tenant_id : typing.Optional[str]
|
|
1362
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
606
1363
|
|
|
607
1364
|
request_options : typing.Optional[RequestOptions]
|
|
608
1365
|
Request-specific configuration.
|
|
609
1366
|
|
|
610
1367
|
Returns
|
|
611
1368
|
-------
|
|
612
|
-
AsyncHttpResponse[
|
|
1369
|
+
AsyncHttpResponse[AddUserMemoryResponse]
|
|
613
1370
|
Successful Response
|
|
614
1371
|
"""
|
|
615
1372
|
_response = await self._client_wrapper.httpx_client.request(
|
|
@@ -617,23 +1374,71 @@ class AsyncRawUserMemoryClient:
|
|
|
617
1374
|
method="POST",
|
|
618
1375
|
params={
|
|
619
1376
|
"tenant_id": tenant_id,
|
|
620
|
-
"user_memory": user_memory,
|
|
621
1377
|
"sub_tenant_id": sub_tenant_id,
|
|
622
1378
|
},
|
|
1379
|
+
json={
|
|
1380
|
+
"user_memory": user_memory,
|
|
1381
|
+
},
|
|
1382
|
+
headers={
|
|
1383
|
+
"content-type": "application/json",
|
|
1384
|
+
},
|
|
623
1385
|
request_options=request_options,
|
|
1386
|
+
omit=OMIT,
|
|
624
1387
|
)
|
|
625
1388
|
try:
|
|
626
|
-
if _response is None or not _response.text.strip():
|
|
627
|
-
return AsyncHttpResponse(response=_response, data=None)
|
|
628
1389
|
if 200 <= _response.status_code < 300:
|
|
629
1390
|
_data = typing.cast(
|
|
630
|
-
|
|
1391
|
+
AddUserMemoryResponse,
|
|
631
1392
|
parse_obj_as(
|
|
632
|
-
type_=
|
|
1393
|
+
type_=AddUserMemoryResponse, # type: ignore
|
|
633
1394
|
object_=_response.json(),
|
|
634
1395
|
),
|
|
635
1396
|
)
|
|
636
1397
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
1398
|
+
if _response.status_code == 400:
|
|
1399
|
+
raise BadRequestError(
|
|
1400
|
+
headers=dict(_response.headers),
|
|
1401
|
+
body=typing.cast(
|
|
1402
|
+
ActualErrorResponse,
|
|
1403
|
+
parse_obj_as(
|
|
1404
|
+
type_=ActualErrorResponse, # type: ignore
|
|
1405
|
+
object_=_response.json(),
|
|
1406
|
+
),
|
|
1407
|
+
),
|
|
1408
|
+
)
|
|
1409
|
+
if _response.status_code == 401:
|
|
1410
|
+
raise UnauthorizedError(
|
|
1411
|
+
headers=dict(_response.headers),
|
|
1412
|
+
body=typing.cast(
|
|
1413
|
+
ActualErrorResponse,
|
|
1414
|
+
parse_obj_as(
|
|
1415
|
+
type_=ActualErrorResponse, # type: ignore
|
|
1416
|
+
object_=_response.json(),
|
|
1417
|
+
),
|
|
1418
|
+
),
|
|
1419
|
+
)
|
|
1420
|
+
if _response.status_code == 403:
|
|
1421
|
+
raise ForbiddenError(
|
|
1422
|
+
headers=dict(_response.headers),
|
|
1423
|
+
body=typing.cast(
|
|
1424
|
+
ActualErrorResponse,
|
|
1425
|
+
parse_obj_as(
|
|
1426
|
+
type_=ActualErrorResponse, # type: ignore
|
|
1427
|
+
object_=_response.json(),
|
|
1428
|
+
),
|
|
1429
|
+
),
|
|
1430
|
+
)
|
|
1431
|
+
if _response.status_code == 404:
|
|
1432
|
+
raise NotFoundError(
|
|
1433
|
+
headers=dict(_response.headers),
|
|
1434
|
+
body=typing.cast(
|
|
1435
|
+
ActualErrorResponse,
|
|
1436
|
+
parse_obj_as(
|
|
1437
|
+
type_=ActualErrorResponse, # type: ignore
|
|
1438
|
+
object_=_response.json(),
|
|
1439
|
+
),
|
|
1440
|
+
),
|
|
1441
|
+
)
|
|
637
1442
|
if _response.status_code == 422:
|
|
638
1443
|
raise UnprocessableEntityError(
|
|
639
1444
|
headers=dict(_response.headers),
|
|
@@ -645,6 +1450,28 @@ class AsyncRawUserMemoryClient:
|
|
|
645
1450
|
),
|
|
646
1451
|
),
|
|
647
1452
|
)
|
|
1453
|
+
if _response.status_code == 500:
|
|
1454
|
+
raise InternalServerError(
|
|
1455
|
+
headers=dict(_response.headers),
|
|
1456
|
+
body=typing.cast(
|
|
1457
|
+
ActualErrorResponse,
|
|
1458
|
+
parse_obj_as(
|
|
1459
|
+
type_=ActualErrorResponse, # type: ignore
|
|
1460
|
+
object_=_response.json(),
|
|
1461
|
+
),
|
|
1462
|
+
),
|
|
1463
|
+
)
|
|
1464
|
+
if _response.status_code == 503:
|
|
1465
|
+
raise ServiceUnavailableError(
|
|
1466
|
+
headers=dict(_response.headers),
|
|
1467
|
+
body=typing.cast(
|
|
1468
|
+
ActualErrorResponse,
|
|
1469
|
+
parse_obj_as(
|
|
1470
|
+
type_=ActualErrorResponse, # type: ignore
|
|
1471
|
+
object_=_response.json(),
|
|
1472
|
+
),
|
|
1473
|
+
),
|
|
1474
|
+
)
|
|
648
1475
|
_response_json = _response.json()
|
|
649
1476
|
except JSONDecodeError:
|
|
650
1477
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|