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.
Files changed (103) hide show
  1. usecortex_ai/__init__.py +84 -66
  2. usecortex_ai/client.py +25 -23
  3. usecortex_ai/dashboard/client.py +448 -0
  4. usecortex_ai/{user_memory → dashboard}/raw_client.py +371 -530
  5. usecortex_ai/embeddings/client.py +229 -102
  6. usecortex_ai/embeddings/raw_client.py +323 -211
  7. usecortex_ai/errors/__init__.py +2 -0
  8. usecortex_ai/errors/bad_request_error.py +1 -2
  9. usecortex_ai/errors/forbidden_error.py +1 -2
  10. usecortex_ai/errors/internal_server_error.py +1 -2
  11. usecortex_ai/errors/not_found_error.py +1 -2
  12. usecortex_ai/errors/service_unavailable_error.py +1 -2
  13. usecortex_ai/errors/too_many_requests_error.py +11 -0
  14. usecortex_ai/errors/unauthorized_error.py +1 -2
  15. usecortex_ai/fetch/client.py +350 -29
  16. usecortex_ai/fetch/raw_client.py +919 -65
  17. usecortex_ai/raw_client.py +8 -2
  18. usecortex_ai/search/client.py +293 -257
  19. usecortex_ai/search/raw_client.py +445 -346
  20. usecortex_ai/search/types/alpha.py +1 -1
  21. usecortex_ai/sources/client.py +29 -216
  22. usecortex_ai/sources/raw_client.py +51 -589
  23. usecortex_ai/tenant/client.py +155 -118
  24. usecortex_ai/tenant/raw_client.py +227 -350
  25. usecortex_ai/types/__init__.py +78 -62
  26. usecortex_ai/types/add_memory_response.py +39 -0
  27. usecortex_ai/types/{relations.py → api_key_info.py} +25 -5
  28. usecortex_ai/types/app_sources_upload_data.py +15 -6
  29. usecortex_ai/types/{file_upload_result.py → collection_stats.py} +5 -5
  30. usecortex_ai/types/custom_property_definition.py +75 -0
  31. usecortex_ai/types/dashboard_apis_response.py +33 -0
  32. usecortex_ai/types/dashboard_sources_response.py +33 -0
  33. usecortex_ai/types/dashboard_tenants_response.py +33 -0
  34. usecortex_ai/types/{list_sources_response.py → delete_result.py} +10 -7
  35. usecortex_ai/types/delete_user_memory_response.py +1 -1
  36. usecortex_ai/types/entity.py +4 -4
  37. usecortex_ai/types/fetch_mode.py +5 -0
  38. usecortex_ai/types/graph_context.py +26 -0
  39. usecortex_ai/types/{delete_sources.py → infra.py} +4 -3
  40. usecortex_ai/types/{fetch_content_data.py → insert_result.py} +12 -8
  41. usecortex_ai/types/memory_item.py +82 -0
  42. usecortex_ai/types/memory_result_item.py +47 -0
  43. usecortex_ai/types/milvus_data_type.py +21 -0
  44. usecortex_ai/types/{related_chunk.py → path_triplet.py} +6 -5
  45. usecortex_ai/types/processing_status.py +3 -2
  46. usecortex_ai/types/processing_status_indexing_status.py +7 -0
  47. usecortex_ai/types/qn_a_search_response.py +49 -0
  48. usecortex_ai/types/{retrieve_response.py → raw_embedding_document.py} +11 -8
  49. usecortex_ai/types/raw_embedding_search_result.py +47 -0
  50. usecortex_ai/types/{user_memory.py → raw_embedding_vector.py} +6 -6
  51. usecortex_ai/types/relation_evidence.py +20 -0
  52. usecortex_ai/types/retrieval_result.py +26 -0
  53. usecortex_ai/types/scored_path_response.py +26 -0
  54. usecortex_ai/types/search_mode.py +5 -0
  55. usecortex_ai/types/{batch_upload_data.py → source_delete_response.py} +8 -8
  56. usecortex_ai/types/{list_user_memories_response.py → source_delete_result_item.py} +11 -7
  57. usecortex_ai/types/source_fetch_response.py +70 -0
  58. usecortex_ai/types/{graph_relations_response.py → source_graph_relations_response.py} +3 -3
  59. usecortex_ai/types/{single_upload_data.py → source_list_response.py} +7 -10
  60. usecortex_ai/types/source_model.py +11 -1
  61. usecortex_ai/types/source_status.py +5 -0
  62. usecortex_ai/types/source_upload_response.py +35 -0
  63. usecortex_ai/types/source_upload_result_item.py +38 -0
  64. usecortex_ai/types/supported_llm_providers.py +5 -0
  65. usecortex_ai/types/{embeddings_create_collection_data.py → tenant_create_response.py} +9 -7
  66. usecortex_ai/types/{extended_context.py → tenant_info.py} +13 -4
  67. usecortex_ai/types/{embeddings_search_data.py → tenant_metadata_schema_info.py} +8 -9
  68. usecortex_ai/types/{tenant_create_data.py → tenant_stats_response.py} +9 -8
  69. usecortex_ai/types/{triple_with_evidence.py → triplet_with_evidence.py} +1 -1
  70. usecortex_ai/types/user_assistant_pair.py +4 -0
  71. usecortex_ai/types/{search_chunk.py → vector_store_chunk.py} +3 -9
  72. usecortex_ai/upload/__init__.py +3 -0
  73. usecortex_ai/upload/client.py +233 -1937
  74. usecortex_ai/upload/raw_client.py +364 -4401
  75. usecortex_ai/upload/types/__init__.py +7 -0
  76. usecortex_ai/upload/types/body_upload_app_ingestion_upload_app_post_app_sources.py +7 -0
  77. {usecortex_ai-0.3.5.dist-info → usecortex_ai-0.4.0.dist-info}/METADATA +2 -2
  78. usecortex_ai-0.4.0.dist-info/RECORD +113 -0
  79. {usecortex_ai-0.3.5.dist-info → usecortex_ai-0.4.0.dist-info}/WHEEL +1 -1
  80. usecortex_ai/document/client.py +0 -139
  81. usecortex_ai/document/raw_client.py +0 -312
  82. usecortex_ai/types/add_user_memory_response.py +0 -41
  83. usecortex_ai/types/body_scrape_webpage_upload_scrape_webpage_post.py +0 -17
  84. usecortex_ai/types/body_update_scrape_job_upload_update_webpage_patch.py +0 -17
  85. usecortex_ai/types/delete_memory_request.py +0 -32
  86. usecortex_ai/types/delete_sub_tenant_data.py +0 -42
  87. usecortex_ai/types/embeddings_delete_data.py +0 -37
  88. usecortex_ai/types/embeddings_get_data.py +0 -37
  89. usecortex_ai/types/markdown_upload_request.py +0 -41
  90. usecortex_ai/types/retrieve_user_memory_response.py +0 -38
  91. usecortex_ai/types/source.py +0 -52
  92. usecortex_ai/types/sub_tenant_ids_data.py +0 -47
  93. usecortex_ai/types/tenant_stats.py +0 -42
  94. usecortex_ai/types/webpage_scrape_request.py +0 -27
  95. usecortex_ai/user/__init__.py +0 -4
  96. usecortex_ai/user/client.py +0 -145
  97. usecortex_ai/user/raw_client.py +0 -316
  98. usecortex_ai/user_memory/__init__.py +0 -4
  99. usecortex_ai/user_memory/client.py +0 -515
  100. usecortex_ai-0.3.5.dist-info/RECORD +0 -108
  101. /usecortex_ai/{document → dashboard}/__init__.py +0 -0
  102. {usecortex_ai-0.3.5.dist-info → usecortex_ai-0.4.0.dist-info}/licenses/LICENSE +0 -0
  103. {usecortex_ai-0.3.5.dist-info → usecortex_ai-0.4.0.dist-info}/top_level.txt +0 -0
