usecortex-ai 0.3.6__py3-none-any.whl → 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. usecortex_ai/__init__.py +80 -70
  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 +74 -66
  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/path_triplet.py +3 -18
  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 +24 -5
  52. usecortex_ai/types/retrieval_result.py +26 -0
  53. usecortex_ai/types/scored_path_response.py +5 -19
  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/{webpage_scrape_request.py → tenant_info.py} +10 -5
  67. usecortex_ai/types/{scored_triplet_response.py → tenant_metadata_schema_info.py} +8 -15
  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} +5 -1
  70. usecortex_ai/types/user_assistant_pair.py +4 -0
  71. usecortex_ai/types/{search_chunk.py → vector_store_chunk.py} +3 -14
  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.6.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.6.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/chunk_graph_relations_response.py +0 -33
  86. usecortex_ai/types/delete_memory_request.py +0 -32
  87. usecortex_ai/types/delete_sub_tenant_data.py +0 -42
  88. usecortex_ai/types/embeddings_delete_data.py +0 -37
  89. usecortex_ai/types/embeddings_get_data.py +0 -37
  90. usecortex_ai/types/embeddings_search_data.py +0 -37
  91. usecortex_ai/types/extended_context.py +0 -17
  92. usecortex_ai/types/markdown_upload_request.py +0 -41
  93. usecortex_ai/types/related_chunk.py +0 -22
  94. usecortex_ai/types/retrieve_user_memory_response.py +0 -38
  95. usecortex_ai/types/source.py +0 -52
  96. usecortex_ai/types/sub_tenant_ids_data.py +0 -47
  97. usecortex_ai/types/tenant_stats.py +0 -42
  98. usecortex_ai/user/__init__.py +0 -4
  99. usecortex_ai/user/client.py +0 -145
  100. usecortex_ai/user/raw_client.py +0 -316
  101. usecortex_ai/user_memory/__init__.py +0 -4
  102. usecortex_ai/user_memory/client.py +0 -515
  103. usecortex_ai-0.3.6.dist-info/RECORD +0 -112
  104. /usecortex_ai/{document → dashboard}/__init__.py +0 -0
  105. {usecortex_ai-0.3.6.dist-info → usecortex_ai-0.4.0.dist-info}/licenses/LICENSE +0 -0
  106. {usecortex_ai-0.3.6.dist-info → usecortex_ai-0.4.0.dist-info}/top_level.txt +0 -0
@@ -4,10 +4,10 @@ import typing
4
4
 
5
5
  from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
6
  from ..core.request_options import RequestOptions
7
- from ..types.embeddings_create_collection_data import EmbeddingsCreateCollectionData
8
- from ..types.embeddings_delete_data import EmbeddingsDeleteData
9
- from ..types.embeddings_get_data import EmbeddingsGetData
10
- from ..types.embeddings_search_data import EmbeddingsSearchData
7
+ from ..types.delete_result import DeleteResult
8
+ from ..types.insert_result import InsertResult
9
+ from ..types.raw_embedding_document import RawEmbeddingDocument
10
+ from ..types.raw_embedding_search_result import RawEmbeddingSearchResult
11
11
  from .raw_client import AsyncRawEmbeddingsClient, RawEmbeddingsClient
12
12
 
13
13
  # this is used as the default value for optional parameters
@@ -29,47 +29,61 @@ class EmbeddingsClient:
29
29
  """
30
30
  return self._raw_client
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
- ) -> EmbeddingsDeleteData:
40
+ ) -> 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
- EmbeddingsDeleteData
71
+ InsertResult
62
72
  Successful Response
63
73
 
64
74
  Examples
65
75
  --------
66
- from usecortex-ai import CortexAI
76
+ from usecortex-ai import CortexAI, RawEmbeddingDocument, RawEmbeddingVector
67
77
 
68
78
  client = CortexAI(token="YOUR_TOKEN", )
69
- client.embeddings.delete(chunk_ids=['CortexEmbeddings123_0', 'CortexEmbeddings123_1'], tenant_id='tenant_1234', )
79
+ client.embeddings.insert(tenant_id='tenant_id', embeddings=[RawEmbeddingDocument(source_id='source_id', embeddings=[RawEmbeddingVector(chunk_id='chunk_id', embedding=[1.1], )], )], )
70
80
  """
