usecortex-ai 0.4.0__tar.gz → 0.5.0__tar.gz
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-0.4.0 → usecortex_ai-0.5.0}/LICENSE +21 -21
- {usecortex_ai-0.4.0/src/usecortex_ai.egg-info → usecortex_ai-0.5.0}/PKG-INFO +1 -1
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/README.md +135 -135
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/pyproject.toml +40 -40
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/setup.cfg +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/__init__.py +2 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/client.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/core/__init__.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/core/api_error.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/core/client_wrapper.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/core/datetime_utils.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/core/file.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/core/force_multipart.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/core/http_client.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/core/http_response.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/core/jsonable_encoder.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/core/pydantic_utilities.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/core/query_encoder.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/core/remove_none_from_dict.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/core/request_options.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/core/serialization.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/dashboard/__init__.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/dashboard/client.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/dashboard/raw_client.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/embeddings/__init__.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/embeddings/client.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/embeddings/raw_client.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/environment.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/errors/__init__.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/errors/bad_request_error.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/errors/forbidden_error.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/errors/internal_server_error.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/errors/not_found_error.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/errors/service_unavailable_error.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/errors/too_many_requests_error.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/errors/unauthorized_error.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/errors/unprocessable_entity_error.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/fetch/__init__.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/fetch/client.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/fetch/raw_client.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/raw_client.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/search/__init__.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/search/client.py +20 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/search/raw_client.py +20 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/search/types/__init__.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/search/types/alpha.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/sources/__init__.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/sources/client.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/sources/raw_client.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/tenant/__init__.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/tenant/client.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/tenant/raw_client.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/__init__.py +2 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/actual_error_response.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/add_memory_response.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/api_key_info.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/app_sources_upload_data.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/attachment_model.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/bm_25_operator_type.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/collection_stats.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/content_model.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/custom_property_definition.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/dashboard_apis_response.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/dashboard_sources_response.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/dashboard_tenants_response.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/delete_result.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/delete_user_memory_response.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/entity.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/error_response.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/fetch_mode.py +0 -0
- usecortex_ai-0.5.0/src/usecortex_ai/types/forceful_relations_payload.py +27 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/graph_context.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/http_validation_error.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/infra.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/insert_result.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/memory_item.py +7 -1
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/memory_result_item.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/milvus_data_type.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/path_triplet.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/processing_status.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/processing_status_indexing_status.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/qn_a_search_response.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/raw_embedding_document.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/raw_embedding_search_result.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/raw_embedding_vector.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/relation_evidence.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/retrieval_result.py +4 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/retrieve_mode.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/scored_path_response.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/search_mode.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/source_delete_response.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/source_delete_result_item.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/source_fetch_response.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/source_graph_relations_response.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/source_list_response.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/source_model.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/source_status.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/source_upload_response.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/source_upload_result_item.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/supported_llm_providers.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/tenant_create_response.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/tenant_info.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/tenant_metadata_schema_info.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/tenant_stats_response.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/triplet_with_evidence.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/user_assistant_pair.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/validation_error.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/validation_error_loc_item.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/vector_store_chunk.py +5 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/upload/__init__.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/upload/client.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/upload/raw_client.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/upload/types/__init__.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/upload/types/body_upload_app_ingestion_upload_app_post_app_sources.py +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0/src/usecortex_ai.egg-info}/PKG-INFO +1 -1
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai.egg-info/SOURCES.txt +1 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai.egg-info/dependency_links.txt +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai.egg-info/requires.txt +0 -0
- {usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai.egg-info/top_level.txt +0 -0
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
Copyright (c) 2024 Cortex AI
|
|
2
|
-
|
|
3
|
-
All Rights Reserved.
|
|
4
|
-
|
|
5
|
-
PROPRIETARY AND CONFIDENTIAL
|
|
6
|
-
|
|
7
|
-
This software is the proprietary and confidential property of Cortex AI ("the Company").
|
|
8
|
-
Permission is hereby granted to users to install and use this software as part of the Cortex AI service, subject to the terms and conditions of the service agreement entered into with the Company.
|
|
9
|
-
|
|
10
|
-
You may not, without the express written permission of the Company:
|
|
11
|
-
|
|
12
|
-
1. Copy, modify, or create derivative works of the software.
|
|
13
|
-
2. Distribute, sell, rent, lease, sublicense, or otherwise transfer the software to any third party.
|
|
14
|
-
3. Reverse engineer, decompile, or disassemble the software, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
Copyright (c) 2024 Cortex AI
|
|
2
|
+
|
|
3
|
+
All Rights Reserved.
|
|
4
|
+
|
|
5
|
+
PROPRIETARY AND CONFIDENTIAL
|
|
6
|
+
|
|
7
|
+
This software is the proprietary and confidential property of Cortex AI ("the Company").
|
|
8
|
+
Permission is hereby granted to users to install and use this software as part of the Cortex AI service, subject to the terms and conditions of the service agreement entered into with the Company.
|
|
9
|
+
|
|
10
|
+
You may not, without the express written permission of the Company:
|
|
11
|
+
|
|
12
|
+
1. Copy, modify, or create derivative works of the software.
|
|
13
|
+
2. Distribute, sell, rent, lease, sublicense, or otherwise transfer the software to any third party.
|
|
14
|
+
3. Reverse engineer, decompile, or disassemble the software, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
SOFTWARE.
|
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
# Cortex AI Python SDK - [usecortex.ai](https://www.usecortex.ai/)
|
|
2
|
-
|
|
3
|
-
The official Python SDK for the Cortex AI platform. Build powerful, context-aware AI applications in your Python applications.
|
|
4
|
-
|
|
5
|
-
**Cortex** is your plug-and-play memory infrastructure. It powers intelligent, context-aware retrieval for any AI app or agent. Whether you’re building a customer support bot, research copilot, or internal knowledge assistant.
|
|
6
|
-
|
|
7
|
-
[Learn more about the SDK from our docs](https://docs.usecortex.ai/)
|
|
8
|
-
|
|
9
|
-
## Core features
|
|
10
|
-
|
|
11
|
-
* **Dynamic retrieval and querying** that always retrieve the most relevant context
|
|
12
|
-
* **Built-in long-term memory** that evolves with every user interaction
|
|
13
|
-
* **Personalization hooks** for user preferences, intent, and history
|
|
14
|
-
* **Developer-first SDK** with the most flexible APIs and fine-grained controls
|
|
15
|
-
|
|
16
|
-
## Getting started
|
|
17
|
-
|
|
18
|
-
### Installation
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
pip install usecortex-ai
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### Client setup
|
|
25
|
-
|
|
26
|
-
We provide both synchronous and asynchronous clients. Use **`AsyncCortexAI`** when working with async/await patterns, and **`CortexAI`** for traditional synchronous workflows. Client initialization does not trigger any network requests, so you can safely create as many client instances as needed. Both clients expose the exact same set of methods.
|
|
27
|
-
|
|
28
|
-
```python
|
|
29
|
-
import os
|
|
30
|
-
from usecortex_ai import CortexAI, AsyncCortexAI
|
|
31
|
-
|
|
32
|
-
api_key = os.environ["CORTEX_API_KEY"] # Set your Cortex API key in the environment variable CORTEX_API_KEY. Optional, but recommended.
|
|
33
|
-
|
|
34
|
-
# Sync client
|
|
35
|
-
client = CortexAI(token=api_key)
|
|
36
|
-
|
|
37
|
-
# Async client (for async/await usage)
|
|
38
|
-
async_client = AsyncCortexAI(token=api_key)
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Create a Tenant
|
|
42
|
-
|
|
43
|
-
You can consider a `tenant` as a single database that can have internal isolated collections called `sub-tenants`. [Know more about the concept of tenant here](https://docs.usecortex.ai/essentials/multi-tenant)
|
|
44
|
-
|
|
45
|
-
```python
|
|
46
|
-
def create_tenant():
|
|
47
|
-
return client.user.create_tenant(tenant_id="my-company")
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Index Your Data
|
|
51
|
-
|
|
52
|
-
When you index your data, you make it ready for retrieval from Cortex using natural language.
|
|
53
|
-
|
|
54
|
-
```python
|
|
55
|
-
# Upload text content
|
|
56
|
-
def upload_text():
|
|
57
|
-
return client.upload.upload_text(
|
|
58
|
-
tenant_id="my-company-py-sync",
|
|
59
|
-
sub_tenant_id="engineering",
|
|
60
|
-
content="Our API rate limits are 1000 requests per minute for premium accounts.",
|
|
61
|
-
file_id="api-docs-rate-limits",
|
|
62
|
-
tenant_metadata={"sub_tenant_id": "engineering"}
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
# Upload document file
|
|
66
|
-
def upload_file():
|
|
67
|
-
with open("company-handbook.pdf", 'rb') as file_obj:
|
|
68
|
-
file_data = ("company-handbook.pdf", file_obj)
|
|
69
|
-
return client.upload.upload_document(
|
|
70
|
-
tenant_id="my-company",
|
|
71
|
-
file=file_data,
|
|
72
|
-
file_id="company-handbook.pdf"
|
|
73
|
-
)
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
**For a more detailed explanation** of document upload, including supported file formats, processing pipeline, metadata handling, and advanced configuration options, refer to the [Upload Document endpoint documentation](https://docs.usecortex.ai/api-reference/endpoint/upload-document).
|
|
77
|
-
|
|
78
|
-
### Search and retrieval
|
|
79
|
-
|
|
80
|
-
```python
|
|
81
|
-
# Semantic search with retrieval
|
|
82
|
-
results = client.search.retrieve(
|
|
83
|
-
query="What are the API rate limits?",
|
|
84
|
-
tenant_id="my-company",
|
|
85
|
-
sub_tenant_id="engineering",
|
|
86
|
-
max_chunks=10
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
# List all sources
|
|
90
|
-
all_sources = client.sources.get_all(
|
|
91
|
-
tenant_id="my-company",
|
|
92
|
-
sub_tenant_id="engineering",
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
# Get specific sources by ID
|
|
96
|
-
specific_sources = client.sources.get_by_ids(
|
|
97
|
-
tenant_id="my-company",
|
|
98
|
-
sub_tenant_id="engineering",
|
|
99
|
-
source_ids=["api-docs-rate-limits", "company-handbook"]
|
|
100
|
-
)
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
**For a more detailed explanation** of search and retrieval, including query parameters, scoring mechanisms, result structure, and advanced search features, refer to the [Search endpoint documentation](https://docs.usecortex.ai/api-reference/endpoint/search).
|
|
104
|
-
|
|
105
|
-
## SDK Method Structure & Type Safety
|
|
106
|
-
|
|
107
|
-
Our SDKs follow a predictable pattern that mirrors the API structure while providing full type safety.
|
|
108
|
-
|
|
109
|
-
> **Method Mapping** : `client.<group>.<function_name>` mirrors `api.usecortex.ai/<group>/<function_name>`
|
|
110
|
-
>
|
|
111
|
-
> For example: `client.upload.upload_text()` corresponds to `POST /upload/upload_text`
|
|
112
|
-
|
|
113
|
-
The SDKs provide exact type parity with the API specification:
|
|
114
|
-
|
|
115
|
-
- **Request Parameters** : Every field documented in the API reference (required, optional, types, validation rules) is reflected in the SDK method signatures
|
|
116
|
-
- **Response Objects** : Return types match the exact JSON schema documented for each endpoint
|
|
117
|
-
- **Error Types** : Exception structures mirror the error response formats from the API
|
|
118
|
-
- **Nested Objects** : Complex nested parameters and responses maintain their full structure and typing
|
|
119
|
-
|
|
120
|
-
> This means you can rely on your IDE’s autocomplete and type checking. If a parameter is optional in the API docs, it’s optional in the SDK. If a response contains a specific field, your IDE will know about it. Our SDKs are built in such a way that your IDE will automatically provide **autocompletion, type-checking, inline documentation with examples, and compile time validation** for each and every method.
|
|
121
|
-
>
|
|
122
|
-
> Just hit **Cmd+Space/Ctrl+Space!**
|
|
123
|
-
|
|
124
|
-
## Links
|
|
125
|
-
|
|
126
|
-
- **Homepage:** [usecortex.ai](https://www.usecortex.ai/)
|
|
127
|
-
- **Documentation:** [docs.usecortex.ai](https://docs.usecortex.ai/)
|
|
128
|
-
|
|
129
|
-
## Our docs
|
|
130
|
-
|
|
131
|
-
Please refer to our [API reference](https://docs.usecortex.ai/api-reference/introduction) for detailed explanations of every API endpoint, parameter options, and advanced use cases.
|
|
132
|
-
|
|
133
|
-
## Support
|
|
134
|
-
|
|
135
|
-
If you have any questions or need help, please reach out to our support team at [founders@usecortex.ai](mailto:founders@usecortex.ai).
|
|
1
|
+
# Cortex AI Python SDK - [usecortex.ai](https://www.usecortex.ai/)
|
|
2
|
+
|
|
3
|
+
The official Python SDK for the Cortex AI platform. Build powerful, context-aware AI applications in your Python applications.
|
|
4
|
+
|
|
5
|
+
**Cortex** is your plug-and-play memory infrastructure. It powers intelligent, context-aware retrieval for any AI app or agent. Whether you’re building a customer support bot, research copilot, or internal knowledge assistant.
|
|
6
|
+
|
|
7
|
+
[Learn more about the SDK from our docs](https://docs.usecortex.ai/)
|
|
8
|
+
|
|
9
|
+
## Core features
|
|
10
|
+
|
|
11
|
+
* **Dynamic retrieval and querying** that always retrieve the most relevant context
|
|
12
|
+
* **Built-in long-term memory** that evolves with every user interaction
|
|
13
|
+
* **Personalization hooks** for user preferences, intent, and history
|
|
14
|
+
* **Developer-first SDK** with the most flexible APIs and fine-grained controls
|
|
15
|
+
|
|
16
|
+
## Getting started
|
|
17
|
+
|
|
18
|
+
### Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install usecortex-ai
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Client setup
|
|
25
|
+
|
|
26
|
+
We provide both synchronous and asynchronous clients. Use **`AsyncCortexAI`** when working with async/await patterns, and **`CortexAI`** for traditional synchronous workflows. Client initialization does not trigger any network requests, so you can safely create as many client instances as needed. Both clients expose the exact same set of methods.
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
import os
|
|
30
|
+
from usecortex_ai import CortexAI, AsyncCortexAI
|
|
31
|
+
|
|
32
|
+
api_key = os.environ["CORTEX_API_KEY"] # Set your Cortex API key in the environment variable CORTEX_API_KEY. Optional, but recommended.
|
|
33
|
+
|
|
34
|
+
# Sync client
|
|
35
|
+
client = CortexAI(token=api_key)
|
|
36
|
+
|
|
37
|
+
# Async client (for async/await usage)
|
|
38
|
+
async_client = AsyncCortexAI(token=api_key)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Create a Tenant
|
|
42
|
+
|
|
43
|
+
You can consider a `tenant` as a single database that can have internal isolated collections called `sub-tenants`. [Know more about the concept of tenant here](https://docs.usecortex.ai/essentials/multi-tenant)
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
def create_tenant():
|
|
47
|
+
return client.user.create_tenant(tenant_id="my-company")
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Index Your Data
|
|
51
|
+
|
|
52
|
+
When you index your data, you make it ready for retrieval from Cortex using natural language.
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
# Upload text content
|
|
56
|
+
def upload_text():
|
|
57
|
+
return client.upload.upload_text(
|
|
58
|
+
tenant_id="my-company-py-sync",
|
|
59
|
+
sub_tenant_id="engineering",
|
|
60
|
+
content="Our API rate limits are 1000 requests per minute for premium accounts.",
|
|
61
|
+
file_id="api-docs-rate-limits",
|
|
62
|
+
tenant_metadata={"sub_tenant_id": "engineering"}
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
# Upload document file
|
|
66
|
+
def upload_file():
|
|
67
|
+
with open("company-handbook.pdf", 'rb') as file_obj:
|
|
68
|
+
file_data = ("company-handbook.pdf", file_obj)
|
|
69
|
+
return client.upload.upload_document(
|
|
70
|
+
tenant_id="my-company",
|
|
71
|
+
file=file_data,
|
|
72
|
+
file_id="company-handbook.pdf"
|
|
73
|
+
)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**For a more detailed explanation** of document upload, including supported file formats, processing pipeline, metadata handling, and advanced configuration options, refer to the [Upload Document endpoint documentation](https://docs.usecortex.ai/api-reference/endpoint/upload-document).
|
|
77
|
+
|
|
78
|
+
### Search and retrieval
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
# Semantic search with retrieval
|
|
82
|
+
results = client.search.retrieve(
|
|
83
|
+
query="What are the API rate limits?",
|
|
84
|
+
tenant_id="my-company",
|
|
85
|
+
sub_tenant_id="engineering",
|
|
86
|
+
max_chunks=10
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
# List all sources
|
|
90
|
+
all_sources = client.sources.get_all(
|
|
91
|
+
tenant_id="my-company",
|
|
92
|
+
sub_tenant_id="engineering",
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
# Get specific sources by ID
|
|
96
|
+
specific_sources = client.sources.get_by_ids(
|
|
97
|
+
tenant_id="my-company",
|
|
98
|
+
sub_tenant_id="engineering",
|
|
99
|
+
source_ids=["api-docs-rate-limits", "company-handbook"]
|
|
100
|
+
)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**For a more detailed explanation** of search and retrieval, including query parameters, scoring mechanisms, result structure, and advanced search features, refer to the [Search endpoint documentation](https://docs.usecortex.ai/api-reference/endpoint/search).
|
|
104
|
+
|
|
105
|
+
## SDK Method Structure & Type Safety
|
|
106
|
+
|
|
107
|
+
Our SDKs follow a predictable pattern that mirrors the API structure while providing full type safety.
|
|
108
|
+
|
|
109
|
+
> **Method Mapping** : `client.<group>.<function_name>` mirrors `api.usecortex.ai/<group>/<function_name>`
|
|
110
|
+
>
|
|
111
|
+
> For example: `client.upload.upload_text()` corresponds to `POST /upload/upload_text`
|
|
112
|
+
|
|
113
|
+
The SDKs provide exact type parity with the API specification:
|
|
114
|
+
|
|
115
|
+
- **Request Parameters** : Every field documented in the API reference (required, optional, types, validation rules) is reflected in the SDK method signatures
|
|
116
|
+
- **Response Objects** : Return types match the exact JSON schema documented for each endpoint
|
|
117
|
+
- **Error Types** : Exception structures mirror the error response formats from the API
|
|
118
|
+
- **Nested Objects** : Complex nested parameters and responses maintain their full structure and typing
|
|
119
|
+
|
|
120
|
+
> This means you can rely on your IDE’s autocomplete and type checking. If a parameter is optional in the API docs, it’s optional in the SDK. If a response contains a specific field, your IDE will know about it. Our SDKs are built in such a way that your IDE will automatically provide **autocompletion, type-checking, inline documentation with examples, and compile time validation** for each and every method.
|
|
121
|
+
>
|
|
122
|
+
> Just hit **Cmd+Space/Ctrl+Space!**
|
|
123
|
+
|
|
124
|
+
## Links
|
|
125
|
+
|
|
126
|
+
- **Homepage:** [usecortex.ai](https://www.usecortex.ai/)
|
|
127
|
+
- **Documentation:** [docs.usecortex.ai](https://docs.usecortex.ai/)
|
|
128
|
+
|
|
129
|
+
## Our docs
|
|
130
|
+
|
|
131
|
+
Please refer to our [API reference](https://docs.usecortex.ai/api-reference/introduction) for detailed explanations of every API endpoint, parameter options, and advanced use cases.
|
|
132
|
+
|
|
133
|
+
## Support
|
|
134
|
+
|
|
135
|
+
If you have any questions or need help, please reach out to our support team at [founders@usecortex.ai](mailto:founders@usecortex.ai).
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["setuptools>=61.0"]
|
|
3
|
-
build-backend = "setuptools.build_meta"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "usecortex-ai"
|
|
7
|
-
|
|
8
|
-
version = "0.
|
|
9
|
-
|
|
10
|
-
authors = [
|
|
11
|
-
{ name = "Soham Ratnaparkhi", email = "soham@usecortex.ai" },
|
|
12
|
-
]
|
|
13
|
-
description = "The official Python SDK for the Cortex AI platform."
|
|
14
|
-
readme = "README.md"
|
|
15
|
-
requires-python = ">=3.10"
|
|
16
|
-
license = { file = "LICENSE" }
|
|
17
|
-
keywords = ["cortex", "ai", "sdk", "api", "generative ai", "rag"]
|
|
18
|
-
|
|
19
|
-
# Add classifiers to help users find your package on PyPI
|
|
20
|
-
classifiers = [
|
|
21
|
-
# See https://pypi.org/classifiers/
|
|
22
|
-
"Development Status :: 5 - Production/Stable",
|
|
23
|
-
"Programming Language :: Python :: 3",
|
|
24
|
-
"Programming Language :: Python :: 3.10",
|
|
25
|
-
"Programming Language :: Python :: 3.11",
|
|
26
|
-
"Programming Language :: Python :: 3.12",
|
|
27
|
-
"Intended Audience :: Developers",
|
|
28
|
-
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
29
|
-
"Typing :: Typed",
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
dependencies = [
|
|
33
|
-
"httpx>=0.24",
|
|
34
|
-
"pydantic>=1.10,<3",
|
|
35
|
-
]
|
|
36
|
-
|
|
37
|
-
[project.urls]
|
|
38
|
-
Homepage = "https://www.usecortex.ai/"
|
|
39
|
-
Documentation = "https://docs.usecortex.ai/"
|
|
40
|
-
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "usecortex-ai"
|
|
7
|
+
|
|
8
|
+
version = "0.5.0"
|
|
9
|
+
|
|
10
|
+
authors = [
|
|
11
|
+
{ name = "Soham Ratnaparkhi", email = "soham@usecortex.ai" },
|
|
12
|
+
]
|
|
13
|
+
description = "The official Python SDK for the Cortex AI platform."
|
|
14
|
+
readme = "README.md"
|
|
15
|
+
requires-python = ">=3.10"
|
|
16
|
+
license = { file = "LICENSE" }
|
|
17
|
+
keywords = ["cortex", "ai", "sdk", "api", "generative ai", "rag"]
|
|
18
|
+
|
|
19
|
+
# Add classifiers to help users find your package on PyPI
|
|
20
|
+
classifiers = [
|
|
21
|
+
# See https://pypi.org/classifiers/
|
|
22
|
+
"Development Status :: 5 - Production/Stable",
|
|
23
|
+
"Programming Language :: Python :: 3",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Intended Audience :: Developers",
|
|
28
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
29
|
+
"Typing :: Typed",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
dependencies = [
|
|
33
|
+
"httpx>=0.24",
|
|
34
|
+
"pydantic>=1.10,<3",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://www.usecortex.ai/"
|
|
39
|
+
Documentation = "https://docs.usecortex.ai/"
|
|
40
|
+
|
|
File without changes
|
|
@@ -20,6 +20,7 @@ from .types import (
|
|
|
20
20
|
Entity,
|
|
21
21
|
ErrorResponse,
|
|
22
22
|
FetchMode,
|
|
23
|
+
ForcefulRelationsPayload,
|
|
23
24
|
GraphContext,
|
|
24
25
|
HttpValidationError,
|
|
25
26
|
Infra,
|
|
@@ -100,6 +101,7 @@ __all__ = [
|
|
|
100
101
|
"ErrorResponse",
|
|
101
102
|
"FetchMode",
|
|
102
103
|
"ForbiddenError",
|
|
104
|
+
"ForcefulRelationsPayload",
|
|
103
105
|
"GraphContext",
|
|
104
106
|
"HttpValidationError",
|
|
105
107
|
"Infra",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/errors/service_unavailable_error.py
RENAMED
|
File without changes
|
{usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/errors/too_many_requests_error.py
RENAMED
|
File without changes
|
|
File without changes
|
{usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/errors/unprocessable_entity_error.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -47,6 +47,7 @@ class SearchClient:
|
|
|
47
47
|
graph_context: typing.Optional[bool] = OMIT,
|
|
48
48
|
extra_context: typing.Optional[str] = OMIT,
|
|
49
49
|
search_mode: typing.Optional[SearchMode] = OMIT,
|
|
50
|
+
filters: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
50
51
|
request_options: typing.Optional[RequestOptions] = None,
|
|
51
52
|
) -> RetrievalResult:
|
|
52
53
|
"""
|
|
@@ -63,6 +64,11 @@ class SearchClient:
|
|
|
63
64
|
- "fast" (default): Single query, faster response
|
|
64
65
|
- "accurate": Multi-query generation with reranking, higher quality
|
|
65
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
|
+
|
|
66
72
|
Parameters
|
|
67
73
|
----------
|
|
68
74
|
tenant_id : str
|
|
@@ -101,6 +107,9 @@ class SearchClient:
|
|
|
101
107
|
search_mode : typing.Optional[SearchMode]
|
|
102
108
|
What to search: 'sources' for documents or 'memories' for user memories
|
|
103
109
|
|
|
110
|
+
filters : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
111
|
+
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
|
+
|
|
104
113
|
request_options : typing.Optional[RequestOptions]
|
|
105
114
|
Request-specific configuration.
|
|
106
115
|
|
|
@@ -129,6 +138,7 @@ class SearchClient:
|
|
|
129
138
|
graph_context=graph_context,
|
|
130
139
|
extra_context=extra_context,
|
|
131
140
|
search_mode=search_mode,
|
|
141
|
+
filters=filters,
|
|
132
142
|
request_options=request_options,
|
|
133
143
|
)
|
|
134
144
|
return _response.data
|
|
@@ -336,6 +346,7 @@ class AsyncSearchClient:
|
|
|
336
346
|
graph_context: typing.Optional[bool] = OMIT,
|
|
337
347
|
extra_context: typing.Optional[str] = OMIT,
|
|
338
348
|
search_mode: typing.Optional[SearchMode] = OMIT,
|
|
349
|
+
filters: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
339
350
|
request_options: typing.Optional[RequestOptions] = None,
|
|
340
351
|
) -> RetrievalResult:
|
|
341
352
|
"""
|
|
@@ -352,6 +363,11 @@ class AsyncSearchClient:
|
|
|
352
363
|
- "fast" (default): Single query, faster response
|
|
353
364
|
- "accurate": Multi-query generation with reranking, higher quality
|
|
354
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
|
+
|
|
355
371
|
Parameters
|
|
356
372
|
----------
|
|
357
373
|
tenant_id : str
|
|
@@ -390,6 +406,9 @@ class AsyncSearchClient:
|
|
|
390
406
|
search_mode : typing.Optional[SearchMode]
|
|
391
407
|
What to search: 'sources' for documents or 'memories' for user memories
|
|
392
408
|
|
|
409
|
+
filters : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
410
|
+
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
|
+
|
|
393
412
|
request_options : typing.Optional[RequestOptions]
|
|
394
413
|
Request-specific configuration.
|
|
395
414
|
|
|
@@ -422,6 +441,7 @@ class AsyncSearchClient:
|
|
|
422
441
|
graph_context=graph_context,
|
|
423
442
|
extra_context=extra_context,
|
|
424
443
|
search_mode=search_mode,
|
|
444
|
+
filters=filters,
|
|
425
445
|
request_options=request_options,
|
|
426
446
|
)
|
|
427
447
|
return _response.data
|
|
@@ -49,6 +49,7 @@ class RawSearchClient:
|
|
|
49
49
|
graph_context: typing.Optional[bool] = OMIT,
|
|
50
50
|
extra_context: typing.Optional[str] = OMIT,
|
|
51
51
|
search_mode: typing.Optional[SearchMode] = OMIT,
|
|
52
|
+
filters: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
52
53
|
request_options: typing.Optional[RequestOptions] = None,
|
|
53
54
|
) -> HttpResponse[RetrievalResult]:
|
|
54
55
|
"""
|
|
@@ -65,6 +66,11 @@ class RawSearchClient:
|
|
|
65
66
|
- "fast" (default): Single query, faster response
|
|
66
67
|
- "accurate": Multi-query generation with reranking, higher quality
|
|
67
68
|
|
|
69
|
+
Use `filters` to narrow results by metadata:
|
|
70
|
+
- Provide key-value pairs matching fields defined in your tenant_metadata_schema
|
|
71
|
+
- Example: `{"category": "engineering", "priority": "high"}`
|
|
72
|
+
- Filters are validated against your tenant schema for type safety
|
|
73
|
+
|
|
68
74
|
Parameters
|
|
69
75
|
----------
|
|
70
76
|
tenant_id : str
|
|
@@ -103,6 +109,9 @@ class RawSearchClient:
|
|
|
103
109
|
search_mode : typing.Optional[SearchMode]
|
|
104
110
|
What to search: 'sources' for documents or 'memories' for user memories
|
|
105
111
|
|
|
112
|
+
filters : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
113
|
+
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'}
|
|
114
|
+
|
|
106
115
|
request_options : typing.Optional[RequestOptions]
|
|
107
116
|
Request-specific configuration.
|
|
108
117
|
|
|
@@ -127,6 +136,7 @@ class RawSearchClient:
|
|
|
127
136
|
"graph_context": graph_context,
|
|
128
137
|
"extra_context": extra_context,
|
|
129
138
|
"search_mode": search_mode,
|
|
139
|
+
"filters": filters,
|
|
130
140
|
},
|
|
131
141
|
headers={
|
|
132
142
|
"content-type": "application/json",
|
|
@@ -633,6 +643,7 @@ class AsyncRawSearchClient:
|
|
|
633
643
|
graph_context: typing.Optional[bool] = OMIT,
|
|
634
644
|
extra_context: typing.Optional[str] = OMIT,
|
|
635
645
|
search_mode: typing.Optional[SearchMode] = OMIT,
|
|
646
|
+
filters: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
636
647
|
request_options: typing.Optional[RequestOptions] = None,
|
|
637
648
|
) -> AsyncHttpResponse[RetrievalResult]:
|
|
638
649
|
"""
|
|
@@ -649,6 +660,11 @@ class AsyncRawSearchClient:
|
|
|
649
660
|
- "fast" (default): Single query, faster response
|
|
650
661
|
- "accurate": Multi-query generation with reranking, higher quality
|
|
651
662
|
|
|
663
|
+
Use `filters` to narrow results by metadata:
|
|
664
|
+
- Provide key-value pairs matching fields defined in your tenant_metadata_schema
|
|
665
|
+
- Example: `{"category": "engineering", "priority": "high"}`
|
|
666
|
+
- Filters are validated against your tenant schema for type safety
|
|
667
|
+
|
|
652
668
|
Parameters
|
|
653
669
|
----------
|
|
654
670
|
tenant_id : str
|
|
@@ -687,6 +703,9 @@ class AsyncRawSearchClient:
|
|
|
687
703
|
search_mode : typing.Optional[SearchMode]
|
|
688
704
|
What to search: 'sources' for documents or 'memories' for user memories
|
|
689
705
|
|
|
706
|
+
filters : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
707
|
+
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'}
|
|
708
|
+
|
|
690
709
|
request_options : typing.Optional[RequestOptions]
|
|
691
710
|
Request-specific configuration.
|
|
692
711
|
|
|
@@ -711,6 +730,7 @@ class AsyncRawSearchClient:
|
|
|
711
730
|
"graph_context": graph_context,
|
|
712
731
|
"extra_context": extra_context,
|
|
713
732
|
"search_mode": search_mode,
|
|
733
|
+
"filters": filters,
|
|
714
734
|
},
|
|
715
735
|
headers={
|
|
716
736
|
"content-type": "application/json",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -19,6 +19,7 @@ from .delete_user_memory_response import DeleteUserMemoryResponse
|
|
|
19
19
|
from .entity import Entity
|
|
20
20
|
from .error_response import ErrorResponse
|
|
21
21
|
from .fetch_mode import FetchMode
|
|
22
|
+
from .forceful_relations_payload import ForcefulRelationsPayload
|
|
22
23
|
from .graph_context import GraphContext
|
|
23
24
|
from .http_validation_error import HttpValidationError
|
|
24
25
|
from .infra import Infra
|
|
@@ -76,6 +77,7 @@ __all__ = [
|
|
|
76
77
|
"Entity",
|
|
77
78
|
"ErrorResponse",
|
|
78
79
|
"FetchMode",
|
|
80
|
+
"ForcefulRelationsPayload",
|
|
79
81
|
"GraphContext",
|
|
80
82
|
"HttpValidationError",
|
|
81
83
|
"Infra",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/custom_property_definition.py
RENAMED
|
File without changes
|
|
File without changes
|
{usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/dashboard_sources_response.py
RENAMED
|
File without changes
|
{usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/dashboard_tenants_response.py
RENAMED
|
File without changes
|
|
File without changes
|
{usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/delete_user_memory_response.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ForcefulRelationsPayload(UniversalBaseModel):
|
|
10
|
+
cortex_source_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
|
|
11
|
+
"""
|
|
12
|
+
Cortex source IDs to forcefully relate to the uploaded source.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
properties: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
|
|
16
|
+
"""
|
|
17
|
+
Optional properties to attach to the forceful relation.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
if IS_PYDANTIC_V2:
|
|
21
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
22
|
+
else:
|
|
23
|
+
|
|
24
|
+
class Config:
|
|
25
|
+
frozen = True
|
|
26
|
+
smart_union = True
|
|
27
|
+
extra = pydantic.Extra.allow
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -4,6 +4,7 @@ import typing
|
|
|
4
4
|
|
|
5
5
|
import pydantic
|
|
6
6
|
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
+
from .forceful_relations_payload import ForcefulRelationsPayload
|
|
7
8
|
from .user_assistant_pair import UserAssistantPair
|
|
8
9
|
|
|
9
10
|
|
|
@@ -40,7 +41,7 @@ class MemoryItem(UniversalBaseModel):
|
|
|
40
41
|
|
|
41
42
|
infer: typing.Optional[bool] = pydantic.Field(default=None)
|
|
42
43
|
"""
|
|
43
|
-
If true, process and extract additional insights/inferences from the
|
|
44
|
+
If true, process and extract additional insights/inferences from the contentbefore indexingUseful for extracting implicit information from conversations
|
|
44
45
|
"""
|
|
45
46
|
|
|
46
47
|
custom_instructions: typing.Optional[str] = pydantic.Field(default=None)
|
|
@@ -72,6 +73,11 @@ class MemoryItem(UniversalBaseModel):
|
|
|
72
73
|
Example: > "{"title":"Q1 Report.pdf","author":"Alice Smith","file_id":"custom_file_123"}"
|
|
73
74
|
"""
|
|
74
75
|
|
|
76
|
+
relations: typing.Optional[ForcefulRelationsPayload] = pydantic.Field(default=None)
|
|
77
|
+
"""
|
|
78
|
+
Forcefully connect 2 sources based on cortex source ids or common properties.
|
|
79
|
+
"""
|
|
80
|
+
|
|
75
81
|
if IS_PYDANTIC_V2:
|
|
76
82
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
77
83
|
else:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/raw_embedding_search_result.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -15,6 +15,10 @@ class RetrievalResult(UniversalBaseModel):
|
|
|
15
15
|
|
|
16
16
|
chunks: typing.Optional[typing.List[VectorStoreChunk]] = None
|
|
17
17
|
graph_context: typing.Optional[GraphContext] = None
|
|
18
|
+
extra_context: typing.Optional[typing.Dict[str, VectorStoreChunk]] = pydantic.Field(default=None)
|
|
19
|
+
"""
|
|
20
|
+
Map of chunk_uuid to VectorStoreChunk for extra context from forcefully related sources. Use chunk.extra_context_ids to look up chunks: extra_context[id] for id in chunk.extra_context_ids.
|
|
21
|
+
"""
|
|
18
22
|
|
|
19
23
|
if IS_PYDANTIC_V2:
|
|
20
24
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/source_delete_result_item.py
RENAMED
|
File without changes
|
|
File without changes
|
{usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/source_graph_relations_response.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/source_upload_result_item.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/tenant_metadata_schema_info.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{usecortex_ai-0.4.0 → usecortex_ai-0.5.0}/src/usecortex_ai/types/validation_error_loc_item.py
RENAMED
|
File without changes
|
|
@@ -62,6 +62,11 @@ class VectorStoreChunk(UniversalBaseModel):
|
|
|
62
62
|
Custom metadata associated with your tenant
|
|
63
63
|
"""
|
|
64
64
|
|
|
65
|
+
extra_context_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
|
|
66
|
+
"""
|
|
67
|
+
IDs of related chunks providing extra context (from forceful relations). Only present in accurate mode when sources have forceful relations.
|
|
68
|
+
"""
|
|
69
|
+
|
|
65
70
|
if IS_PYDANTIC_V2:
|
|
66
71
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
67
72
|
else:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -71,6 +71,7 @@ src/usecortex_ai/types/delete_user_memory_response.py
|
|
|
71
71
|
src/usecortex_ai/types/entity.py
|
|
72
72
|
src/usecortex_ai/types/error_response.py
|
|
73
73
|
src/usecortex_ai/types/fetch_mode.py
|
|
74
|
+
src/usecortex_ai/types/forceful_relations_payload.py
|
|
74
75
|
src/usecortex_ai/types/graph_context.py
|
|
75
76
|
src/usecortex_ai/types/http_validation_error.py
|
|
76
77
|
src/usecortex_ai/types/infra.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|