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