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
|
@@ -16,6 +16,8 @@ from ..errors.service_unavailable_error import ServiceUnavailableError
|
|
|
16
16
|
from ..errors.unauthorized_error import UnauthorizedError
|
|
17
17
|
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
18
18
|
from ..types.actual_error_response import ActualErrorResponse
|
|
19
|
+
from ..types.delete_sub_tenant_data import DeleteSubTenantData
|
|
20
|
+
from ..types.sub_tenant_ids_data import SubTenantIdsData
|
|
19
21
|
from ..types.tenant_stats import TenantStats
|
|
20
22
|
|
|
21
23
|
|
|
@@ -31,15 +33,21 @@ class RawTenantClient:
|
|
|
31
33
|
request_options: typing.Optional[RequestOptions] = None,
|
|
32
34
|
) -> HttpResponse[TenantStats]:
|
|
33
35
|
"""
|
|
34
|
-
|
|
36
|
+
Retrieve usage stats for your tenant.
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
Use this endpoint to check whether a tenant exists and view core metrics like total indexed objects and vector dimension. This helps you validate setup and monitor ingestion.
|
|
39
|
+
|
|
40
|
+
Expected outcome
|
|
41
|
+
- You receive the current object count and vector dimension for the tenant.
|
|
42
|
+
- If the tenant does not exist, you get a not-found error.
|
|
37
43
|
|
|
38
44
|
Parameters
|
|
39
45
|
----------
|
|
40
46
|
tenant_id : str
|
|
47
|
+
Unique identifier for the tenant/organization
|
|
41
48
|
|
|
42
49
|
sub_tenant_id : typing.Optional[str]
|
|
50
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
43
51
|
|
|
44
52
|
request_options : typing.Optional[RequestOptions]
|
|
45
53
|
Request-specific configuration.
|
|
@@ -150,6 +158,248 @@ class RawTenantClient:
|
|
|
150
158
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
151
159
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
152
160
|
|
|
161
|
+
def get_sub_tenant_ids(
|
|
162
|
+
self, *, tenant_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
163
|
+
) -> HttpResponse[SubTenantIdsData]:
|
|
164
|
+
"""
|
|
165
|
+
Retrieve all sub-tenant IDs contained within a specific tenant. Fetches the sub-tenant IDs directly from the underlying data store.
|
|
166
|
+
|
|
167
|
+
Parameters
|
|
168
|
+
----------
|
|
169
|
+
tenant_id : str
|
|
170
|
+
|
|
171
|
+
request_options : typing.Optional[RequestOptions]
|
|
172
|
+
Request-specific configuration.
|
|
173
|
+
|
|
174
|
+
Returns
|
|
175
|
+
-------
|
|
176
|
+
HttpResponse[SubTenantIdsData]
|
|
177
|
+
Successful Response
|
|
178
|
+
"""
|
|
179
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
180
|
+
"tenant/sub_tenant_ids",
|
|
181
|
+
method="GET",
|
|
182
|
+
params={
|
|
183
|
+
"tenant_id": tenant_id,
|
|
184
|
+
},
|
|
185
|
+
request_options=request_options,
|
|
186
|
+
)
|
|
187
|
+
try:
|
|
188
|
+
if 200 <= _response.status_code < 300:
|
|
189
|
+
_data = typing.cast(
|
|
190
|
+
SubTenantIdsData,
|
|
191
|
+
parse_obj_as(
|
|
192
|
+
type_=SubTenantIdsData, # type: ignore
|
|
193
|
+
object_=_response.json(),
|
|
194
|
+
),
|
|
195
|
+
)
|
|
196
|
+
return HttpResponse(response=_response, data=_data)
|
|
197
|
+
if _response.status_code == 400:
|
|
198
|
+
raise BadRequestError(
|
|
199
|
+
headers=dict(_response.headers),
|
|
200
|
+
body=typing.cast(
|
|
201
|
+
ActualErrorResponse,
|
|
202
|
+
parse_obj_as(
|
|
203
|
+
type_=ActualErrorResponse, # type: ignore
|
|
204
|
+
object_=_response.json(),
|
|
205
|
+
),
|
|
206
|
+
),
|
|
207
|
+
)
|
|
208
|
+
if _response.status_code == 401:
|
|
209
|
+
raise UnauthorizedError(
|
|
210
|
+
headers=dict(_response.headers),
|
|
211
|
+
body=typing.cast(
|
|
212
|
+
ActualErrorResponse,
|
|
213
|
+
parse_obj_as(
|
|
214
|
+
type_=ActualErrorResponse, # type: ignore
|
|
215
|
+
object_=_response.json(),
|
|
216
|
+
),
|
|
217
|
+
),
|
|
218
|
+
)
|
|
219
|
+
if _response.status_code == 403:
|
|
220
|
+
raise ForbiddenError(
|
|
221
|
+
headers=dict(_response.headers),
|
|
222
|
+
body=typing.cast(
|
|
223
|
+
ActualErrorResponse,
|
|
224
|
+
parse_obj_as(
|
|
225
|
+
type_=ActualErrorResponse, # type: ignore
|
|
226
|
+
object_=_response.json(),
|
|
227
|
+
),
|
|
228
|
+
),
|
|
229
|
+
)
|
|
230
|
+
if _response.status_code == 404:
|
|
231
|
+
raise NotFoundError(
|
|
232
|
+
headers=dict(_response.headers),
|
|
233
|
+
body=typing.cast(
|
|
234
|
+
ActualErrorResponse,
|
|
235
|
+
parse_obj_as(
|
|
236
|
+
type_=ActualErrorResponse, # type: ignore
|
|
237
|
+
object_=_response.json(),
|
|
238
|
+
),
|
|
239
|
+
),
|
|
240
|
+
)
|
|
241
|
+
if _response.status_code == 422:
|
|
242
|
+
raise UnprocessableEntityError(
|
|
243
|
+
headers=dict(_response.headers),
|
|
244
|
+
body=typing.cast(
|
|
245
|
+
typing.Optional[typing.Any],
|
|
246
|
+
parse_obj_as(
|
|
247
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
248
|
+
object_=_response.json(),
|
|
249
|
+
),
|
|
250
|
+
),
|
|
251
|
+
)
|
|
252
|
+
if _response.status_code == 500:
|
|
253
|
+
raise InternalServerError(
|
|
254
|
+
headers=dict(_response.headers),
|
|
255
|
+
body=typing.cast(
|
|
256
|
+
ActualErrorResponse,
|
|
257
|
+
parse_obj_as(
|
|
258
|
+
type_=ActualErrorResponse, # type: ignore
|
|
259
|
+
object_=_response.json(),
|
|
260
|
+
),
|
|
261
|
+
),
|
|
262
|
+
)
|
|
263
|
+
if _response.status_code == 503:
|
|
264
|
+
raise ServiceUnavailableError(
|
|
265
|
+
headers=dict(_response.headers),
|
|
266
|
+
body=typing.cast(
|
|
267
|
+
ActualErrorResponse,
|
|
268
|
+
parse_obj_as(
|
|
269
|
+
type_=ActualErrorResponse, # type: ignore
|
|
270
|
+
object_=_response.json(),
|
|
271
|
+
),
|
|
272
|
+
),
|
|
273
|
+
)
|
|
274
|
+
_response_json = _response.json()
|
|
275
|
+
except JSONDecodeError:
|
|
276
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
277
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
278
|
+
|
|
279
|
+
def delete_sub_tenant(
|
|
280
|
+
self, *, tenant_id: str, sub_tenant_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
281
|
+
) -> HttpResponse[DeleteSubTenantData]:
|
|
282
|
+
"""
|
|
283
|
+
Delete a sub-tenant from a given tenant.
|
|
284
|
+
|
|
285
|
+
This endpoint deletes a specific sub-tenant from the specified tenant.
|
|
286
|
+
It validates that the sub-tenant is not the primary/default sub-tenant before deletion.
|
|
287
|
+
|
|
288
|
+
Parameters
|
|
289
|
+
----------
|
|
290
|
+
tenant_id : str
|
|
291
|
+
|
|
292
|
+
sub_tenant_id : str
|
|
293
|
+
|
|
294
|
+
request_options : typing.Optional[RequestOptions]
|
|
295
|
+
Request-specific configuration.
|
|
296
|
+
|
|
297
|
+
Returns
|
|
298
|
+
-------
|
|
299
|
+
HttpResponse[DeleteSubTenantData]
|
|
300
|
+
Successful Response
|
|
301
|
+
"""
|
|
302
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
303
|
+
"tenant/delete_sub_tenant",
|
|
304
|
+
method="DELETE",
|
|
305
|
+
params={
|
|
306
|
+
"tenant_id": tenant_id,
|
|
307
|
+
"sub_tenant_id": sub_tenant_id,
|
|
308
|
+
},
|
|
309
|
+
request_options=request_options,
|
|
310
|
+
)
|
|
311
|
+
try:
|
|
312
|
+
if 200 <= _response.status_code < 300:
|
|
313
|
+
_data = typing.cast(
|
|
314
|
+
DeleteSubTenantData,
|
|
315
|
+
parse_obj_as(
|
|
316
|
+
type_=DeleteSubTenantData, # type: ignore
|
|
317
|
+
object_=_response.json(),
|
|
318
|
+
),
|
|
319
|
+
)
|
|
320
|
+
return HttpResponse(response=_response, data=_data)
|
|
321
|
+
if _response.status_code == 400:
|
|
322
|
+
raise BadRequestError(
|
|
323
|
+
headers=dict(_response.headers),
|
|
324
|
+
body=typing.cast(
|
|
325
|
+
ActualErrorResponse,
|
|
326
|
+
parse_obj_as(
|
|
327
|
+
type_=ActualErrorResponse, # type: ignore
|
|
328
|
+
object_=_response.json(),
|
|
329
|
+
),
|
|
330
|
+
),
|
|
331
|
+
)
|
|
332
|
+
if _response.status_code == 401:
|
|
333
|
+
raise UnauthorizedError(
|
|
334
|
+
headers=dict(_response.headers),
|
|
335
|
+
body=typing.cast(
|
|
336
|
+
ActualErrorResponse,
|
|
337
|
+
parse_obj_as(
|
|
338
|
+
type_=ActualErrorResponse, # type: ignore
|
|
339
|
+
object_=_response.json(),
|
|
340
|
+
),
|
|
341
|
+
),
|
|
342
|
+
)
|
|
343
|
+
if _response.status_code == 403:
|
|
344
|
+
raise ForbiddenError(
|
|
345
|
+
headers=dict(_response.headers),
|
|
346
|
+
body=typing.cast(
|
|
347
|
+
ActualErrorResponse,
|
|
348
|
+
parse_obj_as(
|
|
349
|
+
type_=ActualErrorResponse, # type: ignore
|
|
350
|
+
object_=_response.json(),
|
|
351
|
+
),
|
|
352
|
+
),
|
|
353
|
+
)
|
|
354
|
+
if _response.status_code == 404:
|
|
355
|
+
raise NotFoundError(
|
|
356
|
+
headers=dict(_response.headers),
|
|
357
|
+
body=typing.cast(
|
|
358
|
+
ActualErrorResponse,
|
|
359
|
+
parse_obj_as(
|
|
360
|
+
type_=ActualErrorResponse, # type: ignore
|
|
361
|
+
object_=_response.json(),
|
|
362
|
+
),
|
|
363
|
+
),
|
|
364
|
+
)
|
|
365
|
+
if _response.status_code == 422:
|
|
366
|
+
raise UnprocessableEntityError(
|
|
367
|
+
headers=dict(_response.headers),
|
|
368
|
+
body=typing.cast(
|
|
369
|
+
typing.Optional[typing.Any],
|
|
370
|
+
parse_obj_as(
|
|
371
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
372
|
+
object_=_response.json(),
|
|
373
|
+
),
|
|
374
|
+
),
|
|
375
|
+
)
|
|
376
|
+
if _response.status_code == 500:
|
|
377
|
+
raise InternalServerError(
|
|
378
|
+
headers=dict(_response.headers),
|
|
379
|
+
body=typing.cast(
|
|
380
|
+
ActualErrorResponse,
|
|
381
|
+
parse_obj_as(
|
|
382
|
+
type_=ActualErrorResponse, # type: ignore
|
|
383
|
+
object_=_response.json(),
|
|
384
|
+
),
|
|
385
|
+
),
|
|
386
|
+
)
|
|
387
|
+
if _response.status_code == 503:
|
|
388
|
+
raise ServiceUnavailableError(
|
|
389
|
+
headers=dict(_response.headers),
|
|
390
|
+
body=typing.cast(
|
|
391
|
+
ActualErrorResponse,
|
|
392
|
+
parse_obj_as(
|
|
393
|
+
type_=ActualErrorResponse, # type: ignore
|
|
394
|
+
object_=_response.json(),
|
|
395
|
+
),
|
|
396
|
+
),
|
|
397
|
+
)
|
|
398
|
+
_response_json = _response.json()
|
|
399
|
+
except JSONDecodeError:
|
|
400
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
401
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
402
|
+
|
|
153
403
|
|
|
154
404
|
class AsyncRawTenantClient:
|
|
155
405
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -163,15 +413,21 @@ class AsyncRawTenantClient:
|
|
|
163
413
|
request_options: typing.Optional[RequestOptions] = None,
|
|
164
414
|
) -> AsyncHttpResponse[TenantStats]:
|
|
165
415
|
"""
|
|
166
|
-
|
|
416
|
+
Retrieve usage stats for your tenant.
|
|
167
417
|
|
|
168
|
-
|
|
418
|
+
Use this endpoint to check whether a tenant exists and view core metrics like total indexed objects and vector dimension. This helps you validate setup and monitor ingestion.
|
|
419
|
+
|
|
420
|
+
Expected outcome
|
|
421
|
+
- You receive the current object count and vector dimension for the tenant.
|
|
422
|
+
- If the tenant does not exist, you get a not-found error.
|
|
169
423
|
|
|
170
424
|
Parameters
|
|
171
425
|
----------
|
|
172
426
|
tenant_id : str
|
|
427
|
+
Unique identifier for the tenant/organization
|
|
173
428
|
|
|
174
429
|
sub_tenant_id : typing.Optional[str]
|
|
430
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
175
431
|
|
|
176
432
|
request_options : typing.Optional[RequestOptions]
|
|
177
433
|
Request-specific configuration.
|
|
@@ -281,3 +537,245 @@ class AsyncRawTenantClient:
|
|
|
281
537
|
except JSONDecodeError:
|
|
282
538
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
283
539
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
540
|
+
|
|
541
|
+
async def get_sub_tenant_ids(
|
|
542
|
+
self, *, tenant_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
543
|
+
) -> AsyncHttpResponse[SubTenantIdsData]:
|
|
544
|
+
"""
|
|
545
|
+
Retrieve all sub-tenant IDs contained within a specific tenant. Fetches the sub-tenant IDs directly from the underlying data store.
|
|
546
|
+
|
|
547
|
+
Parameters
|
|
548
|
+
----------
|
|
549
|
+
tenant_id : str
|
|
550
|
+
|
|
551
|
+
request_options : typing.Optional[RequestOptions]
|
|
552
|
+
Request-specific configuration.
|
|
553
|
+
|
|
554
|
+
Returns
|
|
555
|
+
-------
|
|
556
|
+
AsyncHttpResponse[SubTenantIdsData]
|
|
557
|
+
Successful Response
|
|
558
|
+
"""
|
|
559
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
560
|
+
"tenant/sub_tenant_ids",
|
|
561
|
+
method="GET",
|
|
562
|
+
params={
|
|
563
|
+
"tenant_id": tenant_id,
|
|
564
|
+
},
|
|
565
|
+
request_options=request_options,
|
|
566
|
+
)
|
|
567
|
+
try:
|
|
568
|
+
if 200 <= _response.status_code < 300:
|
|
569
|
+
_data = typing.cast(
|
|
570
|
+
SubTenantIdsData,
|
|
571
|
+
parse_obj_as(
|
|
572
|
+
type_=SubTenantIdsData, # type: ignore
|
|
573
|
+
object_=_response.json(),
|
|
574
|
+
),
|
|
575
|
+
)
|
|
576
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
577
|
+
if _response.status_code == 400:
|
|
578
|
+
raise BadRequestError(
|
|
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 == 401:
|
|
589
|
+
raise UnauthorizedError(
|
|
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
|
+
)
|
|
599
|
+
if _response.status_code == 403:
|
|
600
|
+
raise ForbiddenError(
|
|
601
|
+
headers=dict(_response.headers),
|
|
602
|
+
body=typing.cast(
|
|
603
|
+
ActualErrorResponse,
|
|
604
|
+
parse_obj_as(
|
|
605
|
+
type_=ActualErrorResponse, # type: ignore
|
|
606
|
+
object_=_response.json(),
|
|
607
|
+
),
|
|
608
|
+
),
|
|
609
|
+
)
|
|
610
|
+
if _response.status_code == 404:
|
|
611
|
+
raise NotFoundError(
|
|
612
|
+
headers=dict(_response.headers),
|
|
613
|
+
body=typing.cast(
|
|
614
|
+
ActualErrorResponse,
|
|
615
|
+
parse_obj_as(
|
|
616
|
+
type_=ActualErrorResponse, # type: ignore
|
|
617
|
+
object_=_response.json(),
|
|
618
|
+
),
|
|
619
|
+
),
|
|
620
|
+
)
|
|
621
|
+
if _response.status_code == 422:
|
|
622
|
+
raise UnprocessableEntityError(
|
|
623
|
+
headers=dict(_response.headers),
|
|
624
|
+
body=typing.cast(
|
|
625
|
+
typing.Optional[typing.Any],
|
|
626
|
+
parse_obj_as(
|
|
627
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
628
|
+
object_=_response.json(),
|
|
629
|
+
),
|
|
630
|
+
),
|
|
631
|
+
)
|
|
632
|
+
if _response.status_code == 500:
|
|
633
|
+
raise InternalServerError(
|
|
634
|
+
headers=dict(_response.headers),
|
|
635
|
+
body=typing.cast(
|
|
636
|
+
ActualErrorResponse,
|
|
637
|
+
parse_obj_as(
|
|
638
|
+
type_=ActualErrorResponse, # type: ignore
|
|
639
|
+
object_=_response.json(),
|
|
640
|
+
),
|
|
641
|
+
),
|
|
642
|
+
)
|
|
643
|
+
if _response.status_code == 503:
|
|
644
|
+
raise ServiceUnavailableError(
|
|
645
|
+
headers=dict(_response.headers),
|
|
646
|
+
body=typing.cast(
|
|
647
|
+
ActualErrorResponse,
|
|
648
|
+
parse_obj_as(
|
|
649
|
+
type_=ActualErrorResponse, # type: ignore
|
|
650
|
+
object_=_response.json(),
|
|
651
|
+
),
|
|
652
|
+
),
|
|
653
|
+
)
|
|
654
|
+
_response_json = _response.json()
|
|
655
|
+
except JSONDecodeError:
|
|
656
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
657
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
658
|
+
|
|
659
|
+
async def delete_sub_tenant(
|
|
660
|
+
self, *, tenant_id: str, sub_tenant_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
661
|
+
) -> AsyncHttpResponse[DeleteSubTenantData]:
|
|
662
|
+
"""
|
|
663
|
+
Delete a sub-tenant from a given tenant.
|
|
664
|
+
|
|
665
|
+
This endpoint deletes a specific sub-tenant from the specified tenant.
|
|
666
|
+
It validates that the sub-tenant is not the primary/default sub-tenant before deletion.
|
|
667
|
+
|
|
668
|
+
Parameters
|
|
669
|
+
----------
|
|
670
|
+
tenant_id : str
|
|
671
|
+
|
|
672
|
+
sub_tenant_id : str
|
|
673
|
+
|
|
674
|
+
request_options : typing.Optional[RequestOptions]
|
|
675
|
+
Request-specific configuration.
|
|
676
|
+
|
|
677
|
+
Returns
|
|
678
|
+
-------
|
|
679
|
+
AsyncHttpResponse[DeleteSubTenantData]
|
|
680
|
+
Successful Response
|
|
681
|
+
"""
|
|
682
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
683
|
+
"tenant/delete_sub_tenant",
|
|
684
|
+
method="DELETE",
|
|
685
|
+
params={
|
|
686
|
+
"tenant_id": tenant_id,
|
|
687
|
+
"sub_tenant_id": sub_tenant_id,
|
|
688
|
+
},
|
|
689
|
+
request_options=request_options,
|
|
690
|
+
)
|
|
691
|
+
try:
|
|
692
|
+
if 200 <= _response.status_code < 300:
|
|
693
|
+
_data = typing.cast(
|
|
694
|
+
DeleteSubTenantData,
|
|
695
|
+
parse_obj_as(
|
|
696
|
+
type_=DeleteSubTenantData, # type: ignore
|
|
697
|
+
object_=_response.json(),
|
|
698
|
+
),
|
|
699
|
+
)
|
|
700
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
701
|
+
if _response.status_code == 400:
|
|
702
|
+
raise BadRequestError(
|
|
703
|
+
headers=dict(_response.headers),
|
|
704
|
+
body=typing.cast(
|
|
705
|
+
ActualErrorResponse,
|
|
706
|
+
parse_obj_as(
|
|
707
|
+
type_=ActualErrorResponse, # type: ignore
|
|
708
|
+
object_=_response.json(),
|
|
709
|
+
),
|
|
710
|
+
),
|
|
711
|
+
)
|
|
712
|
+
if _response.status_code == 401:
|
|
713
|
+
raise UnauthorizedError(
|
|
714
|
+
headers=dict(_response.headers),
|
|
715
|
+
body=typing.cast(
|
|
716
|
+
ActualErrorResponse,
|
|
717
|
+
parse_obj_as(
|
|
718
|
+
type_=ActualErrorResponse, # type: ignore
|
|
719
|
+
object_=_response.json(),
|
|
720
|
+
),
|
|
721
|
+
),
|
|
722
|
+
)
|
|
723
|
+
if _response.status_code == 403:
|
|
724
|
+
raise ForbiddenError(
|
|
725
|
+
headers=dict(_response.headers),
|
|
726
|
+
body=typing.cast(
|
|
727
|
+
ActualErrorResponse,
|
|
728
|
+
parse_obj_as(
|
|
729
|
+
type_=ActualErrorResponse, # type: ignore
|
|
730
|
+
object_=_response.json(),
|
|
731
|
+
),
|
|
732
|
+
),
|
|
733
|
+
)
|
|
734
|
+
if _response.status_code == 404:
|
|
735
|
+
raise NotFoundError(
|
|
736
|
+
headers=dict(_response.headers),
|
|
737
|
+
body=typing.cast(
|
|
738
|
+
ActualErrorResponse,
|
|
739
|
+
parse_obj_as(
|
|
740
|
+
type_=ActualErrorResponse, # type: ignore
|
|
741
|
+
object_=_response.json(),
|
|
742
|
+
),
|
|
743
|
+
),
|
|
744
|
+
)
|
|
745
|
+
if _response.status_code == 422:
|
|
746
|
+
raise UnprocessableEntityError(
|
|
747
|
+
headers=dict(_response.headers),
|
|
748
|
+
body=typing.cast(
|
|
749
|
+
typing.Optional[typing.Any],
|
|
750
|
+
parse_obj_as(
|
|
751
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
752
|
+
object_=_response.json(),
|
|
753
|
+
),
|
|
754
|
+
),
|
|
755
|
+
)
|
|
756
|
+
if _response.status_code == 500:
|
|
757
|
+
raise InternalServerError(
|
|
758
|
+
headers=dict(_response.headers),
|
|
759
|
+
body=typing.cast(
|
|
760
|
+
ActualErrorResponse,
|
|
761
|
+
parse_obj_as(
|
|
762
|
+
type_=ActualErrorResponse, # type: ignore
|
|
763
|
+
object_=_response.json(),
|
|
764
|
+
),
|
|
765
|
+
),
|
|
766
|
+
)
|
|
767
|
+
if _response.status_code == 503:
|
|
768
|
+
raise ServiceUnavailableError(
|
|
769
|
+
headers=dict(_response.headers),
|
|
770
|
+
body=typing.cast(
|
|
771
|
+
ActualErrorResponse,
|
|
772
|
+
parse_obj_as(
|
|
773
|
+
type_=ActualErrorResponse, # type: ignore
|
|
774
|
+
object_=_response.json(),
|
|
775
|
+
),
|
|
776
|
+
),
|
|
777
|
+
)
|
|
778
|
+
_response_json = _response.json()
|
|
779
|
+
except JSONDecodeError:
|
|
780
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
781
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
usecortex_ai/types/__init__.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
# isort: skip_file
|
|
4
4
|
|
|
5
5
|
from .actual_error_response import ActualErrorResponse
|
|
6
|
+
from .add_user_memory_response import AddUserMemoryResponse
|
|
6
7
|
from .app_sources_upload_data import AppSourcesUploadData
|
|
7
8
|
from .attachment_model import AttachmentModel
|
|
8
9
|
from .batch_upload_data import BatchUploadData
|
|
@@ -11,6 +12,9 @@ from .body_scrape_webpage_upload_scrape_webpage_post import BodyScrapeWebpageUpl
|
|
|
11
12
|
from .body_update_scrape_job_upload_update_webpage_patch import BodyUpdateScrapeJobUploadUpdateWebpagePatch
|
|
12
13
|
from .content_model import ContentModel
|
|
13
14
|
from .delete_memory_request import DeleteMemoryRequest
|
|
15
|
+
from .delete_sources import DeleteSources
|
|
16
|
+
from .delete_sub_tenant_data import DeleteSubTenantData
|
|
17
|
+
from .delete_user_memory_response import DeleteUserMemoryResponse
|
|
14
18
|
from .embeddings_create_collection_data import EmbeddingsCreateCollectionData
|
|
15
19
|
from .embeddings_delete_data import EmbeddingsDeleteData
|
|
16
20
|
from .embeddings_get_data import EmbeddingsGetData
|
|
@@ -19,25 +23,29 @@ from .error_response import ErrorResponse
|
|
|
19
23
|
from .extended_context import ExtendedContext
|
|
20
24
|
from .fetch_content_data import FetchContentData
|
|
21
25
|
from .file_upload_result import FileUploadResult
|
|
26
|
+
from .generate_user_memory_response import GenerateUserMemoryResponse
|
|
22
27
|
from .http_validation_error import HttpValidationError
|
|
23
28
|
from .list_sources_response import ListSourcesResponse
|
|
29
|
+
from .list_user_memories_response import ListUserMemoriesResponse
|
|
24
30
|
from .markdown_upload_request import MarkdownUploadRequest
|
|
25
31
|
from .processing_status import ProcessingStatus
|
|
26
32
|
from .related_chunk import RelatedChunk
|
|
27
33
|
from .relations import Relations
|
|
34
|
+
from .retrieve_user_memory_response import RetrieveUserMemoryResponse
|
|
28
35
|
from .search_chunk import SearchChunk
|
|
29
36
|
from .single_upload_data import SingleUploadData
|
|
30
37
|
from .source import Source
|
|
31
|
-
from .source_content import SourceContent
|
|
32
38
|
from .source_model import SourceModel
|
|
33
39
|
from .sub_tenant_ids_data import SubTenantIdsData
|
|
34
40
|
from .tenant_create_data import TenantCreateData
|
|
35
41
|
from .tenant_stats import TenantStats
|
|
42
|
+
from .user_memory import UserMemory
|
|
36
43
|
from .validation_error import ValidationError
|
|
37
44
|
from .validation_error_loc_item import ValidationErrorLocItem
|
|
38
45
|
|
|
39
46
|
__all__ = [
|
|
40
47
|
"ActualErrorResponse",
|
|
48
|
+
"AddUserMemoryResponse",
|
|
41
49
|
"AppSourcesUploadData",
|
|
42
50
|
"AttachmentModel",
|
|
43
51
|
"BatchUploadData",
|
|
@@ -46,6 +54,9 @@ __all__ = [
|
|
|
46
54
|
"BodyUpdateScrapeJobUploadUpdateWebpagePatch",
|
|
47
55
|
"ContentModel",
|
|
48
56
|
"DeleteMemoryRequest",
|
|
57
|
+
"DeleteSources",
|
|
58
|
+
"DeleteSubTenantData",
|
|
59
|
+
"DeleteUserMemoryResponse",
|
|
49
60
|
"EmbeddingsCreateCollectionData",
|
|
50
61
|
"EmbeddingsDeleteData",
|
|
51
62
|
"EmbeddingsGetData",
|
|
@@ -54,20 +65,23 @@ __all__ = [
|
|
|
54
65
|
"ExtendedContext",
|
|
55
66
|
"FetchContentData",
|
|
56
67
|
"FileUploadResult",
|
|
68
|
+
"GenerateUserMemoryResponse",
|
|
57
69
|
"HttpValidationError",
|
|
58
70
|
"ListSourcesResponse",
|
|
71
|
+
"ListUserMemoriesResponse",
|
|
59
72
|
"MarkdownUploadRequest",
|
|
60
73
|
"ProcessingStatus",
|
|
61
74
|
"RelatedChunk",
|
|
62
75
|
"Relations",
|
|
76
|
+
"RetrieveUserMemoryResponse",
|
|
63
77
|
"SearchChunk",
|
|
64
78
|
"SingleUploadData",
|
|
65
79
|
"Source",
|
|
66
|
-
"SourceContent",
|
|
67
80
|
"SourceModel",
|
|
68
81
|
"SubTenantIdsData",
|
|
69
82
|
"TenantCreateData",
|
|
70
83
|
"TenantStats",
|
|
84
|
+
"UserMemory",
|
|
71
85
|
"ValidationError",
|
|
72
86
|
"ValidationErrorLocItem",
|
|
73
87
|
]
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AddUserMemoryResponse(UniversalBaseModel):
|
|
10
|
+
"""
|
|
11
|
+
Response model for adding a new user memory.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
success: bool = pydantic.Field()
|
|
15
|
+
"""
|
|
16
|
+
Indicates whether the memory addition operation was successful
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
user_memory_added: bool = pydantic.Field()
|
|
20
|
+
"""
|
|
21
|
+
Confirms whether the memory was successfully stored in the system
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
memory_id: typing.Optional[str] = pydantic.Field(default=None)
|
|
25
|
+
"""
|
|
26
|
+
Unique identifier assigned to the newly created memory
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
if IS_PYDANTIC_V2:
|
|
30
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
31
|
+
else:
|
|
32
|
+
|
|
33
|
+
class Config:
|
|
34
|
+
frozen = True
|
|
35
|
+
smart_union = True
|
|
36
|
+
extra = pydantic.Extra.allow
|
|
@@ -8,9 +8,17 @@ from .file_upload_result import FileUploadResult
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class AppSourcesUploadData(UniversalBaseModel):
|
|
11
|
-
uploaded: typing.List[FileUploadResult]
|
|
11
|
+
uploaded: typing.List[FileUploadResult] = pydantic.Field()
|
|
12
|
+
"""
|
|
13
|
+
List of successfully uploaded app source for indexing
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
message: str = pydantic.Field()
|
|
17
|
+
"""
|
|
18
|
+
Status message indicating app sources upload scheduled
|
|
19
|
+
"""
|
|
20
|
+
|
|
12
21
|
success: typing.Optional[bool] = None
|
|
13
|
-
message: typing.Optional[str] = None
|
|
14
22
|
|
|
15
23
|
if IS_PYDANTIC_V2:
|
|
16
24
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|