71
- _response = self._raw_client.delete(
72
- chunk_ids=chunk_ids, tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
81
+ _response = self._raw_client.insert(
82
+ tenant_id=tenant_id,
83
+ embeddings=embeddings,
84
+ sub_tenant_id=sub_tenant_id,
85
+ upsert=upsert,
86
+ request_options=request_options,
73
87
  )
74
88
  return _response.data
75
89
 
@@ -77,18 +91,19 @@ class EmbeddingsClient:
77
91
  self,
78
92
  *,
79
93
  tenant_id: str,
80
- embeddings: typing.Optional[typing.Sequence[float]] = OMIT,
81
- sub_tenant_id: typing.Optional[str] = OMIT,
82
- max_chunks: typing.Optional[int] = OMIT,
94
+ sub_tenant_id: str,
95
+ query_embedding: typing.Sequence[float],
96
+ limit: typing.Optional[int] = OMIT,
97
+ filter_expr: typing.Optional[str] = OMIT,
98
+ output_fields: typing.Optional[typing.Sequence[str]] = OMIT,
83
99
  request_options: typing.Optional[RequestOptions] = None,
84
- ) -> EmbeddingsSearchData:
100
+ ) -> typing.List[RawEmbeddingSearchResult]:
85
101
  """
86
102
  Find similar chunks using an embedding vector.
87
103
 
88
104
  Use this to retrieve the most similar chunk IDs to a single query embedding.
89
105
 
90
-
91
- Expected outcome
106
+ Expected outcome:
92
107
  - You receive the closest chunk IDs with optional similarity scores.
93
108
 
94
109
  Parameters
@@ -96,20 +111,27 @@ class EmbeddingsClient:
96
111
  tenant_id : str
97
112
  Unique identifier for the tenant/organization
98
113
 
99
- embeddings : typing.Optional[typing.Sequence[float]]
100
- The embedding vector for search
101
-
102
- sub_tenant_id : typing.Optional[str]
114
+ sub_tenant_id : str
103
115
  Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
104
116
 
105
- max_chunks : typing.Optional[int]
117
+ query_embedding : typing.Sequence[float]
118
+ Query embedding vector to search for
119
+
120
+ limit : typing.Optional[int]
121
+ Maximum number of results to return
122
+
123
+ filter_expr : typing.Optional[str]
124
+ Optional Milvus filter expression for additional filtering
125
+
126
+ output_fields : typing.Optional[typing.Sequence[str]]
127
+ Optional list of fields to return in results (default: chunk_id, source_id, metadata)
106
128
 
107
129
  request_options : typing.Optional[RequestOptions]
108
130
  Request-specific configuration.
109
131
 
110
132
  Returns
111
133
  -------
112
- EmbeddingsSearchData
134
+ typing.List[RawEmbeddingSearchResult]
113
135
  Successful Response
114
136
 
115
137
  Examples
@@ -117,47 +139,60 @@ class EmbeddingsClient:
117
139
  from usecortex-ai import CortexAI
118
140
 
119
141
  client = CortexAI(token="YOUR_TOKEN", )
120
- client.embeddings.search(tenant_id='tenant_1234', )
142
+ client.embeddings.search(tenant_id='tenant_id', sub_tenant_id='sub_tenant_id', query_embedding=[1.1], )
121
143
  """
122
144
  _response = self._raw_client.search(
123
145
  tenant_id=tenant_id,
124
- embeddings=embeddings,
125
146
  sub_tenant_id=sub_tenant_id,
126
- max_chunks=max_chunks,
147
+ query_embedding=query_embedding,
148
+ limit=limit,
149
+ filter_expr=filter_expr,
150
+ output_fields=output_fields,
127
151
  request_options=request_options,
128
152
  )
129
153
  return _response.data
130
154
 
