usecortex-ai 0.2.1__py3-none-any.whl → 0.2.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- usecortex_ai/__init__.py +18 -3
- usecortex_ai/client.py +7 -78
- usecortex_ai/core/client_wrapper.py +6 -8
- usecortex_ai/document/__init__.py +4 -0
- usecortex_ai/document/client.py +139 -0
- usecortex_ai/document/raw_client.py +312 -0
- usecortex_ai/embeddings/client.py +40 -70
- usecortex_ai/embeddings/raw_client.py +40 -70
- usecortex_ai/fetch/client.py +10 -0
- usecortex_ai/fetch/raw_client.py +10 -0
- usecortex_ai/search/client.py +74 -80
- usecortex_ai/search/raw_client.py +74 -80
- usecortex_ai/sources/client.py +28 -83
- usecortex_ai/sources/raw_client.py +28 -259
- usecortex_ai/tenant/client.py +152 -4
- usecortex_ai/tenant/raw_client.py +502 -4
- usecortex_ai/types/__init__.py +16 -2
- usecortex_ai/types/add_user_memory_response.py +36 -0
- usecortex_ai/types/app_sources_upload_data.py +10 -2
- usecortex_ai/types/attachment_model.py +34 -7
- usecortex_ai/types/batch_upload_data.py +10 -2
- usecortex_ai/types/body_scrape_webpage_upload_scrape_webpage_post.py +0 -2
- usecortex_ai/types/body_update_scrape_job_upload_update_webpage_patch.py +0 -2
- usecortex_ai/types/content_model.py +33 -6
- usecortex_ai/types/delete_memory_request.py +14 -3
- usecortex_ai/types/delete_sources.py +20 -0
- usecortex_ai/types/delete_sub_tenant_data.py +42 -0
- usecortex_ai/types/delete_user_memory_response.py +31 -0
- usecortex_ai/types/embeddings_create_collection_data.py +19 -4
- usecortex_ai/types/embeddings_delete_data.py +19 -4
- usecortex_ai/types/embeddings_get_data.py +19 -4
- usecortex_ai/types/embeddings_search_data.py +19 -4
- usecortex_ai/types/error_response.py +0 -1
- usecortex_ai/types/fetch_content_data.py +19 -5
- usecortex_ai/types/file_upload_result.py +9 -2
- usecortex_ai/types/generate_user_memory_response.py +32 -0
- usecortex_ai/types/list_sources_response.py +14 -3
- usecortex_ai/types/list_user_memories_response.py +32 -0
- usecortex_ai/types/markdown_upload_request.py +18 -5
- usecortex_ai/types/processing_status.py +14 -3
- usecortex_ai/types/relations.py +9 -2
- usecortex_ai/types/retrieve_user_memory_response.py +32 -0
- usecortex_ai/types/search_chunk.py +54 -17
- usecortex_ai/types/single_upload_data.py +10 -2
- usecortex_ai/types/source.py +34 -15
- usecortex_ai/types/source_model.py +63 -14
- usecortex_ai/types/sub_tenant_ids_data.py +24 -5
- usecortex_ai/types/tenant_create_data.py +19 -4
- usecortex_ai/types/tenant_stats.py +24 -5
- usecortex_ai/types/user_memory.py +31 -0
- usecortex_ai/upload/client.py +394 -79
- usecortex_ai/upload/raw_client.py +398 -103
- usecortex_ai/user/client.py +14 -6
- usecortex_ai/user/raw_client.py +14 -6
- usecortex_ai/user_memory/client.py +184 -50
- usecortex_ai/user_memory/raw_client.py +905 -88
- {usecortex_ai-0.2.1.dist-info → usecortex_ai-0.2.2.dist-info}/METADATA +1 -1
- usecortex_ai-0.2.2.dist-info/RECORD +100 -0
- usecortex_ai/raw_client.py +0 -90
- usecortex_ai/types/source_content.py +0 -26
- usecortex_ai-0.2.1.dist-info/RECORD +0 -91
- {usecortex_ai-0.2.1.dist-info → usecortex_ai-0.2.2.dist-info}/WHEEL +0 -0
- {usecortex_ai-0.2.1.dist-info → usecortex_ai-0.2.2.dist-info}/licenses/LICENSE +0 -0
- {usecortex_ai-0.2.1.dist-info → usecortex_ai-0.2.2.dist-info}/top_level.txt +0 -0
usecortex_ai/__init__.py
CHANGED
|
@@ -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,20 +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,
|
|
34
40
|
SubTenantIdsData,
|
|
35
41
|
TenantCreateData,
|
|
36
42
|
TenantStats,
|
|
43
|
+
UserMemory,
|
|
37
44
|
ValidationError,
|
|
38
45
|
ValidationErrorLocItem,
|
|
39
46
|
)
|
|
@@ -46,13 +53,14 @@ from .errors import (
|
|
|
46
53
|
UnauthorizedError,
|
|
47
54
|
UnprocessableEntityError,
|
|
48
55
|
)
|
|
49
|
-
from . import embeddings, fetch, search, sources, tenant, upload, user, user_memory
|
|
56
|
+
from . import document, embeddings, fetch, search, sources, tenant, upload, user, user_memory
|
|
50
57
|
from .client import AsyncCortexAI, CortexAI
|
|
51
58
|
from .environment import CortexAIEnvironment
|
|
52
59
|
from .search import Alpha
|
|
53
60
|
|
|
54
61
|
__all__ = [
|
|
55
62
|
"ActualErrorResponse",
|
|
63
|
+
"AddUserMemoryResponse",
|
|
56
64
|
"Alpha",
|
|
57
65
|
"AppSourcesUploadData",
|
|
58
66
|
"AsyncCortexAI",
|
|
@@ -66,6 +74,9 @@ __all__ = [
|
|
|
66
74
|
"CortexAI",
|
|
67
75
|
"CortexAIEnvironment",
|
|
68
76
|
"DeleteMemoryRequest",
|
|
77
|
+
"DeleteSources",
|
|
78
|
+
"DeleteSubTenantData",
|
|
79
|
+
"DeleteUserMemoryResponse",
|
|
69
80
|
"EmbeddingsCreateCollectionData",
|
|
70
81
|
"EmbeddingsDeleteData",
|
|
71
82
|
"EmbeddingsGetData",
|
|
@@ -75,27 +86,31 @@ __all__ = [
|
|
|
75
86
|
"FetchContentData",
|
|
76
87
|
"FileUploadResult",
|
|
77
88
|
"ForbiddenError",
|
|
89
|
+
"GenerateUserMemoryResponse",
|
|
78
90
|
"HttpValidationError",
|
|
79
91
|
"InternalServerError",
|
|
80
92
|
"ListSourcesResponse",
|
|
93
|
+
"ListUserMemoriesResponse",
|
|
81
94
|
"MarkdownUploadRequest",
|
|
82
95
|
"NotFoundError",
|
|
83
96
|
"ProcessingStatus",
|
|
84
97
|
"RelatedChunk",
|
|
85
98
|
"Relations",
|
|
99
|
+
"RetrieveUserMemoryResponse",
|
|
86
100
|
"SearchChunk",
|
|
87
101
|
"ServiceUnavailableError",
|
|
88
102
|
"SingleUploadData",
|
|
89
103
|
"Source",
|
|
90
|
-
"SourceContent",
|
|
91
104
|
"SourceModel",
|
|
92
105
|
"SubTenantIdsData",
|
|
93
106
|
"TenantCreateData",
|
|
94
107
|
"TenantStats",
|
|
95
108
|
"UnauthorizedError",
|
|
96
109
|
"UnprocessableEntityError",
|
|
110
|
+
"UserMemory",
|
|
97
111
|
"ValidationError",
|
|
98
112
|
"ValidationErrorLocItem",
|
|
113
|
+
"document",
|
|
99
114
|
"embeddings",
|
|
100
115
|
"fetch",
|
|
101
116
|
"search",
|
usecortex_ai/client.py
CHANGED
|
@@ -4,11 +4,10 @@ import typing
|
|
|
4
4
|
|
|
5
5
|
import httpx
|
|
6
6
|
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
7
|
-
from .
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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) ->
|
|
34
|
-
if isinstance(self._token, str)
|
|
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.
|
|
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.
|
|
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
|