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/upload/client.py
CHANGED
|
@@ -5,14 +5,14 @@ import typing
|
|
|
5
5
|
from .. import core
|
|
6
6
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
7
7
|
from ..core.request_options import RequestOptions
|
|
8
|
+
from ..types.add_memory_response import AddMemoryResponse
|
|
8
9
|
from ..types.app_sources_upload_data import AppSourcesUploadData
|
|
9
|
-
from ..types.
|
|
10
|
-
from ..types.
|
|
10
|
+
from ..types.delete_user_memory_response import DeleteUserMemoryResponse
|
|
11
|
+
from ..types.memory_item import MemoryItem
|
|
11
12
|
from ..types.processing_status import ProcessingStatus
|
|
12
|
-
from ..types.
|
|
13
|
-
from ..types.source_model import SourceModel
|
|
14
|
-
from ..types.webpage_scrape_request import WebpageScrapeRequest
|
|
13
|
+
from ..types.source_upload_response import SourceUploadResponse
|
|
15
14
|
from .raw_client import AsyncRawUploadClient, RawUploadClient
|
|
15
|
+
from .types.body_upload_app_ingestion_upload_app_post_app_sources import BodyUploadAppIngestionUploadAppPostAppSources
|
|
16
16
|
|
|
17
17
|
# this is used as the default value for optional parameters
|
|
18
18
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -33,1784 +33,136 @@ class UploadClient:
|
|
|
33
33
|
"""
|
|
34
34
|
return self._raw_client
|
|
35
35
|
|
|
36
|
-
def
|
|
37
|
-
self,
|
|
38
|
-
*,
|
|
39
|
-
tenant_id: str,
|
|
40
|
-
files: typing.List[core.File],
|
|
41
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
42
|
-
file_ids: typing.Optional[str] = OMIT,
|
|
43
|
-
tenant_metadata: typing.Optional[str] = OMIT,
|
|
44
|
-
document_metadata: typing.Optional[str] = OMIT,
|
|
45
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
46
|
-
) -> BatchUploadData:
|
|
47
|
-
"""
|
|
48
|
-
Upload multiple documents simultaneously for efficient bulk processing.
|
|
49
|
-
|
|
50
|
-
This endpoint allows you to upload several files at once, which is ideal for large document collections or periodic data imports. Each file gets processed asynchronously, and you can track the progress of individual files using their returned file IDs.
|
|
51
|
-
|
|
52
|
-
The system automatically handles file parsing, content extraction, and indexing across all uploaded documents. You'll receive confirmation once all files are queued for processing.
|
|
53
|
-
|
|
54
|
-
Parameters
|
|
55
|
-
----------
|
|
56
|
-
tenant_id : str
|
|
57
|
-
Unique identifier for the tenant/organization
|
|
58
|
-
|
|
59
|
-
files : typing.List[core.File]
|
|
60
|
-
See core.File for more documentation
|
|
61
|
-
|
|
62
|
-
sub_tenant_id : typing.Optional[str]
|
|
63
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
64
|
-
|
|
65
|
-
file_ids : typing.Optional[str]
|
|
66
|
-
Optional JSON string array of file IDs for the uploaded content. If not provided or empty, will be generated automatically.
|
|
67
|
-
|
|
68
|
-
tenant_metadata : typing.Optional[str]
|
|
69
|
-
JSON string containing tenant-level document metadata (e.g., department, compliance_tag)
|
|
70
|
-
|
|
71
|
-
Example: > "{"department":"Finance","compliance_tag":"GDPR"}"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
document_metadata : typing.Optional[str]
|
|
75
|
-
JSON string containing document-specific metadata (e.g., title, author, file_id). If file_id is not provided, the system will generate an ID automatically.
|
|
76
|
-
|
|
77
|
-
Example: > "{"title":"Q1 Report.pdf","author":"Alice Smith","file_id":"custom_file_123"}"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
request_options : typing.Optional[RequestOptions]
|
|
82
|
-
Request-specific configuration.
|
|
83
|
-
|
|
84
|
-
Returns
|
|
85
|
-
-------
|
|
86
|
-
BatchUploadData
|
|
87
|
-
Successful Response
|
|
88
|
-
|
|
89
|
-
Examples
|
|
90
|
-
--------
|
|
91
|
-
from usecortex-ai import CortexAI
|
|
92
|
-
|
|
93
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
94
|
-
client.upload.batch_upload(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
|
|
95
|
-
"""
|
|
96
|
-
_response = self._raw_client.batch_upload(
|
|
97
|
-
tenant_id=tenant_id,
|
|
98
|
-
files=files,
|
|
99
|
-
sub_tenant_id=sub_tenant_id,
|
|
100
|
-
file_ids=file_ids,
|
|
101
|
-
tenant_metadata=tenant_metadata,
|
|
102
|
-
document_metadata=document_metadata,
|
|
103
|
-
request_options=request_options,
|
|
104
|
-
)
|
|
105
|
-
return _response.data
|
|
106
|
-
|
|
107
|
-
def batch_update(
|
|
108
|
-
self,
|
|
109
|
-
*,
|
|
110
|
-
tenant_id: str,
|
|
111
|
-
files: typing.List[core.File],
|
|
112
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
113
|
-
source_ids: typing.Optional[typing.List[str]] = OMIT,
|
|
114
|
-
tenant_metadata: typing.Optional[str] = OMIT,
|
|
115
|
-
document_metadata: typing.Optional[str] = OMIT,
|
|
116
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
117
|
-
) -> BatchUploadData:
|
|
118
|
-
"""
|
|
119
|
-
Update multiple existing documents with new content and metadata.
|
|
120
|
-
|
|
121
|
-
Use this endpoint when you need to replace or modify several documents that are already in your knowledge base. Each file must correspond to an existing source ID, ensuring that updates are applied to the correct documents.
|
|
122
|
-
|
|
123
|
-
The system processes updates asynchronously, allowing you to continue working while your documents are re-indexed. Track the progress using the returned file IDs to know when updates are complete.
|
|
124
|
-
|
|
125
|
-
Parameters
|
|
126
|
-
----------
|
|
127
|
-
tenant_id : str
|
|
128
|
-
Unique identifier for the tenant/organization
|
|
129
|
-
|
|
130
|
-
files : typing.List[core.File]
|
|
131
|
-
See core.File for more documentation
|
|
132
|
-
|
|
133
|
-
sub_tenant_id : typing.Optional[str]
|
|
134
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
135
|
-
|
|
136
|
-
source_ids : typing.Optional[typing.List[str]]
|
|
137
|
-
List of source IDs corresponding to the files being updated
|
|
138
|
-
|
|
139
|
-
tenant_metadata : typing.Optional[str]
|
|
140
|
-
JSON string containing tenant-level document metadata (e.g., department, compliance_tag)
|
|
141
|
-
|
|
142
|
-
Example: > "{"department":"Finance","compliance_tag":"GDPR"}"
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
document_metadata : typing.Optional[str]
|
|
146
|
-
JSON string containing document-specific metadata (e.g., title, author, file_id). If file_id is not provided, the system will generate an ID automatically.
|
|
147
|
-
|
|
148
|
-
Example: > "{"title":"Q1 Report.pdf","author":"Alice Smith","file_id":"custom_file_123"}"
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
request_options : typing.Optional[RequestOptions]
|
|
153
|
-
Request-specific configuration.
|
|
154
|
-
|
|
155
|
-
Returns
|
|
156
|
-
-------
|
|
157
|
-
BatchUploadData
|
|
158
|
-
Successful Response
|
|
159
|
-
|
|
160
|
-
Examples
|
|
161
|
-
--------
|
|
162
|
-
from usecortex-ai import CortexAI
|
|
163
|
-
|
|
164
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
165
|
-
client.upload.batch_update(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
|
|
166
|
-
"""
|
|
167
|
-
_response = self._raw_client.batch_update(
|
|
168
|
-
tenant_id=tenant_id,
|
|
169
|
-
files=files,
|
|
170
|
-
sub_tenant_id=sub_tenant_id,
|
|
171
|
-
source_ids=source_ids,
|
|
172
|
-
tenant_metadata=tenant_metadata,
|
|
173
|
-
document_metadata=document_metadata,
|
|
174
|
-
request_options=request_options,
|
|
175
|
-
)
|
|
176
|
-
return _response.data
|
|
177
|
-
|
|
178
|
-
def upload_document(
|
|
179
|
-
self,
|
|
180
|
-
*,
|
|
181
|
-
tenant_id: str,
|
|
182
|
-
file: core.File,
|
|
183
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
184
|
-
file_id: typing.Optional[str] = OMIT,
|
|
185
|
-
tenant_metadata: typing.Optional[str] = OMIT,
|
|
186
|
-
document_metadata: typing.Optional[str] = OMIT,
|
|
187
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
188
|
-
) -> SingleUploadData:
|
|
189
|
-
"""
|
|
190
|
-
Upload a single document for processing and indexing into your knowledge base.
|
|
191
|
-
|
|
192
|
-
This endpoint accepts documents in various formats and processes them for search and retrieval. You can include custom metadata to help organize and categorize your content.
|
|
193
|
-
|
|
194
|
-
The system extracts text content, processes it asynchronously, and makes it available for search queries. You can track the processing status using the returned file ID.
|
|
195
|
-
|
|
196
|
-
Parameters
|
|
197
|
-
----------
|
|
198
|
-
tenant_id : str
|
|
199
|
-
Unique identifier for the tenant/organization
|
|
200
|
-
|
|
201
|
-
file : core.File
|
|
202
|
-
See core.File for more documentation
|
|
203
|
-
|
|
204
|
-
sub_tenant_id : typing.Optional[str]
|
|
205
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
206
|
-
|
|
207
|
-
file_id : typing.Optional[str]
|
|
208
|
-
Optional file ID for the uploaded content. If not provided, will be generated automatically.
|
|
209
|
-
|
|
210
|
-
tenant_metadata : typing.Optional[str]
|
|
211
|
-
JSON string containing tenant-level document metadata (e.g., department, compliance_tag)
|
|
212
|
-
|
|
213
|
-
Example: > "{"department":"Finance","compliance_tag":"GDPR"}"
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
document_metadata : typing.Optional[str]
|
|
217
|
-
JSON string containing document-specific metadata (e.g., title, author, file_id). If file_id is not provided, the system will generate an ID automatically.
|
|
218
|
-
|
|
219
|
-
Example: > "{"title":"Q1 Report.pdf","author":"Alice Smith","file_id":"custom_file_123"}"
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
request_options : typing.Optional[RequestOptions]
|
|
224
|
-
Request-specific configuration.
|
|
225
|
-
|
|
226
|
-
Returns
|
|
227
|
-
-------
|
|
228
|
-
SingleUploadData
|
|
229
|
-
Successful Response
|
|
230
|
-
|
|
231
|
-
Examples
|
|
232
|
-
--------
|
|
233
|
-
from usecortex-ai import CortexAI
|
|
234
|
-
|
|
235
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
236
|
-
client.upload.upload_document(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
|
|
237
|
-
"""
|
|
238
|
-
_response = self._raw_client.upload_document(
|
|
239
|
-
tenant_id=tenant_id,
|
|
240
|
-
file=file,
|
|
241
|
-
sub_tenant_id=sub_tenant_id,
|
|
242
|
-
file_id=file_id,
|
|
243
|
-
tenant_metadata=tenant_metadata,
|
|
244
|
-
document_metadata=document_metadata,
|
|
245
|
-
request_options=request_options,
|
|
246
|
-
)
|
|
247
|
-
return _response.data
|
|
248
|
-
|
|
249
|
-
def update_document(
|
|
250
|
-
self,
|
|
251
|
-
*,
|
|
252
|
-
source_id: str,
|
|
253
|
-
tenant_id: str,
|
|
254
|
-
file: core.File,
|
|
255
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
256
|
-
tenant_metadata: typing.Optional[str] = OMIT,
|
|
257
|
-
document_metadata: typing.Optional[str] = OMIT,
|
|
258
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
259
|
-
) -> SingleUploadData:
|
|
260
|
-
"""
|
|
261
|
-
Replace an existing document with updated content.
|
|
262
|
-
|
|
263
|
-
This endpoint allows you to update a specific document that's already in your knowledge base. Provide the source ID of the document you want to modify, along with the new file content.
|
|
264
|
-
|
|
265
|
-
The system will process your update asynchronously and re-index the document with the new content. You can monitor the progress using the returned file ID.
|
|
266
|
-
|
|
267
|
-
Parameters
|
|
268
|
-
----------
|
|
269
|
-
source_id : str
|
|
270
|
-
The source ID of the document to update
|
|
271
|
-
|
|
272
|
-
tenant_id : str
|
|
273
|
-
Unique identifier for the tenant/organization
|
|
274
|
-
|
|
275
|
-
file : core.File
|
|
276
|
-
See core.File for more documentation
|
|
277
|
-
|
|
278
|
-
sub_tenant_id : typing.Optional[str]
|
|
279
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
280
|
-
|
|
281
|
-
tenant_metadata : typing.Optional[str]
|
|
282
|
-
JSON string containing tenant-level document metadata (e.g., department, compliance_tag)
|
|
283
|
-
|
|
284
|
-
Example: > "{"department":"Finance","compliance_tag":"GDPR"}"
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
document_metadata : typing.Optional[str]
|
|
288
|
-
JSON string containing document-specific metadata (e.g., title, author, file_id). If file_id is not provided, the system will generate an ID automatically.
|
|
289
|
-
|
|
290
|
-
Example: > "{"title":"Q1 Report.pdf","author":"Alice Smith","file_id":"custom_file_123"}"
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
request_options : typing.Optional[RequestOptions]
|
|
295
|
-
Request-specific configuration.
|
|
296
|
-
|
|
297
|
-
Returns
|
|
298
|
-
-------
|
|
299
|
-
SingleUploadData
|
|
300
|
-
Successful Response
|
|
301
|
-
|
|
302
|
-
Examples
|
|
303
|
-
--------
|
|
304
|
-
from usecortex-ai import CortexAI
|
|
305
|
-
|
|
306
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
307
|
-
client.upload.update_document(source_id='CortexDoc1234', tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
|
|
308
|
-
"""
|
|
309
|
-
_response = self._raw_client.update_document(
|
|
310
|
-
source_id=source_id,
|
|
311
|
-
tenant_id=tenant_id,
|
|
312
|
-
file=file,
|
|
313
|
-
sub_tenant_id=sub_tenant_id,
|
|
314
|
-
tenant_metadata=tenant_metadata,
|
|
315
|
-
document_metadata=document_metadata,
|
|
316
|
-
request_options=request_options,
|
|
317
|
-
)
|
|
318
|
-
return _response.data
|
|
319
|
-
|
|
320
|
-
def upload_app_sources(
|
|
321
|
-
self,
|
|
322
|
-
*,
|
|
323
|
-
tenant_id: str,
|
|
324
|
-
request: typing.Sequence[SourceModel],
|
|
325
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
326
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
327
|
-
) -> AppSourcesUploadData:
|
|
328
|
-
"""
|
|
329
|
-
Upload structured data from applications or APIs for indexing.
|
|
330
|
-
|
|
331
|
-
This endpoint is designed for importing data from applications. If you are specifically using Cortex to provide search to an application, you should prefer this endpoint. It accepts structured source objects and allows you to clearly define contents of attachments
|
|
332
|
-
|
|
333
|
-
The system processes each source asynchronously and makes the content available for search and retrieval. Use this when you need to integrate search and indexing from data in your applications into your knowledge base.
|
|
334
|
-
|
|
335
|
-
Parameters
|
|
336
|
-
----------
|
|
337
|
-
tenant_id : str
|
|
338
|
-
Unique identifier for the tenant/organization
|
|
339
|
-
|
|
340
|
-
request : typing.Sequence[SourceModel]
|
|
341
|
-
|
|
342
|
-
sub_tenant_id : typing.Optional[str]
|
|
343
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
344
|
-
|
|
345
|
-
request_options : typing.Optional[RequestOptions]
|
|
346
|
-
Request-specific configuration.
|
|
347
|
-
|
|
348
|
-
Returns
|
|
349
|
-
-------
|
|
350
|
-
AppSourcesUploadData
|
|
351
|
-
Successful Response
|
|
352
|
-
|
|
353
|
-
Examples
|
|
354
|
-
--------
|
|
355
|
-
from usecortex-ai import CortexAI, SourceModel
|
|
356
|
-
|
|
357
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
358
|
-
client.upload.upload_app_sources(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', request=[SourceModel()], )
|
|
359
|
-
"""
|
|
360
|
-
_response = self._raw_client.upload_app_sources(
|
|
361
|
-
tenant_id=tenant_id, request=request, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
362
|
-
)
|
|
363
|
-
return _response.data
|
|
364
|
-
|
|
365
|
-
def upload_markdown(
|
|
366
|
-
self,
|
|
367
|
-
*,
|
|
368
|
-
tenant_id: str,
|
|
369
|
-
content: str,
|
|
370
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
371
|
-
file_id: typing.Optional[str] = OMIT,
|
|
372
|
-
tenant_metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
373
|
-
document_metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
374
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
375
|
-
) -> SingleUploadData:
|
|
376
|
-
"""
|
|
377
|
-
Upload text or markdown content directly for processing.
|
|
378
|
-
|
|
379
|
-
This endpoint accepts plain text or markdown-formatted content that you want to add to your knowledge base. It's perfect for notes, documentation, articles, or any text-based content you want to make searchable.
|
|
380
|
-
|
|
381
|
-
You can include custom metadata to help organize and categorize your content. You can track the processing status using the returned file ID.
|
|
382
|
-
|
|
383
|
-
Parameters
|
|
384
|
-
----------
|
|
385
|
-
tenant_id : str
|
|
386
|
-
Unique identifier for the tenant/organization
|
|
387
|
-
|
|
388
|
-
content : str
|
|
389
|
-
The text or markdown content to upload
|
|
390
|
-
|
|
391
|
-
sub_tenant_id : typing.Optional[str]
|
|
392
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
393
|
-
|
|
394
|
-
file_id : typing.Optional[str]
|
|
395
|
-
Optional file ID for the uploaded content. If not provided, will be generated automatically.
|
|
396
|
-
|
|
397
|
-
tenant_metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
398
|
-
JSON string containing tenant-level document metadata (e.g., department, compliance_tag)
|
|
399
|
-
|
|
400
|
-
Example: > "{"department":"Finance","compliance_tag":"GDPR"}"
|
|
401
|
-
|
|
402
|
-
document_metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
403
|
-
JSON string containing document-specific metadata (e.g., title, author, file_id). If file_id is not provided, the system will generate an ID automatically.
|
|
404
|
-
|
|
405
|
-
Example: > "{"title":"Q1 Report.pdf","author":"Alice Smith","file_id":"custom_file_123"}"
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
request_options : typing.Optional[RequestOptions]
|
|
409
|
-
Request-specific configuration.
|
|
410
|
-
|
|
411
|
-
Returns
|
|
412
|
-
-------
|
|
413
|
-
SingleUploadData
|
|
414
|
-
Successful Response
|
|
415
|
-
|
|
416
|
-
Examples
|
|
417
|
-
--------
|
|
418
|
-
from usecortex-ai import CortexAI
|
|
419
|
-
|
|
420
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
421
|
-
client.upload.upload_markdown(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', content='<content>', )
|
|
422
|
-
"""
|
|
423
|
-
_response = self._raw_client.upload_markdown(
|
|
424
|
-
tenant_id=tenant_id,
|
|
425
|
-
content=content,
|
|
426
|
-
sub_tenant_id=sub_tenant_id,
|
|
427
|
-
file_id=file_id,
|
|
428
|
-
tenant_metadata=tenant_metadata,
|
|
429
|
-
document_metadata=document_metadata,
|
|
430
|
-
request_options=request_options,
|
|
431
|
-
)
|
|
432
|
-
return _response.data
|
|
433
|
-
|
|
434
|
-
def upload_text(
|
|
435
|
-
self,
|
|
436
|
-
*,
|
|
437
|
-
tenant_id: str,
|
|
438
|
-
content: str,
|
|
439
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
440
|
-
file_id: typing.Optional[str] = OMIT,
|
|
441
|
-
tenant_metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
442
|
-
document_metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
443
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
444
|
-
) -> SingleUploadData:
|
|
445
|
-
"""
|
|
446
|
-
Upload text or markdown content directly for processing.
|
|
447
|
-
|
|
448
|
-
This endpoint accepts plain text or markdown-formatted content that you want to add to your knowledge base. It's perfect for notes, documentation, articles, or any text-based content you want to make searchable.
|
|
449
|
-
|
|
450
|
-
You can include custom metadata to help organize and categorize your content. You can track the processing status using the returned file ID.
|
|
451
|
-
|
|
452
|
-
Parameters
|
|
453
|
-
----------
|
|
454
|
-
tenant_id : str
|
|
455
|
-
Unique identifier for the tenant/organization
|
|
456
|
-
|
|
457
|
-
content : str
|
|
458
|
-
The text or markdown content to upload
|
|
459
|
-
|
|
460
|
-
sub_tenant_id : typing.Optional[str]
|
|
461
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
462
|
-
|
|
463
|
-
file_id : typing.Optional[str]
|
|
464
|
-
Optional file ID for the uploaded content. If not provided, will be generated automatically.
|
|
465
|
-
|
|
466
|
-
tenant_metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
467
|
-
JSON string containing tenant-level document metadata (e.g., department, compliance_tag)
|
|
468
|
-
|
|
469
|
-
Example: > "{"department":"Finance","compliance_tag":"GDPR"}"
|
|
470
|
-
|
|
471
|
-
document_metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
472
|
-
JSON string containing document-specific metadata (e.g., title, author, file_id). If file_id is not provided, the system will generate an ID automatically.
|
|
473
|
-
|
|
474
|
-
Example: > "{"title":"Q1 Report.pdf","author":"Alice Smith","file_id":"custom_file_123"}"
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
request_options : typing.Optional[RequestOptions]
|
|
478
|
-
Request-specific configuration.
|
|
479
|
-
|
|
480
|
-
Returns
|
|
481
|
-
-------
|
|
482
|
-
SingleUploadData
|
|
483
|
-
Successful Response
|
|
484
|
-
|
|
485
|
-
Examples
|
|
486
|
-
--------
|
|
487
|
-
from usecortex-ai import CortexAI
|
|
488
|
-
|
|
489
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
490
|
-
client.upload.upload_text(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', content='<content>', )
|
|
491
|
-
"""
|
|
492
|
-
_response = self._raw_client.upload_text(
|
|
493
|
-
tenant_id=tenant_id,
|
|
494
|
-
content=content,
|
|
495
|
-
sub_tenant_id=sub_tenant_id,
|
|
496
|
-
file_id=file_id,
|
|
497
|
-
tenant_metadata=tenant_metadata,
|
|
498
|
-
document_metadata=document_metadata,
|
|
499
|
-
request_options=request_options,
|
|
500
|
-
)
|
|
501
|
-
return _response.data
|
|
502
|
-
|
|
503
|
-
def update_markdown(
|
|
504
|
-
self,
|
|
505
|
-
*,
|
|
506
|
-
source_id: str,
|
|
507
|
-
tenant_id: str,
|
|
508
|
-
content: str,
|
|
509
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
510
|
-
file_id: typing.Optional[str] = OMIT,
|
|
511
|
-
tenant_metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
512
|
-
document_metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
513
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
514
|
-
) -> SingleUploadData:
|
|
515
|
-
"""
|
|
516
|
-
Update existing text or markdown content with new information.
|
|
517
|
-
|
|
518
|
-
This endpoint allows you to modify text or markdown content that's already in your knowledge base. Provide the source ID of the content you want to update, along with the new text.
|
|
519
|
-
|
|
520
|
-
The system will reprocess and re-index the updated content asynchronously. Use this when you need to correct information, add details, or refresh existing documentation.
|
|
521
|
-
|
|
522
|
-
Parameters
|
|
523
|
-
----------
|
|
524
|
-
source_id : str
|
|
525
|
-
The source ID of the document to update
|
|
526
|
-
|
|
527
|
-
tenant_id : str
|
|
528
|
-
Unique identifier for the tenant/organization
|
|
529
|
-
|
|
530
|
-
content : str
|
|
531
|
-
The text or markdown content to upload
|
|
532
|
-
|
|
533
|
-
sub_tenant_id : typing.Optional[str]
|
|
534
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
535
|
-
|
|
536
|
-
file_id : typing.Optional[str]
|
|
537
|
-
Optional file ID for the uploaded content. If not provided, will be generated automatically.
|
|
538
|
-
|
|
539
|
-
tenant_metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
540
|
-
JSON string containing tenant-level document metadata (e.g., department, compliance_tag)
|
|
541
|
-
|
|
542
|
-
Example: > "{"department":"Finance","compliance_tag":"GDPR"}"
|
|
543
|
-
|
|
544
|
-
document_metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
545
|
-
JSON string containing document-specific metadata (e.g., title, author, file_id). If file_id is not provided, the system will generate an ID automatically.
|
|
546
|
-
|
|
547
|
-
Example: > "{"title":"Q1 Report.pdf","author":"Alice Smith","file_id":"custom_file_123"}"
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
request_options : typing.Optional[RequestOptions]
|
|
551
|
-
Request-specific configuration.
|
|
552
|
-
|
|
553
|
-
Returns
|
|
554
|
-
-------
|
|
555
|
-
SingleUploadData
|
|
556
|
-
Successful Response
|
|
557
|
-
|
|
558
|
-
Examples
|
|
559
|
-
--------
|
|
560
|
-
from usecortex-ai import CortexAI
|
|
561
|
-
|
|
562
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
563
|
-
client.upload.update_markdown(source_id='CortexDoc1234', tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', content='<content>', )
|
|
564
|
-
"""
|
|
565
|
-
_response = self._raw_client.update_markdown(
|
|
566
|
-
source_id=source_id,
|
|
567
|
-
tenant_id=tenant_id,
|
|
568
|
-
content=content,
|
|
569
|
-
sub_tenant_id=sub_tenant_id,
|
|
570
|
-
file_id=file_id,
|
|
571
|
-
tenant_metadata=tenant_metadata,
|
|
572
|
-
document_metadata=document_metadata,
|
|
573
|
-
request_options=request_options,
|
|
574
|
-
)
|
|
575
|
-
return _response.data
|
|
576
|
-
|
|
577
|
-
def update_text(
|
|
578
|
-
self,
|
|
579
|
-
*,
|
|
580
|
-
source_id: str,
|
|
581
|
-
tenant_id: str,
|
|
582
|
-
content: str,
|
|
583
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
584
|
-
file_id: typing.Optional[str] = OMIT,
|
|
585
|
-
tenant_metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
586
|
-
document_metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
587
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
588
|
-
) -> SingleUploadData:
|
|
589
|
-
"""
|
|
590
|
-
Update existing text or markdown content with new information.
|
|
591
|
-
|
|
592
|
-
This endpoint allows you to modify text or markdown content that's already in your knowledge base. Provide the source ID of the content you want to update, along with the new text.
|
|
593
|
-
|
|
594
|
-
The system will reprocess and re-index the updated content asynchronously. Use this when you need to correct information, add details, or refresh existing documentation.
|
|
595
|
-
|
|
596
|
-
Parameters
|
|
597
|
-
----------
|
|
598
|
-
source_id : str
|
|
599
|
-
The source ID of the document to update
|
|
600
|
-
|
|
601
|
-
tenant_id : str
|
|
602
|
-
Unique identifier for the tenant/organization
|
|
603
|
-
|
|
604
|
-
content : str
|
|
605
|
-
The text or markdown content to upload
|
|
606
|
-
|
|
607
|
-
sub_tenant_id : typing.Optional[str]
|
|
608
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
609
|
-
|
|
610
|
-
file_id : typing.Optional[str]
|
|
611
|
-
Optional file ID for the uploaded content. If not provided, will be generated automatically.
|
|
612
|
-
|
|
613
|
-
tenant_metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
614
|
-
JSON string containing tenant-level document metadata (e.g., department, compliance_tag)
|
|
615
|
-
|
|
616
|
-
Example: > "{"department":"Finance","compliance_tag":"GDPR"}"
|
|
617
|
-
|
|
618
|
-
document_metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
619
|
-
JSON string containing document-specific metadata (e.g., title, author, file_id). If file_id is not provided, the system will generate an ID automatically.
|
|
620
|
-
|
|
621
|
-
Example: > "{"title":"Q1 Report.pdf","author":"Alice Smith","file_id":"custom_file_123"}"
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
request_options : typing.Optional[RequestOptions]
|
|
625
|
-
Request-specific configuration.
|
|
626
|
-
|
|
627
|
-
Returns
|
|
628
|
-
-------
|
|
629
|
-
SingleUploadData
|
|
630
|
-
Successful Response
|
|
631
|
-
|
|
632
|
-
Examples
|
|
633
|
-
--------
|
|
634
|
-
from usecortex-ai import CortexAI
|
|
635
|
-
|
|
636
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
637
|
-
client.upload.update_text(source_id='CortexDoc1234', tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', content='<content>', )
|
|
638
|
-
"""
|
|
639
|
-
_response = self._raw_client.update_text(
|
|
640
|
-
source_id=source_id,
|
|
641
|
-
tenant_id=tenant_id,
|
|
642
|
-
content=content,
|
|
643
|
-
sub_tenant_id=sub_tenant_id,
|
|
644
|
-
file_id=file_id,
|
|
645
|
-
tenant_metadata=tenant_metadata,
|
|
646
|
-
document_metadata=document_metadata,
|
|
647
|
-
request_options=request_options,
|
|
648
|
-
)
|
|
649
|
-
return _response.data
|
|
650
|
-
|
|
651
|
-
def batch_upload_markdown(
|
|
652
|
-
self,
|
|
653
|
-
*,
|
|
654
|
-
tenant_id: str,
|
|
655
|
-
request: typing.Sequence[MarkdownUploadRequest],
|
|
656
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
657
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
658
|
-
) -> BatchUploadData:
|
|
659
|
-
"""
|
|
660
|
-
Upload multiple markdown/text documents simultaneously for efficient bulk processing.
|
|
661
|
-
|
|
662
|
-
This endpoint allows you to upload several markdown or text contents at once. Each content item gets processed asynchronously, and you can track the progress using their returned file IDs.
|
|
663
|
-
|
|
664
|
-
Parameters
|
|
665
|
-
----------
|
|
666
|
-
tenant_id : str
|
|
667
|
-
Unique identifier for the tenant/organization
|
|
668
|
-
|
|
669
|
-
request : typing.Sequence[MarkdownUploadRequest]
|
|
670
|
-
|
|
671
|
-
sub_tenant_id : typing.Optional[str]
|
|
672
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
673
|
-
|
|
674
|
-
request_options : typing.Optional[RequestOptions]
|
|
675
|
-
Request-specific configuration.
|
|
676
|
-
|
|
677
|
-
Returns
|
|
678
|
-
-------
|
|
679
|
-
BatchUploadData
|
|
680
|
-
Successful Response
|
|
681
|
-
|
|
682
|
-
Examples
|
|
683
|
-
--------
|
|
684
|
-
from usecortex-ai import CortexAI, MarkdownUploadRequest
|
|
685
|
-
|
|
686
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
687
|
-
client.upload.batch_upload_markdown(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', request=[MarkdownUploadRequest(content='<content>', )], )
|
|
688
|
-
"""
|
|
689
|
-
_response = self._raw_client.batch_upload_markdown(
|
|
690
|
-
tenant_id=tenant_id, request=request, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
691
|
-
)
|
|
692
|
-
return _response.data
|
|
693
|
-
|
|
694
|
-
def batch_upload_text(
|
|
695
|
-
self,
|
|
696
|
-
*,
|
|
697
|
-
tenant_id: str,
|
|
698
|
-
request: typing.Sequence[MarkdownUploadRequest],
|
|
699
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
700
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
701
|
-
) -> BatchUploadData:
|
|
702
|
-
"""
|
|
703
|
-
Upload multiple markdown/text documents simultaneously for efficient bulk processing.
|
|
704
|
-
|
|
705
|
-
This endpoint allows you to upload several markdown or text contents at once. Each content item gets processed asynchronously, and you can track the progress using their returned file IDs.
|
|
706
|
-
|
|
707
|
-
Parameters
|
|
708
|
-
----------
|
|
709
|
-
tenant_id : str
|
|
710
|
-
Unique identifier for the tenant/organization
|
|
711
|
-
|
|
712
|
-
request : typing.Sequence[MarkdownUploadRequest]
|
|
713
|
-
|
|
714
|
-
sub_tenant_id : typing.Optional[str]
|
|
715
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
716
|
-
|
|
717
|
-
request_options : typing.Optional[RequestOptions]
|
|
718
|
-
Request-specific configuration.
|
|
719
|
-
|
|
720
|
-
Returns
|
|
721
|
-
-------
|
|
722
|
-
BatchUploadData
|
|
723
|
-
Successful Response
|
|
724
|
-
|
|
725
|
-
Examples
|
|
726
|
-
--------
|
|
727
|
-
from usecortex-ai import CortexAI, MarkdownUploadRequest
|
|
728
|
-
|
|
729
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
730
|
-
client.upload.batch_upload_text(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', request=[MarkdownUploadRequest(content='<content>', )], )
|
|
731
|
-
"""
|
|
732
|
-
_response = self._raw_client.batch_upload_text(
|
|
733
|
-
tenant_id=tenant_id, request=request, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
734
|
-
)
|
|
735
|
-
return _response.data
|
|
736
|
-
|
|
737
|
-
def upload_embeddings(
|
|
738
|
-
self,
|
|
739
|
-
*,
|
|
740
|
-
tenant_id: str,
|
|
741
|
-
embeddings: typing.Sequence[typing.Sequence[float]],
|
|
742
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
743
|
-
file_id: typing.Optional[str] = OMIT,
|
|
744
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
745
|
-
) -> SingleUploadData:
|
|
746
|
-
"""
|
|
747
|
-
Upload pre-computed embeddings for advanced similarity search.
|
|
748
|
-
|
|
749
|
-
This endpoint accepts vector embeddings that you've generated externally, allowing you to integrate with custom embedding models or existing vector databases. The embeddings represent chunks of your content as numerical vectors.
|
|
750
|
-
|
|
751
|
-
The system stores these embeddings and makes them available for semantic search and similarity matching. Use this when you want to leverage specialized embedding models or have existing vector representations.
|
|
752
|
-
|
|
753
|
-
Parameters
|
|
754
|
-
----------
|
|
755
|
-
tenant_id : str
|
|
756
|
-
Unique identifier for the tenant/organization
|
|
757
|
-
|
|
758
|
-
embeddings : typing.Sequence[typing.Sequence[float]]
|
|
759
|
-
The embeddings of source you want to index
|
|
760
|
-
|
|
761
|
-
sub_tenant_id : typing.Optional[str]
|
|
762
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
763
|
-
|
|
764
|
-
file_id : typing.Optional[str]
|
|
765
|
-
The Source ID of the target source you want to index
|
|
766
|
-
|
|
767
|
-
request_options : typing.Optional[RequestOptions]
|
|
768
|
-
Request-specific configuration.
|
|
769
|
-
|
|
770
|
-
Returns
|
|
771
|
-
-------
|
|
772
|
-
SingleUploadData
|
|
773
|
-
Successful Response
|
|
774
|
-
|
|
775
|
-
Examples
|
|
776
|
-
--------
|
|
777
|
-
from usecortex-ai import CortexAI
|
|
778
|
-
|
|
779
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
780
|
-
client.upload.upload_embeddings(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', embeddings=[[0.123413, 0.655367, 0.987654, 0.123456, 0.789012], [0.123413, 0.655367, 0.987654, 0.123456, 0.789012]], )
|
|
781
|
-
"""
|
|
782
|
-
_response = self._raw_client.upload_embeddings(
|
|
783
|
-
tenant_id=tenant_id,
|
|
784
|
-
embeddings=embeddings,
|
|
785
|
-
sub_tenant_id=sub_tenant_id,
|
|
786
|
-
file_id=file_id,
|
|
787
|
-
request_options=request_options,
|
|
788
|
-
)
|
|
789
|
-
return _response.data
|
|
790
|
-
|
|
791
|
-
def update_embeddings(
|
|
792
|
-
self,
|
|
793
|
-
*,
|
|
794
|
-
tenant_id: str,
|
|
795
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
796
|
-
embeddings: typing.Optional[typing.Dict[str, typing.Sequence[float]]] = OMIT,
|
|
797
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
798
|
-
) -> SingleUploadData:
|
|
799
|
-
"""
|
|
800
|
-
Update existing embeddings with new vector representations.
|
|
801
|
-
|
|
802
|
-
This endpoint allows you to modify embeddings that are already stored in your knowledge base. Provide updated vector representations for specific chunks of content, identified by their chunk IDs.
|
|
803
|
-
|
|
804
|
-
The system will replace the existing embeddings with your new ones, ensuring that similarity searches reflect the most current vector representations. Use this when you need to update embeddings due to model improvements or content changes.
|
|
805
|
-
|
|
806
|
-
Parameters
|
|
807
|
-
----------
|
|
808
|
-
tenant_id : str
|
|
809
|
-
Unique identifier for the tenant/organization
|
|
810
|
-
|
|
811
|
-
sub_tenant_id : typing.Optional[str]
|
|
812
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
813
|
-
|
|
814
|
-
embeddings : typing.Optional[typing.Dict[str, typing.Sequence[float]]]
|
|
815
|
-
The embeddings of source you want to index
|
|
816
|
-
|
|
817
|
-
request_options : typing.Optional[RequestOptions]
|
|
818
|
-
Request-specific configuration.
|
|
819
|
-
|
|
820
|
-
Returns
|
|
821
|
-
-------
|
|
822
|
-
SingleUploadData
|
|
823
|
-
Successful Response
|
|
824
|
-
|
|
825
|
-
Examples
|
|
826
|
-
--------
|
|
827
|
-
from usecortex-ai import CortexAI
|
|
828
|
-
|
|
829
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
830
|
-
client.upload.update_embeddings(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
|
|
831
|
-
"""
|
|
832
|
-
_response = self._raw_client.update_embeddings(
|
|
833
|
-
tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, embeddings=embeddings, request_options=request_options
|
|
834
|
-
)
|
|
835
|
-
return _response.data
|
|
836
|
-
|
|
837
|
-
def scrape_webpage(
|
|
838
|
-
self,
|
|
839
|
-
*,
|
|
840
|
-
web_url: str,
|
|
841
|
-
tenant_id: str,
|
|
842
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
843
|
-
file_id: typing.Optional[str] = None,
|
|
844
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
845
|
-
) -> SingleUploadData:
|
|
846
|
-
"""
|
|
847
|
-
Extract and index content from web pages automatically.
|
|
848
|
-
|
|
849
|
-
This endpoint initiates web scraping for the specified URL, extracting the main content, text, and structure from the webpage. It's perfect for capturing articles, documentation, or any web content you want to include in your knowledge base.
|
|
850
|
-
|
|
851
|
-
The system processes the webpage content asynchronously, cleaning and structuring the information for optimal search and retrieval. Use this when you need to add web content without manual copying and pasting.
|
|
852
|
-
|
|
853
|
-
Parameters
|
|
854
|
-
----------
|
|
855
|
-
web_url : str
|
|
856
|
-
The URL of the webpage to scrape and index
|
|
857
|
-
|
|
858
|
-
tenant_id : str
|
|
859
|
-
Unique identifier for the tenant/organization
|
|
860
|
-
|
|
861
|
-
sub_tenant_id : typing.Optional[str]
|
|
862
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
863
|
-
|
|
864
|
-
file_id : typing.Optional[str]
|
|
865
|
-
Optional custom file ID for the scraped content. If not provided, a unique ID will be generated
|
|
866
|
-
|
|
867
|
-
request_options : typing.Optional[RequestOptions]
|
|
868
|
-
Request-specific configuration.
|
|
869
|
-
|
|
870
|
-
Returns
|
|
871
|
-
-------
|
|
872
|
-
SingleUploadData
|
|
873
|
-
Successful Response
|
|
874
|
-
|
|
875
|
-
Examples
|
|
876
|
-
--------
|
|
877
|
-
from usecortex-ai import CortexAI
|
|
878
|
-
|
|
879
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
880
|
-
client.upload.scrape_webpage(web_url='https://www.usecortex.ai/', tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', file_id='CortexDoc1234', )
|
|
881
|
-
"""
|
|
882
|
-
_response = self._raw_client.scrape_webpage(
|
|
883
|
-
web_url=web_url,
|
|
884
|
-
tenant_id=tenant_id,
|
|
885
|
-
sub_tenant_id=sub_tenant_id,
|
|
886
|
-
file_id=file_id,
|
|
887
|
-
request_options=request_options,
|
|
888
|
-
)
|
|
889
|
-
return _response.data
|
|
890
|
-
|
|
891
|
-
def update_webpage(
|
|
892
|
-
self,
|
|
893
|
-
*,
|
|
894
|
-
web_url: str,
|
|
895
|
-
source_id: str,
|
|
896
|
-
tenant_id: str,
|
|
897
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
898
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
899
|
-
) -> SingleUploadData:
|
|
900
|
-
"""
|
|
901
|
-
Update web scraping content with fresh data from the source URL.
|
|
902
|
-
|
|
903
|
-
This endpoint refreshes the content for an existing web scraping job. Provide the source ID of the webpage content you want to update, and the system will re-scrape the URL to capture any changes.
|
|
904
|
-
|
|
905
|
-
The updated content gets processed asynchronously and re-indexed in your knowledge base. Use this to keep web content current when the source pages are frequently updated.
|
|
906
|
-
|
|
907
|
-
Parameters
|
|
908
|
-
----------
|
|
909
|
-
web_url : str
|
|
910
|
-
The URL of the webpage to re-scrape
|
|
911
|
-
|
|
912
|
-
source_id : str
|
|
913
|
-
The file ID of the existing web scraping job to update
|
|
914
|
-
|
|
915
|
-
tenant_id : str
|
|
916
|
-
Unique identifier for the tenant/organization
|
|
917
|
-
|
|
918
|
-
sub_tenant_id : typing.Optional[str]
|
|
919
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
920
|
-
|
|
921
|
-
request_options : typing.Optional[RequestOptions]
|
|
922
|
-
Request-specific configuration.
|
|
923
|
-
|
|
924
|
-
Returns
|
|
925
|
-
-------
|
|
926
|
-
SingleUploadData
|
|
927
|
-
Successful Response
|
|
928
|
-
|
|
929
|
-
Examples
|
|
930
|
-
--------
|
|
931
|
-
from usecortex-ai import CortexAI
|
|
932
|
-
|
|
933
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
934
|
-
client.upload.update_webpage(web_url='https://www.usecortex.ai/', source_id='CortexDoc1234', tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
|
|
935
|
-
"""
|
|
936
|
-
_response = self._raw_client.update_webpage(
|
|
937
|
-
web_url=web_url,
|
|
938
|
-
source_id=source_id,
|
|
939
|
-
tenant_id=tenant_id,
|
|
940
|
-
sub_tenant_id=sub_tenant_id,
|
|
941
|
-
request_options=request_options,
|
|
942
|
-
)
|
|
943
|
-
return _response.data
|
|
944
|
-
|
|
945
|
-
def batch_scrape_webpage(
|
|
946
|
-
self,
|
|
947
|
-
*,
|
|
948
|
-
tenant_id: str,
|
|
949
|
-
request: typing.Sequence[WebpageScrapeRequest],
|
|
950
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
951
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
952
|
-
) -> BatchUploadData:
|
|
953
|
-
"""
|
|
954
|
-
Extract and index content from multiple web pages simultaneously.
|
|
955
|
-
|
|
956
|
-
This endpoint initiates web scraping for multiple URLs at once, extracting the main content, text, and structure from each webpage. It's perfect for capturing multiple articles, documentation pages, or any web content you want to include in your knowledge base.
|
|
957
|
-
|
|
958
|
-
The system processes all webpage content asynchronously, cleaning and structuring the information for optimal search and retrieval.
|
|
959
|
-
|
|
960
|
-
Parameters
|
|
961
|
-
----------
|
|
962
|
-
tenant_id : str
|
|
963
|
-
Unique identifier for the tenant/organization
|
|
964
|
-
|
|
965
|
-
request : typing.Sequence[WebpageScrapeRequest]
|
|
966
|
-
|
|
967
|
-
sub_tenant_id : typing.Optional[str]
|
|
968
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
969
|
-
|
|
970
|
-
request_options : typing.Optional[RequestOptions]
|
|
971
|
-
Request-specific configuration.
|
|
972
|
-
|
|
973
|
-
Returns
|
|
974
|
-
-------
|
|
975
|
-
BatchUploadData
|
|
976
|
-
Successful Response
|
|
977
|
-
|
|
978
|
-
Examples
|
|
979
|
-
--------
|
|
980
|
-
from usecortex-ai import CortexAI, WebpageScrapeRequest
|
|
981
|
-
|
|
982
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
983
|
-
client.upload.batch_scrape_webpage(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', request=[WebpageScrapeRequest(web_url='https://www.usecortex.ai/', )], )
|
|
984
|
-
"""
|
|
985
|
-
_response = self._raw_client.batch_scrape_webpage(
|
|
986
|
-
tenant_id=tenant_id, request=request, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
987
|
-
)
|
|
988
|
-
return _response.data
|
|
989
|
-
|
|
990
|
-
def delete_source(
|
|
991
|
-
self,
|
|
992
|
-
*,
|
|
993
|
-
tenant_id: str,
|
|
994
|
-
source_ids: typing.Sequence[str],
|
|
995
|
-
sub_tenant_id: typing.Optional[str] = OMIT,
|
|
996
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
997
|
-
) -> typing.Optional[typing.Any]:
|
|
998
|
-
"""
|
|
999
|
-
Remove documents and content from your knowledge base.
|
|
1000
|
-
|
|
1001
|
-
This endpoint permanently deletes the specified sources from your knowledge base. Once deleted, the content will no longer be available for search or retrieval.
|
|
1002
|
-
|
|
1003
|
-
Use this carefully as the action cannot be undone. The system will confirm successful deletion of each source ID you specify.
|
|
1004
|
-
|
|
1005
|
-
Parameters
|
|
1006
|
-
----------
|
|
1007
|
-
tenant_id : str
|
|
1008
|
-
Unique identifier for the tenant/organization
|
|
1009
|
-
|
|
1010
|
-
source_ids : typing.Sequence[str]
|
|
1011
|
-
List of source IDs to delete
|
|
1012
|
-
|
|
1013
|
-
sub_tenant_id : typing.Optional[str]
|
|
1014
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
1015
|
-
|
|
1016
|
-
request_options : typing.Optional[RequestOptions]
|
|
1017
|
-
Request-specific configuration.
|
|
1018
|
-
|
|
1019
|
-
Returns
|
|
1020
|
-
-------
|
|
1021
|
-
typing.Optional[typing.Any]
|
|
1022
|
-
Successful Response
|
|
1023
|
-
|
|
1024
|
-
Examples
|
|
1025
|
-
--------
|
|
1026
|
-
from usecortex-ai import CortexAI
|
|
1027
|
-
|
|
1028
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
1029
|
-
client.upload.delete_source(tenant_id='tenant_1234', source_ids=['CortexDoc1234', 'CortexDoc4567'], )
|
|
1030
|
-
"""
|
|
1031
|
-
_response = self._raw_client.delete_source(
|
|
1032
|
-
tenant_id=tenant_id, source_ids=source_ids, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
1033
|
-
)
|
|
1034
|
-
return _response.data
|
|
1035
|
-
|
|
1036
|
-
def delete_memory(
|
|
1037
|
-
self,
|
|
1038
|
-
*,
|
|
1039
|
-
tenant_id: str,
|
|
1040
|
-
source_ids: typing.Sequence[str],
|
|
1041
|
-
sub_tenant_id: typing.Optional[str] = OMIT,
|
|
1042
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1043
|
-
) -> typing.Optional[typing.Any]:
|
|
1044
|
-
"""
|
|
1045
|
-
Remove documents and content from your knowledge base.
|
|
1046
|
-
|
|
1047
|
-
This endpoint permanently deletes the specified sources from your knowledge base. Once deleted, the content will no longer be available for search or retrieval.
|
|
1048
|
-
|
|
1049
|
-
Use this carefully as the action cannot be undone. The system will confirm successful deletion of each source ID you specify.
|
|
1050
|
-
|
|
1051
|
-
Parameters
|
|
1052
|
-
----------
|
|
1053
|
-
tenant_id : str
|
|
1054
|
-
Unique identifier for the tenant/organization
|
|
1055
|
-
|
|
1056
|
-
source_ids : typing.Sequence[str]
|
|
1057
|
-
List of source IDs to delete
|
|
1058
|
-
|
|
1059
|
-
sub_tenant_id : typing.Optional[str]
|
|
1060
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
1061
|
-
|
|
1062
|
-
request_options : typing.Optional[RequestOptions]
|
|
1063
|
-
Request-specific configuration.
|
|
1064
|
-
|
|
1065
|
-
Returns
|
|
1066
|
-
-------
|
|
1067
|
-
typing.Optional[typing.Any]
|
|
1068
|
-
Successful Response
|
|
1069
|
-
|
|
1070
|
-
Examples
|
|
1071
|
-
--------
|
|
1072
|
-
from usecortex-ai import CortexAI
|
|
1073
|
-
|
|
1074
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
1075
|
-
client.upload.delete_memory(tenant_id='tenant_1234', source_ids=['CortexDoc1234', 'CortexDoc4567'], )
|
|
1076
|
-
"""
|
|
1077
|
-
_response = self._raw_client.delete_memory(
|
|
1078
|
-
tenant_id=tenant_id, source_ids=source_ids, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
1079
|
-
)
|
|
1080
|
-
return _response.data
|
|
1081
|
-
|
|
1082
|
-
def verify_processing(
|
|
1083
|
-
self,
|
|
1084
|
-
*,
|
|
1085
|
-
file_id: str,
|
|
1086
|
-
tenant_id: typing.Optional[str] = None,
|
|
1087
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
1088
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1089
|
-
) -> ProcessingStatus:
|
|
1090
|
-
"""
|
|
1091
|
-
Check the current processing status of your uploaded content.
|
|
1092
|
-
|
|
1093
|
-
This endpoint allows you to monitor the progress of documents, text, or other content you've uploaded. Simply provide the file ID to see whether processing is complete, still in progress, or if any errors occurred.
|
|
1094
|
-
|
|
1095
|
-
Use this to determine when your content is ready for search and retrieval, or to troubleshoot any processing issues.
|
|
1096
|
-
|
|
1097
|
-
Parameters
|
|
1098
|
-
----------
|
|
1099
|
-
file_id : str
|
|
1100
|
-
The file ID to check processing status for
|
|
1101
|
-
|
|
1102
|
-
tenant_id : typing.Optional[str]
|
|
1103
|
-
Unique identifier for the tenant/organization
|
|
1104
|
-
|
|
1105
|
-
sub_tenant_id : typing.Optional[str]
|
|
1106
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
1107
|
-
|
|
1108
|
-
request_options : typing.Optional[RequestOptions]
|
|
1109
|
-
Request-specific configuration.
|
|
1110
|
-
|
|
1111
|
-
Returns
|
|
1112
|
-
-------
|
|
1113
|
-
ProcessingStatus
|
|
1114
|
-
Successful Response
|
|
1115
|
-
|
|
1116
|
-
Examples
|
|
1117
|
-
--------
|
|
1118
|
-
from usecortex-ai import CortexAI
|
|
1119
|
-
|
|
1120
|
-
client = CortexAI(token="YOUR_TOKEN", )
|
|
1121
|
-
client.upload.verify_processing(file_id='CortexDoc1234', tenant_id='tenant_1234', )
|
|
1122
|
-
"""
|
|
1123
|
-
_response = self._raw_client.verify_processing(
|
|
1124
|
-
file_id=file_id, tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
1125
|
-
)
|
|
1126
|
-
return _response.data
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
class AsyncUploadClient:
|
|
1130
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
1131
|
-
self._raw_client = AsyncRawUploadClient(client_wrapper=client_wrapper)
|
|
1132
|
-
|
|
1133
|
-
@property
|
|
1134
|
-
def with_raw_response(self) -> AsyncRawUploadClient:
|
|
1135
|
-
"""
|
|
1136
|
-
Retrieves a raw implementation of this client that returns raw responses.
|
|
1137
|
-
|
|
1138
|
-
Returns
|
|
1139
|
-
-------
|
|
1140
|
-
AsyncRawUploadClient
|
|
1141
|
-
"""
|
|
1142
|
-
return self._raw_client
|
|
1143
|
-
|
|
1144
|
-
async def batch_upload(
|
|
1145
|
-
self,
|
|
1146
|
-
*,
|
|
1147
|
-
tenant_id: str,
|
|
1148
|
-
files: typing.List[core.File],
|
|
1149
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
1150
|
-
file_ids: typing.Optional[str] = OMIT,
|
|
1151
|
-
tenant_metadata: typing.Optional[str] = OMIT,
|
|
1152
|
-
document_metadata: typing.Optional[str] = OMIT,
|
|
1153
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1154
|
-
) -> BatchUploadData:
|
|
1155
|
-
"""
|
|
1156
|
-
Upload multiple documents simultaneously for efficient bulk processing.
|
|
1157
|
-
|
|
1158
|
-
This endpoint allows you to upload several files at once, which is ideal for large document collections or periodic data imports. Each file gets processed asynchronously, and you can track the progress of individual files using their returned file IDs.
|
|
1159
|
-
|
|
1160
|
-
The system automatically handles file parsing, content extraction, and indexing across all uploaded documents. You'll receive confirmation once all files are queued for processing.
|
|
1161
|
-
|
|
1162
|
-
Parameters
|
|
1163
|
-
----------
|
|
1164
|
-
tenant_id : str
|
|
1165
|
-
Unique identifier for the tenant/organization
|
|
1166
|
-
|
|
1167
|
-
files : typing.List[core.File]
|
|
1168
|
-
See core.File for more documentation
|
|
1169
|
-
|
|
1170
|
-
sub_tenant_id : typing.Optional[str]
|
|
1171
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
1172
|
-
|
|
1173
|
-
file_ids : typing.Optional[str]
|
|
1174
|
-
Optional JSON string array of file IDs for the uploaded content. If not provided or empty, will be generated automatically.
|
|
1175
|
-
|
|
1176
|
-
tenant_metadata : typing.Optional[str]
|
|
1177
|
-
JSON string containing tenant-level document metadata (e.g., department, compliance_tag)
|
|
1178
|
-
|
|
1179
|
-
Example: > "{"department":"Finance","compliance_tag":"GDPR"}"
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
document_metadata : typing.Optional[str]
|
|
1183
|
-
JSON string containing document-specific metadata (e.g., title, author, file_id). If file_id is not provided, the system will generate an ID automatically.
|
|
1184
|
-
|
|
1185
|
-
Example: > "{"title":"Q1 Report.pdf","author":"Alice Smith","file_id":"custom_file_123"}"
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
request_options : typing.Optional[RequestOptions]
|
|
1190
|
-
Request-specific configuration.
|
|
1191
|
-
|
|
1192
|
-
Returns
|
|
1193
|
-
-------
|
|
1194
|
-
BatchUploadData
|
|
1195
|
-
Successful Response
|
|
1196
|
-
|
|
1197
|
-
Examples
|
|
1198
|
-
--------
|
|
1199
|
-
import asyncio
|
|
1200
|
-
|
|
1201
|
-
from usecortex-ai import AsyncCortexAI
|
|
1202
|
-
|
|
1203
|
-
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
1204
|
-
async def main() -> None:
|
|
1205
|
-
await client.upload.batch_upload(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
|
|
1206
|
-
asyncio.run(main())
|
|
1207
|
-
"""
|
|
1208
|
-
_response = await self._raw_client.batch_upload(
|
|
1209
|
-
tenant_id=tenant_id,
|
|
1210
|
-
files=files,
|
|
1211
|
-
sub_tenant_id=sub_tenant_id,
|
|
1212
|
-
file_ids=file_ids,
|
|
1213
|
-
tenant_metadata=tenant_metadata,
|
|
1214
|
-
document_metadata=document_metadata,
|
|
1215
|
-
request_options=request_options,
|
|
1216
|
-
)
|
|
1217
|
-
return _response.data
|
|
1218
|
-
|
|
1219
|
-
async def batch_update(
|
|
1220
|
-
self,
|
|
1221
|
-
*,
|
|
1222
|
-
tenant_id: str,
|
|
1223
|
-
files: typing.List[core.File],
|
|
1224
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
1225
|
-
source_ids: typing.Optional[typing.List[str]] = OMIT,
|
|
1226
|
-
tenant_metadata: typing.Optional[str] = OMIT,
|
|
1227
|
-
document_metadata: typing.Optional[str] = OMIT,
|
|
1228
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1229
|
-
) -> BatchUploadData:
|
|
1230
|
-
"""
|
|
1231
|
-
Update multiple existing documents with new content and metadata.
|
|
1232
|
-
|
|
1233
|
-
Use this endpoint when you need to replace or modify several documents that are already in your knowledge base. Each file must correspond to an existing source ID, ensuring that updates are applied to the correct documents.
|
|
1234
|
-
|
|
1235
|
-
The system processes updates asynchronously, allowing you to continue working while your documents are re-indexed. Track the progress using the returned file IDs to know when updates are complete.
|
|
1236
|
-
|
|
1237
|
-
Parameters
|
|
1238
|
-
----------
|
|
1239
|
-
tenant_id : str
|
|
1240
|
-
Unique identifier for the tenant/organization
|
|
1241
|
-
|
|
1242
|
-
files : typing.List[core.File]
|
|
1243
|
-
See core.File for more documentation
|
|
1244
|
-
|
|
1245
|
-
sub_tenant_id : typing.Optional[str]
|
|
1246
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
1247
|
-
|
|
1248
|
-
source_ids : typing.Optional[typing.List[str]]
|
|
1249
|
-
List of source IDs corresponding to the files being updated
|
|
1250
|
-
|
|
1251
|
-
tenant_metadata : typing.Optional[str]
|
|
1252
|
-
JSON string containing tenant-level document metadata (e.g., department, compliance_tag)
|
|
1253
|
-
|
|
1254
|
-
Example: > "{"department":"Finance","compliance_tag":"GDPR"}"
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
document_metadata : typing.Optional[str]
|
|
1258
|
-
JSON string containing document-specific metadata (e.g., title, author, file_id). If file_id is not provided, the system will generate an ID automatically.
|
|
1259
|
-
|
|
1260
|
-
Example: > "{"title":"Q1 Report.pdf","author":"Alice Smith","file_id":"custom_file_123"}"
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
request_options : typing.Optional[RequestOptions]
|
|
1265
|
-
Request-specific configuration.
|
|
1266
|
-
|
|
1267
|
-
Returns
|
|
1268
|
-
-------
|
|
1269
|
-
BatchUploadData
|
|
1270
|
-
Successful Response
|
|
1271
|
-
|
|
1272
|
-
Examples
|
|
1273
|
-
--------
|
|
1274
|
-
import asyncio
|
|
1275
|
-
|
|
1276
|
-
from usecortex-ai import AsyncCortexAI
|
|
1277
|
-
|
|
1278
|
-
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
1279
|
-
async def main() -> None:
|
|
1280
|
-
await client.upload.batch_update(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
|
|
1281
|
-
asyncio.run(main())
|
|
1282
|
-
"""
|
|
1283
|
-
_response = await self._raw_client.batch_update(
|
|
1284
|
-
tenant_id=tenant_id,
|
|
1285
|
-
files=files,
|
|
1286
|
-
sub_tenant_id=sub_tenant_id,
|
|
1287
|
-
source_ids=source_ids,
|
|
1288
|
-
tenant_metadata=tenant_metadata,
|
|
1289
|
-
document_metadata=document_metadata,
|
|
1290
|
-
request_options=request_options,
|
|
1291
|
-
)
|
|
1292
|
-
return _response.data
|
|
1293
|
-
|
|
1294
|
-
async def upload_document(
|
|
1295
|
-
self,
|
|
1296
|
-
*,
|
|
1297
|
-
tenant_id: str,
|
|
1298
|
-
file: core.File,
|
|
1299
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
1300
|
-
file_id: typing.Optional[str] = OMIT,
|
|
1301
|
-
tenant_metadata: typing.Optional[str] = OMIT,
|
|
1302
|
-
document_metadata: typing.Optional[str] = OMIT,
|
|
1303
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1304
|
-
) -> SingleUploadData:
|
|
1305
|
-
"""
|
|
1306
|
-
Upload a single document for processing and indexing into your knowledge base.
|
|
1307
|
-
|
|
1308
|
-
This endpoint accepts documents in various formats and processes them for search and retrieval. You can include custom metadata to help organize and categorize your content.
|
|
1309
|
-
|
|
1310
|
-
The system extracts text content, processes it asynchronously, and makes it available for search queries. You can track the processing status using the returned file ID.
|
|
1311
|
-
|
|
1312
|
-
Parameters
|
|
1313
|
-
----------
|
|
1314
|
-
tenant_id : str
|
|
1315
|
-
Unique identifier for the tenant/organization
|
|
1316
|
-
|
|
1317
|
-
file : core.File
|
|
1318
|
-
See core.File for more documentation
|
|
1319
|
-
|
|
1320
|
-
sub_tenant_id : typing.Optional[str]
|
|
1321
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
1322
|
-
|
|
1323
|
-
file_id : typing.Optional[str]
|
|
1324
|
-
Optional file ID for the uploaded content. If not provided, will be generated automatically.
|
|
1325
|
-
|
|
1326
|
-
tenant_metadata : typing.Optional[str]
|
|
1327
|
-
JSON string containing tenant-level document metadata (e.g., department, compliance_tag)
|
|
1328
|
-
|
|
1329
|
-
Example: > "{"department":"Finance","compliance_tag":"GDPR"}"
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
document_metadata : typing.Optional[str]
|
|
1333
|
-
JSON string containing document-specific metadata (e.g., title, author, file_id). If file_id is not provided, the system will generate an ID automatically.
|
|
1334
|
-
|
|
1335
|
-
Example: > "{"title":"Q1 Report.pdf","author":"Alice Smith","file_id":"custom_file_123"}"
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
request_options : typing.Optional[RequestOptions]
|
|
1340
|
-
Request-specific configuration.
|
|
1341
|
-
|
|
1342
|
-
Returns
|
|
1343
|
-
-------
|
|
1344
|
-
SingleUploadData
|
|
1345
|
-
Successful Response
|
|
1346
|
-
|
|
1347
|
-
Examples
|
|
1348
|
-
--------
|
|
1349
|
-
import asyncio
|
|
1350
|
-
|
|
1351
|
-
from usecortex-ai import AsyncCortexAI
|
|
1352
|
-
|
|
1353
|
-
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
1354
|
-
async def main() -> None:
|
|
1355
|
-
await client.upload.upload_document(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
|
|
1356
|
-
asyncio.run(main())
|
|
1357
|
-
"""
|
|
1358
|
-
_response = await self._raw_client.upload_document(
|
|
1359
|
-
tenant_id=tenant_id,
|
|
1360
|
-
file=file,
|
|
1361
|
-
sub_tenant_id=sub_tenant_id,
|
|
1362
|
-
file_id=file_id,
|
|
1363
|
-
tenant_metadata=tenant_metadata,
|
|
1364
|
-
document_metadata=document_metadata,
|
|
1365
|
-
request_options=request_options,
|
|
1366
|
-
)
|
|
1367
|
-
return _response.data
|
|
1368
|
-
|
|
1369
|
-
async def update_document(
|
|
1370
|
-
self,
|
|
1371
|
-
*,
|
|
1372
|
-
source_id: str,
|
|
1373
|
-
tenant_id: str,
|
|
1374
|
-
file: core.File,
|
|
1375
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
1376
|
-
tenant_metadata: typing.Optional[str] = OMIT,
|
|
1377
|
-
document_metadata: typing.Optional[str] = OMIT,
|
|
1378
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1379
|
-
) -> SingleUploadData:
|
|
1380
|
-
"""
|
|
1381
|
-
Replace an existing document with updated content.
|
|
1382
|
-
|
|
1383
|
-
This endpoint allows you to update a specific document that's already in your knowledge base. Provide the source ID of the document you want to modify, along with the new file content.
|
|
1384
|
-
|
|
1385
|
-
The system will process your update asynchronously and re-index the document with the new content. You can monitor the progress using the returned file ID.
|
|
1386
|
-
|
|
1387
|
-
Parameters
|
|
1388
|
-
----------
|
|
1389
|
-
source_id : str
|
|
1390
|
-
The source ID of the document to update
|
|
1391
|
-
|
|
1392
|
-
tenant_id : str
|
|
1393
|
-
Unique identifier for the tenant/organization
|
|
1394
|
-
|
|
1395
|
-
file : core.File
|
|
1396
|
-
See core.File for more documentation
|
|
1397
|
-
|
|
1398
|
-
sub_tenant_id : typing.Optional[str]
|
|
1399
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
1400
|
-
|
|
1401
|
-
tenant_metadata : typing.Optional[str]
|
|
1402
|
-
JSON string containing tenant-level document metadata (e.g., department, compliance_tag)
|
|
1403
|
-
|
|
1404
|
-
Example: > "{"department":"Finance","compliance_tag":"GDPR"}"
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
document_metadata : typing.Optional[str]
|
|
1408
|
-
JSON string containing document-specific metadata (e.g., title, author, file_id). If file_id is not provided, the system will generate an ID automatically.
|
|
1409
|
-
|
|
1410
|
-
Example: > "{"title":"Q1 Report.pdf","author":"Alice Smith","file_id":"custom_file_123"}"
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
request_options : typing.Optional[RequestOptions]
|
|
1415
|
-
Request-specific configuration.
|
|
1416
|
-
|
|
1417
|
-
Returns
|
|
1418
|
-
-------
|
|
1419
|
-
SingleUploadData
|
|
1420
|
-
Successful Response
|
|
1421
|
-
|
|
1422
|
-
Examples
|
|
1423
|
-
--------
|
|
1424
|
-
import asyncio
|
|
1425
|
-
|
|
1426
|
-
from usecortex-ai import AsyncCortexAI
|
|
1427
|
-
|
|
1428
|
-
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
1429
|
-
async def main() -> None:
|
|
1430
|
-
await client.upload.update_document(source_id='CortexDoc1234', tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
|
|
1431
|
-
asyncio.run(main())
|
|
1432
|
-
"""
|
|
1433
|
-
_response = await self._raw_client.update_document(
|
|
1434
|
-
source_id=source_id,
|
|
1435
|
-
tenant_id=tenant_id,
|
|
1436
|
-
file=file,
|
|
1437
|
-
sub_tenant_id=sub_tenant_id,
|
|
1438
|
-
tenant_metadata=tenant_metadata,
|
|
1439
|
-
document_metadata=document_metadata,
|
|
1440
|
-
request_options=request_options,
|
|
1441
|
-
)
|
|
1442
|
-
return _response.data
|
|
1443
|
-
|
|
1444
|
-
async def upload_app_sources(
|
|
1445
|
-
self,
|
|
1446
|
-
*,
|
|
1447
|
-
tenant_id: str,
|
|
1448
|
-
request: typing.Sequence[SourceModel],
|
|
1449
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
1450
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1451
|
-
) -> AppSourcesUploadData:
|
|
1452
|
-
"""
|
|
1453
|
-
Upload structured data from applications or APIs for indexing.
|
|
1454
|
-
|
|
1455
|
-
This endpoint is designed for importing data from applications. If you are specifically using Cortex to provide search to an application, you should prefer this endpoint. It accepts structured source objects and allows you to clearly define contents of attachments
|
|
1456
|
-
|
|
1457
|
-
The system processes each source asynchronously and makes the content available for search and retrieval. Use this when you need to integrate search and indexing from data in your applications into your knowledge base.
|
|
1458
|
-
|
|
1459
|
-
Parameters
|
|
1460
|
-
----------
|
|
1461
|
-
tenant_id : str
|
|
1462
|
-
Unique identifier for the tenant/organization
|
|
1463
|
-
|
|
1464
|
-
request : typing.Sequence[SourceModel]
|
|
1465
|
-
|
|
1466
|
-
sub_tenant_id : typing.Optional[str]
|
|
1467
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
1468
|
-
|
|
1469
|
-
request_options : typing.Optional[RequestOptions]
|
|
1470
|
-
Request-specific configuration.
|
|
1471
|
-
|
|
1472
|
-
Returns
|
|
1473
|
-
-------
|
|
1474
|
-
AppSourcesUploadData
|
|
1475
|
-
Successful Response
|
|
1476
|
-
|
|
1477
|
-
Examples
|
|
1478
|
-
--------
|
|
1479
|
-
import asyncio
|
|
1480
|
-
|
|
1481
|
-
from usecortex-ai import AsyncCortexAI, SourceModel
|
|
1482
|
-
|
|
1483
|
-
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
1484
|
-
async def main() -> None:
|
|
1485
|
-
await client.upload.upload_app_sources(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', request=[SourceModel()], )
|
|
1486
|
-
asyncio.run(main())
|
|
1487
|
-
"""
|
|
1488
|
-
_response = await self._raw_client.upload_app_sources(
|
|
1489
|
-
tenant_id=tenant_id, request=request, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
1490
|
-
)
|
|
1491
|
-
return _response.data
|
|
1492
|
-
|
|
1493
|
-
async def upload_markdown(
|
|
1494
|
-
self,
|
|
1495
|
-
*,
|
|
1496
|
-
tenant_id: str,
|
|
1497
|
-
content: str,
|
|
1498
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
1499
|
-
file_id: typing.Optional[str] = OMIT,
|
|
1500
|
-
tenant_metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
1501
|
-
document_metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
1502
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1503
|
-
) -> SingleUploadData:
|
|
1504
|
-
"""
|
|
1505
|
-
Upload text or markdown content directly for processing.
|
|
1506
|
-
|
|
1507
|
-
This endpoint accepts plain text or markdown-formatted content that you want to add to your knowledge base. It's perfect for notes, documentation, articles, or any text-based content you want to make searchable.
|
|
1508
|
-
|
|
1509
|
-
You can include custom metadata to help organize and categorize your content. You can track the processing status using the returned file ID.
|
|
1510
|
-
|
|
1511
|
-
Parameters
|
|
1512
|
-
----------
|
|
1513
|
-
tenant_id : str
|
|
1514
|
-
Unique identifier for the tenant/organization
|
|
1515
|
-
|
|
1516
|
-
content : str
|
|
1517
|
-
The text or markdown content to upload
|
|
1518
|
-
|
|
1519
|
-
sub_tenant_id : typing.Optional[str]
|
|
1520
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
1521
|
-
|
|
1522
|
-
file_id : typing.Optional[str]
|
|
1523
|
-
Optional file ID for the uploaded content. If not provided, will be generated automatically.
|
|
1524
|
-
|
|
1525
|
-
tenant_metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
1526
|
-
JSON string containing tenant-level document metadata (e.g., department, compliance_tag)
|
|
1527
|
-
|
|
1528
|
-
Example: > "{"department":"Finance","compliance_tag":"GDPR"}"
|
|
1529
|
-
|
|
1530
|
-
document_metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
1531
|
-
JSON string containing document-specific metadata (e.g., title, author, file_id). If file_id is not provided, the system will generate an ID automatically.
|
|
1532
|
-
|
|
1533
|
-
Example: > "{"title":"Q1 Report.pdf","author":"Alice Smith","file_id":"custom_file_123"}"
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
request_options : typing.Optional[RequestOptions]
|
|
1537
|
-
Request-specific configuration.
|
|
1538
|
-
|
|
1539
|
-
Returns
|
|
1540
|
-
-------
|
|
1541
|
-
SingleUploadData
|
|
1542
|
-
Successful Response
|
|
1543
|
-
|
|
1544
|
-
Examples
|
|
1545
|
-
--------
|
|
1546
|
-
import asyncio
|
|
1547
|
-
|
|
1548
|
-
from usecortex-ai import AsyncCortexAI
|
|
1549
|
-
|
|
1550
|
-
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
1551
|
-
async def main() -> None:
|
|
1552
|
-
await client.upload.upload_markdown(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', content='<content>', )
|
|
1553
|
-
asyncio.run(main())
|
|
1554
|
-
"""
|
|
1555
|
-
_response = await self._raw_client.upload_markdown(
|
|
1556
|
-
tenant_id=tenant_id,
|
|
1557
|
-
content=content,
|
|
1558
|
-
sub_tenant_id=sub_tenant_id,
|
|
1559
|
-
file_id=file_id,
|
|
1560
|
-
tenant_metadata=tenant_metadata,
|
|
1561
|
-
document_metadata=document_metadata,
|
|
1562
|
-
request_options=request_options,
|
|
1563
|
-
)
|
|
1564
|
-
return _response.data
|
|
1565
|
-
|
|
1566
|
-
async def upload_text(
|
|
1567
|
-
self,
|
|
1568
|
-
*,
|
|
1569
|
-
tenant_id: str,
|
|
1570
|
-
content: str,
|
|
1571
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
1572
|
-
file_id: typing.Optional[str] = OMIT,
|
|
1573
|
-
tenant_metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
1574
|
-
document_metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
1575
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1576
|
-
) -> SingleUploadData:
|
|
1577
|
-
"""
|
|
1578
|
-
Upload text or markdown content directly for processing.
|
|
1579
|
-
|
|
1580
|
-
This endpoint accepts plain text or markdown-formatted content that you want to add to your knowledge base. It's perfect for notes, documentation, articles, or any text-based content you want to make searchable.
|
|
1581
|
-
|
|
1582
|
-
You can include custom metadata to help organize and categorize your content. You can track the processing status using the returned file ID.
|
|
1583
|
-
|
|
1584
|
-
Parameters
|
|
1585
|
-
----------
|
|
1586
|
-
tenant_id : str
|
|
1587
|
-
Unique identifier for the tenant/organization
|
|
1588
|
-
|
|
1589
|
-
content : str
|
|
1590
|
-
The text or markdown content to upload
|
|
1591
|
-
|
|
1592
|
-
sub_tenant_id : typing.Optional[str]
|
|
1593
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
1594
|
-
|
|
1595
|
-
file_id : typing.Optional[str]
|
|
1596
|
-
Optional file ID for the uploaded content. If not provided, will be generated automatically.
|
|
1597
|
-
|
|
1598
|
-
tenant_metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
1599
|
-
JSON string containing tenant-level document metadata (e.g., department, compliance_tag)
|
|
1600
|
-
|
|
1601
|
-
Example: > "{"department":"Finance","compliance_tag":"GDPR"}"
|
|
1602
|
-
|
|
1603
|
-
document_metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
1604
|
-
JSON string containing document-specific metadata (e.g., title, author, file_id). If file_id is not provided, the system will generate an ID automatically.
|
|
1605
|
-
|
|
1606
|
-
Example: > "{"title":"Q1 Report.pdf","author":"Alice Smith","file_id":"custom_file_123"}"
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
request_options : typing.Optional[RequestOptions]
|
|
1610
|
-
Request-specific configuration.
|
|
1611
|
-
|
|
1612
|
-
Returns
|
|
1613
|
-
-------
|
|
1614
|
-
SingleUploadData
|
|
1615
|
-
Successful Response
|
|
1616
|
-
|
|
1617
|
-
Examples
|
|
1618
|
-
--------
|
|
1619
|
-
import asyncio
|
|
1620
|
-
|
|
1621
|
-
from usecortex-ai import AsyncCortexAI
|
|
1622
|
-
|
|
1623
|
-
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
1624
|
-
async def main() -> None:
|
|
1625
|
-
await client.upload.upload_text(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', content='<content>', )
|
|
1626
|
-
asyncio.run(main())
|
|
1627
|
-
"""
|
|
1628
|
-
_response = await self._raw_client.upload_text(
|
|
1629
|
-
tenant_id=tenant_id,
|
|
1630
|
-
content=content,
|
|
1631
|
-
sub_tenant_id=sub_tenant_id,
|
|
1632
|
-
file_id=file_id,
|
|
1633
|
-
tenant_metadata=tenant_metadata,
|
|
1634
|
-
document_metadata=document_metadata,
|
|
1635
|
-
request_options=request_options,
|
|
1636
|
-
)
|
|
1637
|
-
return _response.data
|
|
1638
|
-
|
|
1639
|
-
async def update_markdown(
|
|
36
|
+
def upload_document(
|
|
1640
37
|
self,
|
|
1641
38
|
*,
|
|
1642
|
-
|
|
39
|
+
files: typing.List[core.File],
|
|
1643
40
|
tenant_id: str,
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
tenant_metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
1648
|
-
document_metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
41
|
+
sub_tenant_id: typing.Optional[str] = OMIT,
|
|
42
|
+
upsert: typing.Optional[bool] = OMIT,
|
|
43
|
+
file_metadata: typing.Optional[str] = OMIT,
|
|
1649
44
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1650
|
-
) ->
|
|
45
|
+
) -> SourceUploadResponse:
|
|
1651
46
|
"""
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
The system will reprocess and re-index the updated content asynchronously. Use this when you need to correct information, add details, or refresh existing documentation.
|
|
47
|
+
Upload one or more documents for ingestion.
|
|
48
|
+
Supports both single and batch uploads.
|
|
49
|
+
For single file: send one file with the 'files' field.
|
|
50
|
+
For batch: send multiple files with the 'files' field (FastAPI will parse as list).
|
|
1657
51
|
|
|
1658
52
|
Parameters
|
|
1659
53
|
----------
|
|
1660
|
-
|
|
1661
|
-
|
|
54
|
+
files : typing.List[core.File]
|
|
55
|
+
See core.File for more documentation
|
|
1662
56
|
|
|
1663
57
|
tenant_id : str
|
|
1664
58
|
Unique identifier for the tenant/organization
|
|
1665
59
|
|
|
1666
|
-
content : str
|
|
1667
|
-
The text or markdown content to upload
|
|
1668
|
-
|
|
1669
60
|
sub_tenant_id : typing.Optional[str]
|
|
1670
61
|
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
1671
62
|
|
|
1672
|
-
|
|
1673
|
-
Optional file ID for the uploaded content. If not provided, will be generated automatically.
|
|
1674
|
-
|
|
1675
|
-
tenant_metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
1676
|
-
JSON string containing tenant-level document metadata (e.g., department, compliance_tag)
|
|
1677
|
-
|
|
1678
|
-
Example: > "{"department":"Finance","compliance_tag":"GDPR"}"
|
|
1679
|
-
|
|
1680
|
-
document_metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
1681
|
-
JSON string containing document-specific metadata (e.g., title, author, file_id). If file_id is not provided, the system will generate an ID automatically.
|
|
1682
|
-
|
|
1683
|
-
Example: > "{"title":"Q1 Report.pdf","author":"Alice Smith","file_id":"custom_file_123"}"
|
|
63
|
+
upsert : typing.Optional[bool]
|
|
1684
64
|
|
|
65
|
+
file_metadata : typing.Optional[str]
|
|
66
|
+
JSON Array of file metadata objects
|
|
1685
67
|
|
|
1686
68
|
request_options : typing.Optional[RequestOptions]
|
|
1687
69
|
Request-specific configuration.
|
|
1688
70
|
|
|
1689
71
|
Returns
|
|
1690
72
|
-------
|
|
1691
|
-
|
|
73
|
+
SourceUploadResponse
|
|
1692
74
|
Successful Response
|
|
1693
75
|
|
|
1694
76
|
Examples
|
|
1695
77
|
--------
|
|
1696
|
-
import
|
|
1697
|
-
|
|
1698
|
-
from usecortex-ai import AsyncCortexAI
|
|
78
|
+
from usecortex-ai import CortexAI
|
|
1699
79
|
|
|
1700
|
-
client =
|
|
1701
|
-
|
|
1702
|
-
await client.upload.update_markdown(source_id='CortexDoc1234', tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', content='<content>', )
|
|
1703
|
-
asyncio.run(main())
|
|
80
|
+
client = CortexAI(token="YOUR_TOKEN", )
|
|
81
|
+
client.upload.upload_document(tenant_id='tenant_id', )
|
|
1704
82
|
"""
|
|
1705
|
-
_response =
|
|
1706
|
-
|
|
83
|
+
_response = self._raw_client.upload_document(
|
|
84
|
+
files=files,
|
|
1707
85
|
tenant_id=tenant_id,
|
|
1708
|
-
content=content,
|
|
1709
86
|
sub_tenant_id=sub_tenant_id,
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
document_metadata=document_metadata,
|
|
87
|
+
upsert=upsert,
|
|
88
|
+
file_metadata=file_metadata,
|
|
1713
89
|
request_options=request_options,
|
|
1714
90
|
)
|
|
1715
91
|
return _response.data
|
|
1716
92
|
|
|
1717
|
-
|
|
93
|
+
def upload_app_sources(
|
|
1718
94
|
self,
|
|
1719
95
|
*,
|
|
1720
|
-
|
|
96
|
+
app_sources: BodyUploadAppIngestionUploadAppPostAppSources,
|
|
1721
97
|
tenant_id: str,
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
file_id: typing.Optional[str] = OMIT,
|
|
1725
|
-
tenant_metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
1726
|
-
document_metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
98
|
+
sub_tenant_id: typing.Optional[str] = OMIT,
|
|
99
|
+
upsert: typing.Optional[bool] = OMIT,
|
|
1727
100
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1728
|
-
) ->
|
|
101
|
+
) -> AppSourcesUploadData:
|
|
1729
102
|
"""
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
This endpoint allows you to modify text or markdown content that's already in your knowledge base. Provide the source ID of the content you want to update, along with the new text.
|
|
1733
|
-
|
|
1734
|
-
The system will reprocess and re-index the updated content asynchronously. Use this when you need to correct information, add details, or refresh existing documentation.
|
|
103
|
+
Upload structured sources generated by first-party or third-party apps.
|
|
104
|
+
Supports both single and batch uploads.
|
|
1735
105
|
|
|
1736
106
|
Parameters
|
|
1737
107
|
----------
|
|
1738
|
-
|
|
1739
|
-
|
|
108
|
+
app_sources : BodyUploadAppIngestionUploadAppPostAppSources
|
|
109
|
+
Single source object or list of structured source objects containing app-generated data to be indexed
|
|
1740
110
|
|
|
1741
111
|
tenant_id : str
|
|
1742
112
|
Unique identifier for the tenant/organization
|
|
1743
113
|
|
|
1744
|
-
content : str
|
|
1745
|
-
The text or markdown content to upload
|
|
1746
|
-
|
|
1747
114
|
sub_tenant_id : typing.Optional[str]
|
|
1748
115
|
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
1749
116
|
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
tenant_metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
1754
|
-
JSON string containing tenant-level document metadata (e.g., department, compliance_tag)
|
|
1755
|
-
|
|
1756
|
-
Example: > "{"department":"Finance","compliance_tag":"GDPR"}"
|
|
1757
|
-
|
|
1758
|
-
document_metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
1759
|
-
JSON string containing document-specific metadata (e.g., title, author, file_id). If file_id is not provided, the system will generate an ID automatically.
|
|
1760
|
-
|
|
1761
|
-
Example: > "{"title":"Q1 Report.pdf","author":"Alice Smith","file_id":"custom_file_123"}"
|
|
1762
|
-
|
|
117
|
+
upsert : typing.Optional[bool]
|
|
118
|
+
If true, update existing sources with the same source_id. Defaults to True.
|
|
1763
119
|
|
|
1764
120
|
request_options : typing.Optional[RequestOptions]
|
|
1765
121
|
Request-specific configuration.
|
|
1766
122
|
|
|
1767
123
|
Returns
|
|
1768
124
|
-------
|
|
1769
|
-
|
|
125
|
+
AppSourcesUploadData
|
|
1770
126
|
Successful Response
|
|
1771
127
|
|
|
1772
128
|
Examples
|
|
1773
129
|
--------
|
|
1774
|
-
import
|
|
1775
|
-
|
|
1776
|
-
from usecortex-ai import AsyncCortexAI
|
|
130
|
+
from usecortex-ai import CortexAI, SourceModel
|
|
1777
131
|
|
|
1778
|
-
client =
|
|
1779
|
-
|
|
1780
|
-
await client.upload.update_text(source_id='CortexDoc1234', tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', content='<content>', )
|
|
1781
|
-
asyncio.run(main())
|
|
132
|
+
client = CortexAI(token="YOUR_TOKEN", )
|
|
133
|
+
client.upload.upload_app_sources(app_sources=SourceModel(id='id', tenant_id='tenant_id', sub_tenant_id='sub_tenant_id', ), tenant_id='tenant_id', )
|
|
1782
134
|
"""
|
|
1783
|
-
_response =
|
|
1784
|
-
|
|
135
|
+
_response = self._raw_client.upload_app_sources(
|
|
136
|
+
app_sources=app_sources,
|
|
1785
137
|
tenant_id=tenant_id,
|
|
1786
|
-
content=content,
|
|
1787
138
|
sub_tenant_id=sub_tenant_id,
|
|
1788
|
-
|
|
1789
|
-
tenant_metadata=tenant_metadata,
|
|
1790
|
-
document_metadata=document_metadata,
|
|
139
|
+
upsert=upsert,
|
|
1791
140
|
request_options=request_options,
|
|
1792
141
|
)
|
|
1793
142
|
return _response.data
|
|
1794
143
|
|
|
1795
|
-
|
|
144
|
+
def verify_processing(
|
|
1796
145
|
self,
|
|
1797
146
|
*,
|
|
1798
|
-
|
|
1799
|
-
|
|
147
|
+
file_id: str,
|
|
148
|
+
tenant_id: typing.Optional[str] = None,
|
|
1800
149
|
sub_tenant_id: typing.Optional[str] = None,
|
|
1801
150
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1802
|
-
) ->
|
|
151
|
+
) -> ProcessingStatus:
|
|
1803
152
|
"""
|
|
1804
|
-
|
|
153
|
+
Check the current processing status of your uploaded content.
|
|
154
|
+
|
|
155
|
+
This endpoint allows you to monitor the progress of documents, text, or other content you've uploaded. Simply provide the file ID to see whether processing is complete, still in progress, or if any errors occurred.
|
|
1805
156
|
|
|
1806
|
-
|
|
157
|
+
Use this to determine when your content is ready for search and retrieval, or to troubleshoot any processing issues.
|
|
1807
158
|
|
|
1808
159
|
Parameters
|
|
1809
160
|
----------
|
|
1810
|
-
|
|
1811
|
-
|
|
161
|
+
file_id : str
|
|
162
|
+
The file ID to check processing status for
|
|
1812
163
|
|
|
1813
|
-
|
|
164
|
+
tenant_id : typing.Optional[str]
|
|
165
|
+
Unique identifier for the tenant/organization
|
|
1814
166
|
|
|
1815
167
|
sub_tenant_id : typing.Optional[str]
|
|
1816
168
|
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
@@ -1820,200 +172,171 @@ class AsyncUploadClient:
|
|
|
1820
172
|
|
|
1821
173
|
Returns
|
|
1822
174
|
-------
|
|
1823
|
-
|
|
175
|
+
ProcessingStatus
|
|
1824
176
|
Successful Response
|
|
1825
177
|
|
|
1826
178
|
Examples
|
|
1827
179
|
--------
|
|
1828
|
-
import
|
|
1829
|
-
|
|
1830
|
-
from usecortex-ai import AsyncCortexAI, MarkdownUploadRequest
|
|
180
|
+
from usecortex-ai import CortexAI
|
|
1831
181
|
|
|
1832
|
-
client =
|
|
1833
|
-
|
|
1834
|
-
await client.upload.batch_upload_markdown(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', request=[MarkdownUploadRequest(content='<content>', )], )
|
|
1835
|
-
asyncio.run(main())
|
|
182
|
+
client = CortexAI(token="YOUR_TOKEN", )
|
|
183
|
+
client.upload.verify_processing(file_id='file_id', )
|
|
1836
184
|
"""
|
|
1837
|
-
_response =
|
|
1838
|
-
|
|
185
|
+
_response = self._raw_client.verify_processing(
|
|
186
|
+
file_id=file_id, tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
1839
187
|
)
|
|
1840
188
|
return _response.data
|
|
1841
189
|
|
|
1842
|
-
|
|
190
|
+
def add_memory(
|
|
1843
191
|
self,
|
|
1844
192
|
*,
|
|
193
|
+
memories: typing.Sequence[MemoryItem],
|
|
1845
194
|
tenant_id: str,
|
|
1846
|
-
|
|
1847
|
-
|
|
195
|
+
sub_tenant_id: typing.Optional[str] = OMIT,
|
|
196
|
+
upsert: typing.Optional[bool] = OMIT,
|
|
1848
197
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1849
|
-
) ->
|
|
198
|
+
) -> AddMemoryResponse:
|
|
1850
199
|
"""
|
|
1851
|
-
|
|
200
|
+
Add memories for indexing and retrieval.
|
|
201
|
+
|
|
202
|
+
This API provides a unified entry point for ingesting various types of content:
|
|
203
|
+
|
|
204
|
+
**Content Types Supported:**
|
|
205
|
+
- Raw text content (`text` field)
|
|
206
|
+
- Markdown formatted content (`text` + `is_markdown=true`)
|
|
207
|
+
- User/assistant conversation pairs (`user_assistant_pairs` field)
|
|
1852
208
|
|
|
1853
|
-
|
|
209
|
+
**Key Features:**
|
|
210
|
+
- **Inference Mode (`infer=true`)**: When enabled, the system extracts additional
|
|
211
|
+
insights and implicit information from your content. Useful for conversation
|
|
212
|
+
analysis and knowledge extraction.
|
|
213
|
+
- **Direct Mode (`infer=false`)**: Content is chunked and indexed as-is without
|
|
214
|
+
additional processing.
|
|
215
|
+
|
|
216
|
+
Use `/ingestion/verify-processing` endpoint to check the processing status.
|
|
1854
217
|
|
|
1855
218
|
Parameters
|
|
1856
219
|
----------
|
|
220
|
+
memories : typing.Sequence[MemoryItem]
|
|
221
|
+
List of memory items to ingest
|
|
222
|
+
|
|
1857
223
|
tenant_id : str
|
|
1858
224
|
Unique identifier for the tenant/organization
|
|
1859
225
|
|
|
1860
|
-
request : typing.Sequence[MarkdownUploadRequest]
|
|
1861
|
-
|
|
1862
226
|
sub_tenant_id : typing.Optional[str]
|
|
1863
227
|
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
1864
228
|
|
|
229
|
+
upsert : typing.Optional[bool]
|
|
230
|
+
If true, update existing sources with the same source_id.
|
|
231
|
+
|
|
1865
232
|
request_options : typing.Optional[RequestOptions]
|
|
1866
233
|
Request-specific configuration.
|
|
1867
234
|
|
|
1868
235
|
Returns
|
|
1869
236
|
-------
|
|
1870
|
-
|
|
237
|
+
AddMemoryResponse
|
|
1871
238
|
Successful Response
|
|
1872
239
|
|
|
1873
240
|
Examples
|
|
1874
241
|
--------
|
|
1875
|
-
import
|
|
1876
|
-
|
|
1877
|
-
from usecortex-ai import AsyncCortexAI, MarkdownUploadRequest
|
|
242
|
+
from usecortex-ai import CortexAI, MemoryItem
|
|
1878
243
|
|
|
1879
|
-
client =
|
|
1880
|
-
|
|
1881
|
-
await client.upload.batch_upload_text(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', request=[MarkdownUploadRequest(content='<content>', )], )
|
|
1882
|
-
asyncio.run(main())
|
|
244
|
+
client = CortexAI(token="YOUR_TOKEN", )
|
|
245
|
+
client.upload.add_memory(memories=[MemoryItem()], tenant_id='tenant_id', )
|
|
1883
246
|
"""
|
|
1884
|
-
_response =
|
|
1885
|
-
|
|
247
|
+
_response = self._raw_client.add_memory(
|
|
248
|
+
memories=memories,
|
|
249
|
+
tenant_id=tenant_id,
|
|
250
|
+
sub_tenant_id=sub_tenant_id,
|
|
251
|
+
upsert=upsert,
|
|
252
|
+
request_options=request_options,
|
|
1886
253
|
)
|
|
1887
254
|
return _response.data
|
|
1888
255
|
|
|
1889
|
-
|
|
256
|
+
def delete_memory(
|
|
1890
257
|
self,
|
|
1891
258
|
*,
|
|
1892
259
|
tenant_id: str,
|
|
1893
|
-
|
|
260
|
+
memory_id: str,
|
|
1894
261
|
sub_tenant_id: typing.Optional[str] = None,
|
|
1895
|
-
file_id: typing.Optional[str] = OMIT,
|
|
1896
262
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1897
|
-
) ->
|
|
263
|
+
) -> DeleteUserMemoryResponse:
|
|
1898
264
|
"""
|
|
1899
|
-
|
|
265
|
+
Permanently remove a specific memory from storage.
|
|
1900
266
|
|
|
1901
|
-
|
|
267
|
+
This API allows you to delete a memory by its unique identifier.
|
|
268
|
+
Once deleted, the memory cannot be recovered, so use this operation carefully.
|
|
1902
269
|
|
|
1903
|
-
|
|
270
|
+
The memory will be removed from your tenant's storage and will no longer
|
|
271
|
+
appear in search results or memory listings.
|
|
1904
272
|
|
|
1905
273
|
Parameters
|
|
1906
274
|
----------
|
|
1907
275
|
tenant_id : str
|
|
1908
|
-
|
|
276
|
+
Tenant ID
|
|
1909
277
|
|
|
1910
|
-
|
|
1911
|
-
|
|
278
|
+
memory_id : str
|
|
279
|
+
Unique identifier of the memory to delete
|
|
1912
280
|
|
|
1913
281
|
sub_tenant_id : typing.Optional[str]
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
file_id : typing.Optional[str]
|
|
1917
|
-
The Source ID of the target source you want to index
|
|
282
|
+
Sub-tenant ID
|
|
1918
283
|
|
|
1919
284
|
request_options : typing.Optional[RequestOptions]
|
|
1920
285
|
Request-specific configuration.
|
|
1921
286
|
|
|
1922
287
|
Returns
|
|
1923
288
|
-------
|
|
1924
|
-
|
|
289
|
+
DeleteUserMemoryResponse
|
|
1925
290
|
Successful Response
|
|
1926
291
|
|
|
1927
292
|
Examples
|
|
1928
293
|
--------
|
|
1929
|
-
import
|
|
1930
|
-
|
|
1931
|
-
from usecortex-ai import AsyncCortexAI
|
|
294
|
+
from usecortex-ai import CortexAI
|
|
1932
295
|
|
|
1933
|
-
client =
|
|
1934
|
-
|
|
1935
|
-
await client.upload.upload_embeddings(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', embeddings=[[0.123413, 0.655367, 0.987654, 0.123456, 0.789012], [0.123413, 0.655367, 0.987654, 0.123456, 0.789012]], )
|
|
1936
|
-
asyncio.run(main())
|
|
296
|
+
client = CortexAI(token="YOUR_TOKEN", )
|
|
297
|
+
client.upload.delete_memory(tenant_id='tenant_id', memory_id='memory_id', )
|
|
1937
298
|
"""
|
|
1938
|
-
_response =
|
|
1939
|
-
tenant_id=tenant_id,
|
|
1940
|
-
embeddings=embeddings,
|
|
1941
|
-
sub_tenant_id=sub_tenant_id,
|
|
1942
|
-
file_id=file_id,
|
|
1943
|
-
request_options=request_options,
|
|
299
|
+
_response = self._raw_client.delete_memory(
|
|
300
|
+
tenant_id=tenant_id, memory_id=memory_id, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
1944
301
|
)
|
|
1945
302
|
return _response.data
|
|
1946
303
|
|
|
1947
|
-
async def update_embeddings(
|
|
1948
|
-
self,
|
|
1949
|
-
*,
|
|
1950
|
-
tenant_id: str,
|
|
1951
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
1952
|
-
embeddings: typing.Optional[typing.Dict[str, typing.Sequence[float]]] = OMIT,
|
|
1953
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1954
|
-
) -> SingleUploadData:
|
|
1955
|
-
"""
|
|
1956
|
-
Update existing embeddings with new vector representations.
|
|
1957
|
-
|
|
1958
|
-
This endpoint allows you to modify embeddings that are already stored in your knowledge base. Provide updated vector representations for specific chunks of content, identified by their chunk IDs.
|
|
1959
|
-
|
|
1960
|
-
The system will replace the existing embeddings with your new ones, ensuring that similarity searches reflect the most current vector representations. Use this when you need to update embeddings due to model improvements or content changes.
|
|
1961
|
-
|
|
1962
|
-
Parameters
|
|
1963
|
-
----------
|
|
1964
|
-
tenant_id : str
|
|
1965
|
-
Unique identifier for the tenant/organization
|
|
1966
|
-
|
|
1967
|
-
sub_tenant_id : typing.Optional[str]
|
|
1968
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
1969
304
|
|
|
1970
|
-
|
|
1971
|
-
|
|
305
|
+
class AsyncUploadClient:
|
|
306
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
307
|
+
self._raw_client = AsyncRawUploadClient(client_wrapper=client_wrapper)
|
|
1972
308
|
|
|
1973
|
-
|
|
1974
|
-
|
|
309
|
+
@property
|
|
310
|
+
def with_raw_response(self) -> AsyncRawUploadClient:
|
|
311
|
+
"""
|
|
312
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
1975
313
|
|
|
1976
314
|
Returns
|
|
1977
315
|
-------
|
|
1978
|
-
|
|
1979
|
-
Successful Response
|
|
1980
|
-
|
|
1981
|
-
Examples
|
|
1982
|
-
--------
|
|
1983
|
-
import asyncio
|
|
1984
|
-
|
|
1985
|
-
from usecortex-ai import AsyncCortexAI
|
|
1986
|
-
|
|
1987
|
-
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
1988
|
-
async def main() -> None:
|
|
1989
|
-
await client.upload.update_embeddings(tenant_id='tenant_1234', sub_tenant_id='sub_tenant_4567', )
|
|
1990
|
-
asyncio.run(main())
|
|
316
|
+
AsyncRawUploadClient
|
|
1991
317
|
"""
|
|
1992
|
-
|
|
1993
|
-
tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, embeddings=embeddings, request_options=request_options
|
|
1994
|
-
)
|
|
1995
|
-
return _response.data
|
|
318
|
+
return self._raw_client
|
|
1996
319
|
|
|
1997
|
-
async def
|
|
320
|
+
async def upload_document(
|
|
1998
321
|
self,
|
|
1999
322
|
*,
|
|
2000
|
-
|
|
323
|
+
files: typing.List[core.File],
|
|
2001
324
|
tenant_id: str,
|
|
2002
|
-
sub_tenant_id: typing.Optional[str] =
|
|
2003
|
-
|
|
325
|
+
sub_tenant_id: typing.Optional[str] = OMIT,
|
|
326
|
+
upsert: typing.Optional[bool] = OMIT,
|
|
327
|
+
file_metadata: typing.Optional[str] = OMIT,
|
|
2004
328
|
request_options: typing.Optional[RequestOptions] = None,
|
|
2005
|
-
) ->
|
|
329
|
+
) -> SourceUploadResponse:
|
|
2006
330
|
"""
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
The system processes the webpage content asynchronously, cleaning and structuring the information for optimal search and retrieval. Use this when you need to add web content without manual copying and pasting.
|
|
331
|
+
Upload one or more documents for ingestion.
|
|
332
|
+
Supports both single and batch uploads.
|
|
333
|
+
For single file: send one file with the 'files' field.
|
|
334
|
+
For batch: send multiple files with the 'files' field (FastAPI will parse as list).
|
|
2012
335
|
|
|
2013
336
|
Parameters
|
|
2014
337
|
----------
|
|
2015
|
-
|
|
2016
|
-
|
|
338
|
+
files : typing.List[core.File]
|
|
339
|
+
See core.File for more documentation
|
|
2017
340
|
|
|
2018
341
|
tenant_id : str
|
|
2019
342
|
Unique identifier for the tenant/organization
|
|
@@ -2021,15 +344,17 @@ class AsyncUploadClient:
|
|
|
2021
344
|
sub_tenant_id : typing.Optional[str]
|
|
2022
345
|
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
2023
346
|
|
|
2024
|
-
|
|
2025
|
-
|
|
347
|
+
upsert : typing.Optional[bool]
|
|
348
|
+
|
|
349
|
+
file_metadata : typing.Optional[str]
|
|
350
|
+
JSON Array of file metadata objects
|
|
2026
351
|
|
|
2027
352
|
request_options : typing.Optional[RequestOptions]
|
|
2028
353
|
Request-specific configuration.
|
|
2029
354
|
|
|
2030
355
|
Returns
|
|
2031
356
|
-------
|
|
2032
|
-
|
|
357
|
+
SourceUploadResponse
|
|
2033
358
|
Successful Response
|
|
2034
359
|
|
|
2035
360
|
Examples
|
|
@@ -2040,41 +365,36 @@ class AsyncUploadClient:
|
|
|
2040
365
|
|
|
2041
366
|
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
2042
367
|
async def main() -> None:
|
|
2043
|
-
await client.upload.
|
|
368
|
+
await client.upload.upload_document(tenant_id='tenant_id', )
|
|
2044
369
|
asyncio.run(main())
|
|
2045
370
|
"""
|
|
2046
|
-
_response = await self._raw_client.
|
|
2047
|
-
|
|
371
|
+
_response = await self._raw_client.upload_document(
|
|
372
|
+
files=files,
|
|
2048
373
|
tenant_id=tenant_id,
|
|
2049
374
|
sub_tenant_id=sub_tenant_id,
|
|
2050
|
-
|
|
375
|
+
upsert=upsert,
|
|
376
|
+
file_metadata=file_metadata,
|
|
2051
377
|
request_options=request_options,
|
|
2052
378
|
)
|
|
2053
379
|
return _response.data
|
|
2054
380
|
|
|
2055
|
-
async def
|
|
381
|
+
async def upload_app_sources(
|
|
2056
382
|
self,
|
|
2057
383
|
*,
|
|
2058
|
-
|
|
2059
|
-
source_id: str,
|
|
384
|
+
app_sources: BodyUploadAppIngestionUploadAppPostAppSources,
|
|
2060
385
|
tenant_id: str,
|
|
2061
|
-
sub_tenant_id: typing.Optional[str] =
|
|
386
|
+
sub_tenant_id: typing.Optional[str] = OMIT,
|
|
387
|
+
upsert: typing.Optional[bool] = OMIT,
|
|
2062
388
|
request_options: typing.Optional[RequestOptions] = None,
|
|
2063
|
-
) ->
|
|
389
|
+
) -> AppSourcesUploadData:
|
|
2064
390
|
"""
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
This endpoint refreshes the content for an existing web scraping job. Provide the source ID of the webpage content you want to update, and the system will re-scrape the URL to capture any changes.
|
|
2068
|
-
|
|
2069
|
-
The updated content gets processed asynchronously and re-indexed in your knowledge base. Use this to keep web content current when the source pages are frequently updated.
|
|
391
|
+
Upload structured sources generated by first-party or third-party apps.
|
|
392
|
+
Supports both single and batch uploads.
|
|
2070
393
|
|
|
2071
394
|
Parameters
|
|
2072
395
|
----------
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
source_id : str
|
|
2077
|
-
The file ID of the existing web scraping job to update
|
|
396
|
+
app_sources : BodyUploadAppIngestionUploadAppPostAppSources
|
|
397
|
+
Single source object or list of structured source objects containing app-generated data to be indexed
|
|
2078
398
|
|
|
2079
399
|
tenant_id : str
|
|
2080
400
|
Unique identifier for the tenant/organization
|
|
@@ -2082,55 +402,59 @@ class AsyncUploadClient:
|
|
|
2082
402
|
sub_tenant_id : typing.Optional[str]
|
|
2083
403
|
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
2084
404
|
|
|
405
|
+
upsert : typing.Optional[bool]
|
|
406
|
+
If true, update existing sources with the same source_id. Defaults to True.
|
|
407
|
+
|
|
2085
408
|
request_options : typing.Optional[RequestOptions]
|
|
2086
409
|
Request-specific configuration.
|
|
2087
410
|
|
|
2088
411
|
Returns
|
|
2089
412
|
-------
|
|
2090
|
-
|
|
413
|
+
AppSourcesUploadData
|
|
2091
414
|
Successful Response
|
|
2092
415
|
|
|
2093
416
|
Examples
|
|
2094
417
|
--------
|
|
2095
418
|
import asyncio
|
|
2096
419
|
|
|
2097
|
-
from usecortex-ai import AsyncCortexAI
|
|
420
|
+
from usecortex-ai import AsyncCortexAI, SourceModel
|
|
2098
421
|
|
|
2099
422
|
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
2100
423
|
async def main() -> None:
|
|
2101
|
-
await client.upload.
|
|
424
|
+
await client.upload.upload_app_sources(app_sources=SourceModel(id='id', tenant_id='tenant_id', sub_tenant_id='sub_tenant_id', ), tenant_id='tenant_id', )
|
|
2102
425
|
asyncio.run(main())
|
|
2103
426
|
"""
|
|
2104
|
-
_response = await self._raw_client.
|
|
2105
|
-
|
|
2106
|
-
source_id=source_id,
|
|
427
|
+
_response = await self._raw_client.upload_app_sources(
|
|
428
|
+
app_sources=app_sources,
|
|
2107
429
|
tenant_id=tenant_id,
|
|
2108
430
|
sub_tenant_id=sub_tenant_id,
|
|
431
|
+
upsert=upsert,
|
|
2109
432
|
request_options=request_options,
|
|
2110
433
|
)
|
|
2111
434
|
return _response.data
|
|
2112
435
|
|
|
2113
|
-
async def
|
|
436
|
+
async def verify_processing(
|
|
2114
437
|
self,
|
|
2115
438
|
*,
|
|
2116
|
-
|
|
2117
|
-
|
|
439
|
+
file_id: str,
|
|
440
|
+
tenant_id: typing.Optional[str] = None,
|
|
2118
441
|
sub_tenant_id: typing.Optional[str] = None,
|
|
2119
442
|
request_options: typing.Optional[RequestOptions] = None,
|
|
2120
|
-
) ->
|
|
443
|
+
) -> ProcessingStatus:
|
|
2121
444
|
"""
|
|
2122
|
-
|
|
445
|
+
Check the current processing status of your uploaded content.
|
|
2123
446
|
|
|
2124
|
-
This endpoint
|
|
447
|
+
This endpoint allows you to monitor the progress of documents, text, or other content you've uploaded. Simply provide the file ID to see whether processing is complete, still in progress, or if any errors occurred.
|
|
2125
448
|
|
|
2126
|
-
|
|
449
|
+
Use this to determine when your content is ready for search and retrieval, or to troubleshoot any processing issues.
|
|
2127
450
|
|
|
2128
451
|
Parameters
|
|
2129
452
|
----------
|
|
2130
|
-
|
|
2131
|
-
|
|
453
|
+
file_id : str
|
|
454
|
+
The file ID to check processing status for
|
|
2132
455
|
|
|
2133
|
-
|
|
456
|
+
tenant_id : typing.Optional[str]
|
|
457
|
+
Unique identifier for the tenant/organization
|
|
2134
458
|
|
|
2135
459
|
sub_tenant_id : typing.Optional[str]
|
|
2136
460
|
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
@@ -2140,72 +464,92 @@ class AsyncUploadClient:
|
|
|
2140
464
|
|
|
2141
465
|
Returns
|
|
2142
466
|
-------
|
|
2143
|
-
|
|
467
|
+
ProcessingStatus
|
|
2144
468
|
Successful Response
|
|
2145
469
|
|
|
2146
470
|
Examples
|
|
2147
471
|
--------
|
|
2148
472
|
import asyncio
|
|
2149
473
|
|
|
2150
|
-
from usecortex-ai import AsyncCortexAI
|
|
474
|
+
from usecortex-ai import AsyncCortexAI
|
|
2151
475
|
|
|
2152
476
|
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
2153
477
|
async def main() -> None:
|
|
2154
|
-
await client.upload.
|
|
478
|
+
await client.upload.verify_processing(file_id='file_id', )
|
|
2155
479
|
asyncio.run(main())
|
|
2156
480
|
"""
|
|
2157
|
-
_response = await self._raw_client.
|
|
2158
|
-
|
|
481
|
+
_response = await self._raw_client.verify_processing(
|
|
482
|
+
file_id=file_id, tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
2159
483
|
)
|
|
2160
484
|
return _response.data
|
|
2161
485
|
|
|
2162
|
-
async def
|
|
486
|
+
async def add_memory(
|
|
2163
487
|
self,
|
|
2164
488
|
*,
|
|
489
|
+
memories: typing.Sequence[MemoryItem],
|
|
2165
490
|
tenant_id: str,
|
|
2166
|
-
source_ids: typing.Sequence[str],
|
|
2167
491
|
sub_tenant_id: typing.Optional[str] = OMIT,
|
|
492
|
+
upsert: typing.Optional[bool] = OMIT,
|
|
2168
493
|
request_options: typing.Optional[RequestOptions] = None,
|
|
2169
|
-
) ->
|
|
494
|
+
) -> AddMemoryResponse:
|
|
2170
495
|
"""
|
|
2171
|
-
|
|
496
|
+
Add memories for indexing and retrieval.
|
|
497
|
+
|
|
498
|
+
This API provides a unified entry point for ingesting various types of content:
|
|
499
|
+
|
|
500
|
+
**Content Types Supported:**
|
|
501
|
+
- Raw text content (`text` field)
|
|
502
|
+
- Markdown formatted content (`text` + `is_markdown=true`)
|
|
503
|
+
- User/assistant conversation pairs (`user_assistant_pairs` field)
|
|
2172
504
|
|
|
2173
|
-
|
|
505
|
+
**Key Features:**
|
|
506
|
+
- **Inference Mode (`infer=true`)**: When enabled, the system extracts additional
|
|
507
|
+
insights and implicit information from your content. Useful for conversation
|
|
508
|
+
analysis and knowledge extraction.
|
|
509
|
+
- **Direct Mode (`infer=false`)**: Content is chunked and indexed as-is without
|
|
510
|
+
additional processing.
|
|
2174
511
|
|
|
2175
|
-
|
|
512
|
+
Use `/ingestion/verify-processing` endpoint to check the processing status.
|
|
2176
513
|
|
|
2177
514
|
Parameters
|
|
2178
515
|
----------
|
|
516
|
+
memories : typing.Sequence[MemoryItem]
|
|
517
|
+
List of memory items to ingest
|
|
518
|
+
|
|
2179
519
|
tenant_id : str
|
|
2180
520
|
Unique identifier for the tenant/organization
|
|
2181
521
|
|
|
2182
|
-
source_ids : typing.Sequence[str]
|
|
2183
|
-
List of source IDs to delete
|
|
2184
|
-
|
|
2185
522
|
sub_tenant_id : typing.Optional[str]
|
|
2186
523
|
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
2187
524
|
|
|
525
|
+
upsert : typing.Optional[bool]
|
|
526
|
+
If true, update existing sources with the same source_id.
|
|
527
|
+
|
|
2188
528
|
request_options : typing.Optional[RequestOptions]
|
|
2189
529
|
Request-specific configuration.
|
|
2190
530
|
|
|
2191
531
|
Returns
|
|
2192
532
|
-------
|
|
2193
|
-
|
|
533
|
+
AddMemoryResponse
|
|
2194
534
|
Successful Response
|
|
2195
535
|
|
|
2196
536
|
Examples
|
|
2197
537
|
--------
|
|
2198
538
|
import asyncio
|
|
2199
539
|
|
|
2200
|
-
from usecortex-ai import AsyncCortexAI
|
|
540
|
+
from usecortex-ai import AsyncCortexAI, MemoryItem
|
|
2201
541
|
|
|
2202
542
|
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
2203
543
|
async def main() -> None:
|
|
2204
|
-
await client.upload.
|
|
544
|
+
await client.upload.add_memory(memories=[MemoryItem()], tenant_id='tenant_id', )
|
|
2205
545
|
asyncio.run(main())
|
|
2206
546
|
"""
|
|
2207
|
-
_response = await self._raw_client.
|
|
2208
|
-
|
|
547
|
+
_response = await self._raw_client.add_memory(
|
|
548
|
+
memories=memories,
|
|
549
|
+
tenant_id=tenant_id,
|
|
550
|
+
sub_tenant_id=sub_tenant_id,
|
|
551
|
+
upsert=upsert,
|
|
552
|
+
request_options=request_options,
|
|
2209
553
|
)
|
|
2210
554
|
return _response.data
|
|
2211
555
|
|
|
@@ -2213,34 +557,36 @@ class AsyncUploadClient:
|
|
|
2213
557
|
self,
|
|
2214
558
|
*,
|
|
2215
559
|
tenant_id: str,
|
|
2216
|
-
|
|
2217
|
-
sub_tenant_id: typing.Optional[str] =
|
|
560
|
+
memory_id: str,
|
|
561
|
+
sub_tenant_id: typing.Optional[str] = None,
|
|
2218
562
|
request_options: typing.Optional[RequestOptions] = None,
|
|
2219
|
-
) ->
|
|
563
|
+
) -> DeleteUserMemoryResponse:
|
|
2220
564
|
"""
|
|
2221
|
-
|
|
565
|
+
Permanently remove a specific memory from storage.
|
|
2222
566
|
|
|
2223
|
-
|
|
567
|
+
This API allows you to delete a memory by its unique identifier.
|
|
568
|
+
Once deleted, the memory cannot be recovered, so use this operation carefully.
|
|
2224
569
|
|
|
2225
|
-
|
|
570
|
+
The memory will be removed from your tenant's storage and will no longer
|
|
571
|
+
appear in search results or memory listings.
|
|
2226
572
|
|
|
2227
573
|
Parameters
|
|
2228
574
|
----------
|
|
2229
575
|
tenant_id : str
|
|
2230
|
-
|
|
576
|
+
Tenant ID
|
|
2231
577
|
|
|
2232
|
-
|
|
2233
|
-
|
|
578
|
+
memory_id : str
|
|
579
|
+
Unique identifier of the memory to delete
|
|
2234
580
|
|
|
2235
581
|
sub_tenant_id : typing.Optional[str]
|
|
2236
|
-
|
|
582
|
+
Sub-tenant ID
|
|
2237
583
|
|
|
2238
584
|
request_options : typing.Optional[RequestOptions]
|
|
2239
585
|
Request-specific configuration.
|
|
2240
586
|
|
|
2241
587
|
Returns
|
|
2242
588
|
-------
|
|
2243
|
-
|
|
589
|
+
DeleteUserMemoryResponse
|
|
2244
590
|
Successful Response
|
|
2245
591
|
|
|
2246
592
|
Examples
|
|
@@ -2251,60 +597,10 @@ class AsyncUploadClient:
|
|
|
2251
597
|
|
|
2252
598
|
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
2253
599
|
async def main() -> None:
|
|
2254
|
-
await client.upload.delete_memory(tenant_id='
|
|
600
|
+
await client.upload.delete_memory(tenant_id='tenant_id', memory_id='memory_id', )
|
|
2255
601
|
asyncio.run(main())
|
|
2256
602
|
"""
|
|
2257
603
|
_response = await self._raw_client.delete_memory(
|
|
2258
|
-
tenant_id=tenant_id,
|
|
2259
|
-
)
|
|
2260
|
-
return _response.data
|
|
2261
|
-
|
|
2262
|
-
async def verify_processing(
|
|
2263
|
-
self,
|
|
2264
|
-
*,
|
|
2265
|
-
file_id: str,
|
|
2266
|
-
tenant_id: typing.Optional[str] = None,
|
|
2267
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
2268
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
2269
|
-
) -> ProcessingStatus:
|
|
2270
|
-
"""
|
|
2271
|
-
Check the current processing status of your uploaded content.
|
|
2272
|
-
|
|
2273
|
-
This endpoint allows you to monitor the progress of documents, text, or other content you've uploaded. Simply provide the file ID to see whether processing is complete, still in progress, or if any errors occurred.
|
|
2274
|
-
|
|
2275
|
-
Use this to determine when your content is ready for search and retrieval, or to troubleshoot any processing issues.
|
|
2276
|
-
|
|
2277
|
-
Parameters
|
|
2278
|
-
----------
|
|
2279
|
-
file_id : str
|
|
2280
|
-
The file ID to check processing status for
|
|
2281
|
-
|
|
2282
|
-
tenant_id : typing.Optional[str]
|
|
2283
|
-
Unique identifier for the tenant/organization
|
|
2284
|
-
|
|
2285
|
-
sub_tenant_id : typing.Optional[str]
|
|
2286
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
2287
|
-
|
|
2288
|
-
request_options : typing.Optional[RequestOptions]
|
|
2289
|
-
Request-specific configuration.
|
|
2290
|
-
|
|
2291
|
-
Returns
|
|
2292
|
-
-------
|
|
2293
|
-
ProcessingStatus
|
|
2294
|
-
Successful Response
|
|
2295
|
-
|
|
2296
|
-
Examples
|
|
2297
|
-
--------
|
|
2298
|
-
import asyncio
|
|
2299
|
-
|
|
2300
|
-
from usecortex-ai import AsyncCortexAI
|
|
2301
|
-
|
|
2302
|
-
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
2303
|
-
async def main() -> None:
|
|
2304
|
-
await client.upload.verify_processing(file_id='CortexDoc1234', tenant_id='tenant_1234', )
|
|
2305
|
-
asyncio.run(main())
|
|
2306
|
-
"""
|
|
2307
|
-
_response = await self._raw_client.verify_processing(
|
|
2308
|
-
file_id=file_id, tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
604
|
+
tenant_id=tenant_id, memory_id=memory_id, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
2309
605
|
)
|
|
2310
606
|
return _response.data
|