usecortex-ai 0.3.5__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 +84 -66
- 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 +78 -62
- 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/{related_chunk.py → path_triplet.py} +6 -5
- 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 +20 -0
- usecortex_ai/types/retrieval_result.py +26 -0
- usecortex_ai/types/scored_path_response.py +26 -0
- 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/{extended_context.py → tenant_info.py} +13 -4
- usecortex_ai/types/{embeddings_search_data.py → tenant_metadata_schema_info.py} +8 -9
- usecortex_ai/types/{tenant_create_data.py → tenant_stats_response.py} +9 -8
- usecortex_ai/types/{triple_with_evidence.py → triplet_with_evidence.py} +1 -1
- usecortex_ai/types/user_assistant_pair.py +4 -0
- usecortex_ai/types/{search_chunk.py → vector_store_chunk.py} +3 -9
- 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.5.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.5.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/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/markdown_upload_request.py +0 -41
- 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/types/webpage_scrape_request.py +0 -27
- 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.5.dist-info/RECORD +0 -108
- /usecortex_ai/{document → dashboard}/__init__.py +0 -0
- {usecortex_ai-0.3.5.dist-info → usecortex_ai-0.4.0.dist-info}/licenses/LICENSE +0 -0
- {usecortex_ai-0.3.5.dist-info → usecortex_ai-0.4.0.dist-info}/top_level.txt +0 -0
|
@@ -15,9 +15,7 @@ from ..errors.not_found_error import NotFoundError
|
|
|
15
15
|
from ..errors.service_unavailable_error import ServiceUnavailableError
|
|
16
16
|
from ..errors.unauthorized_error import UnauthorizedError
|
|
17
17
|
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
18
|
-
from ..types.
|
|
19
|
-
from ..types.graph_relations_response import GraphRelationsResponse
|
|
20
|
-
from ..types.list_sources_response import ListSourcesResponse
|
|
18
|
+
from ..types.source_delete_response import SourceDeleteResponse
|
|
21
19
|
|
|
22
20
|
# this is used as the default value for optional parameters
|
|
23
21
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -27,178 +25,46 @@ class RawSourcesClient:
|
|
|
27
25
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
28
26
|
self._client_wrapper = client_wrapper
|
|
29
27
|
|
|
30
|
-
def
|
|
31
|
-
self,
|
|
32
|
-
*,
|
|
33
|
-
tenant_id: str,
|
|
34
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
35
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
36
|
-
) -> HttpResponse[ListSourcesResponse]:
|
|
37
|
-
"""
|
|
38
|
-
Retrieve all sources for a specific tenant.
|
|
39
|
-
|
|
40
|
-
Use this endpoint to fetch a complete list of all sources associated with your tenant. This includes documents, files, and other content you've uploaded for processing.
|
|
41
|
-
|
|
42
|
-
You can optionally specify a sub-tenant to narrow down the results to sources within that specific sub-tenant scope.
|
|
43
|
-
|
|
44
|
-
Parameters
|
|
45
|
-
----------
|
|
46
|
-
tenant_id : str
|
|
47
|
-
Unique identifier for the tenant/organization
|
|
48
|
-
|
|
49
|
-
sub_tenant_id : typing.Optional[str]
|
|
50
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
51
|
-
|
|
52
|
-
request_options : typing.Optional[RequestOptions]
|
|
53
|
-
Request-specific configuration.
|
|
54
|
-
|
|
55
|
-
Returns
|
|
56
|
-
-------
|
|
57
|
-
HttpResponse[ListSourcesResponse]
|
|
58
|
-
Successful Response
|
|
59
|
-
"""
|
|
60
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
61
|
-
"list/sources",
|
|
62
|
-
method="GET",
|
|
63
|
-
params={
|
|
64
|
-
"tenant_id": tenant_id,
|
|
65
|
-
"sub_tenant_id": sub_tenant_id,
|
|
66
|
-
},
|
|
67
|
-
request_options=request_options,
|
|
68
|
-
)
|
|
69
|
-
try:
|
|
70
|
-
if 200 <= _response.status_code < 300:
|
|
71
|
-
_data = typing.cast(
|
|
72
|
-
ListSourcesResponse,
|
|
73
|
-
parse_obj_as(
|
|
74
|
-
type_=ListSourcesResponse, # type: ignore
|
|
75
|
-
object_=_response.json(),
|
|
76
|
-
),
|
|
77
|
-
)
|
|
78
|
-
return HttpResponse(response=_response, data=_data)
|
|
79
|
-
if _response.status_code == 400:
|
|
80
|
-
raise BadRequestError(
|
|
81
|
-
headers=dict(_response.headers),
|
|
82
|
-
body=typing.cast(
|
|
83
|
-
ActualErrorResponse,
|
|
84
|
-
parse_obj_as(
|
|
85
|
-
type_=ActualErrorResponse, # type: ignore
|
|
86
|
-
object_=_response.json(),
|
|
87
|
-
),
|
|
88
|
-
),
|
|
89
|
-
)
|
|
90
|
-
if _response.status_code == 401:
|
|
91
|
-
raise UnauthorizedError(
|
|
92
|
-
headers=dict(_response.headers),
|
|
93
|
-
body=typing.cast(
|
|
94
|
-
ActualErrorResponse,
|
|
95
|
-
parse_obj_as(
|
|
96
|
-
type_=ActualErrorResponse, # type: ignore
|
|
97
|
-
object_=_response.json(),
|
|
98
|
-
),
|
|
99
|
-
),
|
|
100
|
-
)
|
|
101
|
-
if _response.status_code == 403:
|
|
102
|
-
raise ForbiddenError(
|
|
103
|
-
headers=dict(_response.headers),
|
|
104
|
-
body=typing.cast(
|
|
105
|
-
ActualErrorResponse,
|
|
106
|
-
parse_obj_as(
|
|
107
|
-
type_=ActualErrorResponse, # type: ignore
|
|
108
|
-
object_=_response.json(),
|
|
109
|
-
),
|
|
110
|
-
),
|
|
111
|
-
)
|
|
112
|
-
if _response.status_code == 404:
|
|
113
|
-
raise NotFoundError(
|
|
114
|
-
headers=dict(_response.headers),
|
|
115
|
-
body=typing.cast(
|
|
116
|
-
ActualErrorResponse,
|
|
117
|
-
parse_obj_as(
|
|
118
|
-
type_=ActualErrorResponse, # type: ignore
|
|
119
|
-
object_=_response.json(),
|
|
120
|
-
),
|
|
121
|
-
),
|
|
122
|
-
)
|
|
123
|
-
if _response.status_code == 422:
|
|
124
|
-
raise UnprocessableEntityError(
|
|
125
|
-
headers=dict(_response.headers),
|
|
126
|
-
body=typing.cast(
|
|
127
|
-
typing.Optional[typing.Any],
|
|
128
|
-
parse_obj_as(
|
|
129
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
130
|
-
object_=_response.json(),
|
|
131
|
-
),
|
|
132
|
-
),
|
|
133
|
-
)
|
|
134
|
-
if _response.status_code == 500:
|
|
135
|
-
raise InternalServerError(
|
|
136
|
-
headers=dict(_response.headers),
|
|
137
|
-
body=typing.cast(
|
|
138
|
-
ActualErrorResponse,
|
|
139
|
-
parse_obj_as(
|
|
140
|
-
type_=ActualErrorResponse, # type: ignore
|
|
141
|
-
object_=_response.json(),
|
|
142
|
-
),
|
|
143
|
-
),
|
|
144
|
-
)
|
|
145
|
-
if _response.status_code == 503:
|
|
146
|
-
raise ServiceUnavailableError(
|
|
147
|
-
headers=dict(_response.headers),
|
|
148
|
-
body=typing.cast(
|
|
149
|
-
ActualErrorResponse,
|
|
150
|
-
parse_obj_as(
|
|
151
|
-
type_=ActualErrorResponse, # type: ignore
|
|
152
|
-
object_=_response.json(),
|
|
153
|
-
),
|
|
154
|
-
),
|
|
155
|
-
)
|
|
156
|
-
_response_json = _response.json()
|
|
157
|
-
except JSONDecodeError:
|
|
158
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
159
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
160
|
-
|
|
161
|
-
def get_by_ids(
|
|
28
|
+
def delete(
|
|
162
29
|
self,
|
|
163
30
|
*,
|
|
164
31
|
tenant_id: str,
|
|
32
|
+
sub_tenant_id: str,
|
|
165
33
|
source_ids: typing.Sequence[str],
|
|
166
|
-
sub_tenant_id: typing.Optional[str] = OMIT,
|
|
167
34
|
request_options: typing.Optional[RequestOptions] = None,
|
|
168
|
-
) -> HttpResponse[
|
|
35
|
+
) -> HttpResponse[SourceDeleteResponse]:
|
|
169
36
|
"""
|
|
170
|
-
|
|
37
|
+
Remove documents and content from your knowledge base.
|
|
171
38
|
|
|
172
|
-
|
|
39
|
+
This endpoint permanently deletes the specified sources from your knowledge base.
|
|
40
|
+
Once deleted, the content will no longer be available for search or retrieval.
|
|
173
41
|
|
|
174
|
-
|
|
42
|
+
Use this carefully as the action cannot be undone. The system will confirm successful deletion of each source ID you specify.
|
|
175
43
|
|
|
176
44
|
Parameters
|
|
177
45
|
----------
|
|
178
46
|
tenant_id : str
|
|
179
|
-
Unique identifier for the tenant/organization
|
|
180
47
|
|
|
181
|
-
|
|
182
|
-
List of source IDs to fetch
|
|
48
|
+
sub_tenant_id : str
|
|
183
49
|
|
|
184
|
-
|
|
185
|
-
|
|
50
|
+
source_ids : typing.Sequence[str]
|
|
51
|
+
List of source IDs to delete.
|
|
186
52
|
|
|
187
53
|
request_options : typing.Optional[RequestOptions]
|
|
188
54
|
Request-specific configuration.
|
|
189
55
|
|
|
190
56
|
Returns
|
|
191
57
|
-------
|
|
192
|
-
HttpResponse[
|
|
58
|
+
HttpResponse[SourceDeleteResponse]
|
|
193
59
|
Successful Response
|
|
194
60
|
"""
|
|
195
61
|
_response = self._client_wrapper.httpx_client.request(
|
|
196
|
-
"
|
|
62
|
+
"delete/delete-sources",
|
|
197
63
|
method="POST",
|
|
198
64
|
json={
|
|
199
65
|
"tenant_id": tenant_id,
|
|
200
|
-
"source_ids": source_ids,
|
|
201
66
|
"sub_tenant_id": sub_tenant_id,
|
|
67
|
+
"source_ids": source_ids,
|
|
202
68
|
},
|
|
203
69
|
headers={
|
|
204
70
|
"content-type": "application/json",
|
|
@@ -209,59 +75,15 @@ class RawSourcesClient:
|
|
|
209
75
|
try:
|
|
210
76
|
if 200 <= _response.status_code < 300:
|
|
211
77
|
_data = typing.cast(
|
|
212
|
-
|
|
78
|
+
SourceDeleteResponse,
|
|
213
79
|
parse_obj_as(
|
|
214
|
-
type_=
|
|
80
|
+
type_=SourceDeleteResponse, # type: ignore
|
|
215
81
|
object_=_response.json(),
|
|
216
82
|
),
|
|
217
83
|
)
|
|
218
84
|
return HttpResponse(response=_response, data=_data)
|
|
219
85
|
if _response.status_code == 400:
|
|
220
86
|
raise BadRequestError(
|
|
221
|
-
headers=dict(_response.headers),
|
|
222
|
-
body=typing.cast(
|
|
223
|
-
ActualErrorResponse,
|
|
224
|
-
parse_obj_as(
|
|
225
|
-
type_=ActualErrorResponse, # type: ignore
|
|
226
|
-
object_=_response.json(),
|
|
227
|
-
),
|
|
228
|
-
),
|
|
229
|
-
)
|
|
230
|
-
if _response.status_code == 401:
|
|
231
|
-
raise UnauthorizedError(
|
|
232
|
-
headers=dict(_response.headers),
|
|
233
|
-
body=typing.cast(
|
|
234
|
-
ActualErrorResponse,
|
|
235
|
-
parse_obj_as(
|
|
236
|
-
type_=ActualErrorResponse, # type: ignore
|
|
237
|
-
object_=_response.json(),
|
|
238
|
-
),
|
|
239
|
-
),
|
|
240
|
-
)
|
|
241
|
-
if _response.status_code == 403:
|
|
242
|
-
raise ForbiddenError(
|
|
243
|
-
headers=dict(_response.headers),
|
|
244
|
-
body=typing.cast(
|
|
245
|
-
ActualErrorResponse,
|
|
246
|
-
parse_obj_as(
|
|
247
|
-
type_=ActualErrorResponse, # type: ignore
|
|
248
|
-
object_=_response.json(),
|
|
249
|
-
),
|
|
250
|
-
),
|
|
251
|
-
)
|
|
252
|
-
if _response.status_code == 404:
|
|
253
|
-
raise NotFoundError(
|
|
254
|
-
headers=dict(_response.headers),
|
|
255
|
-
body=typing.cast(
|
|
256
|
-
ActualErrorResponse,
|
|
257
|
-
parse_obj_as(
|
|
258
|
-
type_=ActualErrorResponse, # type: ignore
|
|
259
|
-
object_=_response.json(),
|
|
260
|
-
),
|
|
261
|
-
),
|
|
262
|
-
)
|
|
263
|
-
if _response.status_code == 422:
|
|
264
|
-
raise UnprocessableEntityError(
|
|
265
87
|
headers=dict(_response.headers),
|
|
266
88
|
body=typing.cast(
|
|
267
89
|
typing.Optional[typing.Any],
|
|
@@ -271,105 +93,13 @@ class RawSourcesClient:
|
|
|
271
93
|
),
|
|
272
94
|
),
|
|
273
95
|
)
|
|
274
|
-
if _response.status_code == 500:
|
|
275
|
-
raise InternalServerError(
|
|
276
|
-
headers=dict(_response.headers),
|
|
277
|
-
body=typing.cast(
|
|
278
|
-
ActualErrorResponse,
|
|
279
|
-
parse_obj_as(
|
|
280
|
-
type_=ActualErrorResponse, # type: ignore
|
|
281
|
-
object_=_response.json(),
|
|
282
|
-
),
|
|
283
|
-
),
|
|
284
|
-
)
|
|
285
|
-
if _response.status_code == 503:
|
|
286
|
-
raise ServiceUnavailableError(
|
|
287
|
-
headers=dict(_response.headers),
|
|
288
|
-
body=typing.cast(
|
|
289
|
-
ActualErrorResponse,
|
|
290
|
-
parse_obj_as(
|
|
291
|
-
type_=ActualErrorResponse, # type: ignore
|
|
292
|
-
object_=_response.json(),
|
|
293
|
-
),
|
|
294
|
-
),
|
|
295
|
-
)
|
|
296
|
-
_response_json = _response.json()
|
|
297
|
-
except JSONDecodeError:
|
|
298
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
299
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
300
|
-
|
|
301
|
-
def get_graph_relations_by_id(
|
|
302
|
-
self,
|
|
303
|
-
*,
|
|
304
|
-
source_id: str,
|
|
305
|
-
tenant_id: typing.Optional[str] = None,
|
|
306
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
307
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
308
|
-
) -> HttpResponse[GraphRelationsResponse]:
|
|
309
|
-
"""
|
|
310
|
-
Retrieve relations for a specific source.
|
|
311
|
-
|
|
312
|
-
Use this endpoint to fetch all relations associated with a specific source. This is useful when you need to understand the relationships between entities within a source.
|
|
313
|
-
|
|
314
|
-
Provide the source ID in the request body along with your tenant information to get the relations for that source.
|
|
315
|
-
|
|
316
|
-
Parameters
|
|
317
|
-
----------
|
|
318
|
-
source_id : str
|
|
319
|
-
The source ID to fetch relations for
|
|
320
|
-
|
|
321
|
-
tenant_id : typing.Optional[str]
|
|
322
|
-
Unique identifier for the tenant/organization
|
|
323
|
-
|
|
324
|
-
sub_tenant_id : typing.Optional[str]
|
|
325
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
326
|
-
|
|
327
|
-
request_options : typing.Optional[RequestOptions]
|
|
328
|
-
Request-specific configuration.
|
|
329
|
-
|
|
330
|
-
Returns
|
|
331
|
-
-------
|
|
332
|
-
HttpResponse[GraphRelationsResponse]
|
|
333
|
-
Successful Response
|
|
334
|
-
"""
|
|
335
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
336
|
-
"list/graph_relations_by_id",
|
|
337
|
-
method="GET",
|
|
338
|
-
params={
|
|
339
|
-
"source_id": source_id,
|
|
340
|
-
"tenant_id": tenant_id,
|
|
341
|
-
"sub_tenant_id": sub_tenant_id,
|
|
342
|
-
},
|
|
343
|
-
request_options=request_options,
|
|
344
|
-
)
|
|
345
|
-
try:
|
|
346
|
-
if 200 <= _response.status_code < 300:
|
|
347
|
-
_data = typing.cast(
|
|
348
|
-
GraphRelationsResponse,
|
|
349
|
-
parse_obj_as(
|
|
350
|
-
type_=GraphRelationsResponse, # type: ignore
|
|
351
|
-
object_=_response.json(),
|
|
352
|
-
),
|
|
353
|
-
)
|
|
354
|
-
return HttpResponse(response=_response, data=_data)
|
|
355
|
-
if _response.status_code == 400:
|
|
356
|
-
raise BadRequestError(
|
|
357
|
-
headers=dict(_response.headers),
|
|
358
|
-
body=typing.cast(
|
|
359
|
-
ActualErrorResponse,
|
|
360
|
-
parse_obj_as(
|
|
361
|
-
type_=ActualErrorResponse, # type: ignore
|
|
362
|
-
object_=_response.json(),
|
|
363
|
-
),
|
|
364
|
-
),
|
|
365
|
-
)
|
|
366
96
|
if _response.status_code == 401:
|
|
367
97
|
raise UnauthorizedError(
|
|
368
98
|
headers=dict(_response.headers),
|
|
369
99
|
body=typing.cast(
|
|
370
|
-
|
|
100
|
+
typing.Optional[typing.Any],
|
|
371
101
|
parse_obj_as(
|
|
372
|
-
type_=
|
|
102
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
373
103
|
object_=_response.json(),
|
|
374
104
|
),
|
|
375
105
|
),
|
|
@@ -378,9 +108,9 @@ class RawSourcesClient:
|
|
|
378
108
|
raise ForbiddenError(
|
|
379
109
|
headers=dict(_response.headers),
|
|
380
110
|
body=typing.cast(
|
|
381
|
-
|
|
111
|
+
typing.Optional[typing.Any],
|
|
382
112
|
parse_obj_as(
|
|
383
|
-
type_=
|
|
113
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
384
114
|
object_=_response.json(),
|
|
385
115
|
),
|
|
386
116
|
),
|
|
@@ -389,9 +119,9 @@ class RawSourcesClient:
|
|
|
389
119
|
raise NotFoundError(
|
|
390
120
|
headers=dict(_response.headers),
|
|
391
121
|
body=typing.cast(
|
|
392
|
-
|
|
122
|
+
typing.Optional[typing.Any],
|
|
393
123
|
parse_obj_as(
|
|
394
|
-
type_=
|
|
124
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
395
125
|
object_=_response.json(),
|
|
396
126
|
),
|
|
397
127
|
),
|
|
@@ -411,9 +141,9 @@ class RawSourcesClient:
|
|
|
411
141
|
raise InternalServerError(
|
|
412
142
|
headers=dict(_response.headers),
|
|
413
143
|
body=typing.cast(
|
|
414
|
-
|
|
144
|
+
typing.Optional[typing.Any],
|
|
415
145
|
parse_obj_as(
|
|
416
|
-
type_=
|
|
146
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
417
147
|
object_=_response.json(),
|
|
418
148
|
),
|
|
419
149
|
),
|
|
@@ -422,9 +152,9 @@ class RawSourcesClient:
|
|
|
422
152
|
raise ServiceUnavailableError(
|
|
423
153
|
headers=dict(_response.headers),
|
|
424
154
|
body=typing.cast(
|
|
425
|
-
|
|
155
|
+
typing.Optional[typing.Any],
|
|
426
156
|
parse_obj_as(
|
|
427
|
-
type_=
|
|
157
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
428
158
|
object_=_response.json(),
|
|
429
159
|
),
|
|
430
160
|
),
|
|
@@ -439,178 +169,46 @@ class AsyncRawSourcesClient:
|
|
|
439
169
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
440
170
|
self._client_wrapper = client_wrapper
|
|
441
171
|
|
|
442
|
-
async def
|
|
443
|
-
self,
|
|
444
|
-
*,
|
|
445
|
-
tenant_id: str,
|
|
446
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
447
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
448
|
-
) -> AsyncHttpResponse[ListSourcesResponse]:
|
|
449
|
-
"""
|
|
450
|
-
Retrieve all sources for a specific tenant.
|
|
451
|
-
|
|
452
|
-
Use this endpoint to fetch a complete list of all sources associated with your tenant. This includes documents, files, and other content you've uploaded for processing.
|
|
453
|
-
|
|
454
|
-
You can optionally specify a sub-tenant to narrow down the results to sources within that specific sub-tenant scope.
|
|
455
|
-
|
|
456
|
-
Parameters
|
|
457
|
-
----------
|
|
458
|
-
tenant_id : str
|
|
459
|
-
Unique identifier for the tenant/organization
|
|
460
|
-
|
|
461
|
-
sub_tenant_id : typing.Optional[str]
|
|
462
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
463
|
-
|
|
464
|
-
request_options : typing.Optional[RequestOptions]
|
|
465
|
-
Request-specific configuration.
|
|
466
|
-
|
|
467
|
-
Returns
|
|
468
|
-
-------
|
|
469
|
-
AsyncHttpResponse[ListSourcesResponse]
|
|
470
|
-
Successful Response
|
|
471
|
-
"""
|
|
472
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
473
|
-
"list/sources",
|
|
474
|
-
method="GET",
|
|
475
|
-
params={
|
|
476
|
-
"tenant_id": tenant_id,
|
|
477
|
-
"sub_tenant_id": sub_tenant_id,
|
|
478
|
-
},
|
|
479
|
-
request_options=request_options,
|
|
480
|
-
)
|
|
481
|
-
try:
|
|
482
|
-
if 200 <= _response.status_code < 300:
|
|
483
|
-
_data = typing.cast(
|
|
484
|
-
ListSourcesResponse,
|
|
485
|
-
parse_obj_as(
|
|
486
|
-
type_=ListSourcesResponse, # type: ignore
|
|
487
|
-
object_=_response.json(),
|
|
488
|
-
),
|
|
489
|
-
)
|
|
490
|
-
return AsyncHttpResponse(response=_response, data=_data)
|
|
491
|
-
if _response.status_code == 400:
|
|
492
|
-
raise BadRequestError(
|
|
493
|
-
headers=dict(_response.headers),
|
|
494
|
-
body=typing.cast(
|
|
495
|
-
ActualErrorResponse,
|
|
496
|
-
parse_obj_as(
|
|
497
|
-
type_=ActualErrorResponse, # type: ignore
|
|
498
|
-
object_=_response.json(),
|
|
499
|
-
),
|
|
500
|
-
),
|
|
501
|
-
)
|
|
502
|
-
if _response.status_code == 401:
|
|
503
|
-
raise UnauthorizedError(
|
|
504
|
-
headers=dict(_response.headers),
|
|
505
|
-
body=typing.cast(
|
|
506
|
-
ActualErrorResponse,
|
|
507
|
-
parse_obj_as(
|
|
508
|
-
type_=ActualErrorResponse, # type: ignore
|
|
509
|
-
object_=_response.json(),
|
|
510
|
-
),
|
|
511
|
-
),
|
|
512
|
-
)
|
|
513
|
-
if _response.status_code == 403:
|
|
514
|
-
raise ForbiddenError(
|
|
515
|
-
headers=dict(_response.headers),
|
|
516
|
-
body=typing.cast(
|
|
517
|
-
ActualErrorResponse,
|
|
518
|
-
parse_obj_as(
|
|
519
|
-
type_=ActualErrorResponse, # type: ignore
|
|
520
|
-
object_=_response.json(),
|
|
521
|
-
),
|
|
522
|
-
),
|
|
523
|
-
)
|
|
524
|
-
if _response.status_code == 404:
|
|
525
|
-
raise NotFoundError(
|
|
526
|
-
headers=dict(_response.headers),
|
|
527
|
-
body=typing.cast(
|
|
528
|
-
ActualErrorResponse,
|
|
529
|
-
parse_obj_as(
|
|
530
|
-
type_=ActualErrorResponse, # type: ignore
|
|
531
|
-
object_=_response.json(),
|
|
532
|
-
),
|
|
533
|
-
),
|
|
534
|
-
)
|
|
535
|
-
if _response.status_code == 422:
|
|
536
|
-
raise UnprocessableEntityError(
|
|
537
|
-
headers=dict(_response.headers),
|
|
538
|
-
body=typing.cast(
|
|
539
|
-
typing.Optional[typing.Any],
|
|
540
|
-
parse_obj_as(
|
|
541
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
542
|
-
object_=_response.json(),
|
|
543
|
-
),
|
|
544
|
-
),
|
|
545
|
-
)
|
|
546
|
-
if _response.status_code == 500:
|
|
547
|
-
raise InternalServerError(
|
|
548
|
-
headers=dict(_response.headers),
|
|
549
|
-
body=typing.cast(
|
|
550
|
-
ActualErrorResponse,
|
|
551
|
-
parse_obj_as(
|
|
552
|
-
type_=ActualErrorResponse, # type: ignore
|
|
553
|
-
object_=_response.json(),
|
|
554
|
-
),
|
|
555
|
-
),
|
|
556
|
-
)
|
|
557
|
-
if _response.status_code == 503:
|
|
558
|
-
raise ServiceUnavailableError(
|
|
559
|
-
headers=dict(_response.headers),
|
|
560
|
-
body=typing.cast(
|
|
561
|
-
ActualErrorResponse,
|
|
562
|
-
parse_obj_as(
|
|
563
|
-
type_=ActualErrorResponse, # type: ignore
|
|
564
|
-
object_=_response.json(),
|
|
565
|
-
),
|
|
566
|
-
),
|
|
567
|
-
)
|
|
568
|
-
_response_json = _response.json()
|
|
569
|
-
except JSONDecodeError:
|
|
570
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
571
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
572
|
-
|
|
573
|
-
async def get_by_ids(
|
|
172
|
+
async def delete(
|
|
574
173
|
self,
|
|
575
174
|
*,
|
|
576
175
|
tenant_id: str,
|
|
176
|
+
sub_tenant_id: str,
|
|
577
177
|
source_ids: typing.Sequence[str],
|
|
578
|
-
sub_tenant_id: typing.Optional[str] = OMIT,
|
|
579
178
|
request_options: typing.Optional[RequestOptions] = None,
|
|
580
|
-
) -> AsyncHttpResponse[
|
|
179
|
+
) -> AsyncHttpResponse[SourceDeleteResponse]:
|
|
581
180
|
"""
|
|
582
|
-
|
|
181
|
+
Remove documents and content from your knowledge base.
|
|
583
182
|
|
|
584
|
-
|
|
183
|
+
This endpoint permanently deletes the specified sources from your knowledge base.
|
|
184
|
+
Once deleted, the content will no longer be available for search or retrieval.
|
|
585
185
|
|
|
586
|
-
|
|
186
|
+
Use this carefully as the action cannot be undone. The system will confirm successful deletion of each source ID you specify.
|
|
587
187
|
|
|
588
188
|
Parameters
|
|
589
189
|
----------
|
|
590
190
|
tenant_id : str
|
|
591
|
-
Unique identifier for the tenant/organization
|
|
592
191
|
|
|
593
|
-
|
|
594
|
-
List of source IDs to fetch
|
|
192
|
+
sub_tenant_id : str
|
|
595
193
|
|
|
596
|
-
|
|
597
|
-
|
|
194
|
+
source_ids : typing.Sequence[str]
|
|
195
|
+
List of source IDs to delete.
|
|
598
196
|
|
|
599
197
|
request_options : typing.Optional[RequestOptions]
|
|
600
198
|
Request-specific configuration.
|
|
601
199
|
|
|
602
200
|
Returns
|
|
603
201
|
-------
|
|
604
|
-
AsyncHttpResponse[
|
|
202
|
+
AsyncHttpResponse[SourceDeleteResponse]
|
|
605
203
|
Successful Response
|
|
606
204
|
"""
|
|
607
205
|
_response = await self._client_wrapper.httpx_client.request(
|
|
608
|
-
"
|
|
206
|
+
"delete/delete-sources",
|
|
609
207
|
method="POST",
|
|
610
208
|
json={
|
|
611
209
|
"tenant_id": tenant_id,
|
|
612
|
-
"source_ids": source_ids,
|
|
613
210
|
"sub_tenant_id": sub_tenant_id,
|
|
211
|
+
"source_ids": source_ids,
|
|
614
212
|
},
|
|
615
213
|
headers={
|
|
616
214
|
"content-type": "application/json",
|
|
@@ -621,59 +219,15 @@ class AsyncRawSourcesClient:
|
|
|
621
219
|
try:
|
|
622
220
|
if 200 <= _response.status_code < 300:
|
|
623
221
|
_data = typing.cast(
|
|
624
|
-
|
|
222
|
+
SourceDeleteResponse,
|
|
625
223
|
parse_obj_as(
|
|
626
|
-
type_=
|
|
224
|
+
type_=SourceDeleteResponse, # type: ignore
|
|
627
225
|
object_=_response.json(),
|
|
628
226
|
),
|
|
629
227
|
)
|
|
630
228
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
631
229
|
if _response.status_code == 400:
|
|
632
230
|
raise BadRequestError(
|
|
633
|
-
headers=dict(_response.headers),
|
|
634
|
-
body=typing.cast(
|
|
635
|
-
ActualErrorResponse,
|
|
636
|
-
parse_obj_as(
|
|
637
|
-
type_=ActualErrorResponse, # type: ignore
|
|
638
|
-
object_=_response.json(),
|
|
639
|
-
),
|
|
640
|
-
),
|
|
641
|
-
)
|
|
642
|
-
if _response.status_code == 401:
|
|
643
|
-
raise UnauthorizedError(
|
|
644
|
-
headers=dict(_response.headers),
|
|
645
|
-
body=typing.cast(
|
|
646
|
-
ActualErrorResponse,
|
|
647
|
-
parse_obj_as(
|
|
648
|
-
type_=ActualErrorResponse, # type: ignore
|
|
649
|
-
object_=_response.json(),
|
|
650
|
-
),
|
|
651
|
-
),
|
|
652
|
-
)
|
|
653
|
-
if _response.status_code == 403:
|
|
654
|
-
raise ForbiddenError(
|
|
655
|
-
headers=dict(_response.headers),
|
|
656
|
-
body=typing.cast(
|
|
657
|
-
ActualErrorResponse,
|
|
658
|
-
parse_obj_as(
|
|
659
|
-
type_=ActualErrorResponse, # type: ignore
|
|
660
|
-
object_=_response.json(),
|
|
661
|
-
),
|
|
662
|
-
),
|
|
663
|
-
)
|
|
664
|
-
if _response.status_code == 404:
|
|
665
|
-
raise NotFoundError(
|
|
666
|
-
headers=dict(_response.headers),
|
|
667
|
-
body=typing.cast(
|
|
668
|
-
ActualErrorResponse,
|
|
669
|
-
parse_obj_as(
|
|
670
|
-
type_=ActualErrorResponse, # type: ignore
|
|
671
|
-
object_=_response.json(),
|
|
672
|
-
),
|
|
673
|
-
),
|
|
674
|
-
)
|
|
675
|
-
if _response.status_code == 422:
|
|
676
|
-
raise UnprocessableEntityError(
|
|
677
231
|
headers=dict(_response.headers),
|
|
678
232
|
body=typing.cast(
|
|
679
233
|
typing.Optional[typing.Any],
|
|
@@ -683,105 +237,13 @@ class AsyncRawSourcesClient:
|
|
|
683
237
|
),
|
|
684
238
|
),
|
|
685
239
|
)
|
|
686
|
-
if _response.status_code == 500:
|
|
687
|
-
raise InternalServerError(
|
|
688
|
-
headers=dict(_response.headers),
|
|
689
|
-
body=typing.cast(
|
|
690
|
-
ActualErrorResponse,
|
|
691
|
-
parse_obj_as(
|
|
692
|
-
type_=ActualErrorResponse, # type: ignore
|
|
693
|
-
object_=_response.json(),
|
|
694
|
-
),
|
|
695
|
-
),
|
|
696
|
-
)
|
|
697
|
-
if _response.status_code == 503:
|
|
698
|
-
raise ServiceUnavailableError(
|
|
699
|
-
headers=dict(_response.headers),
|
|
700
|
-
body=typing.cast(
|
|
701
|
-
ActualErrorResponse,
|
|
702
|
-
parse_obj_as(
|
|
703
|
-
type_=ActualErrorResponse, # type: ignore
|
|
704
|
-
object_=_response.json(),
|
|
705
|
-
),
|
|
706
|
-
),
|
|
707
|
-
)
|
|
708
|
-
_response_json = _response.json()
|
|
709
|
-
except JSONDecodeError:
|
|
710
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
711
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
712
|
-
|
|
713
|
-
async def get_graph_relations_by_id(
|
|
714
|
-
self,
|
|
715
|
-
*,
|
|
716
|
-
source_id: str,
|
|
717
|
-
tenant_id: typing.Optional[str] = None,
|
|
718
|
-
sub_tenant_id: typing.Optional[str] = None,
|
|
719
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
720
|
-
) -> AsyncHttpResponse[GraphRelationsResponse]:
|
|
721
|
-
"""
|
|
722
|
-
Retrieve relations for a specific source.
|
|
723
|
-
|
|
724
|
-
Use this endpoint to fetch all relations associated with a specific source. This is useful when you need to understand the relationships between entities within a source.
|
|
725
|
-
|
|
726
|
-
Provide the source ID in the request body along with your tenant information to get the relations for that source.
|
|
727
|
-
|
|
728
|
-
Parameters
|
|
729
|
-
----------
|
|
730
|
-
source_id : str
|
|
731
|
-
The source ID to fetch relations for
|
|
732
|
-
|
|
733
|
-
tenant_id : typing.Optional[str]
|
|
734
|
-
Unique identifier for the tenant/organization
|
|
735
|
-
|
|
736
|
-
sub_tenant_id : typing.Optional[str]
|
|
737
|
-
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
738
|
-
|
|
739
|
-
request_options : typing.Optional[RequestOptions]
|
|
740
|
-
Request-specific configuration.
|
|
741
|
-
|
|
742
|
-
Returns
|
|
743
|
-
-------
|
|
744
|
-
AsyncHttpResponse[GraphRelationsResponse]
|
|
745
|
-
Successful Response
|
|
746
|
-
"""
|
|
747
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
748
|
-
"list/graph_relations_by_id",
|
|
749
|
-
method="GET",
|
|
750
|
-
params={
|
|
751
|
-
"source_id": source_id,
|
|
752
|
-
"tenant_id": tenant_id,
|
|
753
|
-
"sub_tenant_id": sub_tenant_id,
|
|
754
|
-
},
|
|
755
|
-
request_options=request_options,
|
|
756
|
-
)
|
|
757
|
-
try:
|
|
758
|
-
if 200 <= _response.status_code < 300:
|
|
759
|
-
_data = typing.cast(
|
|
760
|
-
GraphRelationsResponse,
|
|
761
|
-
parse_obj_as(
|
|
762
|
-
type_=GraphRelationsResponse, # type: ignore
|
|
763
|
-
object_=_response.json(),
|
|
764
|
-
),
|
|
765
|
-
)
|
|
766
|
-
return AsyncHttpResponse(response=_response, data=_data)
|
|
767
|
-
if _response.status_code == 400:
|
|
768
|
-
raise BadRequestError(
|
|
769
|
-
headers=dict(_response.headers),
|
|
770
|
-
body=typing.cast(
|
|
771
|
-
ActualErrorResponse,
|
|
772
|
-
parse_obj_as(
|
|
773
|
-
type_=ActualErrorResponse, # type: ignore
|
|
774
|
-
object_=_response.json(),
|
|
775
|
-
),
|
|
776
|
-
),
|
|
777
|
-
)
|
|
778
240
|
if _response.status_code == 401:
|
|
779
241
|
raise UnauthorizedError(
|
|
780
242
|
headers=dict(_response.headers),
|
|
781
243
|
body=typing.cast(
|
|
782
|
-
|
|
244
|
+
typing.Optional[typing.Any],
|
|
783
245
|
parse_obj_as(
|
|
784
|
-
type_=
|
|
246
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
785
247
|
object_=_response.json(),
|
|
786
248
|
),
|
|
787
249
|
),
|
|
@@ -790,9 +252,9 @@ class AsyncRawSourcesClient:
|
|
|
790
252
|
raise ForbiddenError(
|
|
791
253
|
headers=dict(_response.headers),
|
|
792
254
|
body=typing.cast(
|
|
793
|
-
|
|
255
|
+
typing.Optional[typing.Any],
|
|
794
256
|
parse_obj_as(
|
|
795
|
-
type_=
|
|
257
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
796
258
|
object_=_response.json(),
|
|
797
259
|
),
|
|
798
260
|
),
|
|
@@ -801,9 +263,9 @@ class AsyncRawSourcesClient:
|
|
|
801
263
|
raise NotFoundError(
|
|
802
264
|
headers=dict(_response.headers),
|
|
803
265
|
body=typing.cast(
|
|
804
|
-
|
|
266
|
+
typing.Optional[typing.Any],
|
|
805
267
|
parse_obj_as(
|
|
806
|
-
type_=
|
|
268
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
807
269
|
object_=_response.json(),
|
|
808
270
|
),
|
|
809
271
|
),
|
|
@@ -823,9 +285,9 @@ class AsyncRawSourcesClient:
|
|
|
823
285
|
raise InternalServerError(
|
|
824
286
|
headers=dict(_response.headers),
|
|
825
287
|
body=typing.cast(
|
|
826
|
-
|
|
288
|
+
typing.Optional[typing.Any],
|
|
827
289
|
parse_obj_as(
|
|
828
|
-
type_=
|
|
290
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
829
291
|
object_=_response.json(),
|
|
830
292
|
),
|
|
831
293
|
),
|
|
@@ -834,9 +296,9 @@ class AsyncRawSourcesClient:
|
|
|
834
296
|
raise ServiceUnavailableError(
|
|
835
297
|
headers=dict(_response.headers),
|
|
836
298
|
body=typing.cast(
|
|
837
|
-
|
|
299
|
+
typing.Optional[typing.Any],
|
|
838
300
|
parse_obj_as(
|
|
839
|
-
type_=
|
|
301
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
840
302
|
object_=_response.json(),
|
|
841
303
|
),
|
|
842
304
|
),
|