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.
Files changed (61) hide show
  1. usecortex_ai/__init__.py +18 -3
  2. usecortex_ai/client.py +3 -0
  3. usecortex_ai/document/__init__.py +4 -0
  4. usecortex_ai/document/client.py +139 -0
  5. usecortex_ai/document/raw_client.py +312 -0
  6. usecortex_ai/embeddings/client.py +48 -78
  7. usecortex_ai/embeddings/raw_client.py +44 -74
  8. usecortex_ai/fetch/client.py +2 -2
  9. usecortex_ai/search/client.py +88 -84
  10. usecortex_ai/search/raw_client.py +82 -78
  11. usecortex_ai/sources/client.py +26 -157
  12. usecortex_ai/sources/raw_client.py +22 -501
  13. usecortex_ai/tenant/client.py +154 -6
  14. usecortex_ai/tenant/raw_client.py +502 -4
  15. usecortex_ai/types/__init__.py +16 -2
  16. usecortex_ai/types/add_user_memory_response.py +36 -0
  17. usecortex_ai/types/app_sources_upload_data.py +10 -2
  18. usecortex_ai/types/attachment_model.py +34 -7
  19. usecortex_ai/types/batch_upload_data.py +10 -2
  20. usecortex_ai/types/body_scrape_webpage_upload_scrape_webpage_post.py +0 -2
  21. usecortex_ai/types/body_update_scrape_job_upload_update_webpage_patch.py +0 -2
  22. usecortex_ai/types/content_model.py +33 -6
  23. usecortex_ai/types/delete_memory_request.py +14 -3
  24. usecortex_ai/types/delete_sources.py +20 -0
  25. usecortex_ai/types/delete_sub_tenant_data.py +42 -0
  26. usecortex_ai/types/delete_user_memory_response.py +31 -0
  27. usecortex_ai/types/embeddings_create_collection_data.py +19 -4
  28. usecortex_ai/types/embeddings_delete_data.py +19 -4
  29. usecortex_ai/types/embeddings_get_data.py +19 -4
  30. usecortex_ai/types/embeddings_search_data.py +19 -4
  31. usecortex_ai/types/error_response.py +0 -1
  32. usecortex_ai/types/fetch_content_data.py +19 -5
  33. usecortex_ai/types/file_upload_result.py +9 -2
  34. usecortex_ai/types/generate_user_memory_response.py +32 -0
  35. usecortex_ai/types/list_sources_response.py +14 -3
  36. usecortex_ai/types/list_user_memories_response.py +32 -0
  37. usecortex_ai/types/markdown_upload_request.py +23 -5
  38. usecortex_ai/types/processing_status.py +14 -3
  39. usecortex_ai/types/relations.py +9 -2
  40. usecortex_ai/types/retrieve_user_memory_response.py +32 -0
  41. usecortex_ai/types/search_chunk.py +54 -17
  42. usecortex_ai/types/single_upload_data.py +10 -2
  43. usecortex_ai/types/source.py +34 -15
  44. usecortex_ai/types/source_model.py +63 -14
  45. usecortex_ai/types/sub_tenant_ids_data.py +29 -5
  46. usecortex_ai/types/tenant_create_data.py +19 -4
  47. usecortex_ai/types/tenant_stats.py +24 -5
  48. usecortex_ai/types/user_memory.py +31 -0
  49. usecortex_ai/upload/client.py +486 -111
  50. usecortex_ai/upload/raw_client.py +458 -103
  51. usecortex_ai/user/client.py +30 -10
  52. usecortex_ai/user/raw_client.py +22 -6
  53. usecortex_ai/user_memory/client.py +200 -56
  54. usecortex_ai/user_memory/raw_client.py +921 -94
  55. {usecortex_ai-0.2.1.dist-info → usecortex_ai-0.3.0.dist-info}/METADATA +1 -1
  56. usecortex_ai-0.3.0.dist-info/RECORD +101 -0
  57. usecortex_ai/types/source_content.py +0 -26
  58. usecortex_ai-0.2.1.dist-info/RECORD +0 -91
  59. {usecortex_ai-0.2.1.dist-info → usecortex_ai-0.3.0.dist-info}/WHEEL +0 -0
  60. {usecortex_ai-0.2.1.dist-info → usecortex_ai-0.3.0.dist-info}/licenses/LICENSE +0 -0
  61. {usecortex_ai-0.2.1.dist-info → usecortex_ai-0.3.0.dist-info}/top_level.txt +0 -0
