usecortex-ai 0.2.1__py3-none-any.whl → 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- usecortex_ai/__init__.py +18 -3
- usecortex_ai/client.py +3 -0
- 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 +48 -78
- usecortex_ai/embeddings/raw_client.py +44 -74
- usecortex_ai/fetch/client.py +2 -2
- usecortex_ai/search/client.py +88 -84
- usecortex_ai/search/raw_client.py +82 -78
- usecortex_ai/sources/client.py +26 -157
- usecortex_ai/sources/raw_client.py +22 -501
- usecortex_ai/tenant/client.py +154 -6
- 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 +23 -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 +29 -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 +486 -111
- usecortex_ai/upload/raw_client.py +458 -103
- usecortex_ai/user/client.py +30 -10
- usecortex_ai/user/raw_client.py +22 -6
- usecortex_ai/user_memory/client.py +200 -56
- usecortex_ai/user_memory/raw_client.py +921 -94
- {usecortex_ai-0.2.1.dist-info → usecortex_ai-0.3.0.dist-info}/METADATA +1 -1
- usecortex_ai-0.3.0.dist-info/RECORD +101 -0
- 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.3.0.dist-info}/WHEEL +0 -0
- {usecortex_ai-0.2.1.dist-info → usecortex_ai-0.3.0.dist-info}/licenses/LICENSE +0 -0
- {usecortex_ai-0.2.1.dist-info → usecortex_ai-0.3.0.dist-info}/top_level.txt +0 -0
|
@@ -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 used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
63
55
|
|
|
64
56
|
request_options : typing.Optional[RequestOptions]
|
|
65
57
|
Request-specific configuration.
|
|
@@ -74,7 +66,7 @@ class EmbeddingsClient:
|
|
|
74
66
|
from usecortex-ai import CortexAI
|
|
75
67
|
|
|
76
68
|
client = CortexAI(token="YOUR_TOKEN", )
|
|
77
|
-
client.embeddings.delete(chunk_ids=['
|
|
69
|
+
client.embeddings.delete(chunk_ids=['CortexEmbeddings123_0', 'CortexEmbeddings123_1'], tenant_id='tenant_1234', )
|
|
78
70
|
"""
|
|
79
71
|
_response = self._raw_client.delete(
|
|
80
72
|
chunk_ids=chunk_ids, tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
@@ -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 used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
117
104
|
|
|
118
105
|
max_chunks : typing.Optional[int]
|
|
119
106
|
|
|
@@ -130,7 +117,7 @@ class EmbeddingsClient:
|
|
|
130
117
|
from usecortex-ai import CortexAI
|
|
131
118
|
|
|
132
119
|
client = CortexAI(token="YOUR_TOKEN", )
|
|
133
|
-
client.embeddings.search(tenant_id='
|
|
120
|
+
client.embeddings.search(tenant_id='tenant_1234', )
|
|
134
121
|
"""
|
|
135
122
|
_response = self._raw_client.search(
|
|
136
123
|
tenant_id=tenant_id,
|
|
@@ -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 used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
167
154
|
|
|
168
155
|
request_options : typing.Optional[RequestOptions]
|
|
169
156
|
Request-specific configuration.
|
|
@@ -178,7 +165,7 @@ class EmbeddingsClient:
|
|
|
178
165
|
from usecortex-ai import CortexAI
|
|
179
166
|
|
|
180
167
|
client = CortexAI(token="YOUR_TOKEN", )
|
|
181
|
-
client.embeddings.get_by_chunk_ids(chunk_ids=['
|
|
168
|
+
client.embeddings.get_by_chunk_ids(chunk_ids=['CortexEmbeddings123_0', 'CortexEmbeddings123_1'], tenant_id='tenant_1234', )
|
|
182
169
|
"""
|
|
183
170
|
_response = self._raw_client.get_by_chunk_ids(
|
|
184
171
|
chunk_ids=chunk_ids, tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
|
|
@@ -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.
|
|
@@ -213,7 +198,7 @@ class EmbeddingsClient:
|
|
|
213
198
|
from usecortex-ai import CortexAI
|
|
214
199
|
|
|
215
200
|
client = CortexAI(token="YOUR_TOKEN", )
|
|
216
|
-
client.embeddings.create_collection(tenant_id='
|
|
201
|
+
client.embeddings.create_collection(tenant_id='tenant_1234', )
|
|
217
202
|
"""
|
|
218
203
|
_response = self._raw_client.create_collection(tenant_id=tenant_id, request_options=request_options)
|
|
219
204
|
return _response.data
|
|
@@ -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 used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
268
245
|
|
|
269
246
|
request_options : typing.Optional[RequestOptions]
|
|
270
247
|
Request-specific configuration.
|
|
@@ -282,7 +259,7 @@ class AsyncEmbeddingsClient:
|
|
|
282
259
|
|
|
283
260
|
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
284
261
|
async def main() -> None:
|
|
285
|
-
await client.embeddings.delete(chunk_ids=['
|
|
262
|
+
await client.embeddings.delete(chunk_ids=['CortexEmbeddings123_0', 'CortexEmbeddings123_1'], tenant_id='tenant_1234', )
|
|
286
263
|
asyncio.run(main())
|
|
287
264
|
"""
|
|
288
265
|
_response = await self._raw_client.delete(
|
|
@@ -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 used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
326
298
|
|
|
327
299
|
max_chunks : typing.Optional[int]
|
|
328
300
|
|
|
@@ -342,7 +314,7 @@ class AsyncEmbeddingsClient:
|
|
|
342
314
|
|
|
343
315
|
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
344
316
|
async def main() -> None:
|
|
345
|
-
await client.embeddings.search(tenant_id='
|
|
317
|
+
await client.embeddings.search(tenant_id='tenant_1234', )
|
|
346
318
|
asyncio.run(main())
|
|
347
319
|
"""
|
|
348
320
|
_response = await self._raw_client.search(
|
|
@@ -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 used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
380
352
|
|
|
381
353
|
request_options : typing.Optional[RequestOptions]
|
|
382
354
|
Request-specific configuration.
|
|
@@ -394,7 +366,7 @@ class AsyncEmbeddingsClient:
|
|
|
394
366
|
|
|
395
367
|
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
396
368
|
async def main() -> None:
|
|
397
|
-
await client.embeddings.get_by_chunk_ids(chunk_ids=['
|
|
369
|
+
await client.embeddings.get_by_chunk_ids(chunk_ids=['CortexEmbeddings123_0', 'CortexEmbeddings123_1'], tenant_id='tenant_1234', )
|
|
398
370
|
asyncio.run(main())
|
|
399
371
|
"""
|
|
400
372
|
_response = await self._raw_client.get_by_chunk_ids(
|
|
@@ -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.
|
|
@@ -433,7 +403,7 @@ class AsyncEmbeddingsClient:
|
|
|
433
403
|
|
|
434
404
|
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
435
405
|
async def main() -> None:
|
|
436
|
-
await client.embeddings.create_collection(tenant_id='
|
|
406
|
+
await client.embeddings.create_collection(tenant_id='tenant_1234', )
|
|
437
407
|
asyncio.run(main())
|
|
438
408
|
"""
|
|
439
409
|
_response = await self._raw_client.create_collection(tenant_id=tenant_id, request_options=request_options)
|
|
@@ -38,28 +38,20 @@ class RawEmbeddingsClient:
|
|
|
38
38
|
request_options: typing.Optional[RequestOptions] = None,
|
|
39
39
|
) -> HttpResponse[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 used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
63
55
|
|
|
64
56
|
request_options : typing.Optional[RequestOptions]
|
|
65
57
|
Request-specific configuration.
|
|
@@ -185,29 +177,24 @@ class RawEmbeddingsClient:
|
|
|
185
177
|
request_options: typing.Optional[RequestOptions] = None,
|
|
186
178
|
) -> HttpResponse[EmbeddingsSearchData]:
|
|
187
179
|
"""
|
|
188
|
-
|
|
180
|
+
Find similar chunks using an embedding vector.
|
|
189
181
|
|
|
190
|
-
|
|
191
|
-
and returns a list of the most similar chunk IDs based on vector similarity.
|
|
182
|
+
Use this to retrieve the most similar chunk IDs to a single query embedding.
|
|
192
183
|
|
|
193
|
-
Args:
|
|
194
|
-
request (EmbeddingsSearchRequest): The search request containing:
|
|
195
|
-
- embeddings (List[float]): Single embedding vector for similarity search
|
|
196
|
-
- tenant_id (str): Tenant identifier for multi-tenancy
|
|
197
|
-
- sub_tenant_id (str, optional): Sub-tenant identifier, defaults to tenant_id
|
|
198
|
-
- max_chunks (int, optional): Maximum number of chunk IDs to return (default: 10)
|
|
199
|
-
api_details (dict): Authentication details obtained from API key validation
|
|
200
184
|
|
|
201
|
-
|
|
202
|
-
|
|
185
|
+
Expected outcome
|
|
186
|
+
- You receive the closest chunk IDs with optional similarity scores.
|
|
203
187
|
|
|
204
188
|
Parameters
|
|
205
189
|
----------
|
|
206
190
|
tenant_id : str
|
|
191
|
+
Unique identifier for the tenant/organization
|
|
207
192
|
|
|
208
193
|
embeddings : typing.Optional[typing.Sequence[float]]
|
|
194
|
+
The embedding vector for search
|
|
209
195
|
|
|
210
196
|
sub_tenant_id : typing.Optional[str]
|
|
197
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
211
198
|
|
|
212
199
|
max_chunks : typing.Optional[int]
|
|
213
200
|
|
|
@@ -335,20 +322,20 @@ class RawEmbeddingsClient:
|
|
|
335
322
|
request_options: typing.Optional[RequestOptions] = None,
|
|
336
323
|
) -> HttpResponse[EmbeddingsGetData]:
|
|
337
324
|
"""
|
|
338
|
-
|
|
325
|
+
Retrieve embeddings for specific chunk IDs.
|
|
339
326
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
Returns:
|
|
343
|
-
EmbeddingsGetData: Embeddings data for the requested chunk IDs
|
|
327
|
+
Use this when you already know the chunk IDs and need their corresponding embeddings.
|
|
344
328
|
|
|
345
329
|
Parameters
|
|
346
330
|
----------
|
|
347
331
|
chunk_ids : typing.Sequence[str]
|
|
332
|
+
The chunk IDs of the source you want to get embeddings for
|
|
348
333
|
|
|
349
334
|
tenant_id : str
|
|
335
|
+
Unique identifier for the tenant/organization
|
|
350
336
|
|
|
351
337
|
sub_tenant_id : typing.Optional[str]
|
|
338
|
+
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
339
|
|
|
353
340
|
request_options : typing.Optional[RequestOptions]
|
|
354
341
|
Request-specific configuration.
|
|
@@ -359,7 +346,7 @@ class RawEmbeddingsClient:
|
|
|
359
346
|
Successful Response
|
|
360
347
|
"""
|
|
361
348
|
_response = self._client_wrapper.httpx_client.request(
|
|
362
|
-
"embeddings/
|
|
349
|
+
"embeddings/retrieve_by_ids",
|
|
363
350
|
method="POST",
|
|
364
351
|
json={
|
|
365
352
|
"chunk_ids": chunk_ids,
|
|
@@ -468,16 +455,14 @@ class RawEmbeddingsClient:
|
|
|
468
455
|
self, *, tenant_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
469
456
|
) -> HttpResponse[EmbeddingsCreateCollectionData]:
|
|
470
457
|
"""
|
|
471
|
-
Create an embeddings collection for
|
|
472
|
-
|
|
473
|
-
sub_tenant_id is set to be the same as tenant_id as per requirements.
|
|
458
|
+
Create an embeddings collection for a tenant.
|
|
474
459
|
|
|
475
|
-
|
|
476
|
-
EmbeddingsCreateCollectionData: Success response with collection details
|
|
460
|
+
Use this to initialize storage so you can index and query embeddings for the tenant.
|
|
477
461
|
|
|
478
462
|
Parameters
|
|
479
463
|
----------
|
|
480
464
|
tenant_id : str
|
|
465
|
+
Unique identifier for the tenant/organization
|
|
481
466
|
|
|
482
467
|
request_options : typing.Optional[RequestOptions]
|
|
483
468
|
Request-specific configuration.
|
|
@@ -488,7 +473,7 @@ class RawEmbeddingsClient:
|
|
|
488
473
|
Successful Response
|
|
489
474
|
"""
|
|
490
475
|
_response = self._client_wrapper.httpx_client.request(
|
|
491
|
-
"embeddings/
|
|
476
|
+
"embeddings/create_tenant",
|
|
492
477
|
method="POST",
|
|
493
478
|
params={
|
|
494
479
|
"tenant_id": tenant_id,
|
|
@@ -601,28 +586,20 @@ class AsyncRawEmbeddingsClient:
|
|
|
601
586
|
request_options: typing.Optional[RequestOptions] = None,
|
|
602
587
|
) -> AsyncHttpResponse[EmbeddingsDeleteData]:
|
|
603
588
|
"""
|
|
604
|
-
Delete
|
|
589
|
+
Delete embedding chunks by chunk ID.
|
|
605
590
|
|
|
606
|
-
|
|
607
|
-
chunk IDs to the backend delete service.
|
|
608
|
-
|
|
609
|
-
Args:
|
|
610
|
-
request (EmbeddingsDeleteRequest): The delete request containing:
|
|
611
|
-
- chunk_ids (List[str]): List of chunk IDs to delete
|
|
612
|
-
- tenant_id (str): Tenant identifier for multi-tenancy
|
|
613
|
-
- sub_tenant_id (str, optional): Sub-tenant identifier, defaults to tenant_id
|
|
614
|
-
api_details (dict): Authentication details obtained from API key validation
|
|
615
|
-
|
|
616
|
-
Returns:
|
|
617
|
-
EmbeddingsDeleteData: Success response with deletion details
|
|
591
|
+
Use this to remove specific chunks from your embeddings index when they are no longer valid or should not appear in results.
|
|
618
592
|
|
|
619
593
|
Parameters
|
|
620
594
|
----------
|
|
621
595
|
chunk_ids : typing.Sequence[str]
|
|
596
|
+
The chunk IDs of the source you want to delete
|
|
622
597
|
|
|
623
598
|
tenant_id : str
|
|
599
|
+
Unique identifier for the tenant/organization
|
|
624
600
|
|
|
625
601
|
sub_tenant_id : typing.Optional[str]
|
|
602
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
626
603
|
|
|
627
604
|
request_options : typing.Optional[RequestOptions]
|
|
628
605
|
Request-specific configuration.
|
|
@@ -748,29 +725,24 @@ class AsyncRawEmbeddingsClient:
|
|
|
748
725
|
request_options: typing.Optional[RequestOptions] = None,
|
|
749
726
|
) -> AsyncHttpResponse[EmbeddingsSearchData]:
|
|
750
727
|
"""
|
|
751
|
-
|
|
728
|
+
Find similar chunks using an embedding vector.
|
|
752
729
|
|
|
753
|
-
|
|
754
|
-
and returns a list of the most similar chunk IDs based on vector similarity.
|
|
730
|
+
Use this to retrieve the most similar chunk IDs to a single query embedding.
|
|
755
731
|
|
|
756
|
-
Args:
|
|
757
|
-
request (EmbeddingsSearchRequest): The search request containing:
|
|
758
|
-
- embeddings (List[float]): Single embedding vector for similarity search
|
|
759
|
-
- tenant_id (str): Tenant identifier for multi-tenancy
|
|
760
|
-
- sub_tenant_id (str, optional): Sub-tenant identifier, defaults to tenant_id
|
|
761
|
-
- max_chunks (int, optional): Maximum number of chunk IDs to return (default: 10)
|
|
762
|
-
api_details (dict): Authentication details obtained from API key validation
|
|
763
732
|
|
|
764
|
-
|
|
765
|
-
|
|
733
|
+
Expected outcome
|
|
734
|
+
- You receive the closest chunk IDs with optional similarity scores.
|
|
766
735
|
|
|
767
736
|
Parameters
|
|
768
737
|
----------
|
|
769
738
|
tenant_id : str
|
|
739
|
+
Unique identifier for the tenant/organization
|
|
770
740
|
|
|
771
741
|
embeddings : typing.Optional[typing.Sequence[float]]
|
|
742
|
+
The embedding vector for search
|
|
772
743
|
|
|
773
744
|
sub_tenant_id : typing.Optional[str]
|
|
745
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
774
746
|
|
|
775
747
|
max_chunks : typing.Optional[int]
|
|
776
748
|
|
|
@@ -898,20 +870,20 @@ class AsyncRawEmbeddingsClient:
|
|
|
898
870
|
request_options: typing.Optional[RequestOptions] = None,
|
|
899
871
|
) -> AsyncHttpResponse[EmbeddingsGetData]:
|
|
900
872
|
"""
|
|
901
|
-
|
|
873
|
+
Retrieve embeddings for specific chunk IDs.
|
|
902
874
|
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
Returns:
|
|
906
|
-
EmbeddingsGetData: Embeddings data for the requested chunk IDs
|
|
875
|
+
Use this when you already know the chunk IDs and need their corresponding embeddings.
|
|
907
876
|
|
|
908
877
|
Parameters
|
|
909
878
|
----------
|
|
910
879
|
chunk_ids : typing.Sequence[str]
|
|
880
|
+
The chunk IDs of the source you want to get embeddings for
|
|
911
881
|
|
|
912
882
|
tenant_id : str
|
|
883
|
+
Unique identifier for the tenant/organization
|
|
913
884
|
|
|
914
885
|
sub_tenant_id : typing.Optional[str]
|
|
886
|
+
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
|
|
915
887
|
|
|
916
888
|
request_options : typing.Optional[RequestOptions]
|
|
917
889
|
Request-specific configuration.
|
|
@@ -922,7 +894,7 @@ class AsyncRawEmbeddingsClient:
|
|
|
922
894
|
Successful Response
|
|
923
895
|
"""
|
|
924
896
|
_response = await self._client_wrapper.httpx_client.request(
|
|
925
|
-
"embeddings/
|
|
897
|
+
"embeddings/retrieve_by_ids",
|
|
926
898
|
method="POST",
|
|
927
899
|
json={
|
|
928
900
|
"chunk_ids": chunk_ids,
|
|
@@ -1031,16 +1003,14 @@ class AsyncRawEmbeddingsClient:
|
|
|
1031
1003
|
self, *, tenant_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
1032
1004
|
) -> AsyncHttpResponse[EmbeddingsCreateCollectionData]:
|
|
1033
1005
|
"""
|
|
1034
|
-
Create an embeddings collection for
|
|
1035
|
-
|
|
1036
|
-
sub_tenant_id is set to be the same as tenant_id as per requirements.
|
|
1006
|
+
Create an embeddings collection for a tenant.
|
|
1037
1007
|
|
|
1038
|
-
|
|
1039
|
-
EmbeddingsCreateCollectionData: Success response with collection details
|
|
1008
|
+
Use this to initialize storage so you can index and query embeddings for the tenant.
|
|
1040
1009
|
|
|
1041
1010
|
Parameters
|
|
1042
1011
|
----------
|
|
1043
1012
|
tenant_id : str
|
|
1013
|
+
Unique identifier for the tenant/organization
|
|
1044
1014
|
|
|
1045
1015
|
request_options : typing.Optional[RequestOptions]
|
|
1046
1016
|
Request-specific configuration.
|
|
@@ -1051,7 +1021,7 @@ class AsyncRawEmbeddingsClient:
|
|
|
1051
1021
|
Successful Response
|
|
1052
1022
|
"""
|
|
1053
1023
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1054
|
-
"embeddings/
|
|
1024
|
+
"embeddings/create_tenant",
|
|
1055
1025
|
method="POST",
|
|
1056
1026
|
params={
|
|
1057
1027
|
"tenant_id": tenant_id,
|
usecortex_ai/fetch/client.py
CHANGED
|
@@ -62,7 +62,7 @@ class FetchClient:
|
|
|
62
62
|
from usecortex-ai import CortexAI
|
|
63
63
|
|
|
64
64
|
client = CortexAI(token="YOUR_TOKEN", )
|
|
65
|
-
client.fetch.fetch_content(file_id='
|
|
65
|
+
client.fetch.fetch_content(file_id='CortexDoc1234', file_type='<file_type>', tenant_id='tenant_1234', )
|
|
66
66
|
"""
|
|
67
67
|
_response = self._raw_client.fetch_content(
|
|
68
68
|
file_id=file_id,
|
|
@@ -129,7 +129,7 @@ class AsyncFetchClient:
|
|
|
129
129
|
|
|
130
130
|
client = AsyncCortexAI(token="YOUR_TOKEN", )
|
|
131
131
|
async def main() -> None:
|
|
132
|
-
await client.fetch.fetch_content(file_id='
|
|
132
|
+
await client.fetch.fetch_content(file_id='CortexDoc1234', file_type='<file_type>', tenant_id='tenant_1234', )
|
|
133
133
|
asyncio.run(main())
|
|
134
134
|
"""
|
|
135
135
|
_response = await self._raw_client.fetch_content(
|