usecortex-ai 0.2.0__tar.gz → 0.2.2__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 (118) hide show
  1. {usecortex_ai-0.2.0/src/usecortex_ai.egg-info → usecortex_ai-0.2.2}/PKG-INFO +1 -1
  2. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/pyproject.toml +1 -1
  3. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/__init__.py +20 -3
  4. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/client.py +7 -78
  5. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/core/client_wrapper.py +6 -8
  6. usecortex_ai-0.2.2/src/usecortex_ai/document/client.py +139 -0
  7. {usecortex_ai-0.2.0/src/usecortex_ai/tenant → usecortex_ai-0.2.2/src/usecortex_ai/document}/raw_client.py +54 -25
  8. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/embeddings/client.py +50 -82
  9. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/embeddings/raw_client.py +48 -80
  10. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/fetch/client.py +10 -0
  11. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/fetch/raw_client.py +10 -0
  12. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/search/client.py +74 -80
  13. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/search/raw_client.py +74 -80
  14. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/sources/client.py +28 -0
  15. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/sources/raw_client.py +28 -0
  16. usecortex_ai-0.2.2/src/usecortex_ai/tenant/client.py +268 -0
  17. usecortex_ai-0.2.2/src/usecortex_ai/tenant/raw_client.py +781 -0
  18. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/__init__.py +18 -2
  19. usecortex_ai-0.2.2/src/usecortex_ai/types/add_user_memory_response.py +36 -0
  20. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/app_sources_upload_data.py +10 -2
  21. usecortex_ai-0.2.2/src/usecortex_ai/types/attachment_model.py +53 -0
  22. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/batch_upload_data.py +10 -2
  23. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/body_scrape_webpage_upload_scrape_webpage_post.py +0 -2
  24. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/body_update_scrape_job_upload_update_webpage_patch.py +0 -2
  25. usecortex_ai-0.2.2/src/usecortex_ai/types/content_model.py +53 -0
  26. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/delete_memory_request.py +14 -3
  27. usecortex_ai-0.2.0/src/usecortex_ai/types/single_upload_data.py → usecortex_ai-0.2.2/src/usecortex_ai/types/delete_sources.py +1 -2
  28. usecortex_ai-0.2.2/src/usecortex_ai/types/delete_sub_tenant_data.py +42 -0
  29. usecortex_ai-0.2.2/src/usecortex_ai/types/delete_user_memory_response.py +31 -0
  30. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/embeddings_create_collection_data.py +19 -4
  31. usecortex_ai-0.2.2/src/usecortex_ai/types/embeddings_delete_data.py +37 -0
  32. usecortex_ai-0.2.2/src/usecortex_ai/types/embeddings_get_data.py +37 -0
  33. usecortex_ai-0.2.2/src/usecortex_ai/types/embeddings_search_data.py +37 -0
  34. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/error_response.py +0 -1
  35. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/fetch_content_data.py +19 -5
  36. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/file_upload_result.py +9 -2
  37. usecortex_ai-0.2.2/src/usecortex_ai/types/generate_user_memory_response.py +32 -0
  38. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/list_sources_response.py +14 -3
  39. usecortex_ai-0.2.2/src/usecortex_ai/types/list_user_memories_response.py +32 -0
  40. usecortex_ai-0.2.2/src/usecortex_ai/types/markdown_upload_request.py +36 -0
  41. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/processing_status.py +14 -3
  42. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/relations.py +2 -2
  43. usecortex_ai-0.2.2/src/usecortex_ai/types/retrieve_user_memory_response.py +32 -0
  44. usecortex_ai-0.2.2/src/usecortex_ai/types/search_chunk.py +72 -0
  45. usecortex_ai-0.2.0/src/usecortex_ai/types/embeddings_delete_data.py → usecortex_ai-0.2.2/src/usecortex_ai/types/single_upload_data.py +11 -4
  46. usecortex_ai-0.2.2/src/usecortex_ai/types/source.py +52 -0
  47. usecortex_ai-0.2.2/src/usecortex_ai/types/source_model.py +83 -0
  48. usecortex_ai-0.2.2/src/usecortex_ai/types/sub_tenant_ids_data.py +42 -0
  49. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/tenant_create_data.py +19 -4
  50. usecortex_ai-0.2.2/src/usecortex_ai/types/tenant_stats.py +42 -0
  51. usecortex_ai-0.2.2/src/usecortex_ai/types/user_memory.py +31 -0
  52. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/upload/client.py +508 -132
  53. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/upload/raw_client.py +492 -152
  54. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/user/client.py +14 -6
  55. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/user/raw_client.py +14 -6
  56. usecortex_ai-0.2.2/src/usecortex_ai/user_memory/__init__.py +4 -0
  57. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/user_memory/client.py +184 -50
  58. usecortex_ai-0.2.2/src/usecortex_ai/user_memory/raw_client.py +1468 -0
  59. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2/src/usecortex_ai.egg-info}/PKG-INFO +1 -1
  60. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai.egg-info/SOURCES.txt +12 -2
  61. usecortex_ai-0.2.0/src/usecortex_ai/raw_client.py +0 -90
  62. usecortex_ai-0.2.0/src/usecortex_ai/tenant/client.py +0 -120
  63. usecortex_ai-0.2.0/src/usecortex_ai/types/attachment_model.py +0 -26
  64. usecortex_ai-0.2.0/src/usecortex_ai/types/content_model.py +0 -26
  65. usecortex_ai-0.2.0/src/usecortex_ai/types/embeddings_get_data.py +0 -22
  66. usecortex_ai-0.2.0/src/usecortex_ai/types/embeddings_search_data.py +0 -22
  67. usecortex_ai-0.2.0/src/usecortex_ai/types/markdown_upload_request.py +0 -21
  68. usecortex_ai-0.2.0/src/usecortex_ai/types/search_chunk.py +0 -34
  69. usecortex_ai-0.2.0/src/usecortex_ai/types/source.py +0 -32
  70. usecortex_ai-0.2.0/src/usecortex_ai/types/source_content.py +0 -26
  71. usecortex_ai-0.2.0/src/usecortex_ai/types/source_model.py +0 -32
  72. usecortex_ai-0.2.0/src/usecortex_ai/types/tenant_stats.py +0 -23
  73. usecortex_ai-0.2.0/src/usecortex_ai/user_memory/raw_client.py +0 -651
  74. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/LICENSE +0 -0
  75. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/README.md +0 -0
  76. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/setup.cfg +0 -0
  77. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/core/__init__.py +0 -0
  78. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/core/api_error.py +0 -0
  79. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/core/datetime_utils.py +0 -0
  80. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/core/file.py +0 -0
  81. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/core/force_multipart.py +0 -0
  82. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/core/http_client.py +0 -0
  83. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/core/http_response.py +0 -0
  84. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/core/jsonable_encoder.py +0 -0
  85. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/core/pydantic_utilities.py +0 -0
  86. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/core/query_encoder.py +0 -0
  87. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/core/remove_none_from_dict.py +0 -0
  88. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/core/request_options.py +0 -0
  89. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/core/serialization.py +0 -0
  90. {usecortex_ai-0.2.0/src/usecortex_ai/embeddings → usecortex_ai-0.2.2/src/usecortex_ai/document}/__init__.py +0 -0
  91. {usecortex_ai-0.2.0/src/usecortex_ai/fetch → usecortex_ai-0.2.2/src/usecortex_ai/embeddings}/__init__.py +0 -0
  92. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/environment.py +0 -0
  93. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/errors/__init__.py +0 -0
  94. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/errors/bad_request_error.py +0 -0
  95. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/errors/forbidden_error.py +0 -0
  96. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/errors/internal_server_error.py +0 -0
  97. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/errors/not_found_error.py +0 -0
  98. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/errors/service_unavailable_error.py +0 -0
  99. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/errors/unauthorized_error.py +0 -0
  100. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/errors/unprocessable_entity_error.py +0 -0
  101. {usecortex_ai-0.2.0/src/usecortex_ai/sources → usecortex_ai-0.2.2/src/usecortex_ai/fetch}/__init__.py +0 -0
  102. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/search/__init__.py +0 -0
  103. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/search/types/__init__.py +0 -0
  104. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/search/types/alpha.py +0 -0
  105. {usecortex_ai-0.2.0/src/usecortex_ai/tenant → usecortex_ai-0.2.2/src/usecortex_ai/sources}/__init__.py +0 -0
  106. {usecortex_ai-0.2.0/src/usecortex_ai/upload → usecortex_ai-0.2.2/src/usecortex_ai/tenant}/__init__.py +0 -0
  107. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/actual_error_response.py +0 -0
  108. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/bm_25_operator_type.py +0 -0
  109. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/extended_context.py +0 -0
  110. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/http_validation_error.py +0 -0
  111. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/related_chunk.py +0 -0
  112. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/validation_error.py +0 -0
  113. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai/types/validation_error_loc_item.py +0 -0
  114. {usecortex_ai-0.2.0/src/usecortex_ai/user → usecortex_ai-0.2.2/src/usecortex_ai/upload}/__init__.py +0 -0
  115. {usecortex_ai-0.2.0/src/usecortex_ai/user_memory → usecortex_ai-0.2.2/src/usecortex_ai/user}/__init__.py +0 -0
  116. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai.egg-info/dependency_links.txt +0 -0
  117. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai.egg-info/requires.txt +0 -0
  118. {usecortex_ai-0.2.0 → usecortex_ai-0.2.2}/src/usecortex_ai.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: usecortex-ai
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: The official Python SDK for the Cortex AI platform.
5
5
  Author-email: Nishkarsh Shrivastava <nishkarsh@usecortex.ai>