@@ -51,41 +51,60 @@ class SearchClient:
51
51
  request_options: typing.Optional[RequestOptions] = None,
52
52
  ) -> typing.Optional[typing.Any]:
53
53
  """
54
+ Ask a question to your uploaded knowledge base and let Cortex AI answer it.
55
+
54
56
  Parameters
55
57
  ----------
56
58
  question : str
59
+ The question to be answered
57
60
 
58
61
  session_id : str
62
+ Unique identifier for the conversation session. Keep it same when the current question refers to a previous answer or question
59
63
 
60
64
  tenant_id : str
65
+ Identifier for the tenant/organization
61
66
 
62
67
  context_list : typing.Optional[typing.Sequence[str]]
68
+ List of context strings to provide additional information
63
69
 
64
70
  search_modes : typing.Optional[typing.Sequence[str]]
71
+ List of search modes to use for finding relevant information
65
72
 
66
73
  sub_tenant_id : typing.Optional[str]
74
+ Identifier for sub-tenant within the tenant
67
75
 
68
76
  highlight_chunks : typing.Optional[bool]
77
+ Whether to return text chunks in the response along with final LLM generated answer
69
78
 
70
79
  stream : typing.Optional[bool]
80
+ Whether to stream the response
71
81
 
72
82
  search_alpha : typing.Optional[float]
83
+ Closer to 0.0 means a exact keyword search will be performed, closer to 1.0 means semantics of the search will be considered. In most cases, you wont have to toggle it yourself.
73
84
 
74
85
  recency_bias : typing.Optional[float]
86
+ Bias towards more recent information (0.0 to 1.0)
75
87
 
76
88
  ai_generation : typing.Optional[bool]
89
+ Whether to use AI for generating responses
77
90
 
78
91
  top_n : typing.Optional[int]
92
+ Number of top results to return
79
93
 
80
94
  user_name : typing.Optional[str]
95
+ Name of the user making the request. This helps LLM to know the user's name if semantics around the username are involved in query. Its generally a good practice to include it possible.
81
96
 
82
97
  user_instructions : typing.Optional[str]
98
+ Custom instructions for the AI response to add to our proprietary prompt. This can be used to provide additional context or instructions for the LLM to follow so that the answers are tailored towards your application style
83
99
 
84
100
  multi_step_reasoning : typing.Optional[bool]
101
+ Enable advanced multi-step reasoning for complex queries. When enabled, the AI will automatically break down complex questions into multiple research steps to provide more comprehensive and accurate answers.
85
102
 
86
103
  auto_agent_routing : typing.Optional[bool]
104
+ Enable intelligent agent routing to automatically select the most suitable AI agent for your specific query type. Different agents are optimized for various use cases like social media, code, conversations, general knowledge, etc.
87
105
 
88
106
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
107
+ Additional metadata for the request
89
108
 
90
109
  request_options : typing.Optional[RequestOptions]
91
110
  Request-specific configuration.
@@ -100,7 +119,7 @@ class SearchClient:
100
119
  from usecortex-ai import CortexAI
101
120
 
102
121
  client = CortexAI(token="YOUR_TOKEN", )
103
- client.search.qna(question='question', session_id='session_id', tenant_id='tenant_id', )
122
+ client.search.qna(question='What is Cortex AI', session_id='chat_session_1234', tenant_id='tenant_1234', )
104
123
  """