131
- def get_by_chunk_ids(
155
+ def filter(
132
156
  self,
133
157
  *,
134
- chunk_ids: typing.Sequence[str],
135
158
  tenant_id: str,
136
- sub_tenant_id: typing.Optional[str] = OMIT,
159
+ sub_tenant_id: str,
160
+ source_id: typing.Optional[str] = OMIT,
161
+ chunk_ids: typing.Optional[typing.Sequence[str]] = OMIT,
162
+ output_fields: typing.Optional[typing.Sequence[str]] = OMIT,
163
+ limit: typing.Optional[int] = OMIT,
137
164
  request_options: typing.Optional[RequestOptions] = None,
138
- ) -> EmbeddingsGetData:
165
+ ) -> typing.List[RawEmbeddingSearchResult]:
139
166
  """
140
167
  Retrieve embeddings for specific chunk IDs.
141
-
142
168
  Use this when you already know the chunk IDs and need their corresponding embeddings.
143
169
 
144
170
  Parameters
145
171
  ----------
146
- chunk_ids : typing.Sequence[str]
147
- The chunk IDs of the source you want to get embeddings for
148
-
149
172
  tenant_id : str
150
173
  Unique identifier for the tenant/organization
151
174
 
152
- sub_tenant_id : typing.Optional[str]
175
+ sub_tenant_id : str
153
176
  Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
154
177
 
178
+ source_id : typing.Optional[str]
179
+ Optional source ID to filter by (mutually exclusive with chunk_ids)
180
+
181
+ chunk_ids : typing.Optional[typing.Sequence[str]]
182
+ Optional list of chunk IDs to filter by (mutually exclusive with source_id)
183
+
184
+ output_fields : typing.Optional[typing.Sequence[str]]
185
+ Optional list of fields to return in results (default: chunk_id, source_id, metadata)
186
+
187
+ limit : typing.Optional[int]
188
+ Maximum number of results to return
189
+
155
190
  request_options : typing.Optional[RequestOptions]
156
191
  Request-specific configuration.
157
192
 
158
193
  Returns
159
194
  -------
160
- EmbeddingsGetData
195
+ typing.List[RawEmbeddingSearchResult]
161
196
  Successful Response
162
197
 
163
198
  Examples
@@ -165,32 +200,54 @@ class EmbeddingsClient:
165
200
  from usecortex-ai import CortexAI
166
201
 
167
202
  client = CortexAI(token="YOUR_TOKEN", )
168
- client.embeddings.get_by_chunk_ids(chunk_ids=['CortexEmbeddings123_0', 'CortexEmbeddings123_1'], tenant_id='tenant_1234', )
203
+ client.embeddings.filter(tenant_id='tenant_id', sub_tenant_id='sub_tenant_id', )
169
204
  """