6
6
  License: Copyright (c) 2024 Cortex AI
@@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
9
9
  name = "usecortex-ai"
10
10
 
11
11
  # Start with an initial version
12
- version = "0.2.0"
12
+ version = "0.2.2"
13
13
 
14
14
  authors = [
15
15
  { name = "Nishkarsh Shrivastava", email = "nishkarsh@usecortex.ai" },
@@ -4,6 +4,7 @@
4
4
 
5
5
  from .types import (
6
6
  ActualErrorResponse,
7
+ AddUserMemoryResponse,
7
8
  AppSourcesUploadData,
8
9
  AttachmentModel,
9
10
  BatchUploadData,
@@ -12,6 +13,9 @@ from .types import (
12
13
  BodyUpdateScrapeJobUploadUpdateWebpagePatch,
13
14
  ContentModel,
14
15
  DeleteMemoryRequest,
16
+ DeleteSources,
17
+ DeleteSubTenantData,
18
+ DeleteUserMemoryResponse,
15
19
  EmbeddingsCreateCollectionData,
16
20
  EmbeddingsDeleteData,
17
21
  EmbeddingsGetData,
@@ -20,19 +24,23 @@ from .types import (
20
24
  ExtendedContext,
21
25
  FetchContentData,
22
26
  FileUploadResult,
27
+ GenerateUserMemoryResponse,
23
28
  HttpValidationError,
24
29
  ListSourcesResponse,
30
+ ListUserMemoriesResponse,
25
31
  MarkdownUploadRequest,
26
32
  ProcessingStatus,
27
33
  RelatedChunk,
28
34
  Relations,
35
+ RetrieveUserMemoryResponse,
29
36
  SearchChunk,
30
37
  SingleUploadData,
31
38
  Source,
32
- SourceContent,
33
39
  SourceModel,
40
+ SubTenantIdsData,
34
41
  TenantCreateData,
35
42
  TenantStats,
43
+ UserMemory,
36
44
  ValidationError,
37
45
  ValidationErrorLocItem,
38
46
  )
@@ -45,13 +53,14 @@ from .errors import (
45
53
  UnauthorizedError,
46
54
  UnprocessableEntityError,
47
55
  )
48
- from . import embeddings, fetch, search, sources, tenant, upload, user, user_memory
56
+ from . import document, embeddings, fetch, search, sources, tenant, upload, user, user_memory
49
57
  from .client import AsyncCortexAI, CortexAI
50
58
  from .environment import CortexAIEnvironment
51
59
  from .search import Alpha
52
60
 
53
61
  __all__ = [
54
62
  "ActualErrorResponse",
63
+ "AddUserMemoryResponse",
55
64
  "Alpha",
56
65
  "AppSourcesUploadData",
57
66
  "AsyncCortexAI",
@@ -65,6 +74,9 @@ __all__ = [
65
74
  "CortexAI",
66
75
  "CortexAIEnvironment",
67
76
  "DeleteMemoryRequest",
77
+ "DeleteSources",
78
+ "DeleteSubTenantData",
79
+ "DeleteUserMemoryResponse",
68
80
  "EmbeddingsCreateCollectionData",
69
81
  "EmbeddingsDeleteData",
70
82
  "EmbeddingsGetData",
@@ -74,26 +86,31 @@ __all__ = [
74
86
  "FetchContentData",
75
87
  "FileUploadResult",
76
88
  "ForbiddenError",
89
+ "GenerateUserMemoryResponse",
77
90
  "HttpValidationError",
78
91
  "InternalServerError",
79
92
  "ListSourcesResponse",
93
+ "ListUserMemoriesResponse",
80
94
  "MarkdownUploadRequest",
81
95
  "NotFoundError",
82
96
  "ProcessingStatus",
83
97
  "RelatedChunk",
84
98
  "Relations",
99
+ "RetrieveUserMemoryResponse",
85
100
  "SearchChunk",
86
101
  "ServiceUnavailableError",
87
102
  "SingleUploadData",
88
103
  "Source",
89
- "SourceContent",
90
104
  "SourceModel",
105
+ "SubTenantIdsData",
91
106
  "TenantCreateData",
92
107
  "TenantStats",
93
108
  "UnauthorizedError",
94
109
  "UnprocessableEntityError",
110
+ "UserMemory",
95
111
  "ValidationError",
96
112
  "ValidationErrorLocItem",
113
+ "document",
97
114
  "embeddings",
98
115
  "fetch",
99
116
  "search",
@@ -4,11 +4,10 @@ import typing
4
4
 
5
5
  import httpx
6
6
  from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
7
- from .core.request_options import RequestOptions
7
+ from .document.client import AsyncDocumentClient, DocumentClient
8
8
  from .embeddings.client import AsyncEmbeddingsClient, EmbeddingsClient
9
9
  from .environment import CortexAIEnvironment
10
10
  from .fetch.client import AsyncFetchClient, FetchClient
11
- from .raw_client import AsyncRawCortexAI, RawCortexAI
12
11
  from .search.client import AsyncSearchClient, SearchClient
13
12
  from .sources.client import AsyncSourcesClient, SourcesClient
14
13
  from .tenant.client import AsyncTenantClient, TenantClient
@@ -35,7 +34,7 @@ class CortexAI:
35
34
 
36
35
 
37
36
 
38
- token : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
37
+ token : typing.Union[str, typing.Callable[[], str]]
39
38
  headers : typing.Optional[typing.Dict[str, str]]
40
39
  Additional headers to send with every request.
41
40
 
@@ -60,7 +59,7 @@ class CortexAI:
60
59
  *,
61
60
  base_url: typing.Optional[str] = None,
62
61
  environment: CortexAIEnvironment = CortexAIEnvironment.CORTEX_PROD,
63
- token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
62
+ token: typing.Union[str, typing.Callable[[], str]],
64
63
  headers: typing.Optional[typing.Dict[str, str]] = None,
65
64
  timeout: typing.Optional[float] = None,
66
65
  follow_redirects: typing.Optional[bool] = True,
@@ -80,49 +79,16 @@ class CortexAI:
80
79
  else httpx.Client(timeout=_defaulted_timeout),
81
80
  timeout=_defaulted_timeout,
82
81
  )
83
- self._raw_client = RawCortexAI(client_wrapper=self._client_wrapper)
84
82
  self.search = SearchClient(client_wrapper=self._client_wrapper)
85
83
  self.sources = SourcesClient(client_wrapper=self._client_wrapper)
86
84
  self.user_memory = UserMemoryClient(client_wrapper=self._client_wrapper)
87
85
  self.fetch = FetchClient(client_wrapper=self._client_wrapper)
88
86
  self.upload = UploadClient(client_wrapper=self._client_wrapper)
87
+ self.document = DocumentClient(client_wrapper=self._client_wrapper)
89
88
  self.embeddings = EmbeddingsClient(client_wrapper=self._client_wrapper)
90
89
  self.user = UserClient(client_wrapper=self._client_wrapper)
91
90
  self.tenant = TenantClient(client_wrapper=self._client_wrapper)
92
91
 
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 usecortex-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
92
 
127
93
  class AsyncCortexAI:
128
94
  """
@@ -142,7 +108,7 @@ class AsyncCortexAI:
142
108
 
143
109
 
144
110
 
145
- token : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
111
+ token : typing.Union[str, typing.Callable[[], str]]
146
112
  headers : typing.Optional[typing.Dict[str, str]]
147
113
  Additional headers to send with every request.
148
114
 
@@ -167,7 +133,7 @@ class AsyncCortexAI:
167
133
  *,
168
134
  base_url: typing.Optional[str] = None,
169
135
  environment: CortexAIEnvironment = CortexAIEnvironment.CORTEX_PROD,
170
- token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
136
+ token: typing.Union[str, typing.Callable[[], str]],
171
137
  headers: typing.Optional[typing.Dict[str, str]] = None,
172
138
  timeout: typing.Optional[float] = None,
173
139
  follow_redirects: typing.Optional[bool] = True,
@@ -187,53 +153,16 @@ class AsyncCortexAI:
187
153
  else httpx.AsyncClient(timeout=_defaulted_timeout),
188
154
  timeout=_defaulted_timeout,
189
155
  )
190
- self._raw_client = AsyncRawCortexAI(client_wrapper=self._client_wrapper)
191
156
  self.search = AsyncSearchClient(client_wrapper=self._client_wrapper)
192
157
  self.sources = AsyncSourcesClient(client_wrapper=self._client_wrapper)
193
158
  self.user_memory = AsyncUserMemoryClient(client_wrapper=self._client_wrapper)
194
159
  self.fetch = AsyncFetchClient(client_wrapper=self._client_wrapper)
195
160
  self.upload = AsyncUploadClient(client_wrapper=self._client_wrapper)
161
+ self.document = AsyncDocumentClient(client_wrapper=self._client_wrapper)
196
162
  self.embeddings = AsyncEmbeddingsClient(client_wrapper=self._client_wrapper)
197
163
  self.user = AsyncUserClient(client_wrapper=self._client_wrapper)
198
164
  self.tenant = AsyncTenantClient(client_wrapper=self._client_wrapper)
199
165
 
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 usecortex-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
166
 
238
167
  def _get_base_url(*, base_url: typing.Optional[str] = None, environment: CortexAIEnvironment) -> str:
239
168
  if base_url is not None:
@@ -10,7 +10,7 @@ class BaseClientWrapper:
10
10
  def __init__(
11
11
  self,
12
12
  *,
13
- token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
13
+ token: typing.Union[str, typing.Callable[[], str]],
14
14
  headers: typing.Optional[typing.Dict[str, str]] = None,
15
15
  base_url: str,
16
16
  timeout: typing.Optional[float] = None,
@@ -25,13 +25,11 @@ class BaseClientWrapper:
25
25
  "X-Fern-Language": "Python",
26
26
  **(self.get_custom_headers() or {}),
27
27
  }
28
- token = self._get_token()
29
- if token is not None:
30
- headers["Authorization"] = f"Bearer {token}"
28
+ headers["Authorization"] = f"Bearer {self._get_token()}"
31
29
  return headers
32
30
 
33
- def _get_token(self) -> typing.Optional[str]:
34
- if isinstance(self._token, str) or self._token is None:
31
+ def _get_token(self) -> str:
32
+ if isinstance(self._token, str):
35
33
  return self._token
36
34
  else:
37
35
  return self._token()
@@ -50,7 +48,7 @@ class SyncClientWrapper(BaseClientWrapper):
50
48
  def __init__(
51
49
  self,
52
50
  *,
53
- token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
51
+ token: typing.Union[str, typing.Callable[[], str]],
54
52
  headers: typing.Optional[typing.Dict[str, str]] = None,
55
53
  base_url: str,
56
54
  timeout: typing.Optional[float] = None,
@@ -69,7 +67,7 @@ class AsyncClientWrapper(BaseClientWrapper):
69
67
  def __init__(
70
68
  self,
71
69
  *,
72
- token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
70
+ token: typing.Union[str, typing.Callable[[], str]],
73
71
  headers: typing.Optional[typing.Dict[str, str]] = None,
74
72
  base_url: str,
75
73
  timeout: typing.Optional[float] = None,
@@ -0,0 +1,139 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
+ from ..core.request_options import RequestOptions
7
+ from ..types.delete_sources import DeleteSources
8
+ from .raw_client import AsyncRawDocumentClient, RawDocumentClient
9
+
10
+ # this is used as the default value for optional parameters
11
+ OMIT = typing.cast(typing.Any, ...)
12
+
13
+
14
+ class DocumentClient:
15
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
16
+ self._raw_client = RawDocumentClient(client_wrapper=client_wrapper)
17
+
18
+ @property
19
+ def with_raw_response(self) -> RawDocumentClient:
20
+ """
21
+ Retrieves a raw implementation of this client that returns raw responses.
22
+
23
+ Returns
24
+ -------
25
+ RawDocumentClient
26
+ """
27
+ return self._raw_client
28
+
29
+ def delete(
30
+ self,
31
+ *,
32
+ tenant_id: str,
33
+ source_ids: typing.Sequence[str],
34
+ sub_tenant_id: typing.Optional[str] = OMIT,
35
+ request_options: typing.Optional[RequestOptions] = None,
36
+ ) -> DeleteSources:
37
+ """
38
+ Remove documents and content from your knowledge base.
39
+
40
+ This endpoint permanently deletes the specified sources from your knowledge base. Once deleted, the content will no longer be available for search or retrieval.
41
+
42
+ Use this carefully as the action cannot be undone. The system will confirm successful deletion of each source ID you specify.
43
+
44
+ Parameters
45
+ ----------
46
+ tenant_id : str
47
+ Unique identifier for the tenant/organization
48
+
49
+ source_ids : typing.Sequence[str]
50
+ List of source IDs to delete
51
+
52
+ sub_tenant_id : typing.Optional[str]
53
+ Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
54
+
55
+ request_options : typing.Optional[RequestOptions]
56
+ Request-specific configuration.
57
+
58
+ Returns
59
+ -------
60
+ DeleteSources
61
+ Successful Response
62
+
63
+ Examples
64
+ --------
65
+ from usecortex-ai import CortexAI
66
+
67
+ client = CortexAI(token="YOUR_TOKEN", )
68
+ client.document.delete(tenant_id='tenant_id', source_ids=['source_ids'], )
69
+ """
70
+ _response = self._raw_client.delete(
71
+ tenant_id=tenant_id, source_ids=source_ids, sub_tenant_id=sub_tenant_id, request_options=request_options
72
+ )
73
+ return _response.data
74
+
75
+
76
+ class AsyncDocumentClient:
77
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
78
+ self._raw_client = AsyncRawDocumentClient(client_wrapper=client_wrapper)
79
+
80
+ @property
81
+ def with_raw_response(self) -> AsyncRawDocumentClient:
82
+ """
83
+ Retrieves a raw implementation of this client that returns raw responses.
84
+
85
+ Returns
86
+ -------
87
+ AsyncRawDocumentClient
88
+ """
89
+ return self._raw_client
90
+
91
+ async def delete(
92
+ self,
93
+ *,
94
+ tenant_id: str,
95
+ source_ids: typing.Sequence[str],
96
+ sub_tenant_id: typing.Optional[str] = OMIT,
97
+ request_options: typing.Optional[RequestOptions] = None,
98
+ ) -> DeleteSources:
99
+ """
100
+ Remove documents and content from your knowledge base.
101
+
102
+ This endpoint permanently deletes the specified sources from your knowledge base. Once deleted, the content will no longer be available for search or retrieval.
103
+
104
+ Use this carefully as the action cannot be undone. The system will confirm successful deletion of each source ID you specify.
105
+
106
+ Parameters
107
+ ----------
108
+ tenant_id : str
109
+ Unique identifier for the tenant/organization
110
+
111
+ source_ids : typing.Sequence[str]
112
+ List of source IDs to delete
113
+
114
+ sub_tenant_id : typing.Optional[str]
115
+ Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
116
+
117
+ request_options : typing.Optional[RequestOptions]
118
+ Request-specific configuration.
119
+
120
+ Returns
121
+ -------
122
+ DeleteSources
123
+ Successful Response
124
+
125
+ Examples
126
+ --------
127
+ import asyncio
128
+
129
+ from usecortex-ai import AsyncCortexAI
130
+
131
+ client = AsyncCortexAI(token="YOUR_TOKEN", )
132
+ async def main() -> None:
133
+ await client.document.delete(tenant_id='tenant_id', source_ids=['source_ids'], )
134
+ asyncio.run(main())
135
+ """
136
+ _response = await self._raw_client.delete(
137
+ tenant_id=tenant_id, source_ids=source_ids, sub_tenant_id=sub_tenant_id, request_options=request_options
138
+ )
139
+ return _response.data
@@ -16,54 +16,70 @@ from ..errors.service_unavailable_error import ServiceUnavailableError
16
16
  from ..errors.unauthorized_error import UnauthorizedError
17
17
  from ..errors.unprocessable_entity_error import UnprocessableEntityError
18
18
  from ..types.actual_error_response import ActualErrorResponse
19
- from ..types.tenant_stats import TenantStats
19
+ from ..types.delete_sources import DeleteSources
20
20
 
21
+ # this is used as the default value for optional parameters
22
+ OMIT = typing.cast(typing.Any, ...)
21
23
 
22
- class RawTenantClient:
24
+
25
+ class RawDocumentClient:
23
26
  def __init__(self, *, client_wrapper: SyncClientWrapper):
24
27
  self._client_wrapper = client_wrapper
25
28
 
26
- def stats(
29
+ def delete(
27
30
  self,
28
31
  *,
29
32
  tenant_id: str,
30
- sub_tenant_id: typing.Optional[str] = None,
33
+ source_ids: typing.Sequence[str],
34
+ sub_tenant_id: typing.Optional[str] = OMIT,
31
35
  request_options: typing.Optional[RequestOptions] = None,
32
- ) -> HttpResponse[TenantStats]:
36
+ ) -> HttpResponse[DeleteSources]:
33
37
  """
34
- Get tenant stats.
38
+ Remove documents and content from your knowledge base.
39
+
40
+ This endpoint permanently deletes the specified sources from your knowledge base. Once deleted, the content will no longer be available for search or retrieval.
35
41
 
36
- This endpoint returns stats for tenant.
42
+ Use this carefully as the action cannot be undone. The system will confirm successful deletion of each source ID you specify.
37
43
 
38
44
  Parameters
39
45
  ----------
40
46
  tenant_id : str
47
+ Unique identifier for the tenant/organization
48
+
49
+ source_ids : typing.Sequence[str]
50
+ List of source IDs to delete
41
51
 
42
52
  sub_tenant_id : typing.Optional[str]
53
+ Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
43
54
 
44
55
  request_options : typing.Optional[RequestOptions]
45
56
  Request-specific configuration.
46
57
 
47
58
  Returns
48
59
  -------
49
- HttpResponse[TenantStats]
60
+ HttpResponse[DeleteSources]
50
61
  Successful Response
51
62
  """
52
63
  _response = self._client_wrapper.httpx_client.request(
53
- "tenant/stats",
54
- method="GET",
55
- params={
64
+ "document/delete",
65
+ method="DELETE",
66
+ json={
56
67
  "tenant_id": tenant_id,
68
+ "source_ids": source_ids,
57
69
  "sub_tenant_id": sub_tenant_id,
58
70
  },
71
+ headers={
72
+ "content-type": "application/json",
73
+ },
59
74
  request_options=request_options,
75
+ omit=OMIT,
60
76
  )
61
77
  try:
62
78
  if 200 <= _response.status_code < 300:
63
79
  _data = typing.cast(
64
- TenantStats,
80
+ DeleteSources,
65
81
  parse_obj_as(
66
- type_=TenantStats, # type: ignore
82
+ type_=DeleteSources, # type: ignore
67
83
  object_=_response.json(),
68
84
  ),
69
85
  )
@@ -151,51 +167,64 @@ class RawTenantClient:
151
167
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
152
168
 
153
169
 
154
- class AsyncRawTenantClient:
170
+ class AsyncRawDocumentClient:
155
171
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
156
172
  self._client_wrapper = client_wrapper
157
173
 
158
- async def stats(
174
+ async def delete(
159
175
  self,
160
176
  *,
161
177
  tenant_id: str,
162
- sub_tenant_id: typing.Optional[str] = None,
178
+ source_ids: typing.Sequence[str],
179
+ sub_tenant_id: typing.Optional[str] = OMIT,
163
180
  request_options: typing.Optional[RequestOptions] = None,
164
- ) -> AsyncHttpResponse[TenantStats]:
181
+ ) -> AsyncHttpResponse[DeleteSources]:
165
182
  """
166
- Get tenant stats.
183
+ Remove documents and content from your knowledge base.
167
184
 
168
- This endpoint returns stats for tenant.
185
+ This endpoint permanently deletes the specified sources from your knowledge base. Once deleted, the content will no longer be available for search or retrieval.
186
+
187
+ Use this carefully as the action cannot be undone. The system will confirm successful deletion of each source ID you specify.
169
188
 
170
189
  Parameters
171
190
  ----------
172
191
  tenant_id : str
192
+ Unique identifier for the tenant/organization
193
+
194
+ source_ids : typing.Sequence[str]
195
+ List of source IDs to delete
173
196
 
174
197
  sub_tenant_id : typing.Optional[str]
198
+ Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
175
199
 
176
200
  request_options : typing.Optional[RequestOptions]
177
201
  Request-specific configuration.
178
202
 
179
203
  Returns
180
204
  -------
181
- AsyncHttpResponse[TenantStats]
205
+ AsyncHttpResponse[DeleteSources]
182
206
  Successful Response
183
207
  """
184
208
  _response = await self._client_wrapper.httpx_client.request(
185
- "tenant/stats",
186
- method="GET",
187
- params={
209
+ "document/delete",
210
+ method="DELETE",
211
+ json={
188
212
  "tenant_id": tenant_id,
213
+ "source_ids": source_ids,
189
214
  "sub_tenant_id": sub_tenant_id,
190
215
  },
216
+ headers={
217
+ "content-type": "application/json",
218
+ },
191
219
  request_options=request_options,
220
+ omit=OMIT,
192
221
  )
193
222
  try:
194
223
  if 200 <= _response.status_code < 300:
195
224
  _data = typing.cast(
196
- TenantStats,
225
+ DeleteSources,
197
226
  parse_obj_as(
198
- type_=TenantStats, # type: ignore
227
+ type_=DeleteSources, # type: ignore
199
228
  object_=_response.json(),
200
229
  ),
201
230
  )