105
124
  _response = self._raw_client.qna(
106
125
  question=question,
@@ -133,45 +152,37 @@ class SearchClient:
133
152
  max_chunks: typing.Optional[int] = OMIT,
134
153
  alpha: typing.Optional[Alpha] = OMIT,
135
154
  recency_bias: typing.Optional[float] = OMIT,
136
- num_related_chunks: typing.Optional[int] = OMIT,
155
+ personalise_search: typing.Optional[bool] = OMIT,
137
156
  request_options: typing.Optional[RequestOptions] = None,
138
157
  ) -> typing.List[SearchChunk]:
139
158
  """
140
- Search for content within indexed sources using semantic and keyword search capabilities.
141
-
142
- This endpoint performs a search query against the Findr backend, allowing users to retrieve
143
- relevant content chunks from their indexed documents and sources. The search can be customized
144
- with various parameters to control the number of results and search behavior.
145
-
146
- Args:
147
- request (SearchRequest): The search request containing:
148
- - query (str): Search query string to find relevant content
149
- - tenant_id (str, optional): Tenant identifier for multi-tenancy
150
- - sub_tenant_id (str, optional): Sub-tenant identifier, defaults to tenant_id
151
- - max_chunks (int, optional): Maximum number of content chunks to return
152
- - alpha (Union[float, str], optional): Search algorithm parameter for result ranking (default: 0.8). Can be float-type (0.0-1.0) or 'auto' for dynamic selection
153
- - recency_bias (float, optional): Bias towards more recent content (default: 0.5)
154
- - num_related_chunks (int, optional): Number of related chunks to return (default: 0)
155
- api_details (dict): Authentication details obtained from API key validation
156
-
157
- Returns:
158
- SearchData: Success response with search results
159
+ Search for relevant content within your indexed sources.
160
+
161
+ This API returns the chunks related to the query you make. We use neural (embedding) search to give you the most relevant chunks.
162
+ Results are ranked by relevance and can be customized with parameters like result limits and recency preferences.
159
163
 
160
164
  Parameters
161
165
  ----------
162
166
  query : str
167
+ Search terms to find relevant content
163
168
 
164
169
  tenant_id : str
170
+ Unique identifier for the tenant/organization
165
171
 
166
172
  sub_tenant_id : typing.Optional[str]
173
+ 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
174
 
168
175
  max_chunks : typing.Optional[int]
176
+ Maximum number of results to return
169
177
 
170
178
  alpha : typing.Optional[Alpha]
179
+ Search ranking algorithm parameter (0.0-1.0 or 'auto')
171
180
 
172
181
  recency_bias : typing.Optional[float]
182
+ Preference for newer content (0.0 = no bias, 1.0 = strong recency preference)
173
183
 
174
- num_related_chunks : typing.Optional[int]
184
+ personalise_search : typing.Optional[bool]
185
+ Enable personalized search results based on user preferences
175
186
 
176
187
  request_options : typing.Optional[RequestOptions]
177
188
  Request-specific configuration.
@@ -186,7 +197,7 @@ class SearchClient:
186
197
  from usecortex-ai import CortexAI
187
198
 
188
199
  client = CortexAI(token="YOUR_TOKEN", )
189
- client.search.retrieve(query='query', tenant_id='tenant_id', )
200
+ client.search.retrieve(query='Which mode does user prefer', tenant_id='tenant_1234', )
190
201
  """
191
202
  _response = self._raw_client.retrieve(
192
203
  query=query,
@@ -195,7 +206,7 @@ class SearchClient:
195
206
  max_chunks=max_chunks,
196
207
  alpha=alpha,
197
208
  recency_bias=recency_bias,
198
- num_related_chunks=num_related_chunks,
209
+ personalise_search=personalise_search,
199
210
  request_options=request_options,
200
211
  )
201
212
  return _response.data
@@ -211,36 +222,27 @@ class SearchClient:
211
222
  request_options: typing.Optional[RequestOptions] = None,
212
223
  ) -> typing.List[SearchChunk]:
213
224
  """
214
- Full text search endpoint for Cortex customers.
215
- Performs full text search with configurable operators for precise text matching against the Findr backend.
216
-
217
- This endpoint performs a full text search query against the Findr backend, allowing users to retrieve
218
- relevant content chunks from their indexed documents and sources using BM25-based text matching.
219
- The search can be customized with various operators to control the matching behavior.
220
-
221
- Args:
222
- request (FullTextSearchRequest): The full text search request containing:
223
- - query (str): Search query string to find relevant content
224
- - tenant_id (str): Tenant identifier for multi-tenancy
225
- - sub_tenant_id (str, optional): Sub-tenant identifier, defaults to tenant_id
226
- - operator (BM25OperatorType, optional): Full text search operator type (OR or AND). Defaults to OR
227
- - max_chunks (int, optional): Maximum number of content chunks to return (1-1001, defaults to 25)
228
- api_details (dict): Authentication details obtained from API key validation
225
+ Perform full text search for exact matches within your indexed sources.
229
226
 
230
- Returns:
231
- FullTextSearchData: Success response with full text search results
227
+ Use this endpoint to find content chunks using BM25-based text matching with configurable operators.
228
+ Choose between 'OR' and 'AND' operators to control how search terms are combined for precise text matching.
232
229
 
233
230
  Parameters
234
231
  ----------
235
232
  query : str
233
+ Search terms to find in your content
236
234
 
237
235
  tenant_id : str
236
+ Unique identifier for the tenant/organization
238
237
 
239
238
  sub_tenant_id : typing.Optional[str]
239
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
240
240
 
241
241
  operator : typing.Optional[Bm25OperatorType]
242
+ How to combine search terms (OR or AND)
242
243
 
243
244
  max_chunks : typing.Optional[int]
245
+ Maximum number of results to return
244
246
 
245
247
  request_options : typing.Optional[RequestOptions]
246
248
  Request-specific configuration.
@@ -255,7 +257,7 @@ class SearchClient:
255
257
  from usecortex-ai import CortexAI
256
258
 
257
259
  client = CortexAI(token="YOUR_TOKEN", )
258
- client.search.full_text_search(query='query', tenant_id='tenant_id', )
260
+ client.search.full_text_search(query='John Smith Jake', tenant_id='tenant_1234', )
259
261
  """
260
262
  _response = self._raw_client.full_text_search(
261
263
  query=query,
@@ -306,41 +308,60 @@ class AsyncSearchClient:
306
308
  request_options: typing.Optional[RequestOptions] = None,
307
309
  ) -> typing.Optional[typing.Any]:
308
310
  """
311
+ Ask a question to your uploaded knowledge base and let Cortex AI answer it.
312
+
309
313
  Parameters
310
314
  ----------
311
315
  question : str
316
+ The question to be answered
312
317
 
313
318
  session_id : str
319
+ Unique identifier for the conversation session. Keep it same when the current question refers to a previous answer or question
314
320
 
315
321
  tenant_id : str
322
+ Identifier for the tenant/organization
316
323
 
317
324
  context_list : typing.Optional[typing.Sequence[str]]
325
+ List of context strings to provide additional information
318
326
 
319
327
  search_modes : typing.Optional[typing.Sequence[str]]
328
+ List of search modes to use for finding relevant information
320
329
 
321
330
  sub_tenant_id : typing.Optional[str]
331
+ Identifier for sub-tenant within the tenant
322
332
 
323
333
  highlight_chunks : typing.Optional[bool]
334
+ Whether to return text chunks in the response along with final LLM generated answer
324
335
 
325
336
  stream : typing.Optional[bool]
337
+ Whether to stream the response
326
338
 
327
339
  search_alpha : typing.Optional[float]
340
+ Closer to 0.0 means a exact keyword search will be performed, closer to 1.0 means semantics of the search will be considered. In most cases, you wont have to toggle it yourself.
328
341
 
329
342
  recency_bias : typing.Optional[float]
343
+ Bias towards more recent information (0.0 to 1.0)
330
344
 
331
345
  ai_generation : typing.Optional[bool]
346
+ Whether to use AI for generating responses
332
347
 
333
348
  top_n : typing.Optional[int]
349
+ Number of top results to return
334
350
 
335
351
  user_name : typing.Optional[str]
352
+ Name of the user making the request. This helps LLM to know the user's name if semantics around the username are involved in query. Its generally a good practice to include it possible.
336
353
 
337
354
  user_instructions : typing.Optional[str]
355
+ Custom instructions for the AI response to add to our proprietary prompt. This can be used to provide additional context or instructions for the LLM to follow so that the answers are tailored towards your application style
338
356
 
339
357
  multi_step_reasoning : typing.Optional[bool]
358
+ Enable advanced multi-step reasoning for complex queries. When enabled, the AI will automatically break down complex questions into multiple research steps to provide more comprehensive and accurate answers.
340
359
 
341
360
  auto_agent_routing : typing.Optional[bool]
361
+ Enable intelligent agent routing to automatically select the most suitable AI agent for your specific query type. Different agents are optimized for various use cases like social media, code, conversations, general knowledge, etc.
342
362
 
343
363
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
364
+ Additional metadata for the request
344
365
 
345
366
  request_options : typing.Optional[RequestOptions]
346
367
  Request-specific configuration.
@@ -358,7 +379,7 @@ class AsyncSearchClient:
358
379
 
359
380
  client = AsyncCortexAI(token="YOUR_TOKEN", )
360
381
  async def main() -> None:
361
- await client.search.qna(question='question', session_id='session_id', tenant_id='tenant_id', )
382
+ await client.search.qna(question='What is Cortex AI', session_id='chat_session_1234', tenant_id='tenant_1234', )
362
383
  asyncio.run(main())
363
384
  """
