usecortex-ai 0.5.0__py3-none-any.whl → 0.5.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/__init__.py +8 -4
- usecortex_ai/client.py +0 -4
- usecortex_ai/dashboard/client.py +2 -30
- usecortex_ai/dashboard/raw_client.py +0 -28
- usecortex_ai/embeddings/client.py +8 -58
- usecortex_ai/embeddings/raw_client.py +8 -58
- usecortex_ai/fetch/__init__.py +3 -0
- usecortex_ai/fetch/client.py +42 -165
- usecortex_ai/fetch/raw_client.py +38 -341
- usecortex_ai/fetch/types/__init__.py +7 -0
- usecortex_ai/fetch/types/fetch_list_knowledge_response.py +8 -0
- usecortex_ai/raw_client.py +0 -4
- usecortex_ai/search/client.py +36 -124
- usecortex_ai/search/raw_client.py +36 -124
- usecortex_ai/sources/client.py +2 -16
- usecortex_ai/sources/raw_client.py +2 -16
- usecortex_ai/tenant/client.py +4 -108
- usecortex_ai/tenant/raw_client.py +2 -106
- usecortex_ai/types/__init__.py +6 -2
- usecortex_ai/types/list_content_kind.py +5 -0
- usecortex_ai/types/list_user_memories_response.py +32 -0
- usecortex_ai/types/retrieval_result.py +1 -1
- usecortex_ai/types/retrieve_mode.py +1 -1
- usecortex_ai/types/user_memory.py +31 -0
- usecortex_ai/upload/__init__.py +0 -3
- usecortex_ai/upload/client.py +34 -204
- usecortex_ai/upload/raw_client.py +30 -382
- {usecortex_ai-0.5.0.dist-info → usecortex_ai-0.5.1.dist-info}/METADATA +1 -1
- {usecortex_ai-0.5.0.dist-info → usecortex_ai-0.5.1.dist-info}/RECORD +32 -30
- {usecortex_ai-0.5.0.dist-info → usecortex_ai-0.5.1.dist-info}/licenses/LICENSE +21 -21
- {usecortex_ai-0.5.0.dist-info → usecortex_ai-0.5.1.dist-info}/top_level.txt +0 -0
- usecortex_ai/types/app_sources_upload_data.py +0 -39
- usecortex_ai/upload/types/__init__.py +0 -7
- usecortex_ai/upload/types/body_upload_app_ingestion_upload_app_post_app_sources.py +0 -7
- {usecortex_ai-0.5.0.dist-info → usecortex_ai-0.5.1.dist-info}/WHEEL +0 -0
usecortex_ai/fetch/client.py
CHANGED
|
@@ -5,10 +5,11 @@ import typing
|
|
|
5
5
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
6
|
from ..core.request_options import RequestOptions
|
|
7
7
|
from ..types.fetch_mode import FetchMode
|
|
8
|
+
from ..types.list_content_kind import ListContentKind
|
|
8
9
|
from ..types.source_fetch_response import SourceFetchResponse
|
|
9
10
|
from ..types.source_graph_relations_response import SourceGraphRelationsResponse
|
|
10
|
-
from ..types.source_list_response import SourceListResponse
|
|
11
11
|
from .raw_client import AsyncRawFetchClient, RawFetchClient
|
|
12
|
+
from .types.fetch_list_knowledge_response import FetchListKnowledgeResponse
|
|
12
13
|
|
|
13
14
|
# this is used as the default value for optional parameters
|
|
14
15
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -29,86 +30,36 @@ class FetchClient:
|
|
|
29
30
|
"""
|
|
30
31
|
return self._raw_client
|
|
31
32
|
|
|
32
|
-
def
|
|
33
|
+
def list_knowledge(
|
|
33
34
|
self,
|
|
34
35
|
*,
|
|
35
36
|
tenant_id: str,
|
|
36
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
37
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
38
|
-
) -> SourceListResponse:
|
|
39
|
-
"""
|
|
40
|
-
Retrieve all sources for a specific tenant and subtenant combination.
|
|
41
|
-
|
|
42
|
-
Use this endpoint to fetch a complete list of all sources associated
|
|
43
|
-
with your tenant. This includes documents, files, and other content
|
|
44
|
-
you've uploaded for processing.
|
|
45
|
-
|
|
46
|
-
You can optionally specify a sub-tenant to narrow down the results to
|
|
47
|
-
sources within that specific sub-tenant scope.
|
|
48
|
-
|
|
49
|
-
Parameters
|
|
50
|
-
----------
|
|
51
|
-
tenant_id : str
|
|
52
|
-
Unique identifier for the tenant/organization
|
|
53
|
-
|
|
54
|
-
sub_tenant_id : typing.Optional[str]
|
|
55
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
56
|
-
|
|
57
|
-
request_options : typing.Optional[RequestOptions]
|
|
58
|
-
Request-specific configuration.
|
|
59
|
-
|
|
60
|
-
Returns
|
|
61
|
-
-------
|
|
62
|
-
SourceListResponse
|
|
63
|
-
Successful Response
|
|
64
|
-
|
|
65
|
-
Examples
|
|
66
|
-
--------
|
|
67
|
-
from usecortex-ai import CortexAI
|
|
68
|
-
|
|
69
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
70
|
-
client.fetch.sources(tenant_id='tenant_id', )
|
|
71
|
-
"""
|
|
72
|
-
_response = self._raw_client.sources(
|
|
73
|
-
tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
74
|
-
)
|
|
75
|
-
return _response.data
|
|
76
|
-
|
|
77
|
-
def source_by_ids(
|
|
78
|
-
self,
|
|
79
|
-
*,
|
|
80
|
-
source_ids: typing.Sequence[str],
|
|
81
|
-
tenant_id: str,
|
|
82
37
|
sub_tenant_id: typing.Optional[str] = OMIT,
|
|
38
|
+
kind: typing.Optional[ListContentKind] = OMIT,
|
|
39
|
+
source_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
83
40
|
request_options: typing.Optional[RequestOptions] = None,
|
|
84
|
-
) ->
|
|
41
|
+
) -> FetchListKnowledgeResponse:
|
|
85
42
|
"""
|
|
86
|
-
Retrieve specific sources by their IDs.
|
|
87
|
-
|
|
88
|
-
Use this endpoint to fetch one or more sources by providing their
|
|
89
|
-
unique identifiers. This is useful when you need detailed information
|
|
90
|
-
about specific documents or content you've previously uploaded.
|
|
91
|
-
|
|
92
|
-
Provide the source IDs in the request body along with your tenant
|
|
93
|
-
information to get the exact sources you need.
|
|
94
|
-
|
|
95
43
|
Parameters
|
|
96
44
|
----------
|
|
97
|
-
source_ids : typing.Sequence[str]
|
|
98
|
-
List of source IDs to fetch.
|
|
99
|
-
|
|
100
45
|
tenant_id : str
|
|
101
46
|
Tenant ID
|
|
102
47
|
|
|
103
48
|
sub_tenant_id : typing.Optional[str]
|
|
104
49
|
Sub-tenant ID
|
|
105
50
|
|
|
51
|
+
kind : typing.Optional[ListContentKind]
|
|
52
|
+
Whether to list normal sources or user memories.
|
|
53
|
+
|
|
54
|
+
source_ids : typing.Optional[typing.Sequence[str]]
|
|
55
|
+
Optional list of IDs to fetch. If omitted, returns all.
|
|
56
|
+
|
|
106
57
|
request_options : typing.Optional[RequestOptions]
|
|
107
58
|
Request-specific configuration.
|
|
108
59
|
|
|
109
60
|
Returns
|
|
110
61
|
-------
|
|
111
|
-
|
|
62
|
+
FetchListKnowledgeResponse
|
|
112
63
|
Successful Response
|
|
113
64
|
|
|
114
65
|
Examples
|
|
@@ -116,10 +67,14 @@ class FetchClient:
|
|
|
116
67
|
from usecortex-ai import CortexAI
|
|
117
68
|
|
|
118
69
|
client = CortexAI(token="YOUR_TOKEN", )
|
|
119
|
-
client.fetch.
|
|
70
|
+
client.fetch.list_knowledge(tenant_id='tenant_1234', )
|
|
120
71
|
"""
|
|
121
|
-
_response = self._raw_client.
|
|
122
|
-
|
|
72
|
+
_response = self._raw_client.list_knowledge(
|
|
73
|
+
tenant_id=tenant_id,
|
|
74
|
+
sub_tenant_id=sub_tenant_id,
|
|
75
|
+
kind=kind,
|
|
76
|
+
source_ids=source_ids,
|
|
77
|
+
request_options=request_options,
|
|
123
78
|
)
|
|
124
79
|
return _response.data
|
|
125
80
|
|
|
@@ -132,13 +87,6 @@ class FetchClient:
|
|
|
132
87
|
request_options: typing.Optional[RequestOptions] = None,
|
|
133
88
|
) -> SourceGraphRelationsResponse:
|
|
134
89
|
"""
|
|
135
|
-
Retrieve relations for a specific source.
|
|
136
|
-
|
|
137
|
-
Use this endpoint to fetch all relations associated with a specific source.
|
|
138
|
-
This is useful when you need to understand the relationships between entities within a source.
|
|
139
|
-
|
|
140
|
-
Provide the source ID in the request body along with your tenant information to get the relations for that source.
|
|
141
|
-
|
|
142
90
|
Parameters
|
|
143
91
|
----------
|
|
144
92
|
source_id : str
|
|
@@ -163,7 +111,7 @@ class FetchClient:
|
|
|
163
111
|
from usecortex-ai import CortexAI
|
|
164
112
|
|
|
165
113
|
client = CortexAI(token="YOUR_TOKEN", )
|
|
166
|
-
client.fetch.graph_relations_by_source_id(source_id='
|
|
114
|
+
client.fetch.graph_relations_by_source_id(source_id='<str>', tenant_id='tenant_1234', )
|
|
167
115
|
"""
|
|
168
116
|
_response = self._raw_client.graph_relations_by_source_id(
|
|
169
117
|
source_id=source_id, tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
@@ -181,13 +129,6 @@ class FetchClient:
|
|
|
181
129
|
request_options: typing.Optional[RequestOptions] = None,
|
|
182
130
|
) -> SourceFetchResponse:
|
|
183
131
|
"""
|
|
184
|
-
Fetch the content of a source ingested.
|
|
185
|
-
|
|
186
|
-
This endpoint can return:
|
|
187
|
-
- File content directly (as string or base64)
|
|
188
|
-
- A presigned URL to access the file
|
|
189
|
-
- Both content and presigned URL
|
|
190
|
-
|
|
191
132
|
Parameters
|
|
192
133
|
----------
|
|
193
134
|
tenant_id : str
|
|
@@ -218,7 +159,7 @@ class FetchClient:
|
|
|
218
159
|
from usecortex-ai import CortexAI
|
|
219
160
|
|
|
220
161
|
client = CortexAI(token="YOUR_TOKEN", )
|
|
221
|
-
client.fetch.source_content(tenant_id='
|
|
162
|
+
client.fetch.source_content(tenant_id='tenant_1234', source_id='<source_id>', )
|
|
222
163
|
"""
|
|
223
164
|
_response = self._raw_client.source_content(
|
|
224
165
|
tenant_id=tenant_id,
|
|
@@ -246,90 +187,36 @@ class AsyncFetchClient:
|
|
|
246
187
|
"""
|
|
247
188
|
return self._raw_client
|
|
248
189
|
|
|
249
|
-
async def
|
|
250
|
-
self,
|
|
251
|
-
*,
|
|
252
|
-
tenant_id: str,
|
|
253
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
254
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
255
|
-
) -> SourceListResponse:
|
|
256
|
-
"""
|
|
257
|
-
Retrieve all sources for a specific tenant and subtenant combination.
|
|
258
|
-
|
|
259
|
-
Use this endpoint to fetch a complete list of all sources associated
|
|
260
|
-
with your tenant. This includes documents, files, and other content
|
|
261
|
-
you've uploaded for processing.
|
|
262
|
-
|
|
263
|
-
You can optionally specify a sub-tenant to narrow down the results to
|
|
264
|
-
sources within that specific sub-tenant scope.
|
|
265
|
-
|
|
266
|
-
Parameters
|
|
267
|
-
----------
|
|
268
|
-
tenant_id : str
|
|
269
|
-
Unique identifier for the tenant/organization
|
|
270
|
-
|
|
271
|
-
sub_tenant_id : typing.Optional[str]
|
|
272
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
273
|
-
|
|
274
|
-
request_options : typing.Optional[RequestOptions]
|
|
275
|
-
Request-specific configuration.
|
|
276
|
-
|
|
277
|
-
Returns
|
|
278
|
-
-------
|
|
279
|
-
SourceListResponse
|
|
280
|
-
Successful Response
|
|
281
|
-
|
|
282
|
-
Examples
|
|
283
|
-
--------
|
|
284
|
-
import asyncio
|
|
285
|
-
|
|
286
|
-
from usecortex-ai import AsyncCortexAI
|
|
287
|
-
|
|
288
|
-
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
289
|
-
async def main() -> None:
|
|
290
|
-
await client.fetch.sources(tenant_id='tenant_id', )
|
|
291
|
-
asyncio.run(main())
|
|
292
|
-
"""
|
|
293
|
-
_response = await self._raw_client.sources(
|
|
294
|
-
tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
295
|
-
)
|
|
296
|
-
return _response.data
|
|
297
|
-
|
|
298
|
-
async def source_by_ids(
|
|
190
|
+
async def list_knowledge(
|
|
299
191
|
self,
|
|
300
192
|
*,
|
|
301
|
-
source_ids: typing.Sequence[str],
|
|
302
193
|
tenant_id: str,
|
|
303
194
|
sub_tenant_id: typing.Optional[str] = OMIT,
|
|
195
|
+
kind: typing.Optional[ListContentKind] = OMIT,
|
|
196
|
+
source_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
304
197
|
request_options: typing.Optional[RequestOptions] = None,
|
|
305
|
-
) ->
|
|
198
|
+
) -> FetchListKnowledgeResponse:
|
|
306
199
|
"""
|
|
307
|
-
Retrieve specific sources by their IDs.
|
|
308
|
-
|
|
309
|
-
Use this endpoint to fetch one or more sources by providing their
|
|
310
|
-
unique identifiers. This is useful when you need detailed information
|
|
311
|
-
about specific documents or content you've previously uploaded.
|
|
312
|
-
|
|
313
|
-
Provide the source IDs in the request body along with your tenant
|
|
314
|
-
information to get the exact sources you need.
|
|
315
|
-
|
|
316
200
|
Parameters
|
|
317
201
|
----------
|
|
318
|
-
source_ids : typing.Sequence[str]
|
|
319
|
-
List of source IDs to fetch.
|
|
320
|
-
|
|
321
202
|
tenant_id : str
|
|
322
203
|
Tenant ID
|
|
323
204
|
|
|
324
205
|
sub_tenant_id : typing.Optional[str]
|
|
325
206
|
Sub-tenant ID
|
|
326
207
|
|
|
208
|
+
kind : typing.Optional[ListContentKind]
|
|
209
|
+
Whether to list normal sources or user memories.
|
|
210
|
+
|
|
211
|
+
source_ids : typing.Optional[typing.Sequence[str]]
|
|
212
|
+
Optional list of IDs to fetch. If omitted, returns all.
|
|
213
|
+
|
|
327
214
|
request_options : typing.Optional[RequestOptions]
|
|
328
215
|
Request-specific configuration.
|
|
329
216
|
|
|
330
217
|
Returns
|
|
331
218
|
-------
|
|
332
|
-
|
|
219
|
+
FetchListKnowledgeResponse
|
|
333
220
|
Successful Response
|
|
334
221
|
|
|
335
222
|
Examples
|
|
@@ -340,11 +227,15 @@ class AsyncFetchClient:
|
|
|
340
227
|
|
|
341
228
|
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
342
229
|
async def main() -> None:
|
|
343
|
-
await client.fetch.
|
|
230
|
+
await client.fetch.list_knowledge(tenant_id='tenant_1234', )
|
|
344
231
|
asyncio.run(main())
|
|
345
232
|
"""
|
|
346
|
-
_response = await self._raw_client.
|
|
347
|
-
|
|
233
|
+
_response = await self._raw_client.list_knowledge(
|
|
234
|
+
tenant_id=tenant_id,
|
|
235
|
+
sub_tenant_id=sub_tenant_id,
|
|
236
|
+
kind=kind,
|
|
237
|
+
source_ids=source_ids,
|
|
238
|
+
request_options=request_options,
|
|
348
239
|
)
|
|
349
240
|
return _response.data
|
|
350
241
|
|
|
@@ -357,13 +248,6 @@ class AsyncFetchClient:
|
|
|
357
248
|
request_options: typing.Optional[RequestOptions] = None,
|
|
358
249
|
) -> SourceGraphRelationsResponse:
|
|
359
250
|
"""
|
|
360
|
-
Retrieve relations for a specific source.
|
|
361
|
-
|
|
362
|
-
Use this endpoint to fetch all relations associated with a specific source.
|
|
363
|
-
This is useful when you need to understand the relationships between entities within a source.
|
|
364
|
-
|
|
365
|
-
Provide the source ID in the request body along with your tenant information to get the relations for that source.
|
|
366
|
-
|
|
367
251
|
Parameters
|
|
368
252
|
----------
|
|
369
253
|
source_id : str
|
|
@@ -391,7 +275,7 @@ class AsyncFetchClient:
|
|
|
391
275
|
|
|
392
276
|
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
393
277
|
async def main() -> None:
|
|
394
|
-
await client.fetch.graph_relations_by_source_id(source_id='
|
|
278
|
+
await client.fetch.graph_relations_by_source_id(source_id='<str>', tenant_id='tenant_1234', )
|
|
395
279
|
asyncio.run(main())
|
|
396
280
|
"""
|
|
397
281
|
_response = await self._raw_client.graph_relations_by_source_id(
|
|
@@ -410,13 +294,6 @@ class AsyncFetchClient:
|
|
|
410
294
|
request_options: typing.Optional[RequestOptions] = None,
|
|
411
295
|
) -> SourceFetchResponse:
|
|
412
296
|
"""
|
|
413
|
-
Fetch the content of a source ingested.
|
|
414
|
-
|
|
415
|
-
This endpoint can return:
|
|
416
|
-
- File content directly (as string or base64)
|
|
417
|
-
- A presigned URL to access the file
|
|
418
|
-
- Both content and presigned URL
|
|
419
|
-
|
|
420
297
|
Parameters
|
|
421
298
|
----------
|
|
422
299
|
tenant_id : str
|
|
@@ -450,7 +327,7 @@ class AsyncFetchClient:
|
|
|
450
327
|
|
|
451
328
|
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
452
329
|
async def main() -> None:
|
|
453
|
-
await client.fetch.source_content(tenant_id='
|
|
330
|
+
await client.fetch.source_content(tenant_id='tenant_1234', source_id='<source_id>', )
|
|
454
331
|
asyncio.run(main())
|
|
455
332
|
"""
|
|
456
333
|
_response = await self._raw_client.source_content(
|