usecortex-ai 0.2.2__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.
@@ -27,141 +27,11 @@ class RawSourcesClient:
27
27
  self._client_wrapper = client_wrapper
28
28
 
29
29
  def get_all(
30
- self,
31
- *,
32
- tenant_id: str,
33
- sub_tenant_id: typing.Optional[str] = None,
34
- request_options: typing.Optional[RequestOptions] = None,
35
- ) -> HttpResponse[ListSourcesResponse]:
36
- """
37
- Retrieve all sources for a specific tenant.
38
-
39
- Use this endpoint to fetch a complete list of all sources associated with your tenant. This includes documents, files, and other content you've uploaded for processing.
40
-
41
- You can optionally specify a sub-tenant to narrow down the results to sources within that specific sub-tenant scope.
42
-
43
- Parameters
44
- ----------
45
- tenant_id : str
46
- Unique identifier for the tenant/organization
47
-
48
- sub_tenant_id : typing.Optional[str]
49
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
50
-
51
- request_options : typing.Optional[RequestOptions]
52
- Request-specific configuration.
53
-
54
- Returns
55
- -------
56
- HttpResponse[ListSourcesResponse]
57
- Successful Response
58
- """
59
- _response = self._client_wrapper.httpx_client.request(
60
- "list/sources",
61
- method="GET",
62
- params={
63
- "tenant_id": tenant_id,
64
- "sub_tenant_id": sub_tenant_id,
65
- },
66
- request_options=request_options,
67
- )
68
- try:
69
- if 200 <= _response.status_code < 300:
70
- _data = typing.cast(
71
- ListSourcesResponse,
72
- parse_obj_as(
73
- type_=ListSourcesResponse, # type: ignore
74
- object_=_response.json(),
75
- ),
76
- )
77
- return HttpResponse(response=_response, data=_data)
78
- if _response.status_code == 400:
79
- raise BadRequestError(
80
- headers=dict(_response.headers),
81
- body=typing.cast(
82
- ActualErrorResponse,
83
- parse_obj_as(
84
- type_=ActualErrorResponse, # type: ignore
85
- object_=_response.json(),
86
- ),
87
- ),
88
- )
89
- if _response.status_code == 401:
90
- raise UnauthorizedError(
91
- headers=dict(_response.headers),
92
- body=typing.cast(
93
- ActualErrorResponse,
94
- parse_obj_as(
95
- type_=ActualErrorResponse, # type: ignore
96
- object_=_response.json(),
97
- ),
98
- ),
99
- )
100
- if _response.status_code == 403:
101
- raise ForbiddenError(
102
- headers=dict(_response.headers),
103
- body=typing.cast(
104
- ActualErrorResponse,
105
- parse_obj_as(
106
- type_=ActualErrorResponse, # type: ignore
107
- object_=_response.json(),
108
- ),
109
- ),
110
- )
111
- if _response.status_code == 404:
112
- raise NotFoundError(
113
- headers=dict(_response.headers),
114
- body=typing.cast(
115
- ActualErrorResponse,
116
- parse_obj_as(
117
- type_=ActualErrorResponse, # type: ignore
118
- object_=_response.json(),
119
- ),
120
- ),
121
- )
122
- if _response.status_code == 422:
123
- raise UnprocessableEntityError(
124
- headers=dict(_response.headers),
125
- body=typing.cast(
126
- typing.Optional[typing.Any],
127
- parse_obj_as(
128
- type_=typing.Optional[typing.Any], # type: ignore
129
- object_=_response.json(),
130
- ),
131
- ),
132
- )
133
- if _response.status_code == 500:
134
- raise InternalServerError(
135
- headers=dict(_response.headers),
136
- body=typing.cast(
137
- ActualErrorResponse,
138
- parse_obj_as(
139
- type_=ActualErrorResponse, # type: ignore
140
- object_=_response.json(),
141
- ),
142
- ),
143
- )
144
- if _response.status_code == 503:
145
- raise ServiceUnavailableError(
146
- headers=dict(_response.headers),
147
- body=typing.cast(
148
- ActualErrorResponse,
149
- parse_obj_as(
150
- type_=ActualErrorResponse, # type: ignore
151
- object_=_response.json(),
152
- ),
153
- ),
154
- )
155
- _response_json = _response.json()
156
- except JSONDecodeError:
157
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
158
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
159
-
160
- def get_by_ids(
161
30
  self,
162
31
  *,
163
32
  tenant_id: str,
164
33
  source_ids: typing.Sequence[str],
34
+ sub_tenant_id: typing.Optional[str] = OMIT,
165
35
  request_options: typing.Optional[RequestOptions] = None,
166
36
  ) -> HttpResponse[ListSourcesResponse]:
167
37
  """
@@ -174,8 +44,13 @@ class RawSourcesClient:
174
44
  Parameters
175
45
  ----------
176
46
  tenant_id : str
47
+ Unique identifier for the tenant/organization
177
48
 
178
49
  source_ids : typing.Sequence[str]
50
+ List of source IDs to fetch
51
+
52
+ sub_tenant_id : typing.Optional[str]
53
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
179
54
 
180
55
  request_options : typing.Optional[RequestOptions]
181
56
  Request-specific configuration.
@@ -191,6 +66,7 @@ class RawSourcesClient:
191
66
  json={
192
67
  "tenant_id": tenant_id,
193
68
  "source_ids": source_ids,
69
+ "sub_tenant_id": sub_tenant_id,
194
70
  },
195
71
  headers={
196
72
  "content-type": "application/json",
@@ -296,141 +172,11 @@ class AsyncRawSourcesClient:
296
172
  self._client_wrapper = client_wrapper
297
173
 
298
174
  async def get_all(
299
- self,
300
- *,
301
- tenant_id: str,
302
- sub_tenant_id: typing.Optional[str] = None,
303
- request_options: typing.Optional[RequestOptions] = None,
304
- ) -> AsyncHttpResponse[ListSourcesResponse]:
305
- """
306
- Retrieve all sources for a specific tenant.
307
-
308
- Use this endpoint to fetch a complete list of all sources associated with your tenant. This includes documents, files, and other content you've uploaded for processing.
309
-
310
- You can optionally specify a sub-tenant to narrow down the results to sources within that specific sub-tenant scope.
311
-
312
- Parameters
313
- ----------
314
- tenant_id : str
315
- Unique identifier for the tenant/organization
316
-
317
- sub_tenant_id : typing.Optional[str]
318
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
319
-
320
- request_options : typing.Optional[RequestOptions]
321
- Request-specific configuration.
322
-
323
- Returns
324
- -------
325
- AsyncHttpResponse[ListSourcesResponse]
326
- Successful Response
327
- """
328
- _response = await self._client_wrapper.httpx_client.request(
329
- "list/sources",
330
- method="GET",
331
- params={
332
- "tenant_id": tenant_id,
333
- "sub_tenant_id": sub_tenant_id,
334
- },
335
- request_options=request_options,
336
- )
337
- try:
338
- if 200 <= _response.status_code < 300:
339
- _data = typing.cast(
340
- ListSourcesResponse,
341
- parse_obj_as(
342
- type_=ListSourcesResponse, # type: ignore
343
- object_=_response.json(),
344
- ),
345
- )
346
- return AsyncHttpResponse(response=_response, data=_data)
347
- if _response.status_code == 400:
348
- raise BadRequestError(
349
- headers=dict(_response.headers),
350
- body=typing.cast(
351
- ActualErrorResponse,
352
- parse_obj_as(
353
- type_=ActualErrorResponse, # type: ignore
354
- object_=_response.json(),
355
- ),
356
- ),
357
- )
358
- if _response.status_code == 401:
359
- raise UnauthorizedError(
360
- headers=dict(_response.headers),
361
- body=typing.cast(
362
- ActualErrorResponse,
363
- parse_obj_as(
364
- type_=ActualErrorResponse, # type: ignore
365
- object_=_response.json(),
366
- ),
367
- ),
368
- )
369
- if _response.status_code == 403:
370
- raise ForbiddenError(
371
- headers=dict(_response.headers),
372
- body=typing.cast(
373
- ActualErrorResponse,
374
- parse_obj_as(
375
- type_=ActualErrorResponse, # type: ignore
376
- object_=_response.json(),
377
- ),
378
- ),
379
- )
380
- if _response.status_code == 404:
381
- raise NotFoundError(
382
- headers=dict(_response.headers),
383
- body=typing.cast(
384
- ActualErrorResponse,
385
- parse_obj_as(
386
- type_=ActualErrorResponse, # type: ignore
387
- object_=_response.json(),
388
- ),
389
- ),
390
- )
391
- if _response.status_code == 422:
392
- raise UnprocessableEntityError(
393
- headers=dict(_response.headers),
394
- body=typing.cast(
395
- typing.Optional[typing.Any],
396
- parse_obj_as(
397
- type_=typing.Optional[typing.Any], # type: ignore
398
- object_=_response.json(),
399
- ),
400
- ),
401
- )
402
- if _response.status_code == 500:
403
- raise InternalServerError(
404
- headers=dict(_response.headers),
405
- body=typing.cast(
406
- ActualErrorResponse,
407
- parse_obj_as(
408
- type_=ActualErrorResponse, # type: ignore
409
- object_=_response.json(),
410
- ),
411
- ),
412
- )
413
- if _response.status_code == 503:
414
- raise ServiceUnavailableError(
415
- headers=dict(_response.headers),
416
- body=typing.cast(
417
- ActualErrorResponse,
418
- parse_obj_as(
419
- type_=ActualErrorResponse, # type: ignore
420
- object_=_response.json(),
421
- ),
422
- ),
423
- )
424
- _response_json = _response.json()
425
- except JSONDecodeError:
426
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
427
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
428
-
429
- async def get_by_ids(
430
175
  self,
431
176
  *,
432
177
  tenant_id: str,
433
178
  source_ids: typing.Sequence[str],
179
+ sub_tenant_id: typing.Optional[str] = OMIT,
434
180
  request_options: typing.Optional[RequestOptions] = None,
435
181
  ) -> AsyncHttpResponse[ListSourcesResponse]:
436
182
  """