364
385
  _response = await self._raw_client.qna(
@@ -392,45 +413,37 @@ class AsyncSearchClient:
392
413
  max_chunks: typing.Optional[int] = OMIT,
393
414
  alpha: typing.Optional[Alpha] = OMIT,
394
415
  recency_bias: typing.Optional[float] = OMIT,
395
- num_related_chunks: typing.Optional[int] = OMIT,
416
+ personalise_search: typing.Optional[bool] = OMIT,
396
417
  request_options: typing.Optional[RequestOptions] = None,
397
418
  ) -> typing.List[SearchChunk]:
398
419
  """
399
- Search for content within indexed sources using semantic and keyword search capabilities.
400
-
401
- This endpoint performs a search query against the Findr backend, allowing users to retrieve
402
- relevant content chunks from their indexed documents and sources. The search can be customized
403
- with various parameters to control the number of results and search behavior.
404
-
405
- Args:
406
- request (SearchRequest): The search request containing:
407
- - query (str): Search query string to find relevant content
408
- - tenant_id (str, optional): Tenant identifier for multi-tenancy
409
- - sub_tenant_id (str, optional): Sub-tenant identifier, defaults to tenant_id
410
- - max_chunks (int, optional): Maximum number of content chunks to return
411
- - alpha (Union[float, str], optional): Search algorithm parameter for result ranking (default: 0.8). Can be float-type (0.0-1.0) or 'auto' for dynamic selection
412
- - recency_bias (float, optional): Bias towards more recent content (default: 0.5)
413
- - num_related_chunks (int, optional): Number of related chunks to return (default: 0)
414
- api_details (dict): Authentication details obtained from API key validation
415
-
416
- Returns:
417
- SearchData: Success response with search results
420
+ Search for relevant content within your indexed sources.
421
+
422
+ This API returns the chunks related to the query you make. We use neural (embedding) search to give you the most relevant chunks.
423
+ Results are ranked by relevance and can be customized with parameters like result limits and recency preferences.
418
424
 
419
425
  Parameters
420
426
  ----------
421
427
  query : str
428
+ Search terms to find relevant content
422
429
 
423
430
  tenant_id : str
431
+ Unique identifier for the tenant/organization
424
432
 
425
433
  sub_tenant_id : typing.Optional[str]
434
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
426
435
 
427
436
  max_chunks : typing.Optional[int]
437
+ Maximum number of results to return
428
438
 
429
439
  alpha : typing.Optional[Alpha]
440
+ Search ranking algorithm parameter (0.0-1.0 or 'auto')
430
441
 
431
442
  recency_bias : typing.Optional[float]
443
+ Preference for newer content (0.0 = no bias, 1.0 = strong recency preference)
432
444
 
433
- num_related_chunks : typing.Optional[int]
445
+ personalise_search : typing.Optional[bool]
446
+ Enable personalized search results based on user preferences
434
447
 
435
448
  request_options : typing.Optional[RequestOptions]
436
449
  Request-specific configuration.
@@ -448,7 +461,7 @@ class AsyncSearchClient:
448
461
 
449
462
  client = AsyncCortexAI(token="YOUR_TOKEN", )
450
463
  async def main() -> None:
451
- await client.search.retrieve(query='query', tenant_id='tenant_id', )
464
+ await client.search.retrieve(query='Which mode does user prefer', tenant_id='tenant_1234', )
452
465
  asyncio.run(main())
453
466
  """
