usecortex-ai 0.1.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.
Files changed (94) hide show
  1. usecortex_ai-0.1.0/LICENSE +22 -0
  2. usecortex_ai-0.1.0/PKG-INFO +136 -0
  3. usecortex_ai-0.1.0/README.md +91 -0
  4. usecortex_ai-0.1.0/pyproject.toml +46 -0
  5. usecortex_ai-0.1.0/setup.cfg +4 -0
  6. usecortex_ai-0.1.0/src/cortex_ai/__init__.py +103 -0
  7. usecortex_ai-0.1.0/src/cortex_ai/client.py +244 -0
  8. usecortex_ai-0.1.0/src/cortex_ai/core/__init__.py +52 -0
  9. usecortex_ai-0.1.0/src/cortex_ai/core/api_error.py +23 -0
  10. usecortex_ai-0.1.0/src/cortex_ai/core/client_wrapper.py +84 -0
  11. usecortex_ai-0.1.0/src/cortex_ai/core/datetime_utils.py +28 -0
  12. usecortex_ai-0.1.0/src/cortex_ai/core/file.py +67 -0
  13. usecortex_ai-0.1.0/src/cortex_ai/core/force_multipart.py +18 -0
  14. usecortex_ai-0.1.0/src/cortex_ai/core/http_client.py +543 -0
  15. usecortex_ai-0.1.0/src/cortex_ai/core/http_response.py +55 -0
  16. usecortex_ai-0.1.0/src/cortex_ai/core/jsonable_encoder.py +100 -0
  17. usecortex_ai-0.1.0/src/cortex_ai/core/pydantic_utilities.py +258 -0
  18. usecortex_ai-0.1.0/src/cortex_ai/core/query_encoder.py +58 -0
  19. usecortex_ai-0.1.0/src/cortex_ai/core/remove_none_from_dict.py +11 -0
  20. usecortex_ai-0.1.0/src/cortex_ai/core/request_options.py +35 -0
  21. usecortex_ai-0.1.0/src/cortex_ai/core/serialization.py +276 -0
  22. usecortex_ai-0.1.0/src/cortex_ai/embeddings/__init__.py +4 -0
  23. usecortex_ai-0.1.0/src/cortex_ai/embeddings/client.py +442 -0
  24. usecortex_ai-0.1.0/src/cortex_ai/embeddings/raw_client.py +1153 -0
  25. usecortex_ai-0.1.0/src/cortex_ai/environment.py +7 -0
  26. usecortex_ai-0.1.0/src/cortex_ai/errors/__init__.py +21 -0
  27. usecortex_ai-0.1.0/src/cortex_ai/errors/bad_request_error.py +11 -0
  28. usecortex_ai-0.1.0/src/cortex_ai/errors/forbidden_error.py +11 -0
  29. usecortex_ai-0.1.0/src/cortex_ai/errors/internal_server_error.py +11 -0
  30. usecortex_ai-0.1.0/src/cortex_ai/errors/not_found_error.py +11 -0
  31. usecortex_ai-0.1.0/src/cortex_ai/errors/service_unavailable_error.py +11 -0
  32. usecortex_ai-0.1.0/src/cortex_ai/errors/unauthorized_error.py +11 -0
  33. usecortex_ai-0.1.0/src/cortex_ai/errors/unprocessable_entity_error.py +10 -0
  34. usecortex_ai-0.1.0/src/cortex_ai/fetch/__init__.py +4 -0
  35. usecortex_ai-0.1.0/src/cortex_ai/fetch/client.py +143 -0
  36. usecortex_ai-0.1.0/src/cortex_ai/fetch/raw_client.py +310 -0
  37. usecortex_ai-0.1.0/src/cortex_ai/raw_client.py +90 -0
  38. usecortex_ai-0.1.0/src/cortex_ai/search/__init__.py +7 -0
  39. usecortex_ai-0.1.0/src/cortex_ai/search/client.py +536 -0
  40. usecortex_ai-0.1.0/src/cortex_ai/search/raw_client.py +1064 -0
  41. usecortex_ai-0.1.0/src/cortex_ai/search/types/__init__.py +7 -0
  42. usecortex_ai-0.1.0/src/cortex_ai/search/types/alpha.py +5 -0
  43. usecortex_ai-0.1.0/src/cortex_ai/sources/__init__.py +4 -0
  44. usecortex_ai-0.1.0/src/cortex_ai/sources/client.py +187 -0
  45. usecortex_ai-0.1.0/src/cortex_ai/sources/raw_client.py +532 -0
  46. usecortex_ai-0.1.0/src/cortex_ai/tenant/__init__.py +4 -0
  47. usecortex_ai-0.1.0/src/cortex_ai/tenant/client.py +120 -0
  48. usecortex_ai-0.1.0/src/cortex_ai/tenant/raw_client.py +283 -0
  49. usecortex_ai-0.1.0/src/cortex_ai/types/__init__.py +69 -0
  50. usecortex_ai-0.1.0/src/cortex_ai/types/actual_error_response.py +20 -0
  51. usecortex_ai-0.1.0/src/cortex_ai/types/app_sources_upload_data.py +22 -0
  52. usecortex_ai-0.1.0/src/cortex_ai/types/attachment_model.py +26 -0
  53. usecortex_ai-0.1.0/src/cortex_ai/types/batch_upload_data.py +22 -0
  54. usecortex_ai-0.1.0/src/cortex_ai/types/bm_25_operator_type.py +5 -0
  55. usecortex_ai-0.1.0/src/cortex_ai/types/content_model.py +26 -0
  56. usecortex_ai-0.1.0/src/cortex_ai/types/delete_memory_request.py +21 -0
  57. usecortex_ai-0.1.0/src/cortex_ai/types/embeddings_create_collection_data.py +22 -0
  58. usecortex_ai-0.1.0/src/cortex_ai/types/embeddings_delete_data.py +22 -0
  59. usecortex_ai-0.1.0/src/cortex_ai/types/embeddings_get_data.py +22 -0
  60. usecortex_ai-0.1.0/src/cortex_ai/types/embeddings_search_data.py +22 -0
  61. usecortex_ai-0.1.0/src/cortex_ai/types/error_response.py +22 -0
  62. usecortex_ai-0.1.0/src/cortex_ai/types/extended_context.py +20 -0
  63. usecortex_ai-0.1.0/src/cortex_ai/types/fetch_content_data.py +23 -0
  64. usecortex_ai-0.1.0/src/cortex_ai/types/file_upload_result.py +20 -0
  65. usecortex_ai-0.1.0/src/cortex_ai/types/full_text_search_data.py +22 -0
  66. usecortex_ai-0.1.0/src/cortex_ai/types/http_validation_error.py +20 -0
  67. usecortex_ai-0.1.0/src/cortex_ai/types/list_sources_response.py +22 -0
  68. usecortex_ai-0.1.0/src/cortex_ai/types/markdown_upload_request.py +21 -0
  69. usecortex_ai-0.1.0/src/cortex_ai/types/processing_status.py +22 -0
  70. usecortex_ai-0.1.0/src/cortex_ai/types/related_chunk.py +22 -0
  71. usecortex_ai-0.1.0/src/cortex_ai/types/search_chunk.py +34 -0
  72. usecortex_ai-0.1.0/src/cortex_ai/types/search_data.py +22 -0
  73. usecortex_ai-0.1.0/src/cortex_ai/types/single_upload_data.py +21 -0
  74. usecortex_ai-0.1.0/src/cortex_ai/types/source.py +32 -0
  75. usecortex_ai-0.1.0/src/cortex_ai/types/source_content.py +26 -0
  76. usecortex_ai-0.1.0/src/cortex_ai/types/source_model.py +32 -0
  77. usecortex_ai-0.1.0/src/cortex_ai/types/tenant_create_data.py +22 -0
  78. usecortex_ai-0.1.0/src/cortex_ai/types/tenant_stats.py +23 -0
  79. usecortex_ai-0.1.0/src/cortex_ai/types/validation_error.py +22 -0
  80. usecortex_ai-0.1.0/src/cortex_ai/types/validation_error_loc_item.py +5 -0
  81. usecortex_ai-0.1.0/src/cortex_ai/upload/__init__.py +4 -0
  82. usecortex_ai-0.1.0/src/cortex_ai/upload/client.py +1572 -0
  83. usecortex_ai-0.1.0/src/cortex_ai/upload/raw_client.py +4202 -0
  84. usecortex_ai-0.1.0/src/cortex_ai/user/__init__.py +4 -0
  85. usecortex_ai-0.1.0/src/cortex_ai/user/client.py +125 -0
  86. usecortex_ai-0.1.0/src/cortex_ai/user/raw_client.py +300 -0
  87. usecortex_ai-0.1.0/src/cortex_ai/user_memory/__init__.py +4 -0
  88. usecortex_ai-0.1.0/src/cortex_ai/user_memory/client.py +443 -0
  89. usecortex_ai-0.1.0/src/cortex_ai/user_memory/raw_client.py +651 -0
  90. usecortex_ai-0.1.0/src/usecortex_ai.egg-info/PKG-INFO +136 -0
  91. usecortex_ai-0.1.0/src/usecortex_ai.egg-info/SOURCES.txt +92 -0
  92. usecortex_ai-0.1.0/src/usecortex_ai.egg-info/dependency_links.txt +1 -0
  93. usecortex_ai-0.1.0/src/usecortex_ai.egg-info/requires.txt +2 -0
  94. usecortex_ai-0.1.0/src/usecortex_ai.egg-info/top_level.txt +1 -0
