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
usecortex_ai/user/raw_client.py
DELETED
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
3
|
-
import typing
|
|
4
|
-
from json.decoder import JSONDecodeError
|
|
5
|
-
|
|
6
|
-
from ..core.api_error import ApiError
|
|
7
|
-
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
-
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
9
|
-
from ..core.pydantic_utilities import parse_obj_as
|
|
10
|
-
from ..core.request_options import RequestOptions
|
|
11
|
-
from ..errors.bad_request_error import BadRequestError
|
|
12
|
-
from ..errors.forbidden_error import ForbiddenError
|
|
13
|
-
from ..errors.internal_server_error import InternalServerError
|
|
14
|
-
from ..errors.not_found_error import NotFoundError
|
|
15
|
-
from ..errors.service_unavailable_error import ServiceUnavailableError
|
|
16
|
-
from ..errors.unauthorized_error import UnauthorizedError
|
|
17
|
-
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
18
|
-
from ..types.actual_error_response import ActualErrorResponse
|
|
19
|
-
from ..types.tenant_create_data import TenantCreateData
|
|
20
|
-
|
|
21
|
-
# this is used as the default value for optional parameters
|
|
22
|
-
OMIT = typing.cast(typing.Any, ...)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class RawUserClient:
|
|
26
|
-
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
27
|
-
self._client_wrapper = client_wrapper
|
|
28
|
-
|
|
29
|
-
def create_tenant(
|
|
30
|
-
self,
|
|
31
|
-
*,
|
|
32
|
-
tenant_id: typing.Optional[str] = None,
|
|
33
|
-
note: typing.Optional[str] = None,
|
|
34
|
-
tenant_metadata_schema: typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]] = OMIT,
|
|
35
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
36
|
-
) -> HttpResponse[TenantCreateData]:
|
|
37
|
-
"""
|
|
38
|
-
Create a tenant for your account.
|
|
39
|
-
|
|
40
|
-
Use this endpoint to initialize a tenant space you can use for ingestion, embeddings, and search. Optionally include a metadata schema to enforce consistent attributes across documents.
|
|
41
|
-
|
|
42
|
-
Expected outcome
|
|
43
|
-
- A tenant is created and returned with its identifier.
|
|
44
|
-
- If the tenant already exists, you receive a success message with the existing identifier.
|
|
45
|
-
|
|
46
|
-
Parameters
|
|
47
|
-
----------
|
|
48
|
-
tenant_id : typing.Optional[str]
|
|
49
|
-
Unique identifier for the tenant/organization
|
|
50
|
-
|
|
51
|
-
note : typing.Optional[str]
|
|
52
|
-
|
|
53
|
-
tenant_metadata_schema : typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]]
|
|
54
|
-
|
|
55
|
-
request_options : typing.Optional[RequestOptions]
|
|
56
|
-
Request-specific configuration.
|
|
57
|
-
|
|
58
|
-
Returns
|
|
59
|
-
-------
|
|
60
|
-
HttpResponse[TenantCreateData]
|
|
61
|
-
Successful Response
|
|
62
|
-
"""
|
|
63
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
64
|
-
"user/create_tenant",
|
|
65
|
-
method="POST",
|
|
66
|
-
params={
|
|
67
|
-
"tenant_id": tenant_id,
|
|
68
|
-
"note": note,
|
|
69
|
-
},
|
|
70
|
-
json={
|
|
71
|
-
"tenant_metadata_schema": tenant_metadata_schema,
|
|
72
|
-
},
|
|
73
|
-
headers={
|
|
74
|
-
"content-type": "application/json",
|
|
75
|
-
},
|
|
76
|
-
request_options=request_options,
|
|
77
|
-
omit=OMIT,
|
|
78
|
-
)
|
|
79
|
-
try:
|
|
80
|
-
if 200 <= _response.status_code < 300:
|
|
81
|
-
_data = typing.cast(
|
|
82
|
-
TenantCreateData,
|
|
83
|
-
parse_obj_as(
|
|
84
|
-
type_=TenantCreateData, # type: ignore
|
|
85
|
-
object_=_response.json(),
|
|
86
|
-
),
|
|
87
|
-
)
|
|
88
|
-
return HttpResponse(response=_response, data=_data)
|
|
89
|
-
if _response.status_code == 400:
|
|
90
|
-
raise BadRequestError(
|
|
91
|
-
headers=dict(_response.headers),
|
|
92
|
-
body=typing.cast(
|
|
93
|
-
ActualErrorResponse,
|
|
94
|
-
parse_obj_as(
|
|
95
|
-
type_=ActualErrorResponse, # type: ignore
|
|
96
|
-
object_=_response.json(),
|
|
97
|
-
),
|
|
98
|
-
),
|
|
99
|
-
)
|
|
100
|
-
if _response.status_code == 401:
|
|
101
|
-
raise UnauthorizedError(
|
|
102
|
-
headers=dict(_response.headers),
|
|
103
|
-
body=typing.cast(
|
|
104
|
-
ActualErrorResponse,
|
|
105
|
-
parse_obj_as(
|
|
106
|
-
type_=ActualErrorResponse, # type: ignore
|
|
107
|
-
object_=_response.json(),
|
|
108
|
-
),
|
|
109
|
-
),
|
|
110
|
-
)
|
|
111
|
-
if _response.status_code == 403:
|
|
112
|
-
raise ForbiddenError(
|
|
113
|
-
headers=dict(_response.headers),
|
|
114
|
-
body=typing.cast(
|
|
115
|
-
ActualErrorResponse,
|
|
116
|
-
parse_obj_as(
|
|
117
|
-
type_=ActualErrorResponse, # type: ignore
|
|
118
|
-
object_=_response.json(),
|
|
119
|
-
),
|
|
120
|
-
),
|
|
121
|
-
)
|
|
122
|
-
if _response.status_code == 404:
|
|
123
|
-
raise NotFoundError(
|
|
124
|
-
headers=dict(_response.headers),
|
|
125
|
-
body=typing.cast(
|
|
126
|
-
ActualErrorResponse,
|
|
127
|
-
parse_obj_as(
|
|
128
|
-
type_=ActualErrorResponse, # type: ignore
|
|
129
|
-
object_=_response.json(),
|
|
130
|
-
),
|
|
131
|
-
),
|
|
132
|
-
)
|
|
133
|
-
if _response.status_code == 422:
|
|
134
|
-
raise UnprocessableEntityError(
|
|
135
|
-
headers=dict(_response.headers),
|
|
136
|
-
body=typing.cast(
|
|
137
|
-
typing.Optional[typing.Any],
|
|
138
|
-
parse_obj_as(
|
|
139
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
140
|
-
object_=_response.json(),
|
|
141
|
-
),
|
|
142
|
-
),
|
|
143
|
-
)
|
|
144
|
-
if _response.status_code == 500:
|
|
145
|
-
raise InternalServerError(
|
|
146
|
-
headers=dict(_response.headers),
|
|
147
|
-
body=typing.cast(
|
|
148
|
-
ActualErrorResponse,
|
|
149
|
-
parse_obj_as(
|
|
150
|
-
type_=ActualErrorResponse, # type: ignore
|
|
151
|
-
object_=_response.json(),
|
|
152
|
-
),
|
|
153
|
-
),
|
|
154
|
-
)
|
|
155
|
-
if _response.status_code == 503:
|
|
156
|
-
raise ServiceUnavailableError(
|
|
157
|
-
headers=dict(_response.headers),
|
|
158
|
-
body=typing.cast(
|
|
159
|
-
ActualErrorResponse,
|
|
160
|
-
parse_obj_as(
|
|
161
|
-
type_=ActualErrorResponse, # type: ignore
|
|
162
|
-
object_=_response.json(),
|
|
163
|
-
),
|
|
164
|
-
),
|
|
165
|
-
)
|
|
166
|
-
_response_json = _response.json()
|
|
167
|
-
except JSONDecodeError:
|
|
168
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
169
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
class AsyncRawUserClient:
|
|
173
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
174
|
-
self._client_wrapper = client_wrapper
|
|
175
|
-
|
|
176
|
-
async def create_tenant(
|
|
177
|
-
self,
|
|
178
|
-
*,
|
|
179
|
-
tenant_id: typing.Optional[str] = None,
|
|
180
|
-
note: typing.Optional[str] = None,
|
|
181
|
-
tenant_metadata_schema: typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]] = OMIT,
|
|
182
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
183
|
-
) -> AsyncHttpResponse[TenantCreateData]:
|
|
184
|
-
"""
|
|
185
|
-
Create a tenant for your account.
|
|
186
|
-
|
|
187
|
-
Use this endpoint to initialize a tenant space you can use for ingestion, embeddings, and search. Optionally include a metadata schema to enforce consistent attributes across documents.
|
|
188
|
-
|
|
189
|
-
Expected outcome
|
|
190
|
-
- A tenant is created and returned with its identifier.
|
|
191
|
-
- If the tenant already exists, you receive a success message with the existing identifier.
|
|
192
|
-
|
|
193
|
-
Parameters
|
|
194
|
-
----------
|
|
195
|
-
tenant_id : typing.Optional[str]
|
|
196
|
-
Unique identifier for the tenant/organization
|
|
197
|
-
|
|
198
|
-
note : typing.Optional[str]
|
|
199
|
-
|
|
200
|
-
tenant_metadata_schema : typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]]
|
|
201
|
-
|
|
202
|
-
request_options : typing.Optional[RequestOptions]
|
|
203
|
-
Request-specific configuration.
|
|
204
|
-
|
|
205
|
-
Returns
|
|
206
|
-
-------
|
|
207
|
-
AsyncHttpResponse[TenantCreateData]
|
|
208
|
-
Successful Response
|
|
209
|
-
"""
|
|
210
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
211
|
-
"user/create_tenant",
|
|
212
|
-
method="POST",
|
|
213
|
-
params={
|
|
214
|
-
"tenant_id": tenant_id,
|
|
215
|
-
"note": note,
|
|
216
|
-
},
|
|
217
|
-
json={
|
|
218
|
-
"tenant_metadata_schema": tenant_metadata_schema,
|
|
219
|
-
},
|
|
220
|
-
headers={
|
|
221
|
-
"content-type": "application/json",
|
|
222
|
-
},
|
|
223
|
-
request_options=request_options,
|
|
224
|
-
omit=OMIT,
|
|
225
|
-
)
|
|
226
|
-
try:
|
|
227
|
-
if 200 <= _response.status_code < 300:
|
|
228
|
-
_data = typing.cast(
|
|
229
|
-
TenantCreateData,
|
|
230
|
-
parse_obj_as(
|
|
231
|
-
type_=TenantCreateData, # type: ignore
|
|
232
|
-
object_=_response.json(),
|
|
233
|
-
),
|
|
234
|
-
)
|
|
235
|
-
return AsyncHttpResponse(response=_response, data=_data)
|
|
236
|
-
if _response.status_code == 400:
|
|
237
|
-
raise BadRequestError(
|
|
238
|
-
headers=dict(_response.headers),
|
|
239
|
-
body=typing.cast(
|
|
240
|
-
ActualErrorResponse,
|
|
241
|
-
parse_obj_as(
|
|
242
|
-
type_=ActualErrorResponse, # type: ignore
|
|
243
|
-
object_=_response.json(),
|
|
244
|
-
),
|
|
245
|
-
),
|
|
246
|
-
)
|
|
247
|
-
if _response.status_code == 401:
|
|
248
|
-
raise UnauthorizedError(
|
|
249
|
-
headers=dict(_response.headers),
|
|
250
|
-
body=typing.cast(
|
|
251
|
-
ActualErrorResponse,
|
|
252
|
-
parse_obj_as(
|
|
253
|
-
type_=ActualErrorResponse, # type: ignore
|
|
254
|
-
object_=_response.json(),
|
|
255
|
-
),
|
|
256
|
-
),
|
|
257
|
-
)
|
|
258
|
-
if _response.status_code == 403:
|
|
259
|
-
raise ForbiddenError(
|
|
260
|
-
headers=dict(_response.headers),
|
|
261
|
-
body=typing.cast(
|
|
262
|
-
ActualErrorResponse,
|
|
263
|
-
parse_obj_as(
|
|
264
|
-
type_=ActualErrorResponse, # type: ignore
|
|
265
|
-
object_=_response.json(),
|
|
266
|
-
),
|
|
267
|
-
),
|
|
268
|
-
)
|
|
269
|
-
if _response.status_code == 404:
|
|
270
|
-
raise NotFoundError(
|
|
271
|
-
headers=dict(_response.headers),
|
|
272
|
-
body=typing.cast(
|
|
273
|
-
ActualErrorResponse,
|
|
274
|
-
parse_obj_as(
|
|
275
|
-
type_=ActualErrorResponse, # type: ignore
|
|
276
|
-
object_=_response.json(),
|
|
277
|
-
),
|
|
278
|
-
),
|
|
279
|
-
)
|
|
280
|
-
if _response.status_code == 422:
|
|
281
|
-
raise UnprocessableEntityError(
|
|
282
|
-
headers=dict(_response.headers),
|
|
283
|
-
body=typing.cast(
|
|
284
|
-
typing.Optional[typing.Any],
|
|
285
|
-
parse_obj_as(
|
|
286
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
287
|
-
object_=_response.json(),
|
|
288
|
-
),
|
|
289
|
-
),
|
|
290
|
-
)
|
|
291
|
-
if _response.status_code == 500:
|
|
292
|
-
raise InternalServerError(
|
|
293
|
-
headers=dict(_response.headers),
|
|
294
|
-
body=typing.cast(
|
|
295
|
-
ActualErrorResponse,
|
|
296
|
-
parse_obj_as(
|
|
297
|
-
type_=ActualErrorResponse, # type: ignore
|
|
298
|
-
object_=_response.json(),
|
|
299
|
-
),
|
|
300
|
-
),
|
|
301
|
-
)
|
|
302
|
-
if _response.status_code == 503:
|
|
303
|
-
raise ServiceUnavailableError(
|
|
304
|
-
headers=dict(_response.headers),
|
|
305
|
-
body=typing.cast(
|
|
306
|
-
ActualErrorResponse,
|
|
307
|
-
parse_obj_as(
|
|
308
|
-
type_=ActualErrorResponse, # type: ignore
|
|
309
|
-
object_=_response.json(),
|
|
310
|
-
),
|
|
311
|
-
),
|
|
312
|
-
)
|
|
313
|
-
_response_json = _response.json()
|
|
314
|
-
except JSONDecodeError:
|
|
315
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
316
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|