usecortex-ai 0.5.0__py3-none-any.whl → 0.5.1__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 (35) hide show
  1. usecortex_ai/__init__.py +8 -4
  2. usecortex_ai/client.py +0 -4
  3. usecortex_ai/dashboard/client.py +2 -30
  4. usecortex_ai/dashboard/raw_client.py +0 -28
  5. usecortex_ai/embeddings/client.py +8 -58
  6. usecortex_ai/embeddings/raw_client.py +8 -58
  7. usecortex_ai/fetch/__init__.py +3 -0
  8. usecortex_ai/fetch/client.py +42 -165
  9. usecortex_ai/fetch/raw_client.py +38 -341
  10. usecortex_ai/fetch/types/__init__.py +7 -0
  11. usecortex_ai/fetch/types/fetch_list_knowledge_response.py +8 -0
  12. usecortex_ai/raw_client.py +0 -4
  13. usecortex_ai/search/client.py +36 -124
  14. usecortex_ai/search/raw_client.py +36 -124
  15. usecortex_ai/sources/client.py +2 -16
  16. usecortex_ai/sources/raw_client.py +2 -16
  17. usecortex_ai/tenant/client.py +4 -108
  18. usecortex_ai/tenant/raw_client.py +2 -106
  19. usecortex_ai/types/__init__.py +6 -2
  20. usecortex_ai/types/list_content_kind.py +5 -0
  21. usecortex_ai/types/list_user_memories_response.py +32 -0
  22. usecortex_ai/types/retrieval_result.py +1 -1
  23. usecortex_ai/types/retrieve_mode.py +1 -1
  24. usecortex_ai/types/user_memory.py +31 -0
  25. usecortex_ai/upload/__init__.py +0 -3
  26. usecortex_ai/upload/client.py +34 -204
  27. usecortex_ai/upload/raw_client.py +30 -382
  28. {usecortex_ai-0.5.0.dist-info → usecortex_ai-0.5.1.dist-info}/METADATA +1 -1
  29. {usecortex_ai-0.5.0.dist-info → usecortex_ai-0.5.1.dist-info}/RECORD +32 -30
  30. {usecortex_ai-0.5.0.dist-info → usecortex_ai-0.5.1.dist-info}/licenses/LICENSE +21 -21
  31. {usecortex_ai-0.5.0.dist-info → usecortex_ai-0.5.1.dist-info}/top_level.txt +0 -0
  32. usecortex_ai/types/app_sources_upload_data.py +0 -39
  33. usecortex_ai/upload/types/__init__.py +0 -7
  34. usecortex_ai/upload/types/body_upload_app_ingestion_upload_app_post_app_sources.py +0 -7
  35. {usecortex_ai-0.5.0.dist-info → usecortex_ai-0.5.1.dist-info}/WHEEL +0 -0
@@ -38,37 +38,18 @@ class SearchClient:
38
38
  tenant_id: str,
39
39
  query: str,
40
40
  sub_tenant_id: typing.Optional[str] = OMIT,
41
- max_chunks: typing.Optional[int] = OMIT,
41
+ max_results: typing.Optional[int] = OMIT,
42
42
  mode: typing.Optional[RetrieveMode] = OMIT,
43
43
  alpha: typing.Optional[Alpha] = OMIT,
44
44
  recency_bias: typing.Optional[float] = OMIT,
45
- num_related_chunks: typing.Optional[int] = OMIT,
46
- personalise_search: typing.Optional[bool] = OMIT,
45
+ personalise_recall: typing.Optional[bool] = OMIT,
47
46
  graph_context: typing.Optional[bool] = OMIT,
48
- extra_context: typing.Optional[str] = OMIT,
47
+ additional_context: typing.Optional[str] = OMIT,
49
48
  search_mode: typing.Optional[SearchMode] = OMIT,
50
- filters: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
49
+ metadata_filters: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
51
50
  request_options: typing.Optional[RequestOptions] = None,
