usecortex-ai 0.2.1__py3-none-any.whl → 0.2.2__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 +18 -3
- usecortex_ai/client.py +7 -78
- usecortex_ai/core/client_wrapper.py +6 -8
- usecortex_ai/document/__init__.py +4 -0
- usecortex_ai/document/client.py +139 -0
- usecortex_ai/document/raw_client.py +312 -0
- usecortex_ai/embeddings/client.py +40 -70
- usecortex_ai/embeddings/raw_client.py +40 -70
- usecortex_ai/fetch/client.py +10 -0
- usecortex_ai/fetch/raw_client.py +10 -0
- usecortex_ai/search/client.py +74 -80
- usecortex_ai/search/raw_client.py +74 -80
- usecortex_ai/sources/client.py +28 -83
- usecortex_ai/sources/raw_client.py +28 -259
- usecortex_ai/tenant/client.py +152 -4
- usecortex_ai/tenant/raw_client.py +502 -4
- usecortex_ai/types/__init__.py +16 -2
- usecortex_ai/types/add_user_memory_response.py +36 -0
- usecortex_ai/types/app_sources_upload_data.py +10 -2
- usecortex_ai/types/attachment_model.py +34 -7
- usecortex_ai/types/batch_upload_data.py +10 -2
- usecortex_ai/types/body_scrape_webpage_upload_scrape_webpage_post.py +0 -2
- usecortex_ai/types/body_update_scrape_job_upload_update_webpage_patch.py +0 -2
- usecortex_ai/types/content_model.py +33 -6
- usecortex_ai/types/delete_memory_request.py +14 -3
- usecortex_ai/types/delete_sources.py +20 -0
- usecortex_ai/types/delete_sub_tenant_data.py +42 -0
- usecortex_ai/types/delete_user_memory_response.py +31 -0
- usecortex_ai/types/embeddings_create_collection_data.py +19 -4
- usecortex_ai/types/embeddings_delete_data.py +19 -4
- usecortex_ai/types/embeddings_get_data.py +19 -4
- usecortex_ai/types/embeddings_search_data.py +19 -4
- usecortex_ai/types/error_response.py +0 -1
- usecortex_ai/types/fetch_content_data.py +19 -5
- usecortex_ai/types/file_upload_result.py +9 -2
- usecortex_ai/types/generate_user_memory_response.py +32 -0
- usecortex_ai/types/list_sources_response.py +14 -3
- usecortex_ai/types/list_user_memories_response.py +32 -0
- usecortex_ai/types/markdown_upload_request.py +18 -5
- usecortex_ai/types/processing_status.py +14 -3
- usecortex_ai/types/relations.py +9 -2
- usecortex_ai/types/retrieve_user_memory_response.py +32 -0
- usecortex_ai/types/search_chunk.py +54 -17
- usecortex_ai/types/single_upload_data.py +10 -2
- usecortex_ai/types/source.py +34 -15
- usecortex_ai/types/source_model.py +63 -14
- usecortex_ai/types/sub_tenant_ids_data.py +24 -5
- usecortex_ai/types/tenant_create_data.py +19 -4
- usecortex_ai/types/tenant_stats.py +24 -5
- usecortex_ai/types/user_memory.py +31 -0
- usecortex_ai/upload/client.py +394 -79
- usecortex_ai/upload/raw_client.py +398 -103
- usecortex_ai/user/client.py +14 -6
- usecortex_ai/user/raw_client.py +14 -6
- usecortex_ai/user_memory/client.py +184 -50
- usecortex_ai/user_memory/raw_client.py +905 -88
- {usecortex_ai-0.2.1.dist-info → usecortex_ai-0.2.2.dist-info}/METADATA +1 -1
- usecortex_ai-0.2.2.dist-info/RECORD +100 -0
- usecortex_ai/raw_client.py +0 -90
- usecortex_ai/types/source_content.py +0 -26
- usecortex_ai-0.2.1.dist-info/RECORD +0 -91
- {usecortex_ai-0.2.1.dist-info → usecortex_ai-0.2.2.dist-info}/WHEEL +0 -0
- {usecortex_ai-0.2.1.dist-info → usecortex_ai-0.2.2.dist-info}/licenses/LICENSE +0 -0
- {usecortex_ai-0.2.1.dist-info → usecortex_ai-0.2.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,312 @@
|
|
|
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.delete_sources import DeleteSources
|
|
20
|
+
|
|
21
|
+
# this is used as the default value for optional parameters
|
|
22
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class RawDocumentClient:
|
|
26
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
27
|
+
self._client_wrapper = client_wrapper
|
|
28
|
+
|
|
29
|
+
def delete(
|
|
30
|
+
self,
|
|
31
|
+
*,
|
|
32
|
+
tenant_id: str,
|
|
33
|
+
source_ids: typing.Sequence[str],
|
|
34
|
+
sub_tenant_id: typing.Optional[str] = OMIT,
|
|
35
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
36
|
+
) -> HttpResponse[DeleteSources]:
|
|
37
|
+
"""
|
|
38
|
+
Remove documents and content from your knowledge base.
|
|
39
|
+
|
|
40
|
+
This endpoint permanently deletes the specified sources from your knowledge base. Once deleted, the content will no longer be available for search or retrieval.
|
|
41
|
+
|
|
42
|
+
Use this carefully as the action cannot be undone. The system will confirm successful deletion of each source ID you specify.
|
|
43
|
+
|
|
44
|
+
Parameters
|
|
45
|
+
----------
|
|
46
|
+
tenant_id : str
|
|
47
|
+
Unique identifier for the tenant/organization
|
|
48
|
+
|
|
49
|
+
source_ids : typing.Sequence[str]
|
|
50
|
+
List of source IDs to delete
|
|
51
|
+
|
|
52
|
+
sub_tenant_id : typing.Optional[str]
|
|
53
|
+
Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
|
|
54
|
+
|
|
55
|
+
request_options : typing.Optional[RequestOptions]
|
|
56
|
+
Request-specific configuration.
|
|
57
|
+
|
|
58
|
+
Returns
|
|
59
|
+
-------
|
|
60
|
+
HttpResponse[DeleteSources]
|
|
61
|
+
Successful Response
|
|
62
|
+
"""
|
|
63
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
64
|
+
"document/delete",
|
|
65
|
+
method="DELETE",
|
|
66
|
+
json={
|
|
67
|
+
"tenant_id": tenant_id,
|
|
68
|
+
"source_ids": source_ids,
|
|
69
|
+
"sub_tenant_id": sub_tenant_id,
|
|
70
|
+
},
|
|
71
|
+
headers={
|
|
72
|
+
"content-type": "application/json",
|
|
73
|
+
},
|
|
74
|
+
request_options=request_options,
|
|
75
|
+
omit=OMIT,
|
|
76
|
+
)
|
|
77
|
+
try:
|
|
78
|
+
if 200 <= _response.status_code < 300:
|
|
79
|
+
_data = typing.cast(
|
|
80
|
+
DeleteSources,
|
|
81
|
+
parse_obj_as(
|
|
82
|
+
type_=DeleteSources, # type: ignore
|
|
83
|
+
object_=_response.json(),
|
|
84
|
+
),
|
|
85
|
+
)
|
|
86
|
+
return HttpResponse(response=_response, data=_data)
|
|
87
|
+
if _response.status_code == 400:
|
|
88
|
+
raise BadRequestError(
|
|
89
|
+
headers=dict(_response.headers),
|
|
90
|
+
body=typing.cast(
|
|
91
|
+
ActualErrorResponse,
|
|
92
|
+
parse_obj_as(
|
|
93
|
+
type_=ActualErrorResponse, # type: ignore
|
|
94
|
+
object_=_response.json(),
|
|
95
|
+
),
|
|
96
|
+
),
|
|
97
|
+
)
|
|
98
|
+
if _response.status_code == 401:
|
|
99
|
+
raise UnauthorizedError(
|
|
100
|
+
headers=dict(_response.headers),
|
|
101
|
+
body=typing.cast(
|
|
102
|
+
ActualErrorResponse,
|
|
103
|
+
parse_obj_as(
|
|
104
|
+
type_=ActualErrorResponse, # type: ignore
|
|
105
|
+
object_=_response.json(),
|
|
106
|
+
),
|
|
107
|
+
),
|
|
108
|
+
)
|
|
109
|
+
if _response.status_code == 403:
|
|
110
|
+
raise ForbiddenError(
|
|
111
|
+
headers=dict(_response.headers),
|
|
112
|
+
body=typing.cast(
|
|
113
|
+
ActualErrorResponse,
|
|
114
|
+
parse_obj_as(
|
|
115
|
+
type_=ActualErrorResponse, # type: ignore
|
|
116
|
+
object_=_response.json(),
|
|
117
|
+
),
|
|
118
|
+
),
|
|
119
|
+
)
|
|
120
|
+
if _response.status_code == 404:
|
|
121
|
+
raise NotFoundError(
|
|
122
|
+
headers=dict(_response.headers),
|
|
123
|
+
body=typing.cast(
|
|
124
|
+
ActualErrorResponse,
|
|
125
|
+
parse_obj_as(
|
|
126
|
+
type_=ActualErrorResponse, # type: ignore
|
|
127
|
+
object_=_response.json(),
|
|
128
|
+
),
|
|
129
|
+
),
|
|
130
|
+
)
|
|
131
|
+
if _response.status_code == 422:
|
|
132
|
+
raise UnprocessableEntityError(
|
|
133
|
+
headers=dict(_response.headers),
|
|
134
|
+
body=typing.cast(
|
|
135
|
+
typing.Optional[typing.Any],
|
|
136
|
+
parse_obj_as(
|
|
137
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
138
|
+
object_=_response.json(),
|
|
139
|
+
),
|
|
140
|
+
),
|
|
141
|
+
)
|
|
142
|
+
if _response.status_code == 500:
|
|
143
|
+
raise InternalServerError(
|
|
144
|
+
headers=dict(_response.headers),
|
|
145
|
+
body=typing.cast(
|
|
146
|
+
ActualErrorResponse,
|
|
147
|
+
parse_obj_as(
|
|
148
|
+
type_=ActualErrorResponse, # type: ignore
|
|
149
|
+
object_=_response.json(),
|
|
150
|
+
),
|
|
151
|
+
),
|
|
152
|
+
)
|
|
153
|
+
if _response.status_code == 503:
|
|
154
|
+
raise ServiceUnavailableError(
|
|
155
|
+
headers=dict(_response.headers),
|
|
156
|
+
body=typing.cast(
|
|
157
|
+
ActualErrorResponse,
|
|
158
|
+
parse_obj_as(
|
|
159
|
+
type_=ActualErrorResponse, # type: ignore
|
|
160
|
+
object_=_response.json(),
|
|
161
|
+
),
|
|
162
|
+
),
|
|
163
|
+
)
|
|
164
|
+
_response_json = _response.json()
|
|
165
|
+
except JSONDecodeError:
|
|
166
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
167
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
class AsyncRawDocumentClient:
|
|
171
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
172
|
+
self._client_wrapper = client_wrapper
|
|
173
|
+
|
|
174
|
+
async def delete(
|
|
175
|
+
self,
|
|
176
|
+
*,
|
|
177
|
+
tenant_id: str,
|
|
178
|
+
source_ids: typing.Sequence[str],
|
|
179
|
+
sub_tenant_id: typing.Optional[str] = OMIT,
|
|
180
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
181
|
+
) -> AsyncHttpResponse[DeleteSources]:
|
|
182
|
+
"""
|
|
183
|
+
Remove documents and content from your knowledge base.
|
|
184
|
+
|
|
185
|
+
This endpoint permanently deletes the specified sources from your knowledge base. Once deleted, the content will no longer be available for search or retrieval.
|
|
186
|
+
|
|
187
|
+
Use this carefully as the action cannot be undone. The system will confirm successful deletion of each source ID you specify.
|
|
188
|
+
|
|
189
|
+
Parameters
|
|
190
|
+
----------
|
|
191
|
+
tenant_id : str
|
|
192
|
+
Unique identifier for the tenant/organization
|
|
193
|
+
|
|
194
|
+
source_ids : typing.Sequence[str]
|
|
195
|
+
List of source IDs to delete
|
|
196
|
+
|
|
197
|
+
sub_tenant_id : typing.Optional[str]
|
|
198
|
+
Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
|
|
199
|
+
|
|
200
|
+
request_options : typing.Optional[RequestOptions]
|
|
201
|
+
Request-specific configuration.
|
|
202
|
+
|
|
203
|
+
Returns
|
|
204
|
+
-------
|
|
205
|
+
AsyncHttpResponse[DeleteSources]
|
|
206
|
+
Successful Response
|
|
207
|
+
"""
|
|
208
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
209
|
+
"document/delete",
|
|
210
|
+
method="DELETE",
|
|
211
|
+
json={
|
|
212
|
+
"tenant_id": tenant_id,
|
|
213
|
+
"source_ids": source_ids,
|
|
214
|
+
"sub_tenant_id": sub_tenant_id,
|
|
215
|
+
},
|
|
216
|
+
headers={
|
|
217
|
+
"content-type": "application/json",
|
|
218
|
+
},
|
|
219
|
+
request_options=request_options,
|
|
220
|
+
omit=OMIT,
|
|
221
|
+
)
|
|
222
|
+
try:
|
|
223
|
+
if 200 <= _response.status_code < 300:
|
|
224
|
+
_data = typing.cast(
|
|
225
|
+
DeleteSources,
|
|
226
|
+
parse_obj_as(
|
|
227
|
+
type_=DeleteSources, # type: ignore
|
|
228
|
+
object_=_response.json(),
|
|
229
|
+
),
|
|
230
|
+
)
|
|
231
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
232
|
+
if _response.status_code == 400:
|
|
233
|
+
raise BadRequestError(
|
|
234
|
+
headers=dict(_response.headers),
|
|
235
|
+
body=typing.cast(
|
|
236
|
+
ActualErrorResponse,
|
|
237
|
+
parse_obj_as(
|
|
238
|
+
type_=ActualErrorResponse, # type: ignore
|
|
239
|
+
object_=_response.json(),
|
|
240
|
+
),
|
|
241
|
+
),
|
|
242
|
+
)
|
|
243
|
+
if _response.status_code == 401:
|
|
244
|
+
raise UnauthorizedError(
|
|
245
|
+
headers=dict(_response.headers),
|
|
246
|
+
body=typing.cast(
|
|
247
|
+
ActualErrorResponse,
|
|
248
|
+
parse_obj_as(
|
|
249
|
+
type_=ActualErrorResponse, # type: ignore
|
|
250
|
+
object_=_response.json(),
|
|
251
|
+
),
|
|
252
|
+
),
|
|
253
|
+
)
|
|
254
|
+
if _response.status_code == 403:
|
|
255
|
+
raise ForbiddenError(
|
|
256
|
+
headers=dict(_response.headers),
|
|
257
|
+
body=typing.cast(
|
|
258
|
+
ActualErrorResponse,
|
|
259
|
+
parse_obj_as(
|
|
260
|
+
type_=ActualErrorResponse, # type: ignore
|
|
261
|
+
object_=_response.json(),
|
|
262
|
+
),
|
|
263
|
+
),
|
|
264
|
+
)
|
|
265
|
+
if _response.status_code == 404:
|
|
266
|
+
raise NotFoundError(
|
|
267
|
+
headers=dict(_response.headers),
|
|
268
|
+
body=typing.cast(
|
|
269
|
+
ActualErrorResponse,
|
|
270
|
+
parse_obj_as(
|
|
271
|
+
type_=ActualErrorResponse, # type: ignore
|
|
272
|
+
object_=_response.json(),
|
|
273
|
+
),
|
|
274
|
+
),
|
|
275
|
+
)
|
|
276
|
+
if _response.status_code == 422:
|
|
277
|
+
raise UnprocessableEntityError(
|
|
278
|
+
headers=dict(_response.headers),
|
|
279
|
+
body=typing.cast(
|
|
280
|
+
typing.Optional[typing.Any],
|
|
281
|
+
parse_obj_as(
|
|
282
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
283
|
+
object_=_response.json(),
|
|
284
|
+
),
|
|
285
|
+
),
|
|
286
|
+
)
|
|
287
|
+
if _response.status_code == 500:
|
|
288
|
+
raise InternalServerError(
|
|
289
|
+
headers=dict(_response.headers),
|
|
290
|
+
body=typing.cast(
|
|
291
|
+
ActualErrorResponse,
|
|
292
|
+
parse_obj_as(
|
|
293
|
+
type_=ActualErrorResponse, # type: ignore
|
|
294
|
+
object_=_response.json(),
|
|
295
|
+
),
|
|
296
|
+
),
|
|
297
|
+
)
|
|
298
|
+
if _response.status_code == 503:
|
|
299
|
+
raise ServiceUnavailableError(
|
|
300
|
+
headers=dict(_response.headers),
|
|
301
|
+
body=typing.cast(
|
|
302
|
+
ActualErrorResponse,
|
|
303
|
+
parse_obj_as(
|
|
304
|
+
type_=ActualErrorResponse, # type: ignore
|
|
305
|
+
object_=_response.json(),
|
|
306
|
+
),
|
|
307
|
+
),
|
|
308
|
+
)
|
|
309
|
+
_response_json = _response.json()
|
|
310
|
+
except JSONDecodeError:
|
|
311
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
312
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
@@ -38,28 +38,20 @@ class EmbeddingsClient:
|
|
|
38
38
|
request_options: typing.Optional[RequestOptions] = None,
|
|
39
39
|
) -> EmbeddingsDeleteData:
|
|
40
40
|
"""
|
|
41
|
-
Delete
|
|
41
|
+
Delete embedding chunks by chunk ID.
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
chunk IDs to the backend delete service.
|
|
45
|
-
|
|
46
|
-
Args:
|
|
47
|
-
request (EmbeddingsDeleteRequest): The delete request containing:
|
|
48
|
-
- chunk_ids (List[str]): List of chunk IDs to delete
|
|
49
|
-
- tenant_id (str): Tenant identifier for multi-tenancy
|
|
50
|
-
- sub_tenant_id (str, optional): Sub-tenant identifier, defaults to tenant_id
|
|
51
|
-
api_details (dict): Authentication details obtained from API key validation
|
|
52
|
-
|
|
53
|
-
Returns:
|
|
54
|
-
EmbeddingsDeleteData: Success response with deletion details
|
|
43
|
+
Use this to remove specific chunks from your embeddings index when they are no longer valid or should not appear in results.
|
|
55
44
|
|
|
56
45
|
Parameters
|
|
57
46
|
----------
|
|
58
47
|
chunk_ids : typing.Sequence[str]
|
|
48
|
+
The chunk IDs of the source you want to delete
|
|
59
49
|
|
|
60
50
|
tenant_id : str
|
|
51
|
+
Unique identifier for the tenant/organization
|
|
61
52
|
|
|
62
53
|
sub_tenant_id : typing.Optional[str]
|
|
54
|
+
Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
|
|
63
55
|
|
|
64
56
|
request_options : typing.Optional[RequestOptions]
|
|
65
57
|
Request-specific configuration.
|
|
@@ -91,29 +83,24 @@ class EmbeddingsClient:
|
|
|
91
83
|
request_options: typing.Optional[RequestOptions] = None,
|
|
92
84
|
) -> EmbeddingsSearchData:
|
|
93
85
|
"""
|
|
94
|
-
|
|
86
|
+
Find similar chunks using an embedding vector.
|
|
95
87
|
|
|
96
|
-
|
|
97
|
-
and returns a list of the most similar chunk IDs based on vector similarity.
|
|
88
|
+
Use this to retrieve the most similar chunk IDs to a single query embedding.
|
|
98
89
|
|
|
99
|
-
Args:
|
|
100
|
-
request (EmbeddingsSearchRequest): The search request containing:
|
|
101
|
-
- embeddings (List[float]): Single embedding vector for similarity search
|
|
102
|
-
- tenant_id (str): Tenant identifier for multi-tenancy
|
|
103
|
-
- sub_tenant_id (str, optional): Sub-tenant identifier, defaults to tenant_id
|
|
104
|
-
- max_chunks (int, optional): Maximum number of chunk IDs to return (default: 10)
|
|
105
|
-
api_details (dict): Authentication details obtained from API key validation
|
|
106
90
|
|
|
107
|
-
|
|
108
|
-
|
|
91
|
+
Expected outcome
|
|
92
|
+
- You receive the closest chunk IDs with optional similarity scores.
|
|
109
93
|
|
|
110
94
|
Parameters
|
|
111
95
|
----------
|
|
112
96
|
tenant_id : str
|
|
97
|
+
Unique identifier for the tenant/organization
|
|
113
98
|
|
|
114
99
|
embeddings : typing.Optional[typing.Sequence[float]]
|
|
100
|
+
The embedding vector for search
|
|
115
101
|
|
|
116
102
|
sub_tenant_id : typing.Optional[str]
|
|
103
|
+
Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
|
|
117
104
|
|
|
118
105
|
max_chunks : typing.Optional[int]
|
|
119
106
|
|
|
@@ -150,20 +137,20 @@ class EmbeddingsClient:
|
|
|
150
137
|
request_options: typing.Optional[RequestOptions] = None,
|
|
151
138
|
) -> EmbeddingsGetData:
|
|
152
139
|
"""
|
|
153
|
-
|
|
140
|
+
Retrieve embeddings for specific chunk IDs.
|
|
154
141
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
Returns:
|
|
158
|
-
EmbeddingsGetData: Embeddings data for the requested chunk IDs
|
|
142
|
+
Use this when you already know the chunk IDs and need their corresponding embeddings.
|
|
159
143
|
|
|
160
144
|
Parameters
|
|
161
145
|
----------
|
|
162
146
|
chunk_ids : typing.Sequence[str]
|
|
147
|
+
The chunk IDs of the source you want to get embeddings for
|
|
163
148
|
|
|
164
149
|
tenant_id : str
|
|
150
|
+
Unique identifier for the tenant/organization
|
|
165
151
|
|
|
166
152
|
sub_tenant_id : typing.Optional[str]
|
|
153
|
+
Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
|
|
167
154
|
|
|
168
155
|
request_options : typing.Optional[RequestOptions]
|
|
169
156
|
Request-specific configuration.
|
|
@@ -189,16 +176,14 @@ class EmbeddingsClient:
|
|
|
189
176
|
self, *, tenant_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
190
177
|
) -> EmbeddingsCreateCollectionData:
|
|
191
178
|
"""
|
|
192
|
-
Create an embeddings collection for
|
|
193
|
-
|
|
194
|
-
sub_tenant_id is set to be the same as tenant_id as per requirements.
|
|
179
|
+
Create an embeddings collection for a tenant.
|
|
195
180
|
|
|
196
|
-
|
|
197
|
-
EmbeddingsCreateCollectionData: Success response with collection details
|
|
181
|
+
Use this to initialize storage so you can index and query embeddings for the tenant.
|
|
198
182
|
|
|
199
183
|
Parameters
|
|
200
184
|
----------
|
|
201
185
|
tenant_id : str
|
|
186
|
+
Unique identifier for the tenant/organization
|
|
202
187
|
|
|
203
188
|
request_options : typing.Optional[RequestOptions]
|
|
204
189
|
Request-specific configuration.
|
|
@@ -243,28 +228,20 @@ class AsyncEmbeddingsClient:
|
|
|
243
228
|
request_options: typing.Optional[RequestOptions] = None,
|
|
244
229
|
) -> EmbeddingsDeleteData:
|
|
245
230
|
"""
|
|
246
|
-
Delete
|
|
231
|
+
Delete embedding chunks by chunk ID.
|
|
247
232
|
|
|
248
|
-
|
|
249
|
-
chunk IDs to the backend delete service.
|
|
250
|
-
|
|
251
|
-
Args:
|
|
252
|
-
request (EmbeddingsDeleteRequest): The delete request containing:
|
|
253
|
-
- chunk_ids (List[str]): List of chunk IDs to delete
|
|
254
|
-
- tenant_id (str): Tenant identifier for multi-tenancy
|
|
255
|
-
- sub_tenant_id (str, optional): Sub-tenant identifier, defaults to tenant_id
|
|
256
|
-
api_details (dict): Authentication details obtained from API key validation
|
|
257
|
-
|
|
258
|
-
Returns:
|
|
259
|
-
EmbeddingsDeleteData: Success response with deletion details
|
|
233
|
+
Use this to remove specific chunks from your embeddings index when they are no longer valid or should not appear in results.
|
|
260
234
|
|
|
261
235
|
Parameters
|
|
262
236
|
----------
|
|
263
237
|
chunk_ids : typing.Sequence[str]
|
|
238
|
+
The chunk IDs of the source you want to delete
|
|
264
239
|
|
|
265
240
|
tenant_id : str
|
|
241
|
+
Unique identifier for the tenant/organization
|
|
266
242
|
|
|
267
243
|
sub_tenant_id : typing.Optional[str]
|
|
244
|
+
Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
|
|
268
245
|
|
|
269
246
|
request_options : typing.Optional[RequestOptions]
|
|
270
247
|
Request-specific configuration.
|
|
@@ -300,29 +277,24 @@ class AsyncEmbeddingsClient:
|
|
|
300
277
|
request_options: typing.Optional[RequestOptions] = None,
|
|
301
278
|
) -> EmbeddingsSearchData:
|
|
302
279
|
"""
|
|
303
|
-
|
|
280
|
+
Find similar chunks using an embedding vector.
|
|
304
281
|
|
|
305
|
-
|
|
306
|
-
and returns a list of the most similar chunk IDs based on vector similarity.
|
|
282
|
+
Use this to retrieve the most similar chunk IDs to a single query embedding.
|
|
307
283
|
|
|
308
|
-
Args:
|
|
309
|
-
request (EmbeddingsSearchRequest): The search request containing:
|
|
310
|
-
- embeddings (List[float]): Single embedding vector for similarity search
|
|
311
|
-
- tenant_id (str): Tenant identifier for multi-tenancy
|
|
312
|
-
- sub_tenant_id (str, optional): Sub-tenant identifier, defaults to tenant_id
|
|
313
|
-
- max_chunks (int, optional): Maximum number of chunk IDs to return (default: 10)
|
|
314
|
-
api_details (dict): Authentication details obtained from API key validation
|
|
315
284
|
|
|
316
|
-
|
|
317
|
-
|
|
285
|
+
Expected outcome
|
|
286
|
+
- You receive the closest chunk IDs with optional similarity scores.
|
|
318
287
|
|
|
319
288
|
Parameters
|
|
320
289
|
----------
|
|
321
290
|
tenant_id : str
|
|
291
|
+
Unique identifier for the tenant/organization
|
|
322
292
|
|
|
323
293
|
embeddings : typing.Optional[typing.Sequence[float]]
|
|
294
|
+
The embedding vector for search
|
|
324
295
|
|
|
325
296
|
sub_tenant_id : typing.Optional[str]
|
|
297
|
+
Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
|
|
326
298
|
|
|
327
299
|
max_chunks : typing.Optional[int]
|
|
328
300
|
|
|
@@ -363,20 +335,20 @@ class AsyncEmbeddingsClient:
|
|
|
363
335
|
request_options: typing.Optional[RequestOptions] = None,
|
|
364
336
|
) -> EmbeddingsGetData:
|
|
365
337
|
"""
|
|
366
|
-
|
|
338
|
+
Retrieve embeddings for specific chunk IDs.
|
|
367
339
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
Returns:
|
|
371
|
-
EmbeddingsGetData: Embeddings data for the requested chunk IDs
|
|
340
|
+
Use this when you already know the chunk IDs and need their corresponding embeddings.
|
|
372
341
|
|
|
373
342
|
Parameters
|
|
374
343
|
----------
|
|
375
344
|
chunk_ids : typing.Sequence[str]
|
|
345
|
+
The chunk IDs of the source you want to get embeddings for
|
|
376
346
|
|
|
377
347
|
tenant_id : str
|
|
348
|
+
Unique identifier for the tenant/organization
|
|
378
349
|
|
|
379
350
|
sub_tenant_id : typing.Optional[str]
|
|
351
|
+
Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
|
|
380
352
|
|
|
381
353
|
request_options : typing.Optional[RequestOptions]
|
|
382
354
|
Request-specific configuration.
|
|
@@ -406,16 +378,14 @@ class AsyncEmbeddingsClient:
|
|
|
406
378
|
self, *, tenant_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
407
379
|
) -> EmbeddingsCreateCollectionData:
|
|
408
380
|
"""
|
|
409
|
-
Create an embeddings collection for
|
|
410
|
-
|
|
411
|
-
sub_tenant_id is set to be the same as tenant_id as per requirements.
|
|
381
|
+
Create an embeddings collection for a tenant.
|
|
412
382
|
|
|
413
|
-
|
|
414
|
-
EmbeddingsCreateCollectionData: Success response with collection details
|
|
383
|
+
Use this to initialize storage so you can index and query embeddings for the tenant.
|
|
415
384
|
|
|
416
385
|
Parameters
|
|
417
386
|
----------
|
|
418
387
|
tenant_id : str
|
|
388
|
+
Unique identifier for the tenant/organization
|
|
419
389
|
|
|
420
390
|
request_options : typing.Optional[RequestOptions]
|
|
421
391
|
Request-specific configuration.
|