@@ -8,6 +8,7 @@ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
8
  from ..core.http_response import AsyncHttpResponse, HttpResponse
9
9
  from ..core.pydantic_utilities import parse_obj_as
10
10
  from ..core.request_options import RequestOptions
11
+ from ..core.serialization import convert_and_respect_annotation_metadata
11
12
  from ..errors.bad_request_error import BadRequestError
12
13
  from ..errors.forbidden_error import ForbiddenError
13
14
  from ..errors.internal_server_error import InternalServerError
@@ -15,11 +16,10 @@ from ..errors.not_found_error import NotFoundError
15
16
  from ..errors.service_unavailable_error import ServiceUnavailableError
16
17
  from ..errors.unauthorized_error import UnauthorizedError
17
18
  from ..errors.unprocessable_entity_error import UnprocessableEntityError
18
- from ..types.actual_error_response import ActualErrorResponse
19
- from ..types.embeddings_create_collection_data import EmbeddingsCreateCollectionData
20
- from ..types.embeddings_delete_data import EmbeddingsDeleteData
21
- from ..types.embeddings_get_data import EmbeddingsGetData
22
- from ..types.embeddings_search_data import EmbeddingsSearchData
19
+ from ..types.delete_result import DeleteResult
20
+ from ..types.insert_result import InsertResult
21
+ from ..types.raw_embedding_document import RawEmbeddingDocument
22
+ from ..types.raw_embedding_search_result import RawEmbeddingSearchResult
23
23
 
24
24
  # this is used as the default value for optional parameters
25
25
  OMIT = typing.cast(typing.Any, ...)
@@ -29,45 +29,58 @@ class RawEmbeddingsClient:
29
29
  def __init__(self, *, client_wrapper: SyncClientWrapper):
30
30
  self._client_wrapper = client_wrapper
31
31
 
32
- def delete(
32
+ def insert(
33
33
  self,
34
34
  *,
35
- chunk_ids: typing.Sequence[str],
36
35
  tenant_id: str,
36
+ embeddings: typing.Sequence[RawEmbeddingDocument],
37
37
  sub_tenant_id: typing.Optional[str] = OMIT,
38
+ upsert: typing.Optional[bool] = OMIT,
38
39
  request_options: typing.Optional[RequestOptions] = None,
39
- ) -> HttpResponse[EmbeddingsDeleteData]:
40
+ ) -> HttpResponse[InsertResult]:
40
41
  """
41
- Delete embedding chunks by chunk ID.
42
+ Upload pre-computed embeddings for advanced similarity search.
43
+
44
+ This endpoint accepts vector embeddings that you’ve generated externally,
45
+ allowing you to integrate with custom embedding models or existing vector databases.
46
+ The embeddings represent chunks of your content as numerical vectors.
42
47
 
43
- Use this to remove specific chunks from your embeddings index when they are no longer valid or should not appear in results.
48
+ The system stores these embeddings and makes them available for semantic search and similarity matching.
49
+ Use this when you want to leverage specialized embedding models or have existing vector representations.
50
+ When upsert=True, existing embeddings with the same chunk_id will be updated.
44
51
 
45
52
  Parameters
46
53
  ----------
47
- chunk_ids : typing.Sequence[str]
48
- The chunk IDs of the source you want to delete
49
-
50
54
  tenant_id : str
51
55
  Unique identifier for the tenant/organization
52
56
 
57
+ embeddings : typing.Sequence[RawEmbeddingDocument]
58
+ List of raw embedding documents to insert
59
+
53
60
  sub_tenant_id : typing.Optional[str]
54
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.
55
62
 
63
+ upsert : typing.Optional[bool]
64
+ If True, update existing embeddings; if False, insert only
65
+
56
66
  request_options : typing.Optional[RequestOptions]
57
67
  Request-specific configuration.
58
68
 
59
69
  Returns
60
70
  -------
61
- HttpResponse[EmbeddingsDeleteData]
71
+ HttpResponse[InsertResult]
62
72
  Successful Response
63
73
  """
