usecortex-ai 0.3.0__py3-none-any.whl → 0.3.1__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/sources/client.py +92 -4
- usecortex_ai/sources/raw_client.py +262 -0
- usecortex_ai-0.3.1.dist-info/METADATA +66 -0
- {usecortex_ai-0.3.0.dist-info → usecortex_ai-0.3.1.dist-info}/RECORD +7 -7
- usecortex_ai-0.3.0.dist-info/METADATA +0 -136
- {usecortex_ai-0.3.0.dist-info → usecortex_ai-0.3.1.dist-info}/WHEEL +0 -0
- {usecortex_ai-0.3.0.dist-info → usecortex_ai-0.3.1.dist-info}/licenses/LICENSE +0 -0
- {usecortex_ai-0.3.0.dist-info → usecortex_ai-0.3.1.dist-info}/top_level.txt +0 -0
usecortex_ai/sources/client.py
CHANGED
|
@@ -27,6 +27,48 @@ class SourcesClient:
|
|
|
27
27
|
return self._raw_client
|
|
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
|
+
) -> 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 used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
50
|
+
|
|
51
|
+
request_options : typing.Optional[RequestOptions]
|
|
52
|
+
Request-specific configuration.
|
|
53
|
+
|
|
54
|
+
Returns
|
|
55
|
+
-------
|
|
56
|
+
ListSourcesResponse
|
|
57
|
+
Successful Response
|
|
58
|
+
|
|
59
|
+
Examples
|
|
60
|
+
--------
|
|
61
|
+
from usecortex-ai import CortexAI
|
|
62
|
+
|
|
63
|
+
client = CortexAI(token="YOUR_TOKEN", )
|
|
64
|
+
client.sources.get_all(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
|
|
65
|
+
"""
|
|
66
|
+
_response = self._raw_client.get_all(
|
|
67
|
+
tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
68
|
+
)
|
|
69
|
+
return _response.data
|
|
70
|
+
|
|
71
|
+
def get_by_ids(
|
|
30
72
|
self,
|
|
31
73
|
*,
|
|
32
74
|
tenant_id: str,
|
|
@@ -65,9 +107,9 @@ class SourcesClient:
|
|
|
65
107
|
from usecortex-ai import CortexAI
|
|
66
108
|
|
|
67
109
|
client = CortexAI(token="YOUR_TOKEN", )
|
|
68
|
-
client.sources.
|
|
110
|
+
client.sources.get_by_ids(tenant_id='tenant_1234', source_ids=['CortexDoc1234', 'CortexDoc4567'], )
|
|
69
111
|
"""
|
|
70
|
-
_response = self._raw_client.
|
|
112
|
+
_response = self._raw_client.get_by_ids(
|
|
71
113
|
tenant_id=tenant_id, source_ids=source_ids, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
72
114
|
)
|
|
73
115
|
return _response.data
|
|
@@ -89,6 +131,52 @@ class AsyncSourcesClient:
|
|
|
89
131
|
return self._raw_client
|
|
90
132
|
|
|
91
133
|
async def get_all(
|
|
134
|
+
self,
|
|
135
|
+
*,
|
|
136
|
+
tenant_id: str,
|
|
137
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
138
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
139
|
+
) -> ListSourcesResponse:
|
|
140
|
+
"""
|
|
141
|
+
Retrieve all sources for a specific tenant.
|
|
142
|
+
|
|
143
|
+
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.
|
|
144
|
+
|
|
145
|
+
You can optionally specify a sub-tenant to narrow down the results to sources within that specific sub-tenant scope.
|
|
146
|
+
|
|
147
|
+
Parameters
|
|
148
|
+
----------
|
|
149
|
+
tenant_id : str
|
|
150
|
+
Unique identifier for the tenant/organization
|
|
151
|
+
|
|
152
|
+
sub_tenant_id : typing.Optional[str]
|
|
153
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
154
|
+
|
|
155
|
+
request_options : typing.Optional[RequestOptions]
|
|
156
|
+
Request-specific configuration.
|
|
157
|
+
|
|
158
|
+
Returns
|
|
159
|
+
-------
|
|
160
|
+
ListSourcesResponse
|
|
161
|
+
Successful Response
|
|
162
|
+
|
|
163
|
+
Examples
|
|
164
|
+
--------
|
|
165
|
+
import asyncio
|
|
166
|
+
|
|
167
|
+
from usecortex-ai import AsyncCortexAI
|
|
168
|
+
|
|
169
|
+
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
170
|
+
async def main() -> None:
|
|
171
|
+
await client.sources.get_all(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
|
|
172
|
+
asyncio.run(main())
|
|
173
|
+
"""
|
|
174
|
+
_response = await self._raw_client.get_all(
|
|
175
|
+
tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
176
|
+
)
|
|
177
|
+
return _response.data
|
|
178
|
+
|
|
179
|
+
async def get_by_ids(
|
|
92
180
|
self,
|
|
93
181
|
*,
|
|
94
182
|
tenant_id: str,
|
|
@@ -130,10 +218,10 @@ class AsyncSourcesClient:
|
|
|
130
218
|
|
|
131
219
|
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
132
220
|
async def main() -> None:
|
|
133
|
-
await client.sources.
|
|
221
|
+
await client.sources.get_by_ids(tenant_id='tenant_1234', source_ids=['CortexDoc1234', 'CortexDoc4567'], )
|
|
134
222
|
asyncio.run(main())
|
|
135
223
|
"""
|
|
136
|
-
_response = await self._raw_client.
|
|
224
|
+
_response = await self._raw_client.get_by_ids(
|
|
137
225
|
tenant_id=tenant_id, source_ids=source_ids, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
138
226
|
)
|
|
139
227
|
return _response.data
|
|
@@ -27,6 +27,137 @@ 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 used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
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(
|
|
30
161
|
self,
|
|
31
162
|
*,
|
|
32
163
|
tenant_id: str,
|
|
@@ -172,6 +303,137 @@ class AsyncRawSourcesClient:
|
|
|
172
303
|
self._client_wrapper = client_wrapper
|
|
173
304
|
|
|
174
305
|
async def get_all(
|
|
306
|
+
self,
|
|
307
|
+
*,
|
|
308
|
+
tenant_id: str,
|
|
309
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
310
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
311
|
+
) -> AsyncHttpResponse[ListSourcesResponse]:
|
|
312
|
+
"""
|
|
313
|
+
Retrieve all sources for a specific tenant.
|
|
314
|
+
|
|
315
|
+
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.
|
|
316
|
+
|
|
317
|
+
You can optionally specify a sub-tenant to narrow down the results to sources within that specific sub-tenant scope.
|
|
318
|
+
|
|
319
|
+
Parameters
|
|
320
|
+
----------
|
|
321
|
+
tenant_id : str
|
|
322
|
+
Unique identifier for the tenant/organization
|
|
323
|
+
|
|
324
|
+
sub_tenant_id : typing.Optional[str]
|
|
325
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
326
|
+
|
|
327
|
+
request_options : typing.Optional[RequestOptions]
|
|
328
|
+
Request-specific configuration.
|
|
329
|
+
|
|
330
|
+
Returns
|
|
331
|
+
-------
|
|
332
|
+
AsyncHttpResponse[ListSourcesResponse]
|
|
333
|
+
Successful Response
|
|
334
|
+
"""
|
|
335
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
336
|
+
"list/sources",
|
|
337
|
+
method="GET",
|
|
338
|
+
params={
|
|
339
|
+
"tenant_id": tenant_id,
|
|
340
|
+
"sub_tenant_id": sub_tenant_id,
|
|
341
|
+
},
|
|
342
|
+
request_options=request_options,
|
|
343
|
+
)
|
|
344
|
+
try:
|
|
345
|
+
if 200 <= _response.status_code < 300:
|
|
346
|
+
_data = typing.cast(
|
|
347
|
+
ListSourcesResponse,
|
|
348
|
+
parse_obj_as(
|
|
349
|
+
type_=ListSourcesResponse, # type: ignore
|
|
350
|
+
object_=_response.json(),
|
|
351
|
+
),
|
|
352
|
+
)
|
|
353
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
354
|
+
if _response.status_code == 400:
|
|
355
|
+
raise BadRequestError(
|
|
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 == 401:
|
|
366
|
+
raise UnauthorizedError(
|
|
367
|
+
headers=dict(_response.headers),
|
|
368
|
+
body=typing.cast(
|
|
369
|
+
ActualErrorResponse,
|
|
370
|
+
parse_obj_as(
|
|
371
|
+
type_=ActualErrorResponse, # type: ignore
|
|
372
|
+
object_=_response.json(),
|
|
373
|
+
),
|
|
374
|
+
),
|
|
375
|
+
)
|
|
376
|
+
if _response.status_code == 403:
|
|
377
|
+
raise ForbiddenError(
|
|
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 == 404:
|
|
388
|
+
raise NotFoundError(
|
|
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
|
+
if _response.status_code == 422:
|
|
399
|
+
raise UnprocessableEntityError(
|
|
400
|
+
headers=dict(_response.headers),
|
|
401
|
+
body=typing.cast(
|
|
402
|
+
typing.Optional[typing.Any],
|
|
403
|
+
parse_obj_as(
|
|
404
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
405
|
+
object_=_response.json(),
|
|
406
|
+
),
|
|
407
|
+
),
|
|
408
|
+
)
|
|
409
|
+
if _response.status_code == 500:
|
|
410
|
+
raise InternalServerError(
|
|
411
|
+
headers=dict(_response.headers),
|
|
412
|
+
body=typing.cast(
|
|
413
|
+
ActualErrorResponse,
|
|
414
|
+
parse_obj_as(
|
|
415
|
+
type_=ActualErrorResponse, # type: ignore
|
|
416
|
+
object_=_response.json(),
|
|
417
|
+
),
|
|
418
|
+
),
|
|
419
|
+
)
|
|
420
|
+
if _response.status_code == 503:
|
|
421
|
+
raise ServiceUnavailableError(
|
|
422
|
+
headers=dict(_response.headers),
|
|
423
|
+
body=typing.cast(
|
|
424
|
+
ActualErrorResponse,
|
|
425
|
+
parse_obj_as(
|
|
426
|
+
type_=ActualErrorResponse, # type: ignore
|
|
427
|
+
object_=_response.json(),
|
|
428
|
+
),
|
|
429
|
+
),
|
|
430
|
+
)
|
|
431
|
+
_response_json = _response.json()
|
|
432
|
+
except JSONDecodeError:
|
|
433
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
434
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
435
|
+
|
|
436
|
+
async def get_by_ids(
|
|
175
437
|
self,
|
|
176
438
|
*,
|
|
177
439
|
tenant_id: str,
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: usecortex-ai
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: The official Python SDK for the Cortex AI platform.
|
|
5
|
+
Author-email: Nishkarsh Shrivastava <nishkarsh@usecortex.ai>
|
|
6
|
+
License: Copyright (c) 2024 Cortex AI
|
|
7
|
+
|
|
8
|
+
All Rights Reserved.
|
|
9
|
+
|
|
10
|
+
PROPRIETARY AND CONFIDENTIAL
|
|
11
|
+
|
|
12
|
+
This software is the proprietary and confidential property of Cortex AI ("the Company").
|
|
13
|
+
Permission is hereby granted to authorized users to install and use this software as part of the Cortex AI service, subject to the terms and conditions of the service agreement entered into with the Company.
|
|
14
|
+
|
|
15
|
+
You may not, without the express written permission of the Company:
|
|
16
|
+
|
|
17
|
+
1. Copy, modify, or create derivative works of the software.
|
|
18
|
+
2. Distribute, sell, rent, lease, sublicense, or otherwise transfer the software to any third party.
|
|
19
|
+
3. Reverse engineer, decompile, or disassemble the software, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
Project-URL: Homepage, https://www.usecortex.ai/
|
|
29
|
+
Project-URL: Documentation, https://docs.usecortex.ai/
|
|
30
|
+
Keywords: cortex,ai,sdk,api,generative ai,rag
|
|
31
|
+
Classifier: Development Status :: 4 - Beta
|
|
32
|
+
Classifier: Programming Language :: Python :: 3
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
36
|
+
Classifier: Intended Audience :: Developers
|
|
37
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
38
|
+
Classifier: Typing :: Typed
|
|
39
|
+
Requires-Python: >=3.10
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
License-File: LICENSE
|
|
42
|
+
Requires-Dist: httpx>=0.24
|
|
43
|
+
Requires-Dist: pydantic<3,>=1.10
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# Cortex AI Python SDK
|
|
52
|
+
|
|
53
|
+
The official Python SDK for the Cortex AI platform. Build powerful, context-aware AI applications in your Python applications.
|
|
54
|
+
|
|
55
|
+
## Links
|
|
56
|
+
|
|
57
|
+
- **Homepage:** [usecortex.ai](https://www.usecortex.ai/)
|
|
58
|
+
- **Documentation:** [docs.usecortex.ai](https://docs.usecortex.ai/)
|
|
59
|
+
|
|
60
|
+
## Getting Started
|
|
61
|
+
|
|
62
|
+
Please refer to our [SDK documentation](https://docs.usecortex.ai/api-reference/sdks) and [API reference](https://docs.usecortex.ai/api-reference/introduction) to get started.
|
|
63
|
+
|
|
64
|
+
## Support
|
|
65
|
+
|
|
66
|
+
If you have any questions or need help, please reach out to our support team at [founders@usecortex.ai](mailto:founders@usecortex.ai).
|
|
@@ -39,8 +39,8 @@ usecortex_ai/search/raw_client.py,sha256=N6v4Ds6AO9R2A0D_wRUnA1xub_y8_ppec6HxPC0
|
|
|
39
39
|
usecortex_ai/search/types/__init__.py,sha256=T0zQrrDzfvgmw2Deo_iYanUoxcVhZ9jDO_fS3CpSU9M,131
|
|
40
40
|
usecortex_ai/search/types/alpha.py,sha256=afIpOT9uMdYdUZB_biXoggzRnZlnr00miVPDgxDRFIA,113
|
|
41
41
|
usecortex_ai/sources/__init__.py,sha256=_VhToAyIt_5axN6CLJwtxg3-CO7THa_23pbUzqhXJa4,85
|
|
42
|
-
usecortex_ai/sources/client.py,sha256=
|
|
43
|
-
usecortex_ai/sources/raw_client.py,sha256=
|
|
42
|
+
usecortex_ai/sources/client.py,sha256=e63A4h0AVEsjCBLFMjTqsgd2L-BPCiSWC7_12SnsvII,7970
|
|
43
|
+
usecortex_ai/sources/raw_client.py,sha256=85pnqg4qDaYzyWUx2Y5FQBUKAKm2VqhEIDTGoqf1rLY,23353
|
|
44
44
|
usecortex_ai/tenant/__init__.py,sha256=_VhToAyIt_5axN6CLJwtxg3-CO7THa_23pbUzqhXJa4,85
|
|
45
45
|
usecortex_ai/tenant/client.py,sha256=IhVoy4lN2UTO8nvkT5NJXhExb6DrqP7CG51mm647akA,8764
|
|
46
46
|
usecortex_ai/tenant/raw_client.py,sha256=aUBX_Fk09hHga_ezEr6iMD5G1xTnBO0RR4RYksGHZdw,31494
|
|
@@ -94,8 +94,8 @@ usecortex_ai/user/raw_client.py,sha256=RnloKJVojvAknaylQknMUY9kS0HwP6_QjcmMuFvvi
|
|
|
94
94
|
usecortex_ai/user_memory/__init__.py,sha256=_VhToAyIt_5axN6CLJwtxg3-CO7THa_23pbUzqhXJa4,85
|
|
95
95
|
usecortex_ai/user_memory/client.py,sha256=tvRx5U_x8VtE7hUN52AMlMMVsWOgUcEK4rzXrVUNHXM,21299
|
|
96
96
|
usecortex_ai/user_memory/raw_client.py,sha256=XVsgzClh57SQWtUXc2ikaywbYRME6zA25PSIu7-9m4M,59521
|
|
97
|
-
usecortex_ai-0.3.
|
|
98
|
-
usecortex_ai-0.3.
|
|
99
|
-
usecortex_ai-0.3.
|
|
100
|
-
usecortex_ai-0.3.
|
|
101
|
-
usecortex_ai-0.3.
|
|
97
|
+
usecortex_ai-0.3.1.dist-info/licenses/LICENSE,sha256=ExSrDLXpv6Bq3AiBk9VwLfysI9Fj-L3LqJNGKqbxNzw,1256
|
|
98
|
+
usecortex_ai-0.3.1.dist-info/METADATA,sha256=R_P9TggMnCwtU2M9muxDbU6LQcz9qo4glxbe1nQxMfw,2965
|
|
99
|
+
usecortex_ai-0.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
100
|
+
usecortex_ai-0.3.1.dist-info/top_level.txt,sha256=TQ77el6hL0CvN7BTXJVFTqZ5ot1_kHKo2ZnEcOvZsjo,13
|
|
101
|
+
usecortex_ai-0.3.1.dist-info/RECORD,,
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: usecortex-ai
|
|
3
|
-
Version: 0.3.0
|
|
4
|
-
Summary: The official Python SDK for the Cortex AI platform.
|
|
5
|
-
Author-email: Nishkarsh Shrivastava <nishkarsh@usecortex.ai>
|
|
6
|
-
License: Copyright (c) 2024 Cortex AI
|
|
7
|
-
|
|
8
|
-
All Rights Reserved.
|
|
9
|
-
|
|
10
|
-
PROPRIETARY AND CONFIDENTIAL
|
|
11
|
-
|
|
12
|
-
This software is the proprietary and confidential property of Cortex AI ("the Company").
|
|
13
|
-
Permission is hereby granted to authorized users to install and use this software as part of the Cortex AI service, subject to the terms and conditions of the service agreement entered into with the Company.
|
|
14
|
-
|
|
15
|
-
You may not, without the express written permission of the Company:
|
|
16
|
-
|
|
17
|
-
1. Copy, modify, or create derivative works of the software.
|
|
18
|
-
2. Distribute, sell, rent, lease, sublicense, or otherwise transfer the software to any third party.
|
|
19
|
-
3. Reverse engineer, decompile, or disassemble the software, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation.
|
|
20
|
-
|
|
21
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
-
SOFTWARE.
|
|
28
|
-
Project-URL: Homepage, https://www.usecortex.ai/
|
|
29
|
-
Project-URL: Documentation, https://docs.usecortex.ai/
|
|
30
|
-
Keywords: cortex,ai,sdk,api,generative ai,rag
|
|
31
|
-
Classifier: Development Status :: 4 - Beta
|
|
32
|
-
Classifier: Programming Language :: Python :: 3
|
|
33
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
34
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
35
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
36
|
-
Classifier: Intended Audience :: Developers
|
|
37
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
38
|
-
Classifier: Typing :: Typed
|
|
39
|
-
Requires-Python: >=3.10
|
|
40
|
-
Description-Content-Type: text/markdown
|
|
41
|
-
License-File: LICENSE
|
|
42
|
-
Requires-Dist: httpx>=0.24
|
|
43
|
-
Requires-Dist: pydantic<3,>=1.10
|
|
44
|
-
Dynamic: license-file
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
# Introduction
|
|
48
|
-
|
|
49
|
-
> You can generate and manage API keys from your Cortex Dashboard. All endpoints require an API key sent as a Bearer token in the Authorization header.
|
|
50
|
-
|
|
51
|
-
Welcome to the Cortex SDK API Reference. This section documents every available endpoint and how to interact with them to power AI apps and agents with intelligent memory and retrieval.
|
|
52
|
-
|
|
53
|
-
> Base URL: `https://api.usecortex.ai`
|
|
54
|
-
>
|
|
55
|
-
> Contact us to get your API key at [founders@usecortex.ai](mailto:founders@usecortex.ai)
|
|
56
|
-
|
|
57
|
-
```mdx
|
|
58
|
-
Authorization: Bearer <your_api_key>
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
### **Data Ingestion**
|
|
62
|
-
|
|
63
|
-
Upload and import content into Cortex from various sources.
|
|
64
|
-
|
|
65
|
-
* `/upload/upload_document` — Upload single documents
|
|
66
|
-
* `/upload/upload_text` — Upload text/markdown content
|
|
67
|
-
* `/upload/upload_app_sources` — Import from workplace apps (Gmail, Slack, etc.)
|
|
68
|
-
* `/upload/scrape_webpage` — Scrape and index web content
|
|
69
|
-
* `/upload/verify_processing` — Check upload processing status
|
|
70
|
-
* `/upload/batch_upload` — Upload multiple files at once
|
|
71
|
-
|
|
72
|
-
### **Search & Query**
|
|
73
|
-
|
|
74
|
-
Retrieve answers and information from your knowledge base.
|
|
75
|
-
|
|
76
|
-
* `/search/qna` — Main search endpoint with AI-powered responses. Supports optional `metadata` parameter to filter sources by `source_title` or `source_type`.
|
|
77
|
-
* `/search/retrieve` — Hybrid search without AI generation. Returns structured search results for custom processing.
|
|
78
|
-
– `/search/full-text-search` – Perform a full text search without AI generation. Allows you to use operators like logical `AND`, `OR`
|
|
79
|
-
|
|
80
|
-
### **Knowledge Management**
|
|
81
|
-
|
|
82
|
-
Browse, fetch, and manage your knowledge base.
|
|
83
|
-
|
|
84
|
-
* `/list/sources` — Browse all indexed sources
|
|
85
|
-
* `/list/sources_by_id` — Get specific sources by ID
|
|
86
|
-
* `/fetch/fetch_content` — Retrieve file content and download URLs
|
|
87
|
-
* `/delete_source` — Remove sources from knowledge base
|
|
88
|
-
|
|
89
|
-
### **Update & Upsert**
|
|
90
|
-
|
|
91
|
-
Update existing content and embeddings. If a `source_id` does not exist, these endpoints upsert (create or update).
|
|
92
|
-
|
|
93
|
-
* `/upload/update_text` — Upsert markdown/text content by `source_id`
|
|
94
|
-
* `/upload/update_document` — Upsert a file/document by `source_id`
|
|
95
|
-
* `/upload/update_webpage` — Re-scrape and upsert a webpage by `source_id` and `web_url`
|
|
96
|
-
* `/upload/update_embeddings` — Update existing embeddings by `chunk_id` within a batch/source
|
|
97
|
-
|
|
98
|
-
### **Embeddings**
|
|
99
|
-
|
|
100
|
-
Manage and query pre-computed embeddings.
|
|
101
|
-
|
|
102
|
-
* `/upload/upload_embeddings` — Upload embeddings and get generated `chunk_ids`
|
|
103
|
-
* `/embeddings/search` — Vector similarity search; returns nearest `chunk_ids` and scores
|
|
104
|
-
* `/embeddings/by-chunk-ids` — Retrieve embedding vectors for specific `chunk_ids`
|
|
105
|
-
* `/embeddings/delete` — Delete embeddings by `chunk_id`
|
|
106
|
-
|
|
107
|
-
### **Tenant Management**
|
|
108
|
-
|
|
109
|
-
Create and monitor tenants for multi-tenant setups.
|
|
110
|
-
|
|
111
|
-
* `/user/create_tenant` — Create a tenant (optionally provide `tenant_id`, or auto-generate)
|
|
112
|
-
* `/embeddings/create_embeddings_tenant` — Create an embeddings-only tenant (sets `sub_tenant_id = tenant_id`); use when directly uploading/searching embeddings
|
|
113
|
-
* `/tenant/stats` — Get tenant stats (object count, vector dimension, identifiers)
|
|
114
|
-
|
|
115
|
-
### **User Memory**
|
|
116
|
-
|
|
117
|
-
Personalize, retrieve, and manage user-specific AI memories for advanced agentic workflows.
|
|
118
|
-
|
|
119
|
-
* `/user_memory/list_user_memories` — Browse user memories
|
|
120
|
-
* `/user_memory/retrieve_user_memory` — Get specific user memories
|
|
121
|
-
* `/user_memory/add_user_memory` — Manually add user-specific memories
|
|
122
|
-
* `/user_memory/generate_user_memory` — AI-generated personalized memories
|
|
123
|
-
* `/user_memory/delete_user_memory` — Remove user memories
|
|
124
|
-
|
|
125
|
-
## 💡 Best Practices
|
|
126
|
-
|
|
127
|
-
* Use **sub-tenants** to support multi-user isolation in B2B use cases.
|
|
128
|
-
* Leverage **metadata** (e.g., `source_title`, `source_type` in the QnA API) for fine-grained filtering and agentic retrieval.
|
|
129
|
-
* Tune **search\_alpha** and **recency\_bias** to control relevance.
|
|
130
|
-
* Enable **highlight\_chunks** for chunk-level citations.
|
|
131
|
-
|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|