52
51
  ) -> RetrievalResult:
53
52
  """
54
- Search for relevant content within your indexed sources or user memories.
55
-
56
- Results are ranked by relevance and can be customized with parameters like
57
- result limits, alpha weighting, and recency preferences.
58
-
59
- Use `search_mode` to specify what to search:
60
- - "sources" (default): Search over indexed documents
61
- - "memories": Search over user memories (uses inferred content)
62
-
63
- Use `mode` to control retrieval quality:
64
- - "fast" (default): Single query, faster response
65
- - "accurate": Multi-query generation with reranking, higher quality
66
-
67
- Use `filters` to narrow results by metadata:
68
- - Provide key-value pairs matching fields defined in your tenant_metadata_schema
69
- - Example: `{"category": "engineering", "priority": "high"}`
70
- - Filters are validated against your tenant schema for type safety
71
-
72
53
  Parameters
73
54
  ----------
74
55
  tenant_id : str
@@ -80,7 +61,7 @@ class SearchClient:
80
61
  sub_tenant_id : typing.Optional[str]
81
62
  Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
82
63
 
83
- max_chunks : typing.Optional[int]
64
+ max_results : typing.Optional[int]
84
65
  Maximum number of results to return
85
66
 
86
67
  mode : typing.Optional[RetrieveMode]
@@ -92,22 +73,19 @@ class SearchClient:
92
73
  recency_bias : typing.Optional[float]
93
74
  Preference for newer content (0.0 = no bias, 1.0 = strong recency preference)
94
75
 
95
- num_related_chunks : typing.Optional[int]
96
- Number of related content chunks to include
97
-
98
- personalise_search : typing.Optional[bool]
76
+ personalise_recall : typing.Optional[bool]
99
77
  Enable personalized search results based on user preferences
100
78
 
101
79
  graph_context : typing.Optional[bool]
102
80
  Enable graph context for search results
103
81
 
104
- extra_context : typing.Optional[str]
82
+ additional_context : typing.Optional[str]
105
83
  Additional context provided by the user to guide retrieval
106
84
 
107
85
  search_mode : typing.Optional[SearchMode]
108
86
  What to search: 'sources' for documents or 'memories' for user memories
109
87
 
110
- filters : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
88
+ metadata_filters : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
111
89
  Optional key-value pairs to filter search results by tenant metadata fields. Keys must match fields defined in tenant_metadata_schema during tenant creation. Supports exact match filtering on indexed metadata fields. Example: {'category': 'engineering', 'priority': 'high'}
112
90
 
113
91
  request_options : typing.Optional[RequestOptions]
@@ -123,22 +101,21 @@ class SearchClient:
123
101
  from usecortex-ai import CortexAI
124
102
 
125
103
  client = CortexAI(token="YOUR_TOKEN", )
126
- client.search.retrieve(tenant_id='tenant_id', query='query', )
104
+ client.search.retrieve(tenant_id='tenant_1234', query='Which mode does user prefer', )
127
105
  """
128
106
  _response = self._raw_client.retrieve(
129
107
  tenant_id=tenant_id,
130
108
  query=query,
131
109
  sub_tenant_id=sub_tenant_id,
132
- max_chunks=max_chunks,
110
+ max_results=max_results,
133
111
  mode=mode,
134
112
  alpha=alpha,
135
113
  recency_bias=recency_bias,
136
- num_related_chunks=num_related_chunks,
137
- personalise_search=personalise_search,
114
+ personalise_recall=personalise_recall,
138
115
  graph_context=graph_context,
139
- extra_context=extra_context,
116
+ additional_context=additional_context,
140
117
  search_mode=search_mode,
141
- filters=filters,
118
+ metadata_filters=metadata_filters,
142
119
  request_options=request_options,
143
120
  )
144
121
  return _response.data
@@ -150,19 +127,11 @@ class SearchClient:
150
127
  query: str,
151
128
  sub_tenant_id: typing.Optional[str] = OMIT,