170
- _response = self._raw_client.get_by_chunk_ids(
171
- chunk_ids=chunk_ids, tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
205
+ _response = self._raw_client.filter(
206
+ tenant_id=tenant_id,
207
+ sub_tenant_id=sub_tenant_id,
208
+ source_id=source_id,
209
+ chunk_ids=chunk_ids,
210
+ output_fields=output_fields,
211
+ limit=limit,
212
+ request_options=request_options,
172
213
  )
173
214
  return _response.data
174
215
 
175
- def create_collection(
176
- self, *, tenant_id: str, request_options: typing.Optional[RequestOptions] = None
177
- ) -> EmbeddingsCreateCollectionData:
216
+ def delete(
217
+ self,
218
+ *,
219
+ tenant_id: str,
220
+ sub_tenant_id: typing.Optional[str] = None,
221
+ source_id: typing.Optional[str] = None,
222
+ chunk_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
223
+ request_options: typing.Optional[RequestOptions] = None,
224
+ ) -> DeleteResult:
178
225
  """
179
- Create an embeddings collection for a tenant.
226
+ Delete embedding chunks by chunk ID.
180
227
 
181
- Use this to initialize storage so you can index and query embeddings for the tenant.
228
+ Use this to remove specific chunks from your embeddings index when they are no longer
229
+ valid or should not appear in results.
182
230
 
183
231
  Parameters
184
232
  ----------
185
233
  tenant_id : str
186
234
  Unique identifier for the tenant/organization
187
235
 
236
+ sub_tenant_id : typing.Optional[str]
237
+ Optional sub-tenant ID for scoping deletion
238
+
239
+ source_id : typing.Optional[str]
240
+ Optional source ID to delete by (mutually exclusive with chunk_ids)
241
+
242
+ chunk_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
243
+ Optional list of chunk IDs to delete (mutually exclusive with source_id)
244
+
188
245
  request_options : typing.Optional[RequestOptions]
189
246
  Request-specific configuration.
190
247
 
191
248
  Returns
192
249
  -------
193
- EmbeddingsCreateCollectionData
250
+ DeleteResult
194
251
  Successful Response
195
252
 
196
253
  Examples
@@ -198,9 +255,15 @@ class EmbeddingsClient:
198
255
  from usecortex-ai import CortexAI
199
256
 
200
257
  client = CortexAI(token="YOUR_TOKEN", )
201
- client.embeddings.create_collection(tenant_id='tenant_1234', )
258
+ client.embeddings.delete(tenant_id='tenant_id', )
202
259
  """
203
- _response = self._raw_client.create_collection(tenant_id=tenant_id, request_options=request_options)
260
+ _response = self._raw_client.delete(
261
+ tenant_id=tenant_id,
262
+ sub_tenant_id=sub_tenant_id,
263
+ source_id=source_id,
264
+ chunk_ids=chunk_ids,
265
+ request_options=request_options,
266
+ )
204
267
  return _response.data
205
268
 
206
269
 
@@ -219,51 +282,66 @@ class AsyncEmbeddingsClient:
219
282
  """
220
283
  return self._raw_client
221
284
 
222
- async def delete(
285
+ async def insert(
223
286
  self,
224
287
  *,
225
- chunk_ids: typing.Sequence[str],
226
288
  tenant_id: str,
289
+ embeddings: typing.Sequence[RawEmbeddingDocument],
227
290
  sub_tenant_id: typing.Optional[str] = OMIT,
291
+ upsert: typing.Optional[bool] = OMIT,
228
292
  request_options: typing.Optional[RequestOptions] = None,
229
- ) -> EmbeddingsDeleteData:
293
+ ) -> InsertResult:
230
294
  """
231
- Delete embedding chunks by chunk ID.
295
+ Upload pre-computed embeddings for advanced similarity search.
296
+
297
+ This endpoint accepts vector embeddings that you’ve generated externally,
298
+ allowing you to integrate with custom embedding models or existing vector databases.
299
+ The embeddings represent chunks of your content as numerical vectors.
232
300
 
233
- Use this to remove specific chunks from your embeddings index when they are no longer valid or should not appear in results.
301
+ The system stores these embeddings and makes them available for semantic search and similarity matching.
302
+ Use this when you want to leverage specialized embedding models or have existing vector representations.
303
+ When upsert=True, existing embeddings with the same chunk_id will be updated.
234
304
 
235
305
  Parameters
236
306
  ----------
237
- chunk_ids : typing.Sequence[str]
238
- The chunk IDs of the source you want to delete
239
-
240
307
  tenant_id : str
241
308
  Unique identifier for the tenant/organization
242
309
 
310
+ embeddings : typing.Sequence[RawEmbeddingDocument]
311
+ List of raw embedding documents to insert
312
+
243
313
  sub_tenant_id : typing.Optional[str]
244
314
  Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
245
315
 
316
+ upsert : typing.Optional[bool]
317
+ If True, update existing embeddings; if False, insert only
318
+
246
319
  request_options : typing.Optional[RequestOptions]
247
320
  Request-specific configuration.
248
321
 
249
322
  Returns
250
323
  -------
251
- EmbeddingsDeleteData
324
+ InsertResult
252
325
  Successful Response
253
326
 
254
327
  Examples
255
328
  --------
256
329
  import asyncio
257
330
 
258
- from usecortex-ai import AsyncCortexAI
331
+ from usecortex-ai import (AsyncCortexAI, RawEmbeddingDocument,
332
+ RawEmbeddingVector)
259
333
 
260
334
  client = AsyncCortexAI(token="YOUR_TOKEN", )
261
335
  async def main() -> None:
262
- await client.embeddings.delete(chunk_ids=['CortexEmbeddings123_0', 'CortexEmbeddings123_1'], tenant_id='tenant_1234', )
336
+ await client.embeddings.insert(tenant_id='tenant_id', embeddings=[RawEmbeddingDocument(source_id='source_id', embeddings=[RawEmbeddingVector(chunk_id='chunk_id', embedding=[1.1], )], )], )
263
337
  asyncio.run(main())
264
338
  """
265
- _response = await self._raw_client.delete(
266
- chunk_ids=chunk_ids, tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
339
+ _response = await self._raw_client.insert(
340
+ tenant_id=tenant_id,
341
+ embeddings=embeddings,
342
+ sub_tenant_id=sub_tenant_id,
343
+ upsert=upsert,
344
+ request_options=request_options,
267
345
  )
268
346
  return _response.data
269
347
 
@@ -271,18 +349,19 @@ class AsyncEmbeddingsClient:
271
349
  self,
272
350
  *,
273
351
  tenant_id: str,
274
- embeddings: typing.Optional[typing.Sequence[float]] = OMIT,
275
- sub_tenant_id: typing.Optional[str] = OMIT,
276
- max_chunks: typing.Optional[int] = OMIT,
352
+ sub_tenant_id: str,
353
+ query_embedding: typing.Sequence[float],
354
+ limit: typing.Optional[int] = OMIT,
355
+ filter_expr: typing.Optional[str] = OMIT,
356
+ output_fields: typing.Optional[typing.Sequence[str]] = OMIT,
277
357
  request_options: typing.Optional[RequestOptions] = None,
278
- ) -> EmbeddingsSearchData:
358
+ ) -> typing.List[RawEmbeddingSearchResult]:
279
359
  """
280
360
  Find similar chunks using an embedding vector.
281
361
 
282
362
  Use this to retrieve the most similar chunk IDs to a single query embedding.
283
363
 
284
-
285
- Expected outcome
364
+ Expected outcome:
286
365
  - You receive the closest chunk IDs with optional similarity scores.
287
366
 
288
367
  Parameters
@@ -290,20 +369,27 @@ class AsyncEmbeddingsClient:
290
369
  tenant_id : str
291
370
  Unique identifier for the tenant/organization
292
371
 
293
- embeddings : typing.Optional[typing.Sequence[float]]
294
- The embedding vector for search
295
-
296
- sub_tenant_id : typing.Optional[str]
372
+ sub_tenant_id : str
297
373
  Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
298
374
 
299
- max_chunks : typing.Optional[int]
375
+ query_embedding : typing.Sequence[float]
376
+ Query embedding vector to search for
377
+
378
+ limit : typing.Optional[int]
379
+ Maximum number of results to return
380
+
381
+ filter_expr : typing.Optional[str]
382
+ Optional Milvus filter expression for additional filtering
383
+
384
+ output_fields : typing.Optional[typing.Sequence[str]]
385
+ Optional list of fields to return in results (default: chunk_id, source_id, metadata)
300
386
 
301
387
  request_options : typing.Optional[RequestOptions]
302
388
  Request-specific configuration.
303
389
 
304
390
  Returns
305
391
  -------
306
- EmbeddingsSearchData
392
+ typing.List[RawEmbeddingSearchResult]
307
393
  Successful Response
308
394
 
309
395
  Examples
@@ -314,48 +400,61 @@ class AsyncEmbeddingsClient:
314
400
 
315
401
  client = AsyncCortexAI(token="YOUR_TOKEN", )
316
402
  async def main() -> None:
317
- await client.embeddings.search(tenant_id='tenant_1234', )
403
+ await client.embeddings.search(tenant_id='tenant_id', sub_tenant_id='sub_tenant_id', query_embedding=[1.1], )
318
404
  asyncio.run(main())
319
405
  """
320
406
  _response = await self._raw_client.search(
321
407
  tenant_id=tenant_id,
322
- embeddings=embeddings,
323
408
  sub_tenant_id=sub_tenant_id,
324
- max_chunks=max_chunks,
409
+ query_embedding=query_embedding,
410
+ limit=limit,
411
+ filter_expr=filter_expr,
412
+ output_fields=output_fields,
325
413
  request_options=request_options,
326
414
  )
327
415
  return _response.data
328
416
 
329
- async def get_by_chunk_ids(
417
+ async def filter(
330
418
  self,
331
419
  *,
332
- chunk_ids: typing.Sequence[str],
333
420
  tenant_id: str,
334
- sub_tenant_id: typing.Optional[str] = OMIT,
421
+ sub_tenant_id: str,
422
+ source_id: typing.Optional[str] = OMIT,
423
+ chunk_ids: typing.Optional[typing.Sequence[str]] = OMIT,
424
+ output_fields: typing.Optional[typing.Sequence[str]] = OMIT,
425
+ limit: typing.Optional[int] = OMIT,
335
426
  request_options: typing.Optional[RequestOptions] = None,
336
- ) -> EmbeddingsGetData:
427
+ ) -> typing.List[RawEmbeddingSearchResult]:
337
428
  """
338
429
  Retrieve embeddings for specific chunk IDs.
339
-
340
430
  Use this when you already know the chunk IDs and need their corresponding embeddings.
341
431
 
342
432
  Parameters
343
433
  ----------
344
- chunk_ids : typing.Sequence[str]
345
- The chunk IDs of the source you want to get embeddings for
346
-
347
434
  tenant_id : str
348
435
  Unique identifier for the tenant/organization
349
436
 
350
- sub_tenant_id : typing.Optional[str]
437
+ sub_tenant_id : str
351
438
  Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
352
439
 
440
+ source_id : typing.Optional[str]
441
+ Optional source ID to filter by (mutually exclusive with chunk_ids)
442
+
443
+ chunk_ids : typing.Optional[typing.Sequence[str]]
444
+ Optional list of chunk IDs to filter by (mutually exclusive with source_id)
445
+
446
+ output_fields : typing.Optional[typing.Sequence[str]]
447
+ Optional list of fields to return in results (default: chunk_id, source_id, metadata)
448
+
449
+ limit : typing.Optional[int]
450
+ Maximum number of results to return
451
+
353
452
  request_options : typing.Optional[RequestOptions]
354
453
  Request-specific configuration.
355
454
 
356
455
  Returns
357
456
  -------
358
- EmbeddingsGetData
457
+ typing.List[RawEmbeddingSearchResult]
359
458
  Successful Response
360
459
 
361
460
  Examples
@@ -366,33 +465,55 @@ class AsyncEmbeddingsClient:
366
465
 
367
466
  client = AsyncCortexAI(token="YOUR_TOKEN", )
368
467
  async def main() -> None:
369
- await client.embeddings.get_by_chunk_ids(chunk_ids=['CortexEmbeddings123_0', 'CortexEmbeddings123_1'], tenant_id='tenant_1234', )
468
+ await client.embeddings.filter(tenant_id='tenant_id', sub_tenant_id='sub_tenant_id', )
370
469
  asyncio.run(main())
371
470
  """
372
- _response = await self._raw_client.get_by_chunk_ids(
373
- chunk_ids=chunk_ids, tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
471
+ _response = await self._raw_client.filter(
472
+ tenant_id=tenant_id,
473
+ sub_tenant_id=sub_tenant_id,
474
+ source_id=source_id,
475
+ chunk_ids=chunk_ids,
476
+ output_fields=output_fields,
477
+ limit=limit,
478
+ request_options=request_options,
374
479
  )
375
480
  return _response.data
376
481
 
377
- async def create_collection(
378
- self, *, tenant_id: str, request_options: typing.Optional[RequestOptions] = None
379
- ) -> EmbeddingsCreateCollectionData:
482
+ async def delete(
483
+ self,
484
+ *,
485
+ tenant_id: str,
486
+ sub_tenant_id: typing.Optional[str] = None,
487
+ source_id: typing.Optional[str] = None,
488
+ chunk_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
489
+ request_options: typing.Optional[RequestOptions] = None,
490
+ ) -> DeleteResult:
380
491
  """
381
- Create an embeddings collection for a tenant.
492
+ Delete embedding chunks by chunk ID.
382
493
 
383
- Use this to initialize storage so you can index and query embeddings for the tenant.
494
+ Use this to remove specific chunks from your embeddings index when they are no longer
495
+ valid or should not appear in results.
384
496
 
385
497
  Parameters
386
498
  ----------
387
499
  tenant_id : str
388
500
  Unique identifier for the tenant/organization
389
501
 
502
+ sub_tenant_id : typing.Optional[str]
503
+ Optional sub-tenant ID for scoping deletion
504
+
505
+ source_id : typing.Optional[str]
506
+ Optional source ID to delete by (mutually exclusive with chunk_ids)
507
+
508
+ chunk_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
509
+ Optional list of chunk IDs to delete (mutually exclusive with source_id)
510
+
390
511
  request_options : typing.Optional[RequestOptions]
391
512
  Request-specific configuration.
392
513
 
393
514
  Returns
394
515
  -------
395
- EmbeddingsCreateCollectionData
516
+ DeleteResult
396
517
  Successful Response
397
518
 
398
519
  Examples
@@ -403,8 +524,14 @@ class AsyncEmbeddingsClient:
403
524
 
404
525
  client = AsyncCortexAI(token="YOUR_TOKEN", )
405
526
  async def main() -> None:
406
- await client.embeddings.create_collection(tenant_id='tenant_1234', )
527
+ await client.embeddings.delete(tenant_id='tenant_id', )
407
528
  asyncio.run(main())
408
529
  """
409
- _response = await self._raw_client.create_collection(tenant_id=tenant_id, request_options=request_options)
530
+ _response = await self._raw_client.delete(
531
+ tenant_id=tenant_id,
532
+ sub_tenant_id=sub_tenant_id,
533
+ source_id=source_id,
534
+ chunk_ids=chunk_ids,
535
+ request_options=request_options,
536
+ )
410
537
  return _response.data