arbi 0.18.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- arbi/__init__.py +92 -0
- arbi/_base_client.py +2124 -0
- arbi/_client.py +442 -0
- arbi/_compat.py +219 -0
- arbi/_constants.py +14 -0
- arbi/_exceptions.py +108 -0
- arbi/_files.py +123 -0
- arbi/_models.py +872 -0
- arbi/_qs.py +150 -0
- arbi/_resource.py +43 -0
- arbi/_response.py +830 -0
- arbi/_streaming.py +333 -0
- arbi/_types.py +270 -0
- arbi/_utils/__init__.py +64 -0
- arbi/_utils/_compat.py +45 -0
- arbi/_utils/_datetime_parse.py +136 -0
- arbi/_utils/_logs.py +25 -0
- arbi/_utils/_proxy.py +65 -0
- arbi/_utils/_reflection.py +42 -0
- arbi/_utils/_resources_proxy.py +24 -0
- arbi/_utils/_streams.py +12 -0
- arbi/_utils/_sync.py +58 -0
- arbi/_utils/_transform.py +457 -0
- arbi/_utils/_typing.py +156 -0
- arbi/_utils/_utils.py +421 -0
- arbi/_version.py +4 -0
- arbi/lib/.keep +4 -0
- arbi/py.typed +0 -0
- arbi/resources/__init__.py +19 -0
- arbi/resources/api/__init__.py +145 -0
- arbi/resources/api/api.py +422 -0
- arbi/resources/api/assistant.py +312 -0
- arbi/resources/api/configs.py +533 -0
- arbi/resources/api/conversation/__init__.py +33 -0
- arbi/resources/api/conversation/conversation.py +648 -0
- arbi/resources/api/conversation/user.py +270 -0
- arbi/resources/api/document/__init__.py +33 -0
- arbi/resources/api/document/doctag.py +516 -0
- arbi/resources/api/document/document.py +929 -0
- arbi/resources/api/health.py +253 -0
- arbi/resources/api/notifications.py +478 -0
- arbi/resources/api/tag.py +409 -0
- arbi/resources/api/user/__init__.py +61 -0
- arbi/resources/api/user/contacts.py +322 -0
- arbi/resources/api/user/settings.py +283 -0
- arbi/resources/api/user/subscription.py +230 -0
- arbi/resources/api/user/user.py +943 -0
- arbi/resources/api/workspace.py +1198 -0
- arbi/types/__init__.py +8 -0
- arbi/types/api/__init__.py +94 -0
- arbi/types/api/assistant_query_params.py +95 -0
- arbi/types/api/assistant_retrieve_params.py +95 -0
- arbi/types/api/chunker_config_param.py +9 -0
- arbi/types/api/config_create_params.py +227 -0
- arbi/types/api/config_create_response.py +17 -0
- arbi/types/api/config_delete_response.py +11 -0
- arbi/types/api/config_get_versions_response.py +19 -0
- arbi/types/api/config_retrieve_response.py +234 -0
- arbi/types/api/conversation/__init__.py +8 -0
- arbi/types/api/conversation/user_add_params.py +11 -0
- arbi/types/api/conversation/user_add_response.py +11 -0
- arbi/types/api/conversation/user_remove_params.py +11 -0
- arbi/types/api/conversation/user_remove_response.py +11 -0
- arbi/types/api/conversation_delete_message_response.py +11 -0
- arbi/types/api/conversation_delete_response.py +11 -0
- arbi/types/api/conversation_retrieve_message_response.py +105 -0
- arbi/types/api/conversation_retrieve_threads_response.py +124 -0
- arbi/types/api/conversation_share_response.py +11 -0
- arbi/types/api/conversation_update_title_params.py +16 -0
- arbi/types/api/conversation_update_title_response.py +13 -0
- arbi/types/api/doc_response.py +66 -0
- arbi/types/api/document/__init__.py +11 -0
- arbi/types/api/document/doc_tag_response.py +40 -0
- arbi/types/api/document/doctag_create_params.py +35 -0
- arbi/types/api/document/doctag_create_response.py +10 -0
- arbi/types/api/document/doctag_delete_params.py +15 -0
- arbi/types/api/document/doctag_generate_params.py +22 -0
- arbi/types/api/document/doctag_generate_response.py +20 -0
- arbi/types/api/document/doctag_update_params.py +35 -0
- arbi/types/api/document_date_extractor_llm_config.py +29 -0
- arbi/types/api/document_date_extractor_llm_config_param.py +28 -0
- arbi/types/api/document_delete_params.py +13 -0
- arbi/types/api/document_get_parsed_response.py +26 -0
- arbi/types/api/document_retrieve_params.py +16 -0
- arbi/types/api/document_retrieve_response.py +10 -0
- arbi/types/api/document_update_params.py +42 -0
- arbi/types/api/document_update_response.py +10 -0
- arbi/types/api/document_upload_from_url_params.py +26 -0
- arbi/types/api/document_upload_from_url_response.py +16 -0
- arbi/types/api/document_upload_params.py +26 -0
- arbi/types/api/document_upload_response.py +16 -0
- arbi/types/api/embedder_config.py +30 -0
- arbi/types/api/embedder_config_param.py +29 -0
- arbi/types/api/health_check_models_response.py +21 -0
- arbi/types/api/health_get_models_response.py +19 -0
- arbi/types/api/health_retrieve_status_response.py +49 -0
- arbi/types/api/model_citation_config.py +20 -0
- arbi/types/api/model_citation_config_param.py +20 -0
- arbi/types/api/notification_create_params.py +20 -0
- arbi/types/api/notification_create_response.py +47 -0
- arbi/types/api/notification_delete_params.py +13 -0
- arbi/types/api/notification_get_schemas_response.py +197 -0
- arbi/types/api/notification_list_response.py +47 -0
- arbi/types/api/notification_update_params.py +27 -0
- arbi/types/api/notification_update_response.py +47 -0
- arbi/types/api/parser_config_param.py +9 -0
- arbi/types/api/query_llm_config.py +30 -0
- arbi/types/api/query_llm_config_param.py +29 -0
- arbi/types/api/reranker_config.py +21 -0
- arbi/types/api/reranker_config_param.py +20 -0
- arbi/types/api/retriever_config.py +39 -0
- arbi/types/api/retriever_config_param.py +38 -0
- arbi/types/api/tag_create_params.py +49 -0
- arbi/types/api/tag_create_response.py +57 -0
- arbi/types/api/tag_delete_response.py +9 -0
- arbi/types/api/tag_update_params.py +22 -0
- arbi/types/api/tag_update_response.py +57 -0
- arbi/types/api/title_llm_config.py +29 -0
- arbi/types/api/title_llm_config_param.py +28 -0
- arbi/types/api/user/__init__.py +13 -0
- arbi/types/api/user/contact_create_params.py +13 -0
- arbi/types/api/user/contact_create_response.py +30 -0
- arbi/types/api/user/contact_delete_params.py +13 -0
- arbi/types/api/user/contact_list_response.py +30 -0
- arbi/types/api/user/setting_retrieve_response.py +89 -0
- arbi/types/api/user/setting_update_params.py +60 -0
- arbi/types/api/user/subscription_create_params.py +13 -0
- arbi/types/api/user/subscription_create_response.py +11 -0
- arbi/types/api/user/subscription_retrieve_response.py +48 -0
- arbi/types/api/user_change_password_params.py +18 -0
- arbi/types/api/user_change_password_response.py +11 -0
- arbi/types/api/user_check_sso_status_params.py +20 -0
- arbi/types/api/user_check_sso_status_response.py +25 -0
- arbi/types/api/user_list_products_response.py +37 -0
- arbi/types/api/user_list_workspaces_response.py +10 -0
- arbi/types/api/user_login_params.py +18 -0
- arbi/types/api/user_login_response.py +23 -0
- arbi/types/api/user_logout_response.py +9 -0
- arbi/types/api/user_register_params.py +22 -0
- arbi/types/api/user_response.py +26 -0
- arbi/types/api/user_verify_email_params.py +11 -0
- arbi/types/api/user_verify_email_response.py +9 -0
- arbi/types/api/workspace_copy_params.py +21 -0
- arbi/types/api/workspace_copy_response.py +25 -0
- arbi/types/api/workspace_create_protected_params.py +16 -0
- arbi/types/api/workspace_delete_response.py +9 -0
- arbi/types/api/workspace_get_conversations_response.py +30 -0
- arbi/types/api/workspace_get_documents_response.py +10 -0
- arbi/types/api/workspace_get_stats_response.py +17 -0
- arbi/types/api/workspace_get_tags_response.py +60 -0
- arbi/types/api/workspace_get_users_response.py +10 -0
- arbi/types/api/workspace_remove_user_params.py +11 -0
- arbi/types/api/workspace_remove_user_response.py +11 -0
- arbi/types/api/workspace_response.py +41 -0
- arbi/types/api/workspace_share_params.py +15 -0
- arbi/types/api/workspace_share_response.py +13 -0
- arbi/types/api/workspace_update_params.py +20 -0
- arbi/types/chunk.py +12 -0
- arbi/types/chunk_metadata.py +31 -0
- arbi/types/chunk_metadata_param.py +32 -0
- arbi/types/chunk_param.py +15 -0
- arbi-0.18.0.dist-info/METADATA +410 -0
- arbi-0.18.0.dist-info/RECORD +165 -0
- arbi-0.18.0.dist-info/WHEEL +4 -0
- arbi-0.18.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,929 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Mapping, Iterable, Optional, cast
|
|
6
|
+
from typing_extensions import Literal
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from .doctag import (
|
|
11
|
+
DoctagResource,
|
|
12
|
+
AsyncDoctagResource,
|
|
13
|
+
DoctagResourceWithRawResponse,
|
|
14
|
+
AsyncDoctagResourceWithRawResponse,
|
|
15
|
+
DoctagResourceWithStreamingResponse,
|
|
16
|
+
AsyncDoctagResourceWithStreamingResponse,
|
|
17
|
+
)
|
|
18
|
+
from ...._types import (
|
|
19
|
+
Body,
|
|
20
|
+
Omit,
|
|
21
|
+
Query,
|
|
22
|
+
Headers,
|
|
23
|
+
NoneType,
|
|
24
|
+
NotGiven,
|
|
25
|
+
FileTypes,
|
|
26
|
+
SequenceNotStr,
|
|
27
|
+
omit,
|
|
28
|
+
not_given,
|
|
29
|
+
)
|
|
30
|
+
from ...._utils import (
|
|
31
|
+
extract_files,
|
|
32
|
+
maybe_transform,
|
|
33
|
+
strip_not_given,
|
|
34
|
+
deepcopy_minimal,
|
|
35
|
+
async_maybe_transform,
|
|
36
|
+
)
|
|
37
|
+
from ...._compat import cached_property
|
|
38
|
+
from ...._resource import SyncAPIResource, AsyncAPIResource
|
|
39
|
+
from ...._response import (
|
|
40
|
+
to_raw_response_wrapper,
|
|
41
|
+
to_streamed_response_wrapper,
|
|
42
|
+
async_to_raw_response_wrapper,
|
|
43
|
+
async_to_streamed_response_wrapper,
|
|
44
|
+
)
|
|
45
|
+
from ....types.api import (
|
|
46
|
+
document_delete_params,
|
|
47
|
+
document_update_params,
|
|
48
|
+
document_upload_params,
|
|
49
|
+
document_retrieve_params,
|
|
50
|
+
document_upload_from_url_params,
|
|
51
|
+
)
|
|
52
|
+
from ...._base_client import make_request_options
|
|
53
|
+
from ....types.api.document_update_response import DocumentUpdateResponse
|
|
54
|
+
from ....types.api.document_upload_response import DocumentUploadResponse
|
|
55
|
+
from ....types.api.document_retrieve_response import DocumentRetrieveResponse
|
|
56
|
+
from ....types.api.document_get_parsed_response import DocumentGetParsedResponse
|
|
57
|
+
from ....types.api.document_upload_from_url_response import DocumentUploadFromURLResponse
|
|
58
|
+
|
|
59
|
+
__all__ = ["DocumentResource", "AsyncDocumentResource"]
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class DocumentResource(SyncAPIResource):
|
|
63
|
+
@cached_property
|
|
64
|
+
def doctag(self) -> DoctagResource:
|
|
65
|
+
return DoctagResource(self._client)
|
|
66
|
+
|
|
67
|
+
@cached_property
|
|
68
|
+
def with_raw_response(self) -> DocumentResourceWithRawResponse:
|
|
69
|
+
"""
|
|
70
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
71
|
+
the raw response object instead of the parsed content.
|
|
72
|
+
|
|
73
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#accessing-raw-response-data-eg-headers
|
|
74
|
+
"""
|
|
75
|
+
return DocumentResourceWithRawResponse(self)
|
|
76
|
+
|
|
77
|
+
@cached_property
|
|
78
|
+
def with_streaming_response(self) -> DocumentResourceWithStreamingResponse:
|
|
79
|
+
"""
|
|
80
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
81
|
+
|
|
82
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#with_streaming_response
|
|
83
|
+
"""
|
|
84
|
+
return DocumentResourceWithStreamingResponse(self)
|
|
85
|
+
|
|
86
|
+
def retrieve(
|
|
87
|
+
self,
|
|
88
|
+
*,
|
|
89
|
+
external_ids: SequenceNotStr[str],
|
|
90
|
+
workspace_key: str | Omit = omit,
|
|
91
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
92
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
93
|
+
extra_headers: Headers | None = None,
|
|
94
|
+
extra_query: Query | None = None,
|
|
95
|
+
extra_body: Body | None = None,
|
|
96
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
97
|
+
) -> DocumentRetrieveResponse:
|
|
98
|
+
"""
|
|
99
|
+
Get one or more documents by external IDs.
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
extra_headers: Send extra headers
|
|
103
|
+
|
|
104
|
+
extra_query: Add additional query parameters to the request
|
|
105
|
+
|
|
106
|
+
extra_body: Add additional JSON properties to the request
|
|
107
|
+
|
|
108
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
109
|
+
"""
|
|
110
|
+
extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
|
|
111
|
+
return self._get(
|
|
112
|
+
"/api/document/",
|
|
113
|
+
options=make_request_options(
|
|
114
|
+
extra_headers=extra_headers,
|
|
115
|
+
extra_query=extra_query,
|
|
116
|
+
extra_body=extra_body,
|
|
117
|
+
timeout=timeout,
|
|
118
|
+
query=maybe_transform({"external_ids": external_ids}, document_retrieve_params.DocumentRetrieveParams),
|
|
119
|
+
),
|
|
120
|
+
cast_to=DocumentRetrieveResponse,
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
def update(
|
|
124
|
+
self,
|
|
125
|
+
*,
|
|
126
|
+
documents: Iterable[document_update_params.Document],
|
|
127
|
+
workspace_key: str | Omit = omit,
|
|
128
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
129
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
130
|
+
extra_headers: Headers | None = None,
|
|
131
|
+
extra_query: Query | None = None,
|
|
132
|
+
extra_body: Body | None = None,
|
|
133
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
134
|
+
) -> DocumentUpdateResponse:
|
|
135
|
+
"""
|
|
136
|
+
Update one or more documents.
|
|
137
|
+
|
|
138
|
+
Args:
|
|
139
|
+
extra_headers: Send extra headers
|
|
140
|
+
|
|
141
|
+
extra_query: Add additional query parameters to the request
|
|
142
|
+
|
|
143
|
+
extra_body: Add additional JSON properties to the request
|
|
144
|
+
|
|
145
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
146
|
+
"""
|
|
147
|
+
extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
|
|
148
|
+
return self._patch(
|
|
149
|
+
"/api/document/",
|
|
150
|
+
body=maybe_transform({"documents": documents}, document_update_params.DocumentUpdateParams),
|
|
151
|
+
options=make_request_options(
|
|
152
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
153
|
+
),
|
|
154
|
+
cast_to=DocumentUpdateResponse,
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
def delete(
|
|
158
|
+
self,
|
|
159
|
+
*,
|
|
160
|
+
external_ids: SequenceNotStr[str],
|
|
161
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
162
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
163
|
+
extra_headers: Headers | None = None,
|
|
164
|
+
extra_query: Query | None = None,
|
|
165
|
+
extra_body: Body | None = None,
|
|
166
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
167
|
+
) -> None:
|
|
168
|
+
"""
|
|
169
|
+
Delete one or more documents.
|
|
170
|
+
|
|
171
|
+
Args:
|
|
172
|
+
extra_headers: Send extra headers
|
|
173
|
+
|
|
174
|
+
extra_query: Add additional query parameters to the request
|
|
175
|
+
|
|
176
|
+
extra_body: Add additional JSON properties to the request
|
|
177
|
+
|
|
178
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
179
|
+
"""
|
|
180
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
181
|
+
return self._delete(
|
|
182
|
+
"/api/document/",
|
|
183
|
+
body=maybe_transform({"external_ids": external_ids}, document_delete_params.DocumentDeleteParams),
|
|
184
|
+
options=make_request_options(
|
|
185
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
186
|
+
),
|
|
187
|
+
cast_to=NoneType,
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
def download(
|
|
191
|
+
self,
|
|
192
|
+
document_ext_id: str,
|
|
193
|
+
*,
|
|
194
|
+
workspace_key: str | Omit = omit,
|
|
195
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
196
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
197
|
+
extra_headers: Headers | None = None,
|
|
198
|
+
extra_query: Query | None = None,
|
|
199
|
+
extra_body: Body | None = None,
|
|
200
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
201
|
+
) -> object:
|
|
202
|
+
"""Download a document by its external ID.
|
|
203
|
+
|
|
204
|
+
Retrieves and decrypts the document for
|
|
205
|
+
downloading as an attachment.
|
|
206
|
+
|
|
207
|
+
Args:
|
|
208
|
+
extra_headers: Send extra headers
|
|
209
|
+
|
|
210
|
+
extra_query: Add additional query parameters to the request
|
|
211
|
+
|
|
212
|
+
extra_body: Add additional JSON properties to the request
|
|
213
|
+
|
|
214
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
215
|
+
"""
|
|
216
|
+
if not document_ext_id:
|
|
217
|
+
raise ValueError(f"Expected a non-empty value for `document_ext_id` but received {document_ext_id!r}")
|
|
218
|
+
extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
|
|
219
|
+
return self._get(
|
|
220
|
+
f"/api/document/{document_ext_id}/download",
|
|
221
|
+
options=make_request_options(
|
|
222
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
223
|
+
),
|
|
224
|
+
cast_to=object,
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
def get_parsed(
|
|
228
|
+
self,
|
|
229
|
+
stage: Literal["marker", "subchunk", "final"],
|
|
230
|
+
*,
|
|
231
|
+
document_ext_id: str,
|
|
232
|
+
workspace_key: str | Omit = omit,
|
|
233
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
234
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
235
|
+
extra_headers: Headers | None = None,
|
|
236
|
+
extra_query: Query | None = None,
|
|
237
|
+
extra_body: Body | None = None,
|
|
238
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
239
|
+
) -> DocumentGetParsedResponse:
|
|
240
|
+
"""Retrieve the full parsed document to be handled by the frontend.
|
|
241
|
+
|
|
242
|
+
Only requires
|
|
243
|
+
document_ext_id, workspace is determined through RLS.
|
|
244
|
+
|
|
245
|
+
Args:
|
|
246
|
+
extra_headers: Send extra headers
|
|
247
|
+
|
|
248
|
+
extra_query: Add additional query parameters to the request
|
|
249
|
+
|
|
250
|
+
extra_body: Add additional JSON properties to the request
|
|
251
|
+
|
|
252
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
253
|
+
"""
|
|
254
|
+
if not document_ext_id:
|
|
255
|
+
raise ValueError(f"Expected a non-empty value for `document_ext_id` but received {document_ext_id!r}")
|
|
256
|
+
if not stage:
|
|
257
|
+
raise ValueError(f"Expected a non-empty value for `stage` but received {stage!r}")
|
|
258
|
+
extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
|
|
259
|
+
return self._get(
|
|
260
|
+
f"/api/document/{document_ext_id}/parsed-{stage}",
|
|
261
|
+
options=make_request_options(
|
|
262
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
263
|
+
),
|
|
264
|
+
cast_to=DocumentGetParsedResponse,
|
|
265
|
+
)
|
|
266
|
+
|
|
267
|
+
def upload(
|
|
268
|
+
self,
|
|
269
|
+
*,
|
|
270
|
+
workspace_ext_id: str,
|
|
271
|
+
files: SequenceNotStr[FileTypes],
|
|
272
|
+
config_ext_id: Optional[str] | Omit = omit,
|
|
273
|
+
shared: bool | Omit = omit,
|
|
274
|
+
workspace_key: str | Omit = omit,
|
|
275
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
276
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
277
|
+
extra_headers: Headers | None = None,
|
|
278
|
+
extra_query: Query | None = None,
|
|
279
|
+
extra_body: Body | None = None,
|
|
280
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
281
|
+
) -> DocumentUploadResponse:
|
|
282
|
+
"""Upload multiple documents to a workspace with encryption.
|
|
283
|
+
|
|
284
|
+
Documents are queued
|
|
285
|
+
for processing, parsed, and indexed for vector search.
|
|
286
|
+
|
|
287
|
+
Requires active subscription (paid/trial/dev) if Stripe is configured.
|
|
288
|
+
|
|
289
|
+
Args:
|
|
290
|
+
files: Multiple files to upload
|
|
291
|
+
|
|
292
|
+
config_ext_id: Configuration to use for processing
|
|
293
|
+
|
|
294
|
+
shared: Whether the document should be shared with workspace members
|
|
295
|
+
|
|
296
|
+
extra_headers: Send extra headers
|
|
297
|
+
|
|
298
|
+
extra_query: Add additional query parameters to the request
|
|
299
|
+
|
|
300
|
+
extra_body: Add additional JSON properties to the request
|
|
301
|
+
|
|
302
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
303
|
+
"""
|
|
304
|
+
extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
|
|
305
|
+
body = deepcopy_minimal({"files": files})
|
|
306
|
+
extracted_files = extract_files(cast(Mapping[str, object], body), paths=[["files", "<array>"]])
|
|
307
|
+
# It should be noted that the actual Content-Type header that will be
|
|
308
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
|
309
|
+
# multipart/form-data; boundary=---abc--
|
|
310
|
+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
|
311
|
+
return self._post(
|
|
312
|
+
"/api/document/upload",
|
|
313
|
+
body=maybe_transform(body, document_upload_params.DocumentUploadParams),
|
|
314
|
+
files=extracted_files,
|
|
315
|
+
options=make_request_options(
|
|
316
|
+
extra_headers=extra_headers,
|
|
317
|
+
extra_query=extra_query,
|
|
318
|
+
extra_body=extra_body,
|
|
319
|
+
timeout=timeout,
|
|
320
|
+
query=maybe_transform(
|
|
321
|
+
{
|
|
322
|
+
"workspace_ext_id": workspace_ext_id,
|
|
323
|
+
"config_ext_id": config_ext_id,
|
|
324
|
+
"shared": shared,
|
|
325
|
+
},
|
|
326
|
+
document_upload_params.DocumentUploadParams,
|
|
327
|
+
),
|
|
328
|
+
),
|
|
329
|
+
cast_to=DocumentUploadResponse,
|
|
330
|
+
)
|
|
331
|
+
|
|
332
|
+
def upload_from_url(
|
|
333
|
+
self,
|
|
334
|
+
*,
|
|
335
|
+
urls: SequenceNotStr[str],
|
|
336
|
+
workspace_ext_id: str,
|
|
337
|
+
config_ext_id: Optional[str] | Omit = omit,
|
|
338
|
+
shared: bool | Omit = omit,
|
|
339
|
+
workspace_key: str | Omit = omit,
|
|
340
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
341
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
342
|
+
extra_headers: Headers | None = None,
|
|
343
|
+
extra_query: Query | None = None,
|
|
344
|
+
extra_body: Body | None = None,
|
|
345
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
346
|
+
) -> DocumentUploadFromURLResponse:
|
|
347
|
+
"""
|
|
348
|
+
Download and upload documents from URLs to a workspace with encryption.
|
|
349
|
+
Documents are queued for processing, parsed, and indexed for vector search.
|
|
350
|
+
|
|
351
|
+
Requires active subscription (paid/trial/dev) if Stripe is configured.
|
|
352
|
+
|
|
353
|
+
Args:
|
|
354
|
+
urls: URLs to download documents from
|
|
355
|
+
|
|
356
|
+
config_ext_id: Configuration to use for processing
|
|
357
|
+
|
|
358
|
+
shared: Whether the document should be shared with workspace members
|
|
359
|
+
|
|
360
|
+
extra_headers: Send extra headers
|
|
361
|
+
|
|
362
|
+
extra_query: Add additional query parameters to the request
|
|
363
|
+
|
|
364
|
+
extra_body: Add additional JSON properties to the request
|
|
365
|
+
|
|
366
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
367
|
+
"""
|
|
368
|
+
extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
|
|
369
|
+
return self._post(
|
|
370
|
+
"/api/document/upload-url",
|
|
371
|
+
options=make_request_options(
|
|
372
|
+
extra_headers=extra_headers,
|
|
373
|
+
extra_query=extra_query,
|
|
374
|
+
extra_body=extra_body,
|
|
375
|
+
timeout=timeout,
|
|
376
|
+
query=maybe_transform(
|
|
377
|
+
{
|
|
378
|
+
"urls": urls,
|
|
379
|
+
"workspace_ext_id": workspace_ext_id,
|
|
380
|
+
"config_ext_id": config_ext_id,
|
|
381
|
+
"shared": shared,
|
|
382
|
+
},
|
|
383
|
+
document_upload_from_url_params.DocumentUploadFromURLParams,
|
|
384
|
+
),
|
|
385
|
+
),
|
|
386
|
+
cast_to=DocumentUploadFromURLResponse,
|
|
387
|
+
)
|
|
388
|
+
|
|
389
|
+
def view(
|
|
390
|
+
self,
|
|
391
|
+
document_ext_id: str,
|
|
392
|
+
*,
|
|
393
|
+
workspace_key: str | Omit = omit,
|
|
394
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
395
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
396
|
+
extra_headers: Headers | None = None,
|
|
397
|
+
extra_query: Query | None = None,
|
|
398
|
+
extra_body: Body | None = None,
|
|
399
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
400
|
+
) -> object:
|
|
401
|
+
"""View a document inline in the browser.
|
|
402
|
+
|
|
403
|
+
Retrieves and decrypts the document for
|
|
404
|
+
inline viewing with optional page specification.
|
|
405
|
+
|
|
406
|
+
Args:
|
|
407
|
+
extra_headers: Send extra headers
|
|
408
|
+
|
|
409
|
+
extra_query: Add additional query parameters to the request
|
|
410
|
+
|
|
411
|
+
extra_body: Add additional JSON properties to the request
|
|
412
|
+
|
|
413
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
414
|
+
"""
|
|
415
|
+
if not document_ext_id:
|
|
416
|
+
raise ValueError(f"Expected a non-empty value for `document_ext_id` but received {document_ext_id!r}")
|
|
417
|
+
extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
|
|
418
|
+
return self._get(
|
|
419
|
+
f"/api/document/{document_ext_id}/view",
|
|
420
|
+
options=make_request_options(
|
|
421
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
422
|
+
),
|
|
423
|
+
cast_to=object,
|
|
424
|
+
)
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
class AsyncDocumentResource(AsyncAPIResource):
|
|
428
|
+
@cached_property
|
|
429
|
+
def doctag(self) -> AsyncDoctagResource:
|
|
430
|
+
return AsyncDoctagResource(self._client)
|
|
431
|
+
|
|
432
|
+
@cached_property
|
|
433
|
+
def with_raw_response(self) -> AsyncDocumentResourceWithRawResponse:
|
|
434
|
+
"""
|
|
435
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
436
|
+
the raw response object instead of the parsed content.
|
|
437
|
+
|
|
438
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#accessing-raw-response-data-eg-headers
|
|
439
|
+
"""
|
|
440
|
+
return AsyncDocumentResourceWithRawResponse(self)
|
|
441
|
+
|
|
442
|
+
@cached_property
|
|
443
|
+
def with_streaming_response(self) -> AsyncDocumentResourceWithStreamingResponse:
|
|
444
|
+
"""
|
|
445
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
446
|
+
|
|
447
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#with_streaming_response
|
|
448
|
+
"""
|
|
449
|
+
return AsyncDocumentResourceWithStreamingResponse(self)
|
|
450
|
+
|
|
451
|
+
async def retrieve(
|
|
452
|
+
self,
|
|
453
|
+
*,
|
|
454
|
+
external_ids: SequenceNotStr[str],
|
|
455
|
+
workspace_key: str | Omit = omit,
|
|
456
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
457
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
458
|
+
extra_headers: Headers | None = None,
|
|
459
|
+
extra_query: Query | None = None,
|
|
460
|
+
extra_body: Body | None = None,
|
|
461
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
462
|
+
) -> DocumentRetrieveResponse:
|
|
463
|
+
"""
|
|
464
|
+
Get one or more documents by external IDs.
|
|
465
|
+
|
|
466
|
+
Args:
|
|
467
|
+
extra_headers: Send extra headers
|
|
468
|
+
|
|
469
|
+
extra_query: Add additional query parameters to the request
|
|
470
|
+
|
|
471
|
+
extra_body: Add additional JSON properties to the request
|
|
472
|
+
|
|
473
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
474
|
+
"""
|
|
475
|
+
extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
|
|
476
|
+
return await self._get(
|
|
477
|
+
"/api/document/",
|
|
478
|
+
options=make_request_options(
|
|
479
|
+
extra_headers=extra_headers,
|
|
480
|
+
extra_query=extra_query,
|
|
481
|
+
extra_body=extra_body,
|
|
482
|
+
timeout=timeout,
|
|
483
|
+
query=await async_maybe_transform(
|
|
484
|
+
{"external_ids": external_ids}, document_retrieve_params.DocumentRetrieveParams
|
|
485
|
+
),
|
|
486
|
+
),
|
|
487
|
+
cast_to=DocumentRetrieveResponse,
|
|
488
|
+
)
|
|
489
|
+
|
|
490
|
+
async def update(
|
|
491
|
+
self,
|
|
492
|
+
*,
|
|
493
|
+
documents: Iterable[document_update_params.Document],
|
|
494
|
+
workspace_key: str | Omit = omit,
|
|
495
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
496
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
497
|
+
extra_headers: Headers | None = None,
|
|
498
|
+
extra_query: Query | None = None,
|
|
499
|
+
extra_body: Body | None = None,
|
|
500
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
501
|
+
) -> DocumentUpdateResponse:
|
|
502
|
+
"""
|
|
503
|
+
Update one or more documents.
|
|
504
|
+
|
|
505
|
+
Args:
|
|
506
|
+
extra_headers: Send extra headers
|
|
507
|
+
|
|
508
|
+
extra_query: Add additional query parameters to the request
|
|
509
|
+
|
|
510
|
+
extra_body: Add additional JSON properties to the request
|
|
511
|
+
|
|
512
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
513
|
+
"""
|
|
514
|
+
extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
|
|
515
|
+
return await self._patch(
|
|
516
|
+
"/api/document/",
|
|
517
|
+
body=await async_maybe_transform({"documents": documents}, document_update_params.DocumentUpdateParams),
|
|
518
|
+
options=make_request_options(
|
|
519
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
520
|
+
),
|
|
521
|
+
cast_to=DocumentUpdateResponse,
|
|
522
|
+
)
|
|
523
|
+
|
|
524
|
+
async def delete(
|
|
525
|
+
self,
|
|
526
|
+
*,
|
|
527
|
+
external_ids: SequenceNotStr[str],
|
|
528
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
529
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
530
|
+
extra_headers: Headers | None = None,
|
|
531
|
+
extra_query: Query | None = None,
|
|
532
|
+
extra_body: Body | None = None,
|
|
533
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
534
|
+
) -> None:
|
|
535
|
+
"""
|
|
536
|
+
Delete one or more documents.
|
|
537
|
+
|
|
538
|
+
Args:
|
|
539
|
+
extra_headers: Send extra headers
|
|
540
|
+
|
|
541
|
+
extra_query: Add additional query parameters to the request
|
|
542
|
+
|
|
543
|
+
extra_body: Add additional JSON properties to the request
|
|
544
|
+
|
|
545
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
546
|
+
"""
|
|
547
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
548
|
+
return await self._delete(
|
|
549
|
+
"/api/document/",
|
|
550
|
+
body=await async_maybe_transform(
|
|
551
|
+
{"external_ids": external_ids}, document_delete_params.DocumentDeleteParams
|
|
552
|
+
),
|
|
553
|
+
options=make_request_options(
|
|
554
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
555
|
+
),
|
|
556
|
+
cast_to=NoneType,
|
|
557
|
+
)
|
|
558
|
+
|
|
559
|
+
async def download(
|
|
560
|
+
self,
|
|
561
|
+
document_ext_id: str,
|
|
562
|
+
*,
|
|
563
|
+
workspace_key: str | Omit = omit,
|
|
564
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
565
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
566
|
+
extra_headers: Headers | None = None,
|
|
567
|
+
extra_query: Query | None = None,
|
|
568
|
+
extra_body: Body | None = None,
|
|
569
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
570
|
+
) -> object:
|
|
571
|
+
"""Download a document by its external ID.
|
|
572
|
+
|
|
573
|
+
Retrieves and decrypts the document for
|
|
574
|
+
downloading as an attachment.
|
|
575
|
+
|
|
576
|
+
Args:
|
|
577
|
+
extra_headers: Send extra headers
|
|
578
|
+
|
|
579
|
+
extra_query: Add additional query parameters to the request
|
|
580
|
+
|
|
581
|
+
extra_body: Add additional JSON properties to the request
|
|
582
|
+
|
|
583
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
584
|
+
"""
|
|
585
|
+
if not document_ext_id:
|
|
586
|
+
raise ValueError(f"Expected a non-empty value for `document_ext_id` but received {document_ext_id!r}")
|
|
587
|
+
extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
|
|
588
|
+
return await self._get(
|
|
589
|
+
f"/api/document/{document_ext_id}/download",
|
|
590
|
+
options=make_request_options(
|
|
591
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
592
|
+
),
|
|
593
|
+
cast_to=object,
|
|
594
|
+
)
|
|
595
|
+
|
|
596
|
+
async def get_parsed(
|
|
597
|
+
self,
|
|
598
|
+
stage: Literal["marker", "subchunk", "final"],
|
|
599
|
+
*,
|
|
600
|
+
document_ext_id: str,
|
|
601
|
+
workspace_key: str | Omit = omit,
|
|
602
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
603
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
604
|
+
extra_headers: Headers | None = None,
|
|
605
|
+
extra_query: Query | None = None,
|
|
606
|
+
extra_body: Body | None = None,
|
|
607
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
608
|
+
) -> DocumentGetParsedResponse:
|
|
609
|
+
"""Retrieve the full parsed document to be handled by the frontend.
|
|
610
|
+
|
|
611
|
+
Only requires
|
|
612
|
+
document_ext_id, workspace is determined through RLS.
|
|
613
|
+
|
|
614
|
+
Args:
|
|
615
|
+
extra_headers: Send extra headers
|
|
616
|
+
|
|
617
|
+
extra_query: Add additional query parameters to the request
|
|
618
|
+
|
|
619
|
+
extra_body: Add additional JSON properties to the request
|
|
620
|
+
|
|
621
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
622
|
+
"""
|
|
623
|
+
if not document_ext_id:
|
|
624
|
+
raise ValueError(f"Expected a non-empty value for `document_ext_id` but received {document_ext_id!r}")
|
|
625
|
+
if not stage:
|
|
626
|
+
raise ValueError(f"Expected a non-empty value for `stage` but received {stage!r}")
|
|
627
|
+
extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
|
|
628
|
+
return await self._get(
|
|
629
|
+
f"/api/document/{document_ext_id}/parsed-{stage}",
|
|
630
|
+
options=make_request_options(
|
|
631
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
632
|
+
),
|
|
633
|
+
cast_to=DocumentGetParsedResponse,
|
|
634
|
+
)
|
|
635
|
+
|
|
636
|
+
async def upload(
|
|
637
|
+
self,
|
|
638
|
+
*,
|
|
639
|
+
workspace_ext_id: str,
|
|
640
|
+
files: SequenceNotStr[FileTypes],
|
|
641
|
+
config_ext_id: Optional[str] | Omit = omit,
|
|
642
|
+
shared: bool | Omit = omit,
|
|
643
|
+
workspace_key: str | Omit = omit,
|
|
644
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
645
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
646
|
+
extra_headers: Headers | None = None,
|
|
647
|
+
extra_query: Query | None = None,
|
|
648
|
+
extra_body: Body | None = None,
|
|
649
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
650
|
+
) -> DocumentUploadResponse:
|
|
651
|
+
"""Upload multiple documents to a workspace with encryption.
|
|
652
|
+
|
|
653
|
+
Documents are queued
|
|
654
|
+
for processing, parsed, and indexed for vector search.
|
|
655
|
+
|
|
656
|
+
Requires active subscription (paid/trial/dev) if Stripe is configured.
|
|
657
|
+
|
|
658
|
+
Args:
|
|
659
|
+
files: Multiple files to upload
|
|
660
|
+
|
|
661
|
+
config_ext_id: Configuration to use for processing
|
|
662
|
+
|
|
663
|
+
shared: Whether the document should be shared with workspace members
|
|
664
|
+
|
|
665
|
+
extra_headers: Send extra headers
|
|
666
|
+
|
|
667
|
+
extra_query: Add additional query parameters to the request
|
|
668
|
+
|
|
669
|
+
extra_body: Add additional JSON properties to the request
|
|
670
|
+
|
|
671
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
672
|
+
"""
|
|
673
|
+
extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
|
|
674
|
+
body = deepcopy_minimal({"files": files})
|
|
675
|
+
extracted_files = extract_files(cast(Mapping[str, object], body), paths=[["files", "<array>"]])
|
|
676
|
+
# It should be noted that the actual Content-Type header that will be
|
|
677
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
|
678
|
+
# multipart/form-data; boundary=---abc--
|
|
679
|
+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
|
680
|
+
return await self._post(
|
|
681
|
+
"/api/document/upload",
|
|
682
|
+
body=await async_maybe_transform(body, document_upload_params.DocumentUploadParams),
|
|
683
|
+
files=extracted_files,
|
|
684
|
+
options=make_request_options(
|
|
685
|
+
extra_headers=extra_headers,
|
|
686
|
+
extra_query=extra_query,
|
|
687
|
+
extra_body=extra_body,
|
|
688
|
+
timeout=timeout,
|
|
689
|
+
query=await async_maybe_transform(
|
|
690
|
+
{
|
|
691
|
+
"workspace_ext_id": workspace_ext_id,
|
|
692
|
+
"config_ext_id": config_ext_id,
|
|
693
|
+
"shared": shared,
|
|
694
|
+
},
|
|
695
|
+
document_upload_params.DocumentUploadParams,
|
|
696
|
+
),
|
|
697
|
+
),
|
|
698
|
+
cast_to=DocumentUploadResponse,
|
|
699
|
+
)
|
|
700
|
+
|
|
701
|
+
async def upload_from_url(
|
|
702
|
+
self,
|
|
703
|
+
*,
|
|
704
|
+
urls: SequenceNotStr[str],
|
|
705
|
+
workspace_ext_id: str,
|
|
706
|
+
config_ext_id: Optional[str] | Omit = omit,
|
|
707
|
+
shared: bool | Omit = omit,
|
|
708
|
+
workspace_key: str | Omit = omit,
|
|
709
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
710
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
711
|
+
extra_headers: Headers | None = None,
|
|
712
|
+
extra_query: Query | None = None,
|
|
713
|
+
extra_body: Body | None = None,
|
|
714
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
715
|
+
) -> DocumentUploadFromURLResponse:
|
|
716
|
+
"""
|
|
717
|
+
Download and upload documents from URLs to a workspace with encryption.
|
|
718
|
+
Documents are queued for processing, parsed, and indexed for vector search.
|
|
719
|
+
|
|
720
|
+
Requires active subscription (paid/trial/dev) if Stripe is configured.
|
|
721
|
+
|
|
722
|
+
Args:
|
|
723
|
+
urls: URLs to download documents from
|
|
724
|
+
|
|
725
|
+
config_ext_id: Configuration to use for processing
|
|
726
|
+
|
|
727
|
+
shared: Whether the document should be shared with workspace members
|
|
728
|
+
|
|
729
|
+
extra_headers: Send extra headers
|
|
730
|
+
|
|
731
|
+
extra_query: Add additional query parameters to the request
|
|
732
|
+
|
|
733
|
+
extra_body: Add additional JSON properties to the request
|
|
734
|
+
|
|
735
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
736
|
+
"""
|
|
737
|
+
extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
|
|
738
|
+
return await self._post(
|
|
739
|
+
"/api/document/upload-url",
|
|
740
|
+
options=make_request_options(
|
|
741
|
+
extra_headers=extra_headers,
|
|
742
|
+
extra_query=extra_query,
|
|
743
|
+
extra_body=extra_body,
|
|
744
|
+
timeout=timeout,
|
|
745
|
+
query=await async_maybe_transform(
|
|
746
|
+
{
|
|
747
|
+
"urls": urls,
|
|
748
|
+
"workspace_ext_id": workspace_ext_id,
|
|
749
|
+
"config_ext_id": config_ext_id,
|
|
750
|
+
"shared": shared,
|
|
751
|
+
},
|
|
752
|
+
document_upload_from_url_params.DocumentUploadFromURLParams,
|
|
753
|
+
),
|
|
754
|
+
),
|
|
755
|
+
cast_to=DocumentUploadFromURLResponse,
|
|
756
|
+
)
|
|
757
|
+
|
|
758
|
+
async def view(
|
|
759
|
+
self,
|
|
760
|
+
document_ext_id: str,
|
|
761
|
+
*,
|
|
762
|
+
workspace_key: str | Omit = omit,
|
|
763
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
764
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
765
|
+
extra_headers: Headers | None = None,
|
|
766
|
+
extra_query: Query | None = None,
|
|
767
|
+
extra_body: Body | None = None,
|
|
768
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
769
|
+
) -> object:
|
|
770
|
+
"""View a document inline in the browser.
|
|
771
|
+
|
|
772
|
+
Retrieves and decrypts the document for
|
|
773
|
+
inline viewing with optional page specification.
|
|
774
|
+
|
|
775
|
+
Args:
|
|
776
|
+
extra_headers: Send extra headers
|
|
777
|
+
|
|
778
|
+
extra_query: Add additional query parameters to the request
|
|
779
|
+
|
|
780
|
+
extra_body: Add additional JSON properties to the request
|
|
781
|
+
|
|
782
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
783
|
+
"""
|
|
784
|
+
if not document_ext_id:
|
|
785
|
+
raise ValueError(f"Expected a non-empty value for `document_ext_id` but received {document_ext_id!r}")
|
|
786
|
+
extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
|
|
787
|
+
return await self._get(
|
|
788
|
+
f"/api/document/{document_ext_id}/view",
|
|
789
|
+
options=make_request_options(
|
|
790
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
791
|
+
),
|
|
792
|
+
cast_to=object,
|
|
793
|
+
)
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
class DocumentResourceWithRawResponse:
|
|
797
|
+
def __init__(self, document: DocumentResource) -> None:
|
|
798
|
+
self._document = document
|
|
799
|
+
|
|
800
|
+
self.retrieve = to_raw_response_wrapper(
|
|
801
|
+
document.retrieve,
|
|
802
|
+
)
|
|
803
|
+
self.update = to_raw_response_wrapper(
|
|
804
|
+
document.update,
|
|
805
|
+
)
|
|
806
|
+
self.delete = to_raw_response_wrapper(
|
|
807
|
+
document.delete,
|
|
808
|
+
)
|
|
809
|
+
self.download = to_raw_response_wrapper(
|
|
810
|
+
document.download,
|
|
811
|
+
)
|
|
812
|
+
self.get_parsed = to_raw_response_wrapper(
|
|
813
|
+
document.get_parsed,
|
|
814
|
+
)
|
|
815
|
+
self.upload = to_raw_response_wrapper(
|
|
816
|
+
document.upload,
|
|
817
|
+
)
|
|
818
|
+
self.upload_from_url = to_raw_response_wrapper(
|
|
819
|
+
document.upload_from_url,
|
|
820
|
+
)
|
|
821
|
+
self.view = to_raw_response_wrapper(
|
|
822
|
+
document.view,
|
|
823
|
+
)
|
|
824
|
+
|
|
825
|
+
@cached_property
|
|
826
|
+
def doctag(self) -> DoctagResourceWithRawResponse:
|
|
827
|
+
return DoctagResourceWithRawResponse(self._document.doctag)
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
class AsyncDocumentResourceWithRawResponse:
|
|
831
|
+
def __init__(self, document: AsyncDocumentResource) -> None:
|
|
832
|
+
self._document = document
|
|
833
|
+
|
|
834
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
835
|
+
document.retrieve,
|
|
836
|
+
)
|
|
837
|
+
self.update = async_to_raw_response_wrapper(
|
|
838
|
+
document.update,
|
|
839
|
+
)
|
|
840
|
+
self.delete = async_to_raw_response_wrapper(
|
|
841
|
+
document.delete,
|
|
842
|
+
)
|
|
843
|
+
self.download = async_to_raw_response_wrapper(
|
|
844
|
+
document.download,
|
|
845
|
+
)
|
|
846
|
+
self.get_parsed = async_to_raw_response_wrapper(
|
|
847
|
+
document.get_parsed,
|
|
848
|
+
)
|
|
849
|
+
self.upload = async_to_raw_response_wrapper(
|
|
850
|
+
document.upload,
|
|
851
|
+
)
|
|
852
|
+
self.upload_from_url = async_to_raw_response_wrapper(
|
|
853
|
+
document.upload_from_url,
|
|
854
|
+
)
|
|
855
|
+
self.view = async_to_raw_response_wrapper(
|
|
856
|
+
document.view,
|
|
857
|
+
)
|
|
858
|
+
|
|
859
|
+
@cached_property
|
|
860
|
+
def doctag(self) -> AsyncDoctagResourceWithRawResponse:
|
|
861
|
+
return AsyncDoctagResourceWithRawResponse(self._document.doctag)
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
class DocumentResourceWithStreamingResponse:
|
|
865
|
+
def __init__(self, document: DocumentResource) -> None:
|
|
866
|
+
self._document = document
|
|
867
|
+
|
|
868
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
869
|
+
document.retrieve,
|
|
870
|
+
)
|
|
871
|
+
self.update = to_streamed_response_wrapper(
|
|
872
|
+
document.update,
|
|
873
|
+
)
|
|
874
|
+
self.delete = to_streamed_response_wrapper(
|
|
875
|
+
document.delete,
|
|
876
|
+
)
|
|
877
|
+
self.download = to_streamed_response_wrapper(
|
|
878
|
+
document.download,
|
|
879
|
+
)
|
|
880
|
+
self.get_parsed = to_streamed_response_wrapper(
|
|
881
|
+
document.get_parsed,
|
|
882
|
+
)
|
|
883
|
+
self.upload = to_streamed_response_wrapper(
|
|
884
|
+
document.upload,
|
|
885
|
+
)
|
|
886
|
+
self.upload_from_url = to_streamed_response_wrapper(
|
|
887
|
+
document.upload_from_url,
|
|
888
|
+
)
|
|
889
|
+
self.view = to_streamed_response_wrapper(
|
|
890
|
+
document.view,
|
|
891
|
+
)
|
|
892
|
+
|
|
893
|
+
@cached_property
|
|
894
|
+
def doctag(self) -> DoctagResourceWithStreamingResponse:
|
|
895
|
+
return DoctagResourceWithStreamingResponse(self._document.doctag)
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
class AsyncDocumentResourceWithStreamingResponse:
|
|
899
|
+
def __init__(self, document: AsyncDocumentResource) -> None:
|
|
900
|
+
self._document = document
|
|
901
|
+
|
|
902
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
903
|
+
document.retrieve,
|
|
904
|
+
)
|
|
905
|
+
self.update = async_to_streamed_response_wrapper(
|
|
906
|
+
document.update,
|
|
907
|
+
)
|
|
908
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
909
|
+
document.delete,
|
|
910
|
+
)
|
|
911
|
+
self.download = async_to_streamed_response_wrapper(
|
|
912
|
+
document.download,
|
|
913
|
+
)
|
|
914
|
+
self.get_parsed = async_to_streamed_response_wrapper(
|
|
915
|
+
document.get_parsed,
|
|
916
|
+
)
|
|
917
|
+
self.upload = async_to_streamed_response_wrapper(
|
|
918
|
+
document.upload,
|
|
919
|
+
)
|
|
920
|
+
self.upload_from_url = async_to_streamed_response_wrapper(
|
|
921
|
+
document.upload_from_url,
|
|
922
|
+
)
|
|
923
|
+
self.view = async_to_streamed_response_wrapper(
|
|
924
|
+
document.view,
|
|
925
|
+
)
|
|
926
|
+
|
|
927
|
+
@cached_property
|
|
928
|
+
def doctag(self) -> AsyncDoctagResourceWithStreamingResponse:
|
|
929
|
+
return AsyncDoctagResourceWithStreamingResponse(self._document.doctag)
|