152
129
  operator: typing.Optional[Bm25OperatorType] = OMIT,
153
- max_chunks: typing.Optional[int] = OMIT,
130
+ max_results: typing.Optional[int] = OMIT,
154
131
  search_mode: typing.Optional[SearchMode] = OMIT,
155
132
  request_options: typing.Optional[RequestOptions] = None,
156
133
  ) -> RetrievalResult:
157
134
  """
158
- Perform full text search for exact matches within your indexed sources or memories.
159
- Choose between 'OR' and 'AND' operators to control how search terms are combined
160
- for precise text matching.
161
-
162
- Use `search_mode` to specify what to search:
163
- - "sources" (default): Search over indexed documents
164
- - "memories": Search over user memories
165
-
166
135
  Parameters
167
136
  ----------
168
137
  tenant_id : str
@@ -177,7 +146,7 @@ class SearchClient:
177
146
  operator : typing.Optional[Bm25OperatorType]
178
147
  How to combine search terms (OR or AND)
179
148
 
180
- max_chunks : typing.Optional[int]
149
+ max_results : typing.Optional[int]
181
150
  Maximum number of results to return
182
151
 
183
152
  search_mode : typing.Optional[SearchMode]
@@ -196,14 +165,14 @@ class SearchClient:
196
165
  from usecortex-ai import CortexAI
197
166
 
198
167
  client = CortexAI(token="YOUR_TOKEN", )
199
- client.search.full_text_search(tenant_id='tenant_id', query='query', )
168
+ client.search.full_text_search(tenant_id='tenant_1234', query='John Smith Jake', )
200
169
  """
201
170
  _response = self._raw_client.full_text_search(
202
171
  tenant_id=tenant_id,
203
172
  query=query,
204
173
  sub_tenant_id=sub_tenant_id,
205
174
  operator=operator,
206
- max_chunks=max_chunks,
175
+ max_results=max_results,
207
176
  search_mode=search_mode,
208
177
  request_options=request_options,
209
178
  )
@@ -228,19 +197,6 @@ class SearchClient:
228
197
  request_options: typing.Optional[RequestOptions] = None,
229
198
  ) -> QnASearchResponse:
230
199
  """
231
- Ask a question and get an AI-generated answer based on your indexed sources or memories.
232
-
233
- The response includes both the AI answer and the source chunks used to generate it,
234
- enabling full transparency and citation capabilities.
235
-
236
- Use `search_mode` to specify what to search:
237
- - "sources" (default): Search over indexed documents
238
- - "memories": Search over user memories
239
-
240
- Use `mode` to control retrieval quality:
241
- - "fast" (default): Single query, faster response
242
- - "accurate": Multi-query generation with reranking, higher quality
243
-
244
200
  Parameters
245
201
  ----------
246
202
  tenant_id : str
@@ -295,7 +251,7 @@ class SearchClient:
295
251
  from usecortex-ai import CortexAI
296
252
 
297
253
  client = CortexAI(token="YOUR_TOKEN", )
298
- client.search.qna(tenant_id='tenant_id', question='question', )
254
+ client.search.qna(tenant_id='tenant_1234', question='What is Cortex AI', )
299
255
  """
300
256
  _response = self._raw_client.qna(
301
257
  tenant_id=tenant_id,
@@ -337,37 +293,18 @@ class AsyncSearchClient:
337
293
  tenant_id: str,
338
294
  query: str,
339
295
  sub_tenant_id: typing.Optional[str] = OMIT,
340
- max_chunks: typing.Optional[int] = OMIT,
296
+ max_results: typing.Optional[int] = OMIT,
341
297
  mode: typing.Optional[RetrieveMode] = OMIT,
342
298
  alpha: typing.Optional[Alpha] = OMIT,
343
299
  recency_bias: typing.Optional[float] = OMIT,
344
- num_related_chunks: typing.Optional[int] = OMIT,
345
- personalise_search: typing.Optional[bool] = OMIT,
300
+ personalise_recall: typing.Optional[bool] = OMIT,
346
301
  graph_context: typing.Optional[bool] = OMIT,
347
- extra_context: typing.Optional[str] = OMIT,
302
+ additional_context: typing.Optional[str] = OMIT,
348
303
  search_mode: typing.Optional[SearchMode] = OMIT,
349
- filters: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
304
+ metadata_filters: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
350
305
  request_options: typing.Optional[RequestOptions] = None,
351
306
  ) -> RetrievalResult:
352
307
  """
353
- Search for relevant content within your indexed sources or user memories.
354
-
355
- Results are ranked by relevance and can be customized with parameters like
356
- result limits, alpha weighting, and recency preferences.
357
-
358
- Use `search_mode` to specify what to search:
359
- - "sources" (default): Search over indexed documents
360
- - "memories": Search over user memories (uses inferred content)
361
-
362
- Use `mode` to control retrieval quality:
363
- - "fast" (default): Single query, faster response
364
- - "accurate": Multi-query generation with reranking, higher quality
365
-
366
- Use `filters` to narrow results by metadata:
367
- - Provide key-value pairs matching fields defined in your tenant_metadata_schema
368
- - Example: `{"category": "engineering", "priority": "high"}`
369
- - Filters are validated against your tenant schema for type safety
370
-
371
308
  Parameters
372
309
  ----------
373
310
  tenant_id : str
@@ -379,7 +316,7 @@ class AsyncSearchClient:
379
316
  sub_tenant_id : typing.Optional[str]
380
317
  Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
381
318
 
382
- max_chunks : typing.Optional[int]
319
+ max_results : typing.Optional[int]
383
320
  Maximum number of results to return
384
321
 
385
322
  mode : typing.Optional[RetrieveMode]
@@ -391,22 +328,19 @@ class AsyncSearchClient:
391
328
  recency_bias : typing.Optional[float]
392
329
  Preference for newer content (0.0 = no bias, 1.0 = strong recency preference)
393
330
 
394
- num_related_chunks : typing.Optional[int]
395
- Number of related content chunks to include
396
-
397
- personalise_search : typing.Optional[bool]
331
+ personalise_recall : typing.Optional[bool]
398
332
  Enable personalized search results based on user preferences
399
333
 
400
334
  graph_context : typing.Optional[bool]
401
335
  Enable graph context for search results
402
336
 
403
- extra_context : typing.Optional[str]
337
+ additional_context : typing.Optional[str]
404
338
  Additional context provided by the user to guide retrieval
405
339
 
406
340
  search_mode : typing.Optional[SearchMode]
407
341
  What to search: 'sources' for documents or 'memories' for user memories
408
342
 
409
- filters : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
343
+ metadata_filters : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
410
344
  Optional key-value pairs to filter search results by tenant metadata fields. Keys must match fields defined in tenant_metadata_schema during tenant creation. Supports exact match filtering on indexed metadata fields. Example: {'category': 'engineering', 'priority': 'high'}
411
345
 
412
346
  request_options : typing.Optional[RequestOptions]
@@ -425,23 +359,22 @@ class AsyncSearchClient:
425
359
 
426
360
  client = AsyncCortexAI(token="YOUR_TOKEN", )
427
361
  async def main() -> None:
428
- await client.search.retrieve(tenant_id='tenant_id', query='query', )
362
+ await client.search.retrieve(tenant_id='tenant_1234', query='Which mode does user prefer', )
429
363
  asyncio.run(main())
430
364
  """
431
365
  _response = await self._raw_client.retrieve(
432
366
  tenant_id=tenant_id,
433
367
  query=query,
434
368
  sub_tenant_id=sub_tenant_id,
435
- max_chunks=max_chunks,
369
+ max_results=max_results,
436
370
  mode=mode,
437
371
  alpha=alpha,
438
372
  recency_bias=recency_bias,
439
- num_related_chunks=num_related_chunks,
440
- personalise_search=personalise_search,
373
+ personalise_recall=personalise_recall,
441
374
  graph_context=graph_context,
442
- extra_context=extra_context,
375
+ additional_context=additional_context,
443
376
  search_mode=search_mode,
444
- filters=filters,
377
+ metadata_filters=metadata_filters,
445
378
  request_options=request_options,
446
379
  )
447
380
  return _response.data
@@ -453,19 +386,11 @@ class AsyncSearchClient:
453
386
  query: str,
454
387
  sub_tenant_id: typing.Optional[str] = OMIT,
455
388
  operator: typing.Optional[Bm25OperatorType] = OMIT,
456
- max_chunks: typing.Optional[int] = OMIT,
389
+ max_results: typing.Optional[int] = OMIT,
457
390
  search_mode: typing.Optional[SearchMode] = OMIT,
458
391
  request_options: typing.Optional[RequestOptions] = None,
459
392
  ) -> RetrievalResult:
460
393
  """
461
- Perform full text search for exact matches within your indexed sources or memories.
462
- Choose between 'OR' and 'AND' operators to control how search terms are combined
463
- for precise text matching.
464
-
465
- Use `search_mode` to specify what to search:
466
- - "sources" (default): Search over indexed documents
467
- - "memories": Search over user memories
468
-
469
394
  Parameters
470
395
  ----------
471
396
  tenant_id : str
@@ -480,7 +405,7 @@ class AsyncSearchClient:
480
405
  operator : typing.Optional[Bm25OperatorType]
481
406
  How to combine search terms (OR or AND)
482
407
 
483
- max_chunks : typing.Optional[int]
408
+ max_results : typing.Optional[int]
484
409
  Maximum number of results to return
485
410
 
486
411
  search_mode : typing.Optional[SearchMode]
@@ -502,7 +427,7 @@ class AsyncSearchClient:
502
427
 
503
428
  client = AsyncCortexAI(token="YOUR_TOKEN", )
504
429
  async def main() -> None:
505
- await client.search.full_text_search(tenant_id='tenant_id', query='query', )
430
+ await client.search.full_text_search(tenant_id='tenant_1234', query='John Smith Jake', )
506
431
  asyncio.run(main())
507
432
  """
508
433
  _response = await self._raw_client.full_text_search(
@@ -510,7 +435,7 @@ class AsyncSearchClient:
510
435
  query=query,
511
436
  sub_tenant_id=sub_tenant_id,
512
437
  operator=operator,
513
- max_chunks=max_chunks,
438
+ max_results=max_results,
514
439
  search_mode=search_mode,
515
440
  request_options=request_options,
516
441
  )
@@ -535,19 +460,6 @@ class AsyncSearchClient:
535
460
  request_options: typing.Optional[RequestOptions] = None,
536
461
  ) -> QnASearchResponse:
537
462
  """
538
- Ask a question and get an AI-generated answer based on your indexed sources or memories.
539
-
540
- The response includes both the AI answer and the source chunks used to generate it,
541
- enabling full transparency and citation capabilities.
542
-
543
- Use `search_mode` to specify what to search:
544
- - "sources" (default): Search over indexed documents
545
- - "memories": Search over user memories
546
-
547
- Use `mode` to control retrieval quality:
548
- - "fast" (default): Single query, faster response
549
- - "accurate": Multi-query generation with reranking, higher quality
550
-
551
463
  Parameters
552
464
  ----------
553
465
  tenant_id : str
@@ -605,7 +517,7 @@ class AsyncSearchClient:
605
517
 
606
518
  client = AsyncCortexAI(token="YOUR_TOKEN", )
607
519
  async def main() -> None:
608
- await client.search.qna(tenant_id='tenant_id', question='question', )
520
+ await client.search.qna(tenant_id='tenant_1234', question='What is Cortex AI', )
609
521
  asyncio.run(main())
610
522
  """
611
523
  _response = await self._raw_client.qna(