@@ -0,0 +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 authorized 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
+ SOFTWARE.
@@ -0,0 +1,136 @@
1
+ Metadata-Version: 2.4
2
+ Name: usecortex-ai
3
+ Version: 0.1.0
4
+ Summary: The official Python SDK for the Cortex AI platform.
5
+ Author-email: Nishkarsh Shrivastava <nishkarsh@usecortex.ai>
6
+ License: Copyright (c) 2024 Cortex AI
7
+
8
+ All Rights Reserved.
9
+
10
+ PROPRIETARY AND CONFIDENTIAL
11
+
12
+ This software is the proprietary and confidential property of Cortex AI ("the Company").
13
+ Permission is hereby granted to authorized 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.
14
+
15
+ You may not, without the express written permission of the Company:
16
+
17
+ 1. Copy, modify, or create derivative works of the software.
18
+ 2. Distribute, sell, rent, lease, sublicense, or otherwise transfer the software to any third party.
19
+ 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.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+ Project-URL: Homepage, https://www.usecortex.ai/
29
+ Project-URL: Documentation, https://docs.usecortex.ai/
30
+ Keywords: cortex,ai,sdk,api,generative ai,rag
31
+ Classifier: Development Status :: 4 - Beta
32
+ Classifier: Programming Language :: Python :: 3
33
+ Classifier: Programming Language :: Python :: 3.10
34
+ Classifier: Programming Language :: Python :: 3.11
35
+ Classifier: Programming Language :: Python :: 3.12
36
+ Classifier: Intended Audience :: Developers
37
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
38
+ Classifier: Typing :: Typed
39
+ Requires-Python: >=3.10
40
+ Description-Content-Type: text/markdown
41
+ License-File: LICENSE
42
+ Requires-Dist: httpx>=0.24
43
+ Requires-Dist: pydantic<3,>=1.10
44
+ Dynamic: license-file
45
+
46
+ ```
47
+ # Introduction
48
+
49
+ > You can generate and manage API keys from your Cortex Dashboard. All endpoints require an API key sent as a Bearer token in the Authorization header.
50
+
51
+ Welcome to the Cortex SDK API Reference. This section documents every available endpoint and how to interact with them to power AI apps and agents with intelligent memory and retrieval.
52
+
53
+ > Base URL: `https://api.usecortex.ai`
54
+ >
55
+ > Contact us to get your API key at [founders@usecortex.ai](mailto:founders@usecortex.ai)
56
+
57
+ ```mdx
58
+ Authorization: Bearer <your_api_key>
59
+ ```
60
+
61
+ ### **Data Ingestion**
62
+
63
+ Upload and import content into Cortex from various sources.
64
+
65
+ * `/upload/upload_document` — Upload single documents
66
+ * `/upload/upload_text` — Upload text/markdown content
67
+ * `/upload/upload_app_sources` — Import from workplace apps (Gmail, Slack, etc.)
68
+ * `/upload/scrape_webpage` — Scrape and index web content
69
+ * `/upload/verify_processing` — Check upload processing status
70
+ * `/upload/batch_upload` — Upload multiple files at once
71
+
72
+ ### **Search & Query**
73
+
74
+ Retrieve answers and information from your knowledge base.
75
+
76
+ * `/search/qna` — Main search endpoint with AI-powered responses. Supports optional `metadata` parameter to filter sources by `source_title` or `source_type`.
77
+ * `/search/retrieve` — Hybrid search without AI generation. Returns structured search results for custom processing.
78
+ – `/search/full-text-search` – Perform a full text search without AI generation. Allows you to use operators like logical `AND`, `OR`
79
+
80
+ ### **Knowledge Management**
81
+
82
+ Browse, fetch, and manage your knowledge base.
83
+
84
+ * `/list/sources` — Browse all indexed sources
85
+ * `/list/sources_by_id` — Get specific sources by ID
86
+ * `/fetch/fetch_content` — Retrieve file content and download URLs
87
+ * `/delete_source` — Remove sources from knowledge base
88
+
89
+ ### **Update & Upsert**
90
+
91
+ Update existing content and embeddings. If a `source_id` does not exist, these endpoints upsert (create or update).
92
+
93
+ * `/upload/update_text` — Upsert markdown/text content by `source_id`
94
+ * `/upload/update_document` — Upsert a file/document by `source_id`
95
+ * `/upload/update_webpage` — Re-scrape and upsert a webpage by `source_id` and `web_url`
96
+ * `/upload/update_embeddings` — Update existing embeddings by `chunk_id` within a batch/source
97
+
98
+ ### **Embeddings**
99
+
100
+ Manage and query pre-computed embeddings.
101
+
102
+ * `/upload/upload_embeddings` — Upload embeddings and get generated `chunk_ids`
103
+ * `/embeddings/search` — Vector similarity search; returns nearest `chunk_ids` and scores
104
+ * `/embeddings/by-chunk-ids` — Retrieve embedding vectors for specific `chunk_ids`
105
+ * `/embeddings/delete` — Delete embeddings by `chunk_id`
106
+
107
+ ### **Tenant Management**
108
+
109
+ Create and monitor tenants for multi-tenant setups.
110
+
111
+ * `/user/create_tenant` — Create a tenant (optionally provide `tenant_id`, or auto-generate)
112
+ * `/embeddings/create_embeddings_tenant` — Create an embeddings-only tenant (sets `sub_tenant_id = tenant_id`); use when directly uploading/searching embeddings
113
+ * `/tenant/stats` — Get tenant stats (object count, vector dimension, identifiers)
114
+
115
+ ### **User Memory**
116
+
117
+ Personalize, retrieve, and manage user-specific AI memories for advanced agentic workflows.
118
+
119
+ * `/user_memory/list_user_memories` — Browse user memories
120
+ * `/user_memory/retrieve_user_memory` — Get specific user memories
121
+ * `/user_memory/add_user_memory` — Manually add user-specific memories
122
+ * `/user_memory/generate_user_memory` — AI-generated personalized memories
123
+ * `/user_memory/delete_user_memory` — Remove user memories
124
+
125
+ ## 💡 Best Practices
126
+
127
+ * Use **sub-tenants** to support multi-user isolation in B2B use cases.
128
+ * Leverage **metadata** (e.g., `source_title`, `source_type` in the QnA API) for fine-grained filtering and agentic retrieval.
129
+ * Tune **search\_alpha** and **recency\_bias** to control relevance.
130
+ * Enable **highlight\_chunks** for chunk-level citations.
131
+
132
+ ---
133
+
134
+ ```
135
+
136
+ ```
@@ -0,0 +1,91 @@
1
+ ```
2
+ # Introduction
3
+
4
+ > You can generate and manage API keys from your Cortex Dashboard. All endpoints require an API key sent as a Bearer token in the Authorization header.
5
+
6
+ Welcome to the Cortex SDK API Reference. This section documents every available endpoint and how to interact with them to power AI apps and agents with intelligent memory and retrieval.
7
+
8
+ > Base URL: `https://api.usecortex.ai`
9
+ >
10
+ > Contact us to get your API key at [founders@usecortex.ai](mailto:founders@usecortex.ai)
11
+
12
+ ```mdx
13
+ Authorization: Bearer <your_api_key>
14
+ ```
15
+
16
+ ### **Data Ingestion**
17
+
18
+ Upload and import content into Cortex from various sources.
19
+
20
+ * `/upload/upload_document` — Upload single documents
21
+ * `/upload/upload_text` — Upload text/markdown content
22
+ * `/upload/upload_app_sources` — Import from workplace apps (Gmail, Slack, etc.)
23
+ * `/upload/scrape_webpage` — Scrape and index web content
24
+ * `/upload/verify_processing` — Check upload processing status
25
+ * `/upload/batch_upload` — Upload multiple files at once
26
+
27
+ ### **Search & Query**
28
+
29
+ Retrieve answers and information from your knowledge base.
30
+
31
+ * `/search/qna` — Main search endpoint with AI-powered responses. Supports optional `metadata` parameter to filter sources by `source_title` or `source_type`.
32
+ * `/search/retrieve` — Hybrid search without AI generation. Returns structured search results for custom processing.
33
+ – `/search/full-text-search` – Perform a full text search without AI generation. Allows you to use operators like logical `AND`, `OR`
34
+
35
+ ### **Knowledge Management**
36
+
37
+ Browse, fetch, and manage your knowledge base.
38
+
39
+ * `/list/sources` — Browse all indexed sources
40
+ * `/list/sources_by_id` — Get specific sources by ID
41
+ * `/fetch/fetch_content` — Retrieve file content and download URLs
42
+ * `/delete_source` — Remove sources from knowledge base
43
+
44
+ ### **Update & Upsert**
45
+
46
+ Update existing content and embeddings. If a `source_id` does not exist, these endpoints upsert (create or update).
47
+
48
+ * `/upload/update_text` — Upsert markdown/text content by `source_id`
49
+ * `/upload/update_document` — Upsert a file/document by `source_id`
50
+ * `/upload/update_webpage` — Re-scrape and upsert a webpage by `source_id` and `web_url`
51
+ * `/upload/update_embeddings` — Update existing embeddings by `chunk_id` within a batch/source
52
+
53
+ ### **Embeddings**
54
+
55
+ Manage and query pre-computed embeddings.
56
+
57
+ * `/upload/upload_embeddings` — Upload embeddings and get generated `chunk_ids`
58
+ * `/embeddings/search` — Vector similarity search; returns nearest `chunk_ids` and scores
59
+ * `/embeddings/by-chunk-ids` — Retrieve embedding vectors for specific `chunk_ids`
60
+ * `/embeddings/delete` — Delete embeddings by `chunk_id`
61
+
62
+ ### **Tenant Management**
63
+
64
+ Create and monitor tenants for multi-tenant setups.
65
+
66
+ * `/user/create_tenant` — Create a tenant (optionally provide `tenant_id`, or auto-generate)
67
+ * `/embeddings/create_embeddings_tenant` — Create an embeddings-only tenant (sets `sub_tenant_id = tenant_id`); use when directly uploading/searching embeddings
68
+ * `/tenant/stats` — Get tenant stats (object count, vector dimension, identifiers)
69
+
70
+ ### **User Memory**
71
+
72
+ Personalize, retrieve, and manage user-specific AI memories for advanced agentic workflows.
73
+
74
+ * `/user_memory/list_user_memories` — Browse user memories
75
+ * `/user_memory/retrieve_user_memory` — Get specific user memories
76
+ * `/user_memory/add_user_memory` — Manually add user-specific memories
77
+ * `/user_memory/generate_user_memory` — AI-generated personalized memories
78
+ * `/user_memory/delete_user_memory` — Remove user memories
79
+
80
+ ## 💡 Best Practices
81
+
82
+ * Use **sub-tenants** to support multi-user isolation in B2B use cases.
83
+ * Leverage **metadata** (e.g., `source_title`, `source_type` in the QnA API) for fine-grained filtering and agentic retrieval.
84
+ * Tune **search\_alpha** and **recency\_bias** to control relevance.
85
+ * Enable **highlight\_chunks** for chunk-level citations.
86
+
87
+ ---
88
+
89
+ ```
90
+
91
+ ```
@@ -0,0 +1,46 @@
1
+ # pyproject.toml
2
+
3
+ [build-system]
4
+ requires = ["setuptools>=61.0"]
5
+ build-backend = "setuptools.build_meta"
6
+
7
+ [project]
8
+ # This is the name used for 'pip install usecortex-ai'
9
+ name = "usecortex-ai"
10
+
11
+ # Start with an initial version
12
+ version = "0.1.0"
13
+
14
+ authors = [
15
+ { name = "Nishkarsh Shrivastava", email = "nishkarsh@usecortex.ai" },
16
+ ]
17
+ description = "The official Python SDK for the Cortex AI platform."
18
+ readme = "README.md"
19
+ requires-python = ">=3.10"
20
+ license = { file = "LICENSE" }
21
+ keywords = ["cortex", "ai", "sdk", "api", "generative ai", "rag"]
22
+
23
+ # Add classifiers to help users find your package on PyPI
24
+ classifiers = [
25
+ # See https://pypi.org/classifiers/
26
+ "Development Status :: 4 - Beta",
27
+ "Programming Language :: Python :: 3",
28
+ "Programming Language :: Python :: 3.10",
29
+ "Programming Language :: Python :: 3.11",
30
+ "Programming Language :: Python :: 3.12",
31
+ "Intended Audience :: Developers",
32
+ "Topic :: Software Development :: Libraries :: Python Modules",
33
+ "Typing :: Typed",
34
+ ]
35
+
36
+ dependencies = [
37
+ "httpx>=0.24",
38
+ "pydantic>=1.10,<3",
39
+ ]
40
+
41
+ [project.urls]
42
+ Homepage = "https://www.usecortex.ai/"
43
+ Documentation = "https://docs.usecortex.ai/"
44
+ # Add this if you have a public issue tracker
45
+ # "Bug Tracker" = "https://github.com/your-org/your-repo/issues"
46
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,103 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ from .types import (
6
+ ActualErrorResponse,
7
+ AppSourcesUploadData,
8
+ AttachmentModel,
9
+ BatchUploadData,
10
+ Bm25OperatorType,
11
+ ContentModel,
12
+ DeleteMemoryRequest,
13
+ EmbeddingsCreateCollectionData,
14
+ EmbeddingsDeleteData,
15
+ EmbeddingsGetData,
16
+ EmbeddingsSearchData,
17
+ ErrorResponse,
18
+ ExtendedContext,
19
+ FetchContentData,
20
+ FileUploadResult,
21
+ FullTextSearchData,
22
+ HttpValidationError,
23
+ ListSourcesResponse,
24
+ MarkdownUploadRequest,
25
+ ProcessingStatus,
26
+ RelatedChunk,
27
+ SearchChunk,
28
+ SearchData,
29
+ SingleUploadData,
30
+ Source,
31
+ SourceContent,
32
+ SourceModel,
33
+ TenantCreateData,
34
+ TenantStats,
35
+ ValidationError,
36
+ ValidationErrorLocItem,
37
+ )
38
+ from .errors import (
39
+ BadRequestError,
40
+ ForbiddenError,
41
+ InternalServerError,
42
+ NotFoundError,
43
+ ServiceUnavailableError,
44
+ UnauthorizedError,
45
+ UnprocessableEntityError,
46
+ )
47
+ from . import embeddings, fetch, search, sources, tenant, upload, user, user_memory
48
+ from .client import AsyncCortexAI, CortexAI
49
+ from .environment import CortexAIEnvironment
50
+ from .search import Alpha
51
+
52
+ __all__ = [
53
+ "ActualErrorResponse",
54
+ "Alpha",
55
+ "AppSourcesUploadData",
56
+ "AsyncCortexAI",
57
+ "AttachmentModel",
58
+ "BadRequestError",
59
+ "BatchUploadData",
60
+ "Bm25OperatorType",
61
+ "ContentModel",
62
+ "CortexAI",
63
+ "CortexAIEnvironment",
64
+ "DeleteMemoryRequest",
65
+ "EmbeddingsCreateCollectionData",
66
+ "EmbeddingsDeleteData",
67
+ "EmbeddingsGetData",
68
+ "EmbeddingsSearchData",
69
+ "ErrorResponse",
70
+ "ExtendedContext",
71
+ "FetchContentData",
72
+ "FileUploadResult",
73
+ "ForbiddenError",
74
+ "FullTextSearchData",
75
+ "HttpValidationError",
76
+ "InternalServerError",
77
+ "ListSourcesResponse",
78
+ "MarkdownUploadRequest",
79
+ "NotFoundError",
80
+ "ProcessingStatus",
81
+ "RelatedChunk",
82
+ "SearchChunk",
83
+ "SearchData",
84
+ "ServiceUnavailableError",
85
+ "SingleUploadData",
86
+ "Source",
87
+ "SourceContent",
88
+ "SourceModel",
89
+ "TenantCreateData",
90
+ "TenantStats",
91
+ "UnauthorizedError",
92
+ "UnprocessableEntityError",
93
+ "ValidationError",
94
+ "ValidationErrorLocItem",
95
+ "embeddings",
96
+ "fetch",
97
+ "search",
98
+ "sources",
99
+ "tenant",
100
+ "upload",
101
+ "user",
102
+ "user_memory",
103
+ ]
@@ -0,0 +1,244 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import httpx
6
+ from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
7
+ from .core.request_options import RequestOptions
8
+ from .embeddings.client import AsyncEmbeddingsClient, EmbeddingsClient
9
+ from .environment import CortexAIEnvironment
10
+ from .fetch.client import AsyncFetchClient, FetchClient
11
+ from .raw_client import AsyncRawCortexAI, RawCortexAI
12
+ from .search.client import AsyncSearchClient, SearchClient
13
+ from .sources.client import AsyncSourcesClient, SourcesClient
14
+ from .tenant.client import AsyncTenantClient, TenantClient
15
+ from .upload.client import AsyncUploadClient, UploadClient
16
+ from .user.client import AsyncUserClient, UserClient
17
+ from .user_memory.client import AsyncUserMemoryClient, UserMemoryClient
18
+
19
+
20
+ class CortexAI:
21
+ """
22
+ Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
23
+
24
+ Parameters
25
+ ----------
26
+ base_url : typing.Optional[str]
27
+ The base url to use for requests from the client.
28
+
29
+ environment : CortexAIEnvironment
30
+ The environment to use for requests from the client. from .environment import CortexAIEnvironment
31
+
32
+
33
+
34
+ Defaults to CortexAIEnvironment.CORTEX_PROD
35
+
36
+
37
+
38
+ token : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
39
+ headers : typing.Optional[typing.Dict[str, str]]
40
+ Additional headers to send with every request.
41
+
42
+ timeout : typing.Optional[float]
43
+ The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
44
+
45
+ follow_redirects : typing.Optional[bool]
46
+ Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
47
+
48
+ httpx_client : typing.Optional[httpx.Client]
49
+ The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
50
+
51
+ Examples
52
+ --------
53
+ from cortex-ai import CortexAI
54
+
55
+ client = CortexAI(token="YOUR_TOKEN", )
56
+ """
57
+
58
+ def __init__(
59
+ self,
60
+ *,
61
+ base_url: typing.Optional[str] = None,
62
+ environment: CortexAIEnvironment = CortexAIEnvironment.CORTEX_PROD,
63
+ token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
64
+ headers: typing.Optional[typing.Dict[str, str]] = None,
65
+ timeout: typing.Optional[float] = None,
66
+ follow_redirects: typing.Optional[bool] = True,
67
+ httpx_client: typing.Optional[httpx.Client] = None,
68
+ ):
69
+ _defaulted_timeout = (
70
+ timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read
71
+ )
72
+ self._client_wrapper = SyncClientWrapper(
73
+ base_url=_get_base_url(base_url=base_url, environment=environment),
74
+ token=token,
75
+ headers=headers,
76
+ httpx_client=httpx_client
77
+ if httpx_client is not None
78
+ else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
79
+ if follow_redirects is not None
80
+ else httpx.Client(timeout=_defaulted_timeout),
81
+ timeout=_defaulted_timeout,
82
+ )
83
+ self._raw_client = RawCortexAI(client_wrapper=self._client_wrapper)
84
+ self.search = SearchClient(client_wrapper=self._client_wrapper)
85
+ self.sources = SourcesClient(client_wrapper=self._client_wrapper)
86
+ self.user_memory = UserMemoryClient(client_wrapper=self._client_wrapper)
87
+ self.fetch = FetchClient(client_wrapper=self._client_wrapper)
88
+ self.upload = UploadClient(client_wrapper=self._client_wrapper)
89
+ self.embeddings = EmbeddingsClient(client_wrapper=self._client_wrapper)
90
+ self.user = UserClient(client_wrapper=self._client_wrapper)
91
+ self.tenant = TenantClient(client_wrapper=self._client_wrapper)
92
+
93
+ @property
94
+ def with_raw_response(self) -> RawCortexAI:
95
+ """
96
+ Retrieves a raw implementation of this client that returns raw responses.
97
+
98
+ Returns
99
+ -------
100
+ RawCortexAI
101
+ """
102
+ return self._raw_client
103
+
104
+ def root_get(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Optional[typing.Any]:
105
+ """
106
+ Parameters
107
+ ----------
108
+ request_options : typing.Optional[RequestOptions]
109
+ Request-specific configuration.
110
+
111
+ Returns
112
+ -------
113
+ typing.Optional[typing.Any]
114
+ Successful Response
115
+
116
+ Examples
117
+ --------
118
+ from cortex-ai import CortexAI
119
+
120
+ client = CortexAI(token="YOUR_TOKEN", )
121
+ client.root_get()
122
+ """
123
+ _response = self._raw_client.root_get(request_options=request_options)
124
+ return _response.data
125
+
126
+
127
+ class AsyncCortexAI:
128
+ """
129
+ Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
130
+
131
+ Parameters
132
+ ----------
133
+ base_url : typing.Optional[str]
134
+ The base url to use for requests from the client.
135
+
136
+ environment : CortexAIEnvironment
137
+ The environment to use for requests from the client. from .environment import CortexAIEnvironment
138
+
139
+
140
+
141
+ Defaults to CortexAIEnvironment.CORTEX_PROD
142
+
143
+
144
+
145
+ token : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
146
+ headers : typing.Optional[typing.Dict[str, str]]
147
+ Additional headers to send with every request.
148
+
149
+ timeout : typing.Optional[float]
150
+ The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
151
+
152
+ follow_redirects : typing.Optional[bool]
153
+ Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
154
+
155
+ httpx_client : typing.Optional[httpx.AsyncClient]
156
+ The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
157
+
158
+ Examples
159
+ --------
160
+ from cortex-ai import AsyncCortexAI
161
+
162
+ client = AsyncCortexAI(token="YOUR_TOKEN", )
163
+ """
164
+
165
+ def __init__(
166
+ self,
167
+ *,
168
+ base_url: typing.Optional[str] = None,
169
+ environment: CortexAIEnvironment = CortexAIEnvironment.CORTEX_PROD,
170
+ token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
171
+ headers: typing.Optional[typing.Dict[str, str]] = None,
172
+ timeout: typing.Optional[float] = None,
173
+ follow_redirects: typing.Optional[bool] = True,
174
+ httpx_client: typing.Optional[httpx.AsyncClient] = None,
175
+ ):
176
+ _defaulted_timeout = (
177
+ timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read
178
+ )
179
+ self._client_wrapper = AsyncClientWrapper(
180
+ base_url=_get_base_url(base_url=base_url, environment=environment),
181
+ token=token,
182
+ headers=headers,
183
+ httpx_client=httpx_client
184
+ if httpx_client is not None
185
+ else httpx.AsyncClient(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
186
+ if follow_redirects is not None
187
+ else httpx.AsyncClient(timeout=_defaulted_timeout),
188
+ timeout=_defaulted_timeout,
189
+ )
190
+ self._raw_client = AsyncRawCortexAI(client_wrapper=self._client_wrapper)
191
+ self.search = AsyncSearchClient(client_wrapper=self._client_wrapper)
192
+ self.sources = AsyncSourcesClient(client_wrapper=self._client_wrapper)
193
+ self.user_memory = AsyncUserMemoryClient(client_wrapper=self._client_wrapper)
194
+ self.fetch = AsyncFetchClient(client_wrapper=self._client_wrapper)
195
+ self.upload = AsyncUploadClient(client_wrapper=self._client_wrapper)
196
+ self.embeddings = AsyncEmbeddingsClient(client_wrapper=self._client_wrapper)
197
+ self.user = AsyncUserClient(client_wrapper=self._client_wrapper)
198
+ self.tenant = AsyncTenantClient(client_wrapper=self._client_wrapper)
199
+
200
+ @property
201
+ def with_raw_response(self) -> AsyncRawCortexAI:
202
+ """
203
+ Retrieves a raw implementation of this client that returns raw responses.
204
+
205
+ Returns
206
+ -------
207
+ AsyncRawCortexAI
208
+ """
209
+ return self._raw_client
210
+
211
+ async def root_get(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Optional[typing.Any]:
212
+ """
213
+ Parameters
214
+ ----------
215
+ request_options : typing.Optional[RequestOptions]
216
+ Request-specific configuration.
217
+
218
+ Returns
219
+ -------
220
+ typing.Optional[typing.Any]
221
+ Successful Response
222
+
223
+ Examples
224
+ --------
225
+ import asyncio
226
+
227
+ from cortex-ai import AsyncCortexAI
228
+
229
+ client = AsyncCortexAI(token="YOUR_TOKEN", )
230
+ async def main() -> None:
231
+ await client.root_get()
232
+ asyncio.run(main())
233
+ """
234
+ _response = await self._raw_client.root_get(request_options=request_options)
235
+ return _response.data
236
+
237
+
238
+ def _get_base_url(*, base_url: typing.Optional[str] = None, environment: CortexAIEnvironment) -> str:
239
+ if base_url is not None:
240
+ return base_url
241
+ elif environment is not None:
242
+ return environment.value
243
+ else:
244
+ raise Exception("Please pass in either base_url or environment to construct the client")