@@ -443,8 +189,13 @@ class AsyncRawSourcesClient:
443
189
  Parameters
444
190
  ----------
445
191
  tenant_id : str
192
+ Unique identifier for the tenant/organization
446
193
 
447
194
  source_ids : typing.Sequence[str]
195
+ List of source IDs to fetch
196
+
197
+ sub_tenant_id : typing.Optional[str]
198
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
448
199
 
449
200
  request_options : typing.Optional[RequestOptions]
450
201
  Request-specific configuration.
@@ -460,6 +211,7 @@ class AsyncRawSourcesClient:
460
211
  json={
461
212
  "tenant_id": tenant_id,
462
213
  "source_ids": source_ids,
214
+ "sub_tenant_id": sub_tenant_id,
463
215
  },
464
216
  headers={
465
217
  "content-type": "application/json",
@@ -47,7 +47,7 @@ class TenantClient:
47
47
  Unique identifier for the tenant/organization
48
48
 
49
49
  sub_tenant_id : typing.Optional[str]
50
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
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.
51
51
 
52
52
  request_options : typing.Optional[RequestOptions]
53
53
  Request-specific configuration.
@@ -62,7 +62,7 @@ class TenantClient:
62
62
  from usecortex-ai import CortexAI
63
63
 
64
64
  client = CortexAI(token="YOUR_TOKEN", )
65
- client.tenant.stats(tenant_id='tenant_id', )
65
+ client.tenant.stats(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
66
66
  """
67
67
  _response = self._raw_client.stats(
68
68
  tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
@@ -92,7 +92,7 @@ class TenantClient:
92
92
  from usecortex-ai import CortexAI
93
93
 
94
94
  client = CortexAI(token="YOUR_TOKEN", )
95
- client.tenant.get_sub_tenant_ids(tenant_id='tenant_id', )
95
+ client.tenant.get_sub_tenant_ids(tenant_id='tenant_1234', )
96
96
  """
97
97
  _response = self._raw_client.get_sub_tenant_ids(tenant_id=tenant_id, request_options=request_options)
98
98
  return _response.data
@@ -125,7 +125,7 @@ class TenantClient:
125
125
  from usecortex-ai import CortexAI
126
126
 
127
127
  client = CortexAI(token="YOUR_TOKEN", )
128
- client.tenant.delete_sub_tenant(tenant_id='tenant_id', sub_tenant_id='sub_tenant_id', )
128
+ client.tenant.delete_sub_tenant(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
129
129
  """
130
130
  _response = self._raw_client.delete_sub_tenant(
131
131
  tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
@@ -170,7 +170,7 @@ class AsyncTenantClient:
170
170
  Unique identifier for the tenant/organization
171
171
 
172
172
  sub_tenant_id : typing.Optional[str]
173
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
173
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
174
174
 
175
175
  request_options : typing.Optional[RequestOptions]
176
176
  Request-specific configuration.
@@ -188,7 +188,7 @@ class AsyncTenantClient:
188
188
 
189
189
  client = AsyncCortexAI(token="YOUR_TOKEN", )
190
190
  async def main() -> None:
191
- await client.tenant.stats(tenant_id='tenant_id', )
191
+ await client.tenant.stats(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
192
192
  asyncio.run(main())
193
193
  """
194
194
  _response = await self._raw_client.stats(
@@ -222,7 +222,7 @@ class AsyncTenantClient:
222
222
 
223
223
  client = AsyncCortexAI(token="YOUR_TOKEN", )
224
224
  async def main() -> None:
225
- await client.tenant.get_sub_tenant_ids(tenant_id='tenant_id', )
225
+ await client.tenant.get_sub_tenant_ids(tenant_id='tenant_1234', )
226
226
  asyncio.run(main())
227
227
  """
228
228
  _response = await self._raw_client.get_sub_tenant_ids(tenant_id=tenant_id, request_options=request_options)
@@ -259,7 +259,7 @@ class AsyncTenantClient:
259
259
 
260
260
  client = AsyncCortexAI(token="YOUR_TOKEN", )
261
261
  async def main() -> None:
262
- await client.tenant.delete_sub_tenant(tenant_id='tenant_id', sub_tenant_id='sub_tenant_id', )
262
+ await client.tenant.delete_sub_tenant(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
263
263
  asyncio.run(main())
264
264
  """
265
265
  _response = await self._raw_client.delete_sub_tenant(
@@ -47,7 +47,7 @@ class RawTenantClient:
47
47
  Unique identifier for the tenant/organization
48
48
 
49
49
  sub_tenant_id : typing.Optional[str]
50
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
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.
51
51
 
52
52
  request_options : typing.Optional[RequestOptions]
53
53
  Request-specific configuration.
@@ -427,7 +427,7 @@ class AsyncRawTenantClient:
427
427
  Unique identifier for the tenant/organization
428
428
 
429
429
  sub_tenant_id : typing.Optional[str]
430
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
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.
431
431
 
432
432
  request_options : typing.Optional[RequestOptions]
433
433
  Request-specific configuration.
@@ -19,7 +19,7 @@ class DeleteMemoryRequest(UniversalBaseModel):
19
19
 
20
20
  sub_tenant_id: typing.Optional[str] = pydantic.Field(default=None)
21
21
  """
22
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
22
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
23
23
  """
24
24
 
25
25
  if IS_PYDANTIC_V2:
@@ -12,6 +12,11 @@ class MarkdownUploadRequest(UniversalBaseModel):
12
12
  The text or markdown content to upload
13
13
  """
14
14
 
15
+ file_id: typing.Optional[str] = pydantic.Field(default=None)
16
+ """
17
+ Optional file ID for the uploaded content. If not provided, will be generated automatically.
18
+ """
19
+
15
20
  tenant_metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
16
21
  """
17
22
  JSON string containing tenant-level document metadata (e.g., department, compliance_tag)
@@ -22,6 +22,11 @@ class SubTenantIdsData(UniversalBaseModel):
22
22
  Total number of sub-tenants found
23
23
  """
24
24
 
25
+ tenant_schema: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
26
+ """
27
+ Schema configuration for the tenant collection
28
+ """
29
+
25
30
  success: typing.Optional[bool] = pydantic.Field(default=None)
26
31
  """
27
32
  Indicates whether the sub-tenant retrieval was successful
@@ -12,9 +12,9 @@ class TenantStats(UniversalBaseModel):
12
12
  Total number of objects stored for this tenant
13
13
  """
14
14
 
15
- tenant_name: str = pydantic.Field()
15
+ tenant_id: str = pydantic.Field()
16
16
  """
17
- Name identifier for the tenant
17
+ identifier for the tenant
18
18
  """
19
19
 
20
20
  vector_dimension: typing.Optional[int] = pydantic.Field(default=None)