usecortex-ai 0.3.6__py3-none-any.whl → 0.4.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 +80 -70
- usecortex_ai/client.py +25 -23
- usecortex_ai/dashboard/client.py +448 -0
- usecortex_ai/{user_memory → dashboard}/raw_client.py +371 -530
- usecortex_ai/embeddings/client.py +229 -102
- usecortex_ai/embeddings/raw_client.py +323 -211
- usecortex_ai/errors/__init__.py +2 -0
- usecortex_ai/errors/bad_request_error.py +1 -2
- usecortex_ai/errors/forbidden_error.py +1 -2
- usecortex_ai/errors/internal_server_error.py +1 -2
- usecortex_ai/errors/not_found_error.py +1 -2
- usecortex_ai/errors/service_unavailable_error.py +1 -2
- usecortex_ai/errors/too_many_requests_error.py +11 -0
- usecortex_ai/errors/unauthorized_error.py +1 -2
- usecortex_ai/fetch/client.py +350 -29
- usecortex_ai/fetch/raw_client.py +919 -65
- usecortex_ai/raw_client.py +8 -2
- usecortex_ai/search/client.py +293 -257
- usecortex_ai/search/raw_client.py +445 -346
- usecortex_ai/search/types/alpha.py +1 -1
- usecortex_ai/sources/client.py +29 -216
- usecortex_ai/sources/raw_client.py +51 -589
- usecortex_ai/tenant/client.py +155 -118
- usecortex_ai/tenant/raw_client.py +227 -350
- usecortex_ai/types/__init__.py +74 -66
- usecortex_ai/types/add_memory_response.py +39 -0
- usecortex_ai/types/{relations.py → api_key_info.py} +25 -5
- usecortex_ai/types/app_sources_upload_data.py +15 -6
- usecortex_ai/types/{file_upload_result.py → collection_stats.py} +5 -5
- usecortex_ai/types/custom_property_definition.py +75 -0
- usecortex_ai/types/dashboard_apis_response.py +33 -0
- usecortex_ai/types/dashboard_sources_response.py +33 -0
- usecortex_ai/types/dashboard_tenants_response.py +33 -0
- usecortex_ai/types/{list_sources_response.py → delete_result.py} +10 -7
- usecortex_ai/types/delete_user_memory_response.py +1 -1
- usecortex_ai/types/entity.py +4 -4
- usecortex_ai/types/fetch_mode.py +5 -0
- usecortex_ai/types/graph_context.py +26 -0
- usecortex_ai/types/{delete_sources.py → infra.py} +4 -3
- usecortex_ai/types/{fetch_content_data.py → insert_result.py} +12 -8
- usecortex_ai/types/memory_item.py +82 -0
- usecortex_ai/types/memory_result_item.py +47 -0
- usecortex_ai/types/milvus_data_type.py +21 -0
- usecortex_ai/types/path_triplet.py +3 -18
- usecortex_ai/types/processing_status.py +3 -2
- usecortex_ai/types/processing_status_indexing_status.py +7 -0
- usecortex_ai/types/qn_a_search_response.py +49 -0
- usecortex_ai/types/{retrieve_response.py → raw_embedding_document.py} +11 -8
- usecortex_ai/types/raw_embedding_search_result.py +47 -0
- usecortex_ai/types/{user_memory.py → raw_embedding_vector.py} +6 -6
- usecortex_ai/types/relation_evidence.py +24 -5
- usecortex_ai/types/retrieval_result.py +26 -0
- usecortex_ai/types/scored_path_response.py +5 -19
- usecortex_ai/types/search_mode.py +5 -0
- usecortex_ai/types/{batch_upload_data.py → source_delete_response.py} +8 -8
- usecortex_ai/types/{list_user_memories_response.py → source_delete_result_item.py} +11 -7
- usecortex_ai/types/source_fetch_response.py +70 -0
- usecortex_ai/types/{graph_relations_response.py → source_graph_relations_response.py} +3 -3
- usecortex_ai/types/{single_upload_data.py → source_list_response.py} +7 -10
- usecortex_ai/types/source_model.py +11 -1
- usecortex_ai/types/source_status.py +5 -0
- usecortex_ai/types/source_upload_response.py +35 -0
- usecortex_ai/types/source_upload_result_item.py +38 -0
- usecortex_ai/types/supported_llm_providers.py +5 -0
- usecortex_ai/types/{embeddings_create_collection_data.py → tenant_create_response.py} +9 -7
- usecortex_ai/types/{webpage_scrape_request.py → tenant_info.py} +10 -5
- usecortex_ai/types/{scored_triplet_response.py → tenant_metadata_schema_info.py} +8 -15
- usecortex_ai/types/{tenant_create_data.py → tenant_stats_response.py} +9 -8
- usecortex_ai/types/{triple_with_evidence.py → triplet_with_evidence.py} +5 -1
- usecortex_ai/types/user_assistant_pair.py +4 -0
- usecortex_ai/types/{search_chunk.py → vector_store_chunk.py} +3 -14
- usecortex_ai/upload/__init__.py +3 -0
- usecortex_ai/upload/client.py +233 -1937
- usecortex_ai/upload/raw_client.py +364 -4401
- usecortex_ai/upload/types/__init__.py +7 -0
- usecortex_ai/upload/types/body_upload_app_ingestion_upload_app_post_app_sources.py +7 -0
- {usecortex_ai-0.3.6.dist-info → usecortex_ai-0.4.0.dist-info}/METADATA +2 -2
- usecortex_ai-0.4.0.dist-info/RECORD +113 -0
- {usecortex_ai-0.3.6.dist-info → usecortex_ai-0.4.0.dist-info}/WHEEL +1 -1
- usecortex_ai/document/client.py +0 -139
- usecortex_ai/document/raw_client.py +0 -312
- usecortex_ai/types/add_user_memory_response.py +0 -41
- usecortex_ai/types/body_scrape_webpage_upload_scrape_webpage_post.py +0 -17
- usecortex_ai/types/body_update_scrape_job_upload_update_webpage_patch.py +0 -17
- usecortex_ai/types/chunk_graph_relations_response.py +0 -33
- usecortex_ai/types/delete_memory_request.py +0 -32
- usecortex_ai/types/delete_sub_tenant_data.py +0 -42
- usecortex_ai/types/embeddings_delete_data.py +0 -37
- usecortex_ai/types/embeddings_get_data.py +0 -37
- usecortex_ai/types/embeddings_search_data.py +0 -37
- usecortex_ai/types/extended_context.py +0 -17
- usecortex_ai/types/markdown_upload_request.py +0 -41
- usecortex_ai/types/related_chunk.py +0 -22
- usecortex_ai/types/retrieve_user_memory_response.py +0 -38
- usecortex_ai/types/source.py +0 -52
- usecortex_ai/types/sub_tenant_ids_data.py +0 -47
- usecortex_ai/types/tenant_stats.py +0 -42
- usecortex_ai/user/__init__.py +0 -4
- usecortex_ai/user/client.py +0 -145
- usecortex_ai/user/raw_client.py +0 -316
- usecortex_ai/user_memory/__init__.py +0 -4
- usecortex_ai/user_memory/client.py +0 -515
- usecortex_ai-0.3.6.dist-info/RECORD +0 -112
- /usecortex_ai/{document → dashboard}/__init__.py +0 -0
- {usecortex_ai-0.3.6.dist-info → usecortex_ai-0.4.0.dist-info}/licenses/LICENSE +0 -0
- {usecortex_ai-0.3.6.dist-info → usecortex_ai-0.4.0.dist-info}/top_level.txt +0 -0
usecortex_ai/sources/client.py
CHANGED
|
@@ -4,8 +4,7 @@ import typing
|
|
|
4
4
|
|
|
5
5
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
6
|
from ..core.request_options import RequestOptions
|
|
7
|
-
from ..types.
|
|
8
|
-
from ..types.list_sources_response import ListSourcesResponse
|
|
7
|
+
from ..types.source_delete_response import SourceDeleteResponse
|
|
9
8
|
from .raw_client import AsyncRawSourcesClient, RawSourcesClient
|
|
10
9
|
|
|
11
10
|
# this is used as the default value for optional parameters
|
|
@@ -27,126 +26,37 @@ class SourcesClient:
|
|
|
27
26
|
"""
|
|
28
27
|
return self._raw_client
|
|
29
28
|
|
|
30
|
-
def
|
|
31
|
-
self,
|
|
32
|
-
*,
|
|
33
|
-
tenant_id: str,
|
|
34
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
35
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
36
|
-
) -> ListSourcesResponse:
|
|
37
|
-
"""
|
|
38
|
-
Retrieve all sources for a specific tenant.
|
|
39
|
-
|
|
40
|
-
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.
|
|
41
|
-
|
|
42
|
-
You can optionally specify a sub-tenant to narrow down the results to sources within that specific sub-tenant scope.
|
|
43
|
-
|
|
44
|
-
Parameters
|
|
45
|
-
----------
|
|
46
|
-
tenant_id : str
|
|
47
|
-
Unique identifier for the tenant/organization
|
|
48
|
-
|
|
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.
|
|
51
|
-
|
|
52
|
-
request_options : typing.Optional[RequestOptions]
|
|
53
|
-
Request-specific configuration.
|
|
54
|
-
|
|
55
|
-
Returns
|
|
56
|
-
-------
|
|
57
|
-
ListSourcesResponse
|
|
58
|
-
Successful Response
|
|
59
|
-
|
|
60
|
-
Examples
|
|
61
|
-
--------
|
|
62
|
-
from usecortex-ai import CortexAI
|
|
63
|
-
|
|
64
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
65
|
-
client.sources.get_all(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
|
|
66
|
-
"""
|
|
67
|
-
_response = self._raw_client.get_all(
|
|
68
|
-
tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
69
|
-
)
|
|
70
|
-
return _response.data
|
|
71
|
-
|
|
72
|
-
def get_by_ids(
|
|
29
|
+
def delete(
|
|
73
30
|
self,
|
|
74
31
|
*,
|
|
75
32
|
tenant_id: str,
|
|
33
|
+
sub_tenant_id: str,
|
|
76
34
|
source_ids: typing.Sequence[str],
|
|
77
|
-
sub_tenant_id: typing.Optional[str] = OMIT,
|
|
78
35
|
request_options: typing.Optional[RequestOptions] = None,
|
|
79
|
-
) ->
|
|
36
|
+
) -> SourceDeleteResponse:
|
|
80
37
|
"""
|
|
81
|
-
|
|
38
|
+
Remove documents and content from your knowledge base.
|
|
82
39
|
|
|
83
|
-
|
|
40
|
+
This endpoint permanently deletes the specified sources from your knowledge base.
|
|
41
|
+
Once deleted, the content will no longer be available for search or retrieval.
|
|
84
42
|
|
|
85
|
-
|
|
43
|
+
Use this carefully as the action cannot be undone. The system will confirm successful deletion of each source ID you specify.
|
|
86
44
|
|
|
87
45
|
Parameters
|
|
88
46
|
----------
|
|
89
47
|
tenant_id : str
|
|
90
|
-
Unique identifier for the tenant/organization
|
|
91
|
-
|
|
92
|
-
source_ids : typing.Sequence[str]
|
|
93
|
-
List of source IDs to fetch
|
|
94
48
|
|
|
95
|
-
sub_tenant_id :
|
|
96
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
49
|
+
sub_tenant_id : str
|
|
97
50
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
Returns
|
|
102
|
-
-------
|
|
103
|
-
ListSourcesResponse
|
|
104
|
-
Successful Response
|
|
105
|
-
|
|
106
|
-
Examples
|
|
107
|
-
--------
|
|
108
|
-
from usecortex-ai import CortexAI
|
|
109
|
-
|
|
110
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
111
|
-
client.sources.get_by_ids(tenant_id='tenant_1234', source_ids=['CortexDoc1234', 'CortexDoc4567'], )
|
|
112
|
-
"""
|
|
113
|
-
_response = self._raw_client.get_by_ids(
|
|
114
|
-
tenant_id=tenant_id, source_ids=source_ids, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
115
|
-
)
|
|
116
|
-
return _response.data
|
|
117
|
-
|
|
118
|
-
def get_graph_relations_by_id(
|
|
119
|
-
self,
|
|
120
|
-
*,
|
|
121
|
-
source_id: str,
|
|
122
|
-
tenant_id: typing.Optional[str] = None,
|
|
123
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
124
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
125
|
-
) -> GraphRelationsResponse:
|
|
126
|
-
"""
|
|
127
|
-
Retrieve relations for a specific source.
|
|
128
|
-
|
|
129
|
-
Use this endpoint to fetch all relations associated with a specific source. This is useful when you need to understand the relationships between entities within a source.
|
|
130
|
-
|
|
131
|
-
Provide the source ID in the request body along with your tenant information to get the relations for that source.
|
|
132
|
-
|
|
133
|
-
Parameters
|
|
134
|
-
----------
|
|
135
|
-
source_id : str
|
|
136
|
-
The source ID to fetch relations for
|
|
137
|
-
|
|
138
|
-
tenant_id : typing.Optional[str]
|
|
139
|
-
Unique identifier for the tenant/organization
|
|
140
|
-
|
|
141
|
-
sub_tenant_id : typing.Optional[str]
|
|
142
|
-
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
|
+
source_ids : typing.Sequence[str]
|
|
52
|
+
List of source IDs to delete.
|
|
143
53
|
|
|
144
54
|
request_options : typing.Optional[RequestOptions]
|
|
145
55
|
Request-specific configuration.
|
|
146
56
|
|
|
147
57
|
Returns
|
|
148
58
|
-------
|
|
149
|
-
|
|
59
|
+
SourceDeleteResponse
|
|
150
60
|
Successful Response
|
|
151
61
|
|
|
152
62
|
Examples
|
|
@@ -154,10 +64,10 @@ class SourcesClient:
|
|
|
154
64
|
from usecortex-ai import CortexAI
|
|
155
65
|
|
|
156
66
|
client = CortexAI(token="YOUR_TOKEN", )
|
|
157
|
-
client.sources.
|
|
67
|
+
client.sources.delete(tenant_id='tenant_id', sub_tenant_id='sub_tenant_id', source_ids=['source_ids'], )
|
|
158
68
|
"""
|
|
159
|
-
_response = self._raw_client.
|
|
160
|
-
|
|
69
|
+
_response = self._raw_client.delete(
|
|
70
|
+
tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, source_ids=source_ids, request_options=request_options
|
|
161
71
|
)
|
|
162
72
|
return _response.data
|
|
163
73
|
|
|
@@ -177,134 +87,37 @@ class AsyncSourcesClient:
|
|
|
177
87
|
"""
|
|
178
88
|
return self._raw_client
|
|
179
89
|
|
|
180
|
-
async def
|
|
181
|
-
self,
|
|
182
|
-
*,
|
|
183
|
-
tenant_id: str,
|
|
184
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
185
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
186
|
-
) -> ListSourcesResponse:
|
|
187
|
-
"""
|
|
188
|
-
Retrieve all sources for a specific tenant.
|
|
189
|
-
|
|
190
|
-
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.
|
|
191
|
-
|
|
192
|
-
You can optionally specify a sub-tenant to narrow down the results to sources within that specific sub-tenant scope.
|
|
193
|
-
|
|
194
|
-
Parameters
|
|
195
|
-
----------
|
|
196
|
-
tenant_id : str
|
|
197
|
-
Unique identifier for the tenant/organization
|
|
198
|
-
|
|
199
|
-
sub_tenant_id : typing.Optional[str]
|
|
200
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
201
|
-
|
|
202
|
-
request_options : typing.Optional[RequestOptions]
|
|
203
|
-
Request-specific configuration.
|
|
204
|
-
|
|
205
|
-
Returns
|
|
206
|
-
-------
|
|
207
|
-
ListSourcesResponse
|
|
208
|
-
Successful Response
|
|
209
|
-
|
|
210
|
-
Examples
|
|
211
|
-
--------
|
|
212
|
-
import asyncio
|
|
213
|
-
|
|
214
|
-
from usecortex-ai import AsyncCortexAI
|
|
215
|
-
|
|
216
|
-
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
217
|
-
async def main() -> None:
|
|
218
|
-
await client.sources.get_all(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
|
|
219
|
-
asyncio.run(main())
|
|
220
|
-
"""
|
|
221
|
-
_response = await self._raw_client.get_all(
|
|
222
|
-
tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
223
|
-
)
|
|
224
|
-
return _response.data
|
|
225
|
-
|
|
226
|
-
async def get_by_ids(
|
|
90
|
+
async def delete(
|
|
227
91
|
self,
|
|
228
92
|
*,
|
|
229
93
|
tenant_id: str,
|
|
94
|
+
sub_tenant_id: str,
|
|
230
95
|
source_ids: typing.Sequence[str],
|
|
231
|
-
sub_tenant_id: typing.Optional[str] = OMIT,
|
|
232
96
|
request_options: typing.Optional[RequestOptions] = None,
|
|
233
|
-
) ->
|
|
97
|
+
) -> SourceDeleteResponse:
|
|
234
98
|
"""
|
|
235
|
-
|
|
99
|
+
Remove documents and content from your knowledge base.
|
|
236
100
|
|
|
237
|
-
|
|
101
|
+
This endpoint permanently deletes the specified sources from your knowledge base.
|
|
102
|
+
Once deleted, the content will no longer be available for search or retrieval.
|
|
238
103
|
|
|
239
|
-
|
|
104
|
+
Use this carefully as the action cannot be undone. The system will confirm successful deletion of each source ID you specify.
|
|
240
105
|
|
|
241
106
|
Parameters
|
|
242
107
|
----------
|
|
243
108
|
tenant_id : str
|
|
244
|
-
Unique identifier for the tenant/organization
|
|
245
|
-
|
|
246
|
-
source_ids : typing.Sequence[str]
|
|
247
|
-
List of source IDs to fetch
|
|
248
109
|
|
|
249
|
-
sub_tenant_id :
|
|
250
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
110
|
+
sub_tenant_id : str
|
|
251
111
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
Returns
|
|
256
|
-
-------
|
|
257
|
-
ListSourcesResponse
|
|
258
|
-
Successful Response
|
|
259
|
-
|
|
260
|
-
Examples
|
|
261
|
-
--------
|
|
262
|
-
import asyncio
|
|
263
|
-
|
|
264
|
-
from usecortex-ai import AsyncCortexAI
|
|
265
|
-
|
|
266
|
-
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
267
|
-
async def main() -> None:
|
|
268
|
-
await client.sources.get_by_ids(tenant_id='tenant_1234', source_ids=['CortexDoc1234', 'CortexDoc4567'], )
|
|
269
|
-
asyncio.run(main())
|
|
270
|
-
"""
|
|
271
|
-
_response = await self._raw_client.get_by_ids(
|
|
272
|
-
tenant_id=tenant_id, source_ids=source_ids, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
273
|
-
)
|
|
274
|
-
return _response.data
|
|
275
|
-
|
|
276
|
-
async def get_graph_relations_by_id(
|
|
277
|
-
self,
|
|
278
|
-
*,
|
|
279
|
-
source_id: str,
|
|
280
|
-
tenant_id: typing.Optional[str] = None,
|
|
281
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
282
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
283
|
-
) -> GraphRelationsResponse:
|
|
284
|
-
"""
|
|
285
|
-
Retrieve relations for a specific source.
|
|
286
|
-
|
|
287
|
-
Use this endpoint to fetch all relations associated with a specific source. This is useful when you need to understand the relationships between entities within a source.
|
|
288
|
-
|
|
289
|
-
Provide the source ID in the request body along with your tenant information to get the relations for that source.
|
|
290
|
-
|
|
291
|
-
Parameters
|
|
292
|
-
----------
|
|
293
|
-
source_id : str
|
|
294
|
-
The source ID to fetch relations for
|
|
295
|
-
|
|
296
|
-
tenant_id : typing.Optional[str]
|
|
297
|
-
Unique identifier for the tenant/organization
|
|
298
|
-
|
|
299
|
-
sub_tenant_id : typing.Optional[str]
|
|
300
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
112
|
+
source_ids : typing.Sequence[str]
|
|
113
|
+
List of source IDs to delete.
|
|
301
114
|
|
|
302
115
|
request_options : typing.Optional[RequestOptions]
|
|
303
116
|
Request-specific configuration.
|
|
304
117
|
|
|
305
118
|
Returns
|
|
306
119
|
-------
|
|
307
|
-
|
|
120
|
+
SourceDeleteResponse
|
|
308
121
|
Successful Response
|
|
309
122
|
|
|
310
123
|
Examples
|
|
@@ -315,10 +128,10 @@ class AsyncSourcesClient:
|
|
|
315
128
|
|
|
316
129
|
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
317
130
|
async def main() -> None:
|
|
318
|
-
await client.sources.
|
|
131
|
+
await client.sources.delete(tenant_id='tenant_id', sub_tenant_id='sub_tenant_id', source_ids=['source_ids'], )
|
|
319
132
|
asyncio.run(main())
|
|
320
133
|
"""
|
|
321
|
-
_response = await self._raw_client.
|
|
322
|
-
|
|
134
|
+
_response = await self._raw_client.delete(
|
|
135
|
+
tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, source_ids=source_ids, request_options=request_options
|
|
323
136
|
)
|
|
324
137
|
return _response.data
|