64
74
  _response = self._client_wrapper.httpx_client.request(
65
- "embeddings/delete",
66
- method="DELETE",
75
+ "embeddings/insert-raw-embeddings",
76
+ method="POST",
67
77
  json={
68
- "chunk_ids": chunk_ids,
69
78
  "tenant_id": tenant_id,
70
79
  "sub_tenant_id": sub_tenant_id,
80
+ "embeddings": convert_and_respect_annotation_metadata(
81
+ object_=embeddings, annotation=typing.Sequence[RawEmbeddingDocument], direction="write"
82
+ ),
83
+ "upsert": upsert,
71
84
  },
72
85
  headers={
73
86
  "content-type": "application/json",
@@ -78,9 +91,9 @@ class RawEmbeddingsClient:
78
91
  try:
79
92
  if 200 <= _response.status_code < 300:
80
93
  _data = typing.cast(
81
- EmbeddingsDeleteData,
94
+ InsertResult,
82
95
  parse_obj_as(
83
- type_=EmbeddingsDeleteData, # type: ignore
96
+ type_=InsertResult, # type: ignore
84
97
  object_=_response.json(),
85
98
  ),
86
99
  )
@@ -89,9 +102,9 @@ class RawEmbeddingsClient:
89
102
  raise BadRequestError(
90
103
  headers=dict(_response.headers),
91
104
  body=typing.cast(
92
- ActualErrorResponse,
105
+ typing.Optional[typing.Any],
93
106
  parse_obj_as(
94
- type_=ActualErrorResponse, # type: ignore
107
+ type_=typing.Optional[typing.Any], # type: ignore
95
108
  object_=_response.json(),
96
109
  ),
97
110
  ),
@@ -100,9 +113,9 @@ class RawEmbeddingsClient:
100
113
  raise UnauthorizedError(
101
114
  headers=dict(_response.headers),
102
115
  body=typing.cast(
103
- ActualErrorResponse,
116
+ typing.Optional[typing.Any],
104
117
  parse_obj_as(
105
- type_=ActualErrorResponse, # type: ignore
118
+ type_=typing.Optional[typing.Any], # type: ignore
106
119
  object_=_response.json(),
107
120
  ),
108
121
  ),
@@ -111,9 +124,9 @@ class RawEmbeddingsClient:
111
124
  raise ForbiddenError(
112
125
  headers=dict(_response.headers),
113
126
  body=typing.cast(
114
- ActualErrorResponse,
127
+ typing.Optional[typing.Any],
115
128
  parse_obj_as(
116
- type_=ActualErrorResponse, # type: ignore
129
+ type_=typing.Optional[typing.Any], # type: ignore
117
130
  object_=_response.json(),
118
131
  ),
119
132
  ),
@@ -122,9 +135,9 @@ class RawEmbeddingsClient:
122
135
  raise NotFoundError(
123
136
  headers=dict(_response.headers),
124
137
  body=typing.cast(
125
- ActualErrorResponse,
138
+ typing.Optional[typing.Any],
126
139
  parse_obj_as(
127
- type_=ActualErrorResponse, # type: ignore
140
+ type_=typing.Optional[typing.Any], # type: ignore
128
141
  object_=_response.json(),
129
142
  ),
130
143
  ),
@@ -144,9 +157,9 @@ class RawEmbeddingsClient:
144
157
  raise InternalServerError(
145
158
  headers=dict(_response.headers),
146
159
  body=typing.cast(
147
- ActualErrorResponse,
160
+ typing.Optional[typing.Any],
148
161
  parse_obj_as(
149
- type_=ActualErrorResponse, # type: ignore
162
+ type_=typing.Optional[typing.Any], # type: ignore
150
163
  object_=_response.json(),
151
164
  ),
152
165
  ),
@@ -155,9 +168,9 @@ class RawEmbeddingsClient:
155
168
  raise ServiceUnavailableError(
156
169
  headers=dict(_response.headers),
157
170
  body=typing.cast(
158
- ActualErrorResponse,
171
+ typing.Optional[typing.Any],
159
172
  parse_obj_as(
160
- type_=ActualErrorResponse, # type: ignore
173
+ type_=typing.Optional[typing.Any], # type: ignore
161
174
  object_=_response.json(),
162
175
  ),
163
176
  ),
@@ -171,18 +184,19 @@ class RawEmbeddingsClient:
171
184
  self,
172
185
  *,
173
186
  tenant_id: str,
174
- embeddings: typing.Optional[typing.Sequence[float]] = OMIT,
175
- sub_tenant_id: typing.Optional[str] = OMIT,
176
- max_chunks: typing.Optional[int] = OMIT,
187
+ sub_tenant_id: str,
188
+ query_embedding: typing.Sequence[float],
189
+ limit: typing.Optional[int] = OMIT,
190
+ filter_expr: typing.Optional[str] = OMIT,
191
+ output_fields: typing.Optional[typing.Sequence[str]] = OMIT,
177
192
  request_options: typing.Optional[RequestOptions] = None,
178
- ) -> HttpResponse[EmbeddingsSearchData]:
193
+ ) -> HttpResponse[typing.List[RawEmbeddingSearchResult]]:
179
194
  """
180
195
  Find similar chunks using an embedding vector.
181
196
 
182
197
  Use this to retrieve the most similar chunk IDs to a single query embedding.
183
198
 
184
-
185
- Expected outcome
199
+ Expected outcome:
186
200
  - You receive the closest chunk IDs with optional similarity scores.
187
201
 
188
202
  Parameters
@@ -190,30 +204,39 @@ class RawEmbeddingsClient:
190
204
  tenant_id : str
191
205
  Unique identifier for the tenant/organization
192
206
 
193
- embeddings : typing.Optional[typing.Sequence[float]]
194
- The embedding vector for search
195
-
196
- sub_tenant_id : typing.Optional[str]
207
+ sub_tenant_id : str
197
208
  Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
198
209
 
199
- max_chunks : typing.Optional[int]
210
+ query_embedding : typing.Sequence[float]
211
+ Query embedding vector to search for
212
+
213
+ limit : typing.Optional[int]
214
+ Maximum number of results to return
215
+
216
+ filter_expr : typing.Optional[str]
217
+ Optional Milvus filter expression for additional filtering
218
+
219
+ output_fields : typing.Optional[typing.Sequence[str]]
220
+ Optional list of fields to return in results (default: chunk_id, source_id, metadata)
200
221
 
201
222
  request_options : typing.Optional[RequestOptions]
202
223
  Request-specific configuration.
203
224
 
204
225
  Returns
205
226
  -------
206
- HttpResponse[EmbeddingsSearchData]
227
+ HttpResponse[typing.List[RawEmbeddingSearchResult]]
207
228
  Successful Response
208
229
  """
209
230
  _response = self._client_wrapper.httpx_client.request(
210
- "embeddings/search",
231
+ "embeddings/search-raw-embeddings",
211
232
  method="POST",
212
233
  json={
213
234
  "tenant_id": tenant_id,
214
- "embeddings": embeddings,
215
235
  "sub_tenant_id": sub_tenant_id,
216
- "max_chunks": max_chunks,
236
+ "query_embedding": query_embedding,
237
+ "limit": limit,
238
+ "filter_expr": filter_expr,
239
+ "output_fields": output_fields,
217
240
  },
218
241
  headers={
219
242
  "content-type": "application/json",
@@ -224,9 +247,9 @@ class RawEmbeddingsClient:
224
247
  try:
225
248
  if 200 <= _response.status_code < 300:
226
249
  _data = typing.cast(
227
- EmbeddingsSearchData,
250
+ typing.List[RawEmbeddingSearchResult],
228
251
  parse_obj_as(
229
- type_=EmbeddingsSearchData, # type: ignore
252
+ type_=typing.List[RawEmbeddingSearchResult], # type: ignore
230
253
  object_=_response.json(),
231
254
  ),
232
255
  )
@@ -235,9 +258,9 @@ class RawEmbeddingsClient:
235
258
  raise BadRequestError(
236
259
  headers=dict(_response.headers),
237
260
  body=typing.cast(
238
- ActualErrorResponse,
261
+ typing.Optional[typing.Any],
239
262
  parse_obj_as(
240
- type_=ActualErrorResponse, # type: ignore
263
+ type_=typing.Optional[typing.Any], # type: ignore
241
264
  object_=_response.json(),
242
265
  ),
243
266
  ),
@@ -246,9 +269,9 @@ class RawEmbeddingsClient:
246
269
  raise UnauthorizedError(
247
270
  headers=dict(_response.headers),
248
271
  body=typing.cast(
249
- ActualErrorResponse,
272
+ typing.Optional[typing.Any],
250
273
  parse_obj_as(
251
- type_=ActualErrorResponse, # type: ignore
274
+ type_=typing.Optional[typing.Any], # type: ignore
252
275
  object_=_response.json(),
253
276
  ),
254
277
  ),
@@ -257,9 +280,9 @@ class RawEmbeddingsClient:
257
280
  raise ForbiddenError(
258
281
  headers=dict(_response.headers),
259
282
  body=typing.cast(
260
- ActualErrorResponse,
283
+ typing.Optional[typing.Any],
261
284
  parse_obj_as(
262
- type_=ActualErrorResponse, # type: ignore
285
+ type_=typing.Optional[typing.Any], # type: ignore
263
286
  object_=_response.json(),
264
287
  ),
265
288
  ),
@@ -268,9 +291,9 @@ class RawEmbeddingsClient:
268
291
  raise NotFoundError(
269
292
  headers=dict(_response.headers),
270
293
  body=typing.cast(
271
- ActualErrorResponse,
294
+ typing.Optional[typing.Any],
272
295
  parse_obj_as(
273
- type_=ActualErrorResponse, # type: ignore
296
+ type_=typing.Optional[typing.Any], # type: ignore
274
297
  object_=_response.json(),
275
298
  ),
276
299
  ),
@@ -290,9 +313,9 @@ class RawEmbeddingsClient:
290
313
  raise InternalServerError(
291
314
  headers=dict(_response.headers),
292
315
  body=typing.cast(
293
- ActualErrorResponse,
316
+ typing.Optional[typing.Any],
294
317
  parse_obj_as(
295
- type_=ActualErrorResponse, # type: ignore
318
+ type_=typing.Optional[typing.Any], # type: ignore
296
319
  object_=_response.json(),
297
320
  ),
298
321
  ),
@@ -301,9 +324,9 @@ class RawEmbeddingsClient:
301
324
  raise ServiceUnavailableError(
302
325
  headers=dict(_response.headers),
303
326
  body=typing.cast(
304
- ActualErrorResponse,
327
+ typing.Optional[typing.Any],
305
328
  parse_obj_as(
306
- type_=ActualErrorResponse, # type: ignore
329
+ type_=typing.Optional[typing.Any], # type: ignore
307
330
  object_=_response.json(),
308
331
  ),
309
332
  ),
@@ -313,45 +336,59 @@ class RawEmbeddingsClient:
313
336
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
314
337
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
315
338
 
316
- def get_by_chunk_ids(
339
+ def filter(
317
340
  self,
318
341
  *,
319
- chunk_ids: typing.Sequence[str],
320
342
  tenant_id: str,
321
- sub_tenant_id: typing.Optional[str] = OMIT,
343
+ sub_tenant_id: str,
344
+ source_id: typing.Optional[str] = OMIT,
345
+ chunk_ids: typing.Optional[typing.Sequence[str]] = OMIT,
346
+ output_fields: typing.Optional[typing.Sequence[str]] = OMIT,
347
+ limit: typing.Optional[int] = OMIT,
322
348
  request_options: typing.Optional[RequestOptions] = None,
323
- ) -> HttpResponse[EmbeddingsGetData]:
349
+ ) -> HttpResponse[typing.List[RawEmbeddingSearchResult]]:
324
350
  """
325
351
  Retrieve embeddings for specific chunk IDs.
326
-
327
352
  Use this when you already know the chunk IDs and need their corresponding embeddings.
328
353
 
329
354
  Parameters
330
355
  ----------
331
- chunk_ids : typing.Sequence[str]
332
- The chunk IDs of the source you want to get embeddings for
333
-
334
356
  tenant_id : str
335
357
  Unique identifier for the tenant/organization
336
358
 
337
- sub_tenant_id : typing.Optional[str]
359
+ sub_tenant_id : str
338
360
  Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
339
361
 
362
+ source_id : typing.Optional[str]
363
+ Optional source ID to filter by (mutually exclusive with chunk_ids)
364
+
365
+ chunk_ids : typing.Optional[typing.Sequence[str]]
366
+ Optional list of chunk IDs to filter by (mutually exclusive with source_id)
367
+
368
+ output_fields : typing.Optional[typing.Sequence[str]]
369
+ Optional list of fields to return in results (default: chunk_id, source_id, metadata)
370
+
371
+ limit : typing.Optional[int]
372
+ Maximum number of results to return
373
+
340
374
  request_options : typing.Optional[RequestOptions]
341
375
  Request-specific configuration.
342
376
 
343
377
  Returns
344
378
  -------
345
- HttpResponse[EmbeddingsGetData]
379
+ HttpResponse[typing.List[RawEmbeddingSearchResult]]
346
380
  Successful Response
347
381
  """
348
382
  _response = self._client_wrapper.httpx_client.request(
349
- "embeddings/retrieve_by_ids",
383
+ "embeddings/filter-raw-embeddings",
350
384
  method="POST",
351
385
  json={
352
- "chunk_ids": chunk_ids,
353
386
  "tenant_id": tenant_id,
354
387
  "sub_tenant_id": sub_tenant_id,
388
+ "source_id": source_id,
389
+ "chunk_ids": chunk_ids,
390
+ "output_fields": output_fields,
391
+ "limit": limit,
355
392
  },
356
393
  headers={
357
394
  "content-type": "application/json",
@@ -362,9 +399,9 @@ class RawEmbeddingsClient:
362
399
  try:
363
400
  if 200 <= _response.status_code < 300:
364
401
  _data = typing.cast(
365
- EmbeddingsGetData,
402
+ typing.List[RawEmbeddingSearchResult],
366
403
  parse_obj_as(
367
- type_=EmbeddingsGetData, # type: ignore
404
+ type_=typing.List[RawEmbeddingSearchResult], # type: ignore
368
405
  object_=_response.json(),
369
406
  ),
370
407
  )
@@ -373,9 +410,9 @@ class RawEmbeddingsClient:
373
410
  raise BadRequestError(
374
411
  headers=dict(_response.headers),
375
412
  body=typing.cast(
376
- ActualErrorResponse,
413
+ typing.Optional[typing.Any],
377
414
  parse_obj_as(
378
- type_=ActualErrorResponse, # type: ignore
415
+ type_=typing.Optional[typing.Any], # type: ignore
379
416
  object_=_response.json(),
380
417
  ),
381
418
  ),
@@ -384,9 +421,9 @@ class RawEmbeddingsClient:
384
421
  raise UnauthorizedError(
385
422
  headers=dict(_response.headers),
386
423
  body=typing.cast(
387
- ActualErrorResponse,
424
+ typing.Optional[typing.Any],
388
425
  parse_obj_as(
389
- type_=ActualErrorResponse, # type: ignore
426
+ type_=typing.Optional[typing.Any], # type: ignore
390
427
  object_=_response.json(),
391
428
  ),
392
429
  ),
@@ -395,9 +432,9 @@ class RawEmbeddingsClient:
395
432
  raise ForbiddenError(
396
433
  headers=dict(_response.headers),
397
434
  body=typing.cast(
398
- ActualErrorResponse,
435
+ typing.Optional[typing.Any],
399
436
  parse_obj_as(
400
- type_=ActualErrorResponse, # type: ignore
437
+ type_=typing.Optional[typing.Any], # type: ignore
401
438
  object_=_response.json(),
402
439
  ),
403
440
  ),
@@ -406,9 +443,9 @@ class RawEmbeddingsClient:
406
443
  raise NotFoundError(
407
444
  headers=dict(_response.headers),
408
445
  body=typing.cast(
409
- ActualErrorResponse,
446
+ typing.Optional[typing.Any],
410
447
  parse_obj_as(
411
- type_=ActualErrorResponse, # type: ignore
448
+ type_=typing.Optional[typing.Any], # type: ignore
412
449
  object_=_response.json(),
413
450
  ),
414
451
  ),
@@ -428,9 +465,9 @@ class RawEmbeddingsClient:
428
465
  raise InternalServerError(
429
466
  headers=dict(_response.headers),
430
467
  body=typing.cast(
431
- ActualErrorResponse,
468
+ typing.Optional[typing.Any],
432
469
  parse_obj_as(
433
- type_=ActualErrorResponse, # type: ignore
470
+ type_=typing.Optional[typing.Any], # type: ignore
434
471
  object_=_response.json(),
435
472
  ),
436
473
  ),
@@ -439,9 +476,9 @@ class RawEmbeddingsClient:
439
476
  raise ServiceUnavailableError(
440
477
  headers=dict(_response.headers),
441
478
  body=typing.cast(
442
- ActualErrorResponse,
479
+ typing.Optional[typing.Any],
443
480
  parse_obj_as(
444
- type_=ActualErrorResponse, # type: ignore
481
+ type_=typing.Optional[typing.Any], # type: ignore
445
482
  object_=_response.json(),
446
483
  ),
447
484
  ),
@@ -451,41 +488,60 @@ class RawEmbeddingsClient:
451
488
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
452
489
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
453
490
 
454
- def create_collection(
455
- self, *, tenant_id: str, request_options: typing.Optional[RequestOptions] = None
456
- ) -> HttpResponse[EmbeddingsCreateCollectionData]:
491
+ def delete(
492
+ self,
493
+ *,
494
+ tenant_id: str,
495
+ sub_tenant_id: typing.Optional[str] = None,
496
+ source_id: typing.Optional[str] = None,
497
+ chunk_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
498
+ request_options: typing.Optional[RequestOptions] = None,
499
+ ) -> HttpResponse[DeleteResult]:
457
500
  """
458
- Create an embeddings collection for a tenant.
501
+ Delete embedding chunks by chunk ID.
459
502
 
460
- Use this to initialize storage so you can index and query embeddings for the tenant.
503
+ Use this to remove specific chunks from your embeddings index when they are no longer
504
+ valid or should not appear in results.
461
505
 
462
506
  Parameters
463
507
  ----------
464
508
  tenant_id : str
465
509
  Unique identifier for the tenant/organization
466
510
 
511
+ sub_tenant_id : typing.Optional[str]
512
+ Optional sub-tenant ID for scoping deletion
513
+
514
+ source_id : typing.Optional[str]
515
+ Optional source ID to delete by (mutually exclusive with chunk_ids)
516
+
517
+ chunk_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
518
+ Optional list of chunk IDs to delete (mutually exclusive with source_id)
519
+
467
520
  request_options : typing.Optional[RequestOptions]
468
521
  Request-specific configuration.
469
522
 
470
523
  Returns
471
524
  -------
472
- HttpResponse[EmbeddingsCreateCollectionData]
525
+ HttpResponse[DeleteResult]
473
526
  Successful Response
474
527
  """
475
528
  _response = self._client_wrapper.httpx_client.request(
476
- "embeddings/create_tenant",
477
- method="POST",
529
+ "embeddings/delete-raw-embeddings",
530
+ method="DELETE",
478
531
  params={
479
532
  "tenant_id": tenant_id,
533
+ "sub_tenant_id": sub_tenant_id,
534
+ "source_id": source_id,
535
+ "chunk_ids": chunk_ids,
480
536
  },
481
537
  request_options=request_options,
482
538
  )
483
539
  try:
484
540
  if 200 <= _response.status_code < 300:
485
541
  _data = typing.cast(
486
- EmbeddingsCreateCollectionData,
542
+ DeleteResult,
487
543
  parse_obj_as(
488
- type_=EmbeddingsCreateCollectionData, # type: ignore
544
+ type_=DeleteResult, # type: ignore
489
545
  object_=_response.json(),
490
546
  ),
491
547
  )
@@ -494,9 +550,9 @@ class RawEmbeddingsClient:
494
550
  raise BadRequestError(
495
551
  headers=dict(_response.headers),
496
552
  body=typing.cast(
497
- ActualErrorResponse,
553
+ typing.Optional[typing.Any],
498
554
  parse_obj_as(
499
- type_=ActualErrorResponse, # type: ignore
555
+ type_=typing.Optional[typing.Any], # type: ignore
500
556
  object_=_response.json(),
501
557
  ),
502
558
  ),
@@ -505,9 +561,9 @@ class RawEmbeddingsClient:
505
561
  raise UnauthorizedError(
506
562
  headers=dict(_response.headers),
507
563
  body=typing.cast(
508
- ActualErrorResponse,
564
+ typing.Optional[typing.Any],
509
565
  parse_obj_as(
510
- type_=ActualErrorResponse, # type: ignore
566
+ type_=typing.Optional[typing.Any], # type: ignore
511
567
  object_=_response.json(),
512
568
  ),
513
569
  ),
@@ -516,9 +572,9 @@ class RawEmbeddingsClient:
516
572
  raise ForbiddenError(
517
573
  headers=dict(_response.headers),
518
574
  body=typing.cast(
519
- ActualErrorResponse,
575
+ typing.Optional[typing.Any],
520
576
  parse_obj_as(
521
- type_=ActualErrorResponse, # type: ignore
577
+ type_=typing.Optional[typing.Any], # type: ignore
522
578
  object_=_response.json(),
523
579
  ),
524
580
  ),
@@ -527,9 +583,9 @@ class RawEmbeddingsClient:
527
583
  raise NotFoundError(
528
584
  headers=dict(_response.headers),
529
585
  body=typing.cast(
530
- ActualErrorResponse,
586
+ typing.Optional[typing.Any],
531
587
  parse_obj_as(
532
- type_=ActualErrorResponse, # type: ignore
588
+ type_=typing.Optional[typing.Any], # type: ignore
533
589
  object_=_response.json(),
534
590
  ),
535
591
  ),
@@ -549,9 +605,9 @@ class RawEmbeddingsClient:
549
605
  raise InternalServerError(
550
606
  headers=dict(_response.headers),
551
607
  body=typing.cast(
552
- ActualErrorResponse,
608
+ typing.Optional[typing.Any],
553
609
  parse_obj_as(
554
- type_=ActualErrorResponse, # type: ignore
610
+ type_=typing.Optional[typing.Any], # type: ignore
555
611
  object_=_response.json(),
556
612
  ),
557
613
  ),
@@ -560,9 +616,9 @@ class RawEmbeddingsClient:
560
616
  raise ServiceUnavailableError(
561
617
  headers=dict(_response.headers),
562
618
  body=typing.cast(
563
- ActualErrorResponse,
619
+ typing.Optional[typing.Any],
564
620
  parse_obj_as(
565
- type_=ActualErrorResponse, # type: ignore
621
+ type_=typing.Optional[typing.Any], # type: ignore
566
622
  object_=_response.json(),
567
623
  ),
568
624
  ),
@@ -577,45 +633,58 @@ class AsyncRawEmbeddingsClient:
577
633
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
578
634
  self._client_wrapper = client_wrapper
579
635
 
580
- async def delete(
636
+ async def insert(
581
637
  self,
582
638
  *,
583
- chunk_ids: typing.Sequence[str],
584
639
  tenant_id: str,
640
+ embeddings: typing.Sequence[RawEmbeddingDocument],
585
641
  sub_tenant_id: typing.Optional[str] = OMIT,
642
+ upsert: typing.Optional[bool] = OMIT,
586
643
  request_options: typing.Optional[RequestOptions] = None,
587
- ) -> AsyncHttpResponse[EmbeddingsDeleteData]:
644
+ ) -> AsyncHttpResponse[InsertResult]:
588
645
  """
589
- Delete embedding chunks by chunk ID.
646
+ Upload pre-computed embeddings for advanced similarity search.
647
+
648
+ This endpoint accepts vector embeddings that you’ve generated externally,
649
+ allowing you to integrate with custom embedding models or existing vector databases.
650
+ The embeddings represent chunks of your content as numerical vectors.
590
651
 
591
- Use this to remove specific chunks from your embeddings index when they are no longer valid or should not appear in results.
652
+ The system stores these embeddings and makes them available for semantic search and similarity matching.
653
+ Use this when you want to leverage specialized embedding models or have existing vector representations.
654
+ When upsert=True, existing embeddings with the same chunk_id will be updated.
592
655
 
593
656
  Parameters
594
657
  ----------
595
- chunk_ids : typing.Sequence[str]
596
- The chunk IDs of the source you want to delete
597
-
598
658
  tenant_id : str
599
659
  Unique identifier for the tenant/organization
600
660
 
661
+ embeddings : typing.Sequence[RawEmbeddingDocument]
662
+ List of raw embedding documents to insert
663
+
601
664
  sub_tenant_id : typing.Optional[str]
602
665
  Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
603
666
 
667
+ upsert : typing.Optional[bool]
668
+ If True, update existing embeddings; if False, insert only
669
+
604
670
  request_options : typing.Optional[RequestOptions]
605
671
  Request-specific configuration.
606
672
 
607
673
  Returns
608
674
  -------
609
- AsyncHttpResponse[EmbeddingsDeleteData]
675
+ AsyncHttpResponse[InsertResult]
610
676
  Successful Response
611
677
  """
612
678
  _response = await self._client_wrapper.httpx_client.request(
613
- "embeddings/delete",
614
- method="DELETE",
679
+ "embeddings/insert-raw-embeddings",
680
+ method="POST",
615
681
  json={
616
- "chunk_ids": chunk_ids,
617
682
  "tenant_id": tenant_id,
618
683
  "sub_tenant_id": sub_tenant_id,
684
+ "embeddings": convert_and_respect_annotation_metadata(
685
+ object_=embeddings, annotation=typing.Sequence[RawEmbeddingDocument], direction="write"
686
+ ),
687
+ "upsert": upsert,
619
688
  },
620
689
  headers={
621
690
  "content-type": "application/json",
@@ -626,9 +695,9 @@ class AsyncRawEmbeddingsClient:
626
695
  try:
627
696
  if 200 <= _response.status_code < 300:
628
697
  _data = typing.cast(
629
- EmbeddingsDeleteData,
698
+ InsertResult,
630
699
  parse_obj_as(
631
- type_=EmbeddingsDeleteData, # type: ignore
700
+ type_=InsertResult, # type: ignore
632
701
  object_=_response.json(),
633
702
  ),
634
703
  )
@@ -637,9 +706,9 @@ class AsyncRawEmbeddingsClient:
637
706
  raise BadRequestError(
638
707
  headers=dict(_response.headers),
639
708
  body=typing.cast(
640
- ActualErrorResponse,
709
+ typing.Optional[typing.Any],
641
710
  parse_obj_as(
642
- type_=ActualErrorResponse, # type: ignore
711
+ type_=typing.Optional[typing.Any], # type: ignore
643
712
  object_=_response.json(),
644
713
  ),
645
714
  ),
@@ -648,9 +717,9 @@ class AsyncRawEmbeddingsClient:
648
717
  raise UnauthorizedError(
649
718
  headers=dict(_response.headers),
650
719
  body=typing.cast(
651
- ActualErrorResponse,
720
+ typing.Optional[typing.Any],
652
721
  parse_obj_as(
653
- type_=ActualErrorResponse, # type: ignore
722
+ type_=typing.Optional[typing.Any], # type: ignore
654
723
  object_=_response.json(),
655
724
  ),
656
725
  ),
@@ -659,9 +728,9 @@ class AsyncRawEmbeddingsClient:
659
728
  raise ForbiddenError(
660
729
  headers=dict(_response.headers),
661
730
  body=typing.cast(
662
- ActualErrorResponse,
731
+ typing.Optional[typing.Any],
663
732
  parse_obj_as(
664
- type_=ActualErrorResponse, # type: ignore
733
+ type_=typing.Optional[typing.Any], # type: ignore
665
734
  object_=_response.json(),
666
735
  ),
667
736
  ),
@@ -670,9 +739,9 @@ class AsyncRawEmbeddingsClient:
670
739
  raise NotFoundError(
671
740
  headers=dict(_response.headers),
672
741
  body=typing.cast(
673
- ActualErrorResponse,
742
+ typing.Optional[typing.Any],
674
743
  parse_obj_as(
675
- type_=ActualErrorResponse, # type: ignore
744
+ type_=typing.Optional[typing.Any], # type: ignore
676
745
  object_=_response.json(),
677
746
  ),
678
747
  ),
@@ -692,9 +761,9 @@ class AsyncRawEmbeddingsClient:
692
761
  raise InternalServerError(
693
762
  headers=dict(_response.headers),
694
763
  body=typing.cast(
695
- ActualErrorResponse,
764
+ typing.Optional[typing.Any],
696
765
  parse_obj_as(
697
- type_=ActualErrorResponse, # type: ignore
766
+ type_=typing.Optional[typing.Any], # type: ignore
698
767
  object_=_response.json(),
699
768
  ),
700
769
  ),
@@ -703,9 +772,9 @@ class AsyncRawEmbeddingsClient:
703
772
  raise ServiceUnavailableError(
704
773
  headers=dict(_response.headers),
705
774
  body=typing.cast(
706
- ActualErrorResponse,
775
+ typing.Optional[typing.Any],
707
776
  parse_obj_as(
708
- type_=ActualErrorResponse, # type: ignore
777
+ type_=typing.Optional[typing.Any], # type: ignore
709
778
  object_=_response.json(),
710
779
  ),
711
780
  ),
@@ -719,18 +788,19 @@ class AsyncRawEmbeddingsClient:
719
788
  self,
720
789
  *,
721
790
  tenant_id: str,
722
- embeddings: typing.Optional[typing.Sequence[float]] = OMIT,
723
- sub_tenant_id: typing.Optional[str] = OMIT,
724
- max_chunks: typing.Optional[int] = OMIT,
791
+ sub_tenant_id: str,
792
+ query_embedding: typing.Sequence[float],
793
+ limit: typing.Optional[int] = OMIT,
794
+ filter_expr: typing.Optional[str] = OMIT,
795
+ output_fields: typing.Optional[typing.Sequence[str]] = OMIT,
725
796
  request_options: typing.Optional[RequestOptions] = None,
726
- ) -> AsyncHttpResponse[EmbeddingsSearchData]:
797
+ ) -> AsyncHttpResponse[typing.List[RawEmbeddingSearchResult]]:
727
798
  """
728
799
  Find similar chunks using an embedding vector.
729
800
 
730
801
  Use this to retrieve the most similar chunk IDs to a single query embedding.
731
802
 
732
-
733
- Expected outcome
803
+ Expected outcome:
734
804
  - You receive the closest chunk IDs with optional similarity scores.
735
805
 
736
806
  Parameters
@@ -738,30 +808,39 @@ class AsyncRawEmbeddingsClient:
738
808
  tenant_id : str
739
809
  Unique identifier for the tenant/organization
740
810
 
741
- embeddings : typing.Optional[typing.Sequence[float]]
742
- The embedding vector for search
743
-
744
- sub_tenant_id : typing.Optional[str]
811
+ sub_tenant_id : str
745
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.
746
813
 
747
- max_chunks : typing.Optional[int]
814
+ query_embedding : typing.Sequence[float]
815
+ Query embedding vector to search for
816
+
817
+ limit : typing.Optional[int]
818
+ Maximum number of results to return
819
+
820
+ filter_expr : typing.Optional[str]
821
+ Optional Milvus filter expression for additional filtering
822
+
823
+ output_fields : typing.Optional[typing.Sequence[str]]
824
+ Optional list of fields to return in results (default: chunk_id, source_id, metadata)
748
825
 
749
826
  request_options : typing.Optional[RequestOptions]
750
827
  Request-specific configuration.
751
828
 
752
829
  Returns
753
830
  -------
754
- AsyncHttpResponse[EmbeddingsSearchData]
831
+ AsyncHttpResponse[typing.List[RawEmbeddingSearchResult]]
755
832
  Successful Response
756
833
  """
757
834
  _response = await self._client_wrapper.httpx_client.request(
758
- "embeddings/search",
835
+ "embeddings/search-raw-embeddings",
759
836
  method="POST",
760
837
  json={
761
838
  "tenant_id": tenant_id,
762
- "embeddings": embeddings,
763
839
  "sub_tenant_id": sub_tenant_id,
764
- "max_chunks": max_chunks,
840
+ "query_embedding": query_embedding,
841
+ "limit": limit,
842
+ "filter_expr": filter_expr,
843
+ "output_fields": output_fields,
765
844
  },
766
845
  headers={
767
846
  "content-type": "application/json",
@@ -772,9 +851,9 @@ class AsyncRawEmbeddingsClient:
772
851
  try:
773
852
  if 200 <= _response.status_code < 300:
774
853
  _data = typing.cast(
775
- EmbeddingsSearchData,
854
+ typing.List[RawEmbeddingSearchResult],
776
855
  parse_obj_as(
777
- type_=EmbeddingsSearchData, # type: ignore
856
+ type_=typing.List[RawEmbeddingSearchResult], # type: ignore
778
857
  object_=_response.json(),
779
858
  ),
780
859
  )
@@ -783,9 +862,9 @@ class AsyncRawEmbeddingsClient:
783
862
  raise BadRequestError(
784
863
  headers=dict(_response.headers),
785
864
  body=typing.cast(
786
- ActualErrorResponse,
865
+ typing.Optional[typing.Any],
787
866
  parse_obj_as(
788
- type_=ActualErrorResponse, # type: ignore
867
+ type_=typing.Optional[typing.Any], # type: ignore
789
868
  object_=_response.json(),
790
869
  ),
791
870
  ),
@@ -794,9 +873,9 @@ class AsyncRawEmbeddingsClient:
794
873
  raise UnauthorizedError(
795
874
  headers=dict(_response.headers),
796
875
  body=typing.cast(
797
- ActualErrorResponse,
876
+ typing.Optional[typing.Any],
798
877
  parse_obj_as(
799
- type_=ActualErrorResponse, # type: ignore
878
+ type_=typing.Optional[typing.Any], # type: ignore
800
879
  object_=_response.json(),
801
880
  ),
802
881
  ),
@@ -805,9 +884,9 @@ class AsyncRawEmbeddingsClient:
805
884
  raise ForbiddenError(
806
885
  headers=dict(_response.headers),
807
886
  body=typing.cast(
808
- ActualErrorResponse,
887
+ typing.Optional[typing.Any],
809
888
  parse_obj_as(
810
- type_=ActualErrorResponse, # type: ignore
889
+ type_=typing.Optional[typing.Any], # type: ignore
811
890
  object_=_response.json(),
812
891
  ),
813
892
  ),
@@ -816,9 +895,9 @@ class AsyncRawEmbeddingsClient:
816
895
  raise NotFoundError(
817
896
  headers=dict(_response.headers),
818
897
  body=typing.cast(
819
- ActualErrorResponse,
898
+ typing.Optional[typing.Any],
820
899
  parse_obj_as(
821
- type_=ActualErrorResponse, # type: ignore
900
+ type_=typing.Optional[typing.Any], # type: ignore
822
901
  object_=_response.json(),
823
902
  ),
824
903
  ),
@@ -838,9 +917,9 @@ class AsyncRawEmbeddingsClient:
838
917
  raise InternalServerError(
839
918
  headers=dict(_response.headers),
840
919
  body=typing.cast(
841
- ActualErrorResponse,
920
+ typing.Optional[typing.Any],
842
921
  parse_obj_as(
843
- type_=ActualErrorResponse, # type: ignore
922
+ type_=typing.Optional[typing.Any], # type: ignore
844
923
  object_=_response.json(),
845
924
  ),
846
925
  ),
@@ -849,9 +928,9 @@ class AsyncRawEmbeddingsClient:
849
928
  raise ServiceUnavailableError(
850
929
  headers=dict(_response.headers),
851
930
  body=typing.cast(
852
- ActualErrorResponse,
931
+ typing.Optional[typing.Any],
853
932
  parse_obj_as(
854
- type_=ActualErrorResponse, # type: ignore
933
+ type_=typing.Optional[typing.Any], # type: ignore
855
934
  object_=_response.json(),
856
935
  ),
857
936
  ),
@@ -861,45 +940,59 @@ class AsyncRawEmbeddingsClient:
861
940
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
862
941
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
863
942
 
864
- async def get_by_chunk_ids(
943
+ async def filter(
865
944
  self,
866
945
  *,
867
- chunk_ids: typing.Sequence[str],
868
946
  tenant_id: str,
869
- sub_tenant_id: typing.Optional[str] = OMIT,
947
+ sub_tenant_id: str,
948
+ source_id: typing.Optional[str] = OMIT,
949
+ chunk_ids: typing.Optional[typing.Sequence[str]] = OMIT,
950
+ output_fields: typing.Optional[typing.Sequence[str]] = OMIT,
951
+ limit: typing.Optional[int] = OMIT,
870
952
  request_options: typing.Optional[RequestOptions] = None,
871
- ) -> AsyncHttpResponse[EmbeddingsGetData]:
953
+ ) -> AsyncHttpResponse[typing.List[RawEmbeddingSearchResult]]:
872
954
  """
873
955
  Retrieve embeddings for specific chunk IDs.
874
-
875
956
  Use this when you already know the chunk IDs and need their corresponding embeddings.
876
957
 
877
958
  Parameters
878
959
  ----------
879
- chunk_ids : typing.Sequence[str]
880
- The chunk IDs of the source you want to get embeddings for
881
-
882
960
  tenant_id : str
883
961
  Unique identifier for the tenant/organization
884
962
 
885
- sub_tenant_id : typing.Optional[str]
963
+ sub_tenant_id : str
886
964
  Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
887
965
 
966
+ source_id : typing.Optional[str]
967
+ Optional source ID to filter by (mutually exclusive with chunk_ids)
968
+
969
+ chunk_ids : typing.Optional[typing.Sequence[str]]
970
+ Optional list of chunk IDs to filter by (mutually exclusive with source_id)
971
+
972
+ output_fields : typing.Optional[typing.Sequence[str]]
973
+ Optional list of fields to return in results (default: chunk_id, source_id, metadata)
974
+
975
+ limit : typing.Optional[int]
976
+ Maximum number of results to return
977
+
888
978
  request_options : typing.Optional[RequestOptions]
889
979
  Request-specific configuration.
890
980
 
891
981
  Returns
892
982
  -------
893
- AsyncHttpResponse[EmbeddingsGetData]
983
+ AsyncHttpResponse[typing.List[RawEmbeddingSearchResult]]
894
984
  Successful Response
895
985
  """
896
986
  _response = await self._client_wrapper.httpx_client.request(
897
- "embeddings/retrieve_by_ids",
987
+ "embeddings/filter-raw-embeddings",
898
988
  method="POST",
899
989
  json={
900
- "chunk_ids": chunk_ids,
901
990
  "tenant_id": tenant_id,
902
991
  "sub_tenant_id": sub_tenant_id,
992
+ "source_id": source_id,
993
+ "chunk_ids": chunk_ids,
994
+ "output_fields": output_fields,
995
+ "limit": limit,
903
996
  },
904
997
  headers={
905
998
  "content-type": "application/json",
@@ -910,9 +1003,9 @@ class AsyncRawEmbeddingsClient:
910
1003
  try:
911
1004
  if 200 <= _response.status_code < 300:
912
1005
  _data = typing.cast(
913
- EmbeddingsGetData,
1006
+ typing.List[RawEmbeddingSearchResult],
914
1007
  parse_obj_as(
915
- type_=EmbeddingsGetData, # type: ignore
1008
+ type_=typing.List[RawEmbeddingSearchResult], # type: ignore
916
1009
  object_=_response.json(),
917
1010
  ),
918
1011
  )
@@ -921,9 +1014,9 @@ class AsyncRawEmbeddingsClient:
921
1014
  raise BadRequestError(
922
1015
  headers=dict(_response.headers),
923
1016
  body=typing.cast(
924
- ActualErrorResponse,
1017
+ typing.Optional[typing.Any],
925
1018
  parse_obj_as(
926
- type_=ActualErrorResponse, # type: ignore
1019
+ type_=typing.Optional[typing.Any], # type: ignore
927
1020
  object_=_response.json(),
928
1021
  ),
929
1022
  ),
@@ -932,9 +1025,9 @@ class AsyncRawEmbeddingsClient:
932
1025
  raise UnauthorizedError(
933
1026
  headers=dict(_response.headers),
934
1027
  body=typing.cast(
935
- ActualErrorResponse,
1028
+ typing.Optional[typing.Any],
936
1029
  parse_obj_as(
937
- type_=ActualErrorResponse, # type: ignore
1030
+ type_=typing.Optional[typing.Any], # type: ignore
938
1031
  object_=_response.json(),
939
1032
  ),
940
1033
  ),
@@ -943,9 +1036,9 @@ class AsyncRawEmbeddingsClient:
943
1036
  raise ForbiddenError(
944
1037
  headers=dict(_response.headers),
945
1038
  body=typing.cast(
946
- ActualErrorResponse,
1039
+ typing.Optional[typing.Any],
947
1040
  parse_obj_as(
948
- type_=ActualErrorResponse, # type: ignore
1041
+ type_=typing.Optional[typing.Any], # type: ignore
949
1042
  object_=_response.json(),
950
1043
  ),
951
1044
  ),
@@ -954,9 +1047,9 @@ class AsyncRawEmbeddingsClient:
954
1047
  raise NotFoundError(
955
1048
  headers=dict(_response.headers),
956
1049
  body=typing.cast(
957
- ActualErrorResponse,
1050
+ typing.Optional[typing.Any],
958
1051
  parse_obj_as(
959
- type_=ActualErrorResponse, # type: ignore
1052
+ type_=typing.Optional[typing.Any], # type: ignore
960
1053
  object_=_response.json(),
961
1054
  ),
962
1055
  ),
@@ -976,9 +1069,9 @@ class AsyncRawEmbeddingsClient:
976
1069
  raise InternalServerError(
977
1070
  headers=dict(_response.headers),
978
1071
  body=typing.cast(
979
- ActualErrorResponse,
1072
+ typing.Optional[typing.Any],
980
1073
  parse_obj_as(
981
- type_=ActualErrorResponse, # type: ignore
1074
+ type_=typing.Optional[typing.Any], # type: ignore
982
1075
  object_=_response.json(),
983
1076
  ),
984
1077
  ),
@@ -987,9 +1080,9 @@ class AsyncRawEmbeddingsClient:
987
1080
  raise ServiceUnavailableError(
988
1081
  headers=dict(_response.headers),
989
1082
  body=typing.cast(
990
- ActualErrorResponse,
1083
+ typing.Optional[typing.Any],
991
1084
  parse_obj_as(
992
- type_=ActualErrorResponse, # type: ignore
1085
+ type_=typing.Optional[typing.Any], # type: ignore
993
1086
  object_=_response.json(),
994
1087
  ),
995
1088
  ),
@@ -999,41 +1092,60 @@ class AsyncRawEmbeddingsClient:
999
1092
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1000
1093
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1001
1094
 
1002
- async def create_collection(
1003
- self, *, tenant_id: str, request_options: typing.Optional[RequestOptions] = None
1004
- ) -> AsyncHttpResponse[EmbeddingsCreateCollectionData]:
1095
+ async def delete(
1096
+ self,
1097
+ *,
1098
+ tenant_id: str,
1099
+ sub_tenant_id: typing.Optional[str] = None,
1100
+ source_id: typing.Optional[str] = None,
1101
+ chunk_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
1102
+ request_options: typing.Optional[RequestOptions] = None,
1103
+ ) -> AsyncHttpResponse[DeleteResult]:
1005
1104
  """
1006
- Create an embeddings collection for a tenant.
1105
+ Delete embedding chunks by chunk ID.
1007
1106
 
1008
- Use this to initialize storage so you can index and query embeddings for the tenant.
1107
+ Use this to remove specific chunks from your embeddings index when they are no longer
1108
+ valid or should not appear in results.
1009
1109
 
1010
1110
  Parameters
1011
1111
  ----------
1012
1112
  tenant_id : str
1013
1113
  Unique identifier for the tenant/organization
1014
1114
 
1115
+ sub_tenant_id : typing.Optional[str]
1116
+ Optional sub-tenant ID for scoping deletion
1117
+
1118
+ source_id : typing.Optional[str]
1119
+ Optional source ID to delete by (mutually exclusive with chunk_ids)
1120
+
1121
+ chunk_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
1122
+ Optional list of chunk IDs to delete (mutually exclusive with source_id)
1123
+
1015
1124
  request_options : typing.Optional[RequestOptions]
1016
1125
  Request-specific configuration.
1017
1126
 
1018
1127
  Returns
1019
1128
  -------
1020
- AsyncHttpResponse[EmbeddingsCreateCollectionData]
1129
+ AsyncHttpResponse[DeleteResult]
1021
1130
  Successful Response
1022
1131
  """
1023
1132
  _response = await self._client_wrapper.httpx_client.request(
1024
- "embeddings/create_tenant",
1025
- method="POST",
1133
+ "embeddings/delete-raw-embeddings",
1134
+ method="DELETE",
1026
1135
  params={
1027
1136
  "tenant_id": tenant_id,
1137
+ "sub_tenant_id": sub_tenant_id,
1138
+ "source_id": source_id,
1139
+ "chunk_ids": chunk_ids,
1028
1140
  },
1029
1141
  request_options=request_options,
1030
1142
  )
1031
1143
  try:
1032
1144
  if 200 <= _response.status_code < 300:
1033
1145
  _data = typing.cast(
1034
- EmbeddingsCreateCollectionData,
1146
+ DeleteResult,
1035
1147
  parse_obj_as(
1036
- type_=EmbeddingsCreateCollectionData, # type: ignore
1148
+ type_=DeleteResult, # type: ignore
1037
1149
  object_=_response.json(),
1038
1150
  ),
1039
1151
  )
@@ -1042,9 +1154,9 @@ class AsyncRawEmbeddingsClient:
1042
1154
  raise BadRequestError(
1043
1155
  headers=dict(_response.headers),
1044
1156
  body=typing.cast(
1045
- ActualErrorResponse,
1157
+ typing.Optional[typing.Any],
1046
1158
  parse_obj_as(
1047
- type_=ActualErrorResponse, # type: ignore
1159
+ type_=typing.Optional[typing.Any], # type: ignore
1048
1160
  object_=_response.json(),
1049
1161
  ),
1050
1162
  ),
@@ -1053,9 +1165,9 @@ class AsyncRawEmbeddingsClient:
1053
1165
  raise UnauthorizedError(
1054
1166
  headers=dict(_response.headers),
1055
1167
  body=typing.cast(
1056
- ActualErrorResponse,
1168
+ typing.Optional[typing.Any],
1057
1169
  parse_obj_as(
1058
- type_=ActualErrorResponse, # type: ignore
1170
+ type_=typing.Optional[typing.Any], # type: ignore
1059
1171
  object_=_response.json(),
1060
1172
  ),
1061
1173
  ),
@@ -1064,9 +1176,9 @@ class AsyncRawEmbeddingsClient:
1064
1176
  raise ForbiddenError(
1065
1177
  headers=dict(_response.headers),
1066
1178
  body=typing.cast(
1067
- ActualErrorResponse,
1179
+ typing.Optional[typing.Any],
1068
1180
  parse_obj_as(
1069
- type_=ActualErrorResponse, # type: ignore
1181
+ type_=typing.Optional[typing.Any], # type: ignore
1070
1182
  object_=_response.json(),
1071
1183
  ),
1072
1184
  ),
@@ -1075,9 +1187,9 @@ class AsyncRawEmbeddingsClient:
1075
1187
  raise NotFoundError(
1076
1188
  headers=dict(_response.headers),
1077
1189
  body=typing.cast(
1078
- ActualErrorResponse,
1190
+ typing.Optional[typing.Any],
1079
1191
  parse_obj_as(
1080
- type_=ActualErrorResponse, # type: ignore
1192
+ type_=typing.Optional[typing.Any], # type: ignore
1081
1193
  object_=_response.json(),
1082
1194
  ),
1083
1195
  ),
@@ -1097,9 +1209,9 @@ class AsyncRawEmbeddingsClient:
1097
1209
  raise InternalServerError(
1098
1210
  headers=dict(_response.headers),
1099
1211
  body=typing.cast(
1100
- ActualErrorResponse,
1212
+ typing.Optional[typing.Any],
1101
1213
  parse_obj_as(
1102
- type_=ActualErrorResponse, # type: ignore
1214
+ type_=typing.Optional[typing.Any], # type: ignore
1103
1215
  object_=_response.json(),
1104
1216
  ),
1105
1217
  ),
@@ -1108,9 +1220,9 @@ class AsyncRawEmbeddingsClient:
1108
1220
  raise ServiceUnavailableError(
1109
1221
  headers=dict(_response.headers),
1110
1222
  body=typing.cast(
1111
- ActualErrorResponse,
1223
+ typing.Optional[typing.Any],
1112
1224
  parse_obj_as(
1113
- type_=ActualErrorResponse, # type: ignore
1225
+ type_=typing.Optional[typing.Any], # type: ignore
1114
1226
  object_=_response.json(),
1115
1227
  ),
1116
1228
  ),