454
467
  _response = await self._raw_client.retrieve(
@@ -458,7 +471,7 @@ class AsyncSearchClient:
458
471
  max_chunks=max_chunks,
459
472
  alpha=alpha,
460
473
  recency_bias=recency_bias,
461
- num_related_chunks=num_related_chunks,
474
+ personalise_search=personalise_search,
462
475
  request_options=request_options,
463
476
  )
464
477
  return _response.data
@@ -474,36 +487,27 @@ class AsyncSearchClient:
474
487
  request_options: typing.Optional[RequestOptions] = None,
475
488
  ) -> typing.List[SearchChunk]:
476
489
  """
477
- Full text search endpoint for Cortex customers.
478
- Performs full text search with configurable operators for precise text matching against the Findr backend.
479
-
480
- This endpoint performs a full text search query against the Findr backend, allowing users to retrieve
481
- relevant content chunks from their indexed documents and sources using BM25-based text matching.
482
- The search can be customized with various operators to control the matching behavior.
483
-
484
- Args:
485
- request (FullTextSearchRequest): The full text search request containing:
486
- - query (str): Search query string to find relevant content
487
- - tenant_id (str): Tenant identifier for multi-tenancy
488
- - sub_tenant_id (str, optional): Sub-tenant identifier, defaults to tenant_id
489
- - operator (BM25OperatorType, optional): Full text search operator type (OR or AND). Defaults to OR
490
- - max_chunks (int, optional): Maximum number of content chunks to return (1-1001, defaults to 25)
491
- api_details (dict): Authentication details obtained from API key validation
490
+ Perform full text search for exact matches within your indexed sources.
492
491
 
493
- Returns:
494
- FullTextSearchData: Success response with full text search results
492
+ Use this endpoint to find content chunks using BM25-based text matching with configurable operators.
493
+ Choose between 'OR' and 'AND' operators to control how search terms are combined for precise text matching.
495
494
 
496
495
  Parameters
497
496
  ----------
498
497
  query : str
498
+ Search terms to find in your content
499
499
 
500
500
  tenant_id : str
501
+ Unique identifier for the tenant/organization
501
502
 
502
503
  sub_tenant_id : typing.Optional[str]
504
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
503
505
 
504
506
  operator : typing.Optional[Bm25OperatorType]
507
+ How to combine search terms (OR or AND)
505
508
 
506
509
  max_chunks : typing.Optional[int]
510
+ Maximum number of results to return
507
511
 
508
512
  request_options : typing.Optional[RequestOptions]
509
513
  Request-specific configuration.
@@ -521,7 +525,7 @@ class AsyncSearchClient:
521
525
 
522
526
  client = AsyncCortexAI(token="YOUR_TOKEN", )
523
527
  async def main() -> None:
524
- await client.search.full_text_search(query='query', tenant_id='tenant_id', )
528
+ await client.search.full_text_search(query='John Smith Jake', tenant_id='tenant_1234', )
525
529
  asyncio.run(main())
526
530
  """
527
531
  _response = await self._raw_client.full_text_search(