arbi 0.1.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.
Potentially problematic release.
This version of arbi might be problematic. Click here for more details.
- arbi/__init__.py +90 -0
- arbi/_base_client.py +1995 -0
- arbi/_client.py +394 -0
- arbi/_compat.py +219 -0
- arbi/_constants.py +14 -0
- arbi/_exceptions.py +108 -0
- arbi/_files.py +123 -0
- arbi/_models.py +829 -0
- arbi/_qs.py +150 -0
- arbi/_resource.py +43 -0
- arbi/_response.py +830 -0
- arbi/_streaming.py +333 -0
- arbi/_types.py +219 -0
- arbi/_utils/__init__.py +57 -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 +86 -0
- arbi/_utils/_transform.py +447 -0
- arbi/_utils/_typing.py +151 -0
- arbi/_utils/_utils.py +422 -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 +300 -0
- arbi/resources/api/configs.py +499 -0
- arbi/resources/api/conversation/__init__.py +33 -0
- arbi/resources/api/conversation/conversation.py +555 -0
- arbi/resources/api/conversation/user.py +270 -0
- arbi/resources/api/document/__init__.py +33 -0
- arbi/resources/api/document/annotation.py +384 -0
- arbi/resources/api/document/document.py +873 -0
- arbi/resources/api/health.py +304 -0
- arbi/resources/api/sso.py +333 -0
- arbi/resources/api/tag.py +614 -0
- arbi/resources/api/user/__init__.py +33 -0
- arbi/resources/api/user/settings.py +251 -0
- arbi/resources/api/user/user.py +532 -0
- arbi/resources/api/workspace.py +1061 -0
- arbi/types/__init__.py +8 -0
- arbi/types/api/__init__.py +84 -0
- arbi/types/api/assistant_query_params.py +59 -0
- arbi/types/api/assistant_retrieve_params.py +59 -0
- arbi/types/api/chunker_config_param.py +9 -0
- arbi/types/api/config_create_params.py +45 -0
- arbi/types/api/config_create_response.py +15 -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 +46 -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_threads_response.py +91 -0
- arbi/types/api/conversation_share_response.py +11 -0
- arbi/types/api/conversation_update_title_params.py +12 -0
- arbi/types/api/conversation_update_title_response.py +13 -0
- arbi/types/api/doc_response.py +48 -0
- arbi/types/api/document/__init__.py +8 -0
- arbi/types/api/document/annotation_create_params.py +16 -0
- arbi/types/api/document/annotation_delete_response.py +11 -0
- arbi/types/api/document/annotation_update_params.py +16 -0
- arbi/types/api/document/doc_tag_response.py +26 -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_response.py +11 -0
- arbi/types/api/document_get_parsed_response.py +26 -0
- arbi/types/api/document_get_tags_response.py +10 -0
- arbi/types/api/document_update_params.py +19 -0
- arbi/types/api/document_update_response.py +22 -0
- arbi/types/api/document_upload_params.py +23 -0
- arbi/types/api/document_view_params.py +13 -0
- arbi/types/api/embedder_config.py +18 -0
- arbi/types/api/embedder_config_param.py +17 -0
- arbi/types/api/health_check_app_response.py +9 -0
- arbi/types/api/health_check_models_response.py +21 -0
- arbi/types/api/health_check_services_response.py +23 -0
- arbi/types/api/health_get_models_response.py +19 -0
- arbi/types/api/model_citation_config.py +23 -0
- arbi/types/api/model_citation_config_param.py +23 -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 +23 -0
- arbi/types/api/retriever_config_param.py +23 -0
- arbi/types/api/sso_invite_params.py +11 -0
- arbi/types/api/sso_invite_response.py +11 -0
- arbi/types/api/sso_login_params.py +16 -0
- arbi/types/api/sso_login_response.py +15 -0
- arbi/types/api/sso_rotate_passcode_response.py +11 -0
- arbi/types/api/tag_apply_to_docs_params.py +12 -0
- arbi/types/api/tag_apply_to_docs_response.py +13 -0
- arbi/types/api/tag_create_params.py +18 -0
- arbi/types/api/tag_create_response.py +11 -0
- arbi/types/api/tag_delete_response.py +9 -0
- arbi/types/api/tag_get_docs_response.py +10 -0
- arbi/types/api/tag_remove_from_docs_params.py +12 -0
- arbi/types/api/tag_remove_from_docs_response.py +13 -0
- arbi/types/api/tag_update_params.py +14 -0
- arbi/types/api/tag_update_response.py +17 -0
- arbi/types/api/title_llm_config.py +29 -0
- arbi/types/api/title_llm_config_param.py +28 -0
- arbi/types/api/token.py +13 -0
- arbi/types/api/user/__init__.py +6 -0
- arbi/types/api/user/setting_retrieve_response.py +36 -0
- arbi/types/api/user/setting_update_params.py +24 -0
- arbi/types/api/user_list_workspaces_response.py +10 -0
- arbi/types/api/user_login_params.py +13 -0
- arbi/types/api/user_logout_response.py +9 -0
- arbi/types/api/user_register_params.py +17 -0
- arbi/types/api/user_response.py +19 -0
- arbi/types/api/workspace_create_protected_params.py +14 -0
- arbi/types/api/workspace_delete_response.py +9 -0
- arbi/types/api/workspace_get_conversations_response.py +28 -0
- arbi/types/api/workspace_get_doctags_response.py +10 -0
- arbi/types/api/workspace_get_documents_response.py +10 -0
- arbi/types/api/workspace_get_stats_response.py +13 -0
- arbi/types/api/workspace_get_tags_response.py +30 -0
- arbi/types/api/workspace_get_users_response.py +17 -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 +24 -0
- arbi/types/api/workspace_share_params.py +11 -0
- arbi/types/api/workspace_share_response.py +21 -0
- arbi/types/api/workspace_update_params.py +14 -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.1.0.dist-info/METADATA +410 -0
- arbi-0.1.0.dist-info/RECORD +143 -0
- arbi-0.1.0.dist-info/WHEEL +4 -0
- arbi-0.1.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
8
|
+
from ...._utils import maybe_transform, async_maybe_transform
|
|
9
|
+
from ...._compat import cached_property
|
|
10
|
+
from ...._resource import SyncAPIResource, AsyncAPIResource
|
|
11
|
+
from ...._response import (
|
|
12
|
+
to_raw_response_wrapper,
|
|
13
|
+
to_streamed_response_wrapper,
|
|
14
|
+
async_to_raw_response_wrapper,
|
|
15
|
+
async_to_streamed_response_wrapper,
|
|
16
|
+
)
|
|
17
|
+
from ...._base_client import make_request_options
|
|
18
|
+
from ....types.api.conversation import user_add_params, user_remove_params
|
|
19
|
+
from ....types.api.conversation.user_add_response import UserAddResponse
|
|
20
|
+
from ....types.api.conversation.user_remove_response import UserRemoveResponse
|
|
21
|
+
|
|
22
|
+
__all__ = ["UserResource", "AsyncUserResource"]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class UserResource(SyncAPIResource):
|
|
26
|
+
@cached_property
|
|
27
|
+
def with_raw_response(self) -> UserResourceWithRawResponse:
|
|
28
|
+
"""
|
|
29
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
30
|
+
the raw response object instead of the parsed content.
|
|
31
|
+
|
|
32
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#accessing-raw-response-data-eg-headers
|
|
33
|
+
"""
|
|
34
|
+
return UserResourceWithRawResponse(self)
|
|
35
|
+
|
|
36
|
+
@cached_property
|
|
37
|
+
def with_streaming_response(self) -> UserResourceWithStreamingResponse:
|
|
38
|
+
"""
|
|
39
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
40
|
+
|
|
41
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#with_streaming_response
|
|
42
|
+
"""
|
|
43
|
+
return UserResourceWithStreamingResponse(self)
|
|
44
|
+
|
|
45
|
+
def add(
|
|
46
|
+
self,
|
|
47
|
+
conversation_ext_id: str,
|
|
48
|
+
*,
|
|
49
|
+
user_ext_id: str,
|
|
50
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
51
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
52
|
+
extra_headers: Headers | None = None,
|
|
53
|
+
extra_query: Query | None = None,
|
|
54
|
+
extra_body: Body | None = None,
|
|
55
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
56
|
+
) -> UserAddResponse:
|
|
57
|
+
"""
|
|
58
|
+
Add a user to a conversation.
|
|
59
|
+
|
|
60
|
+
RLS ensures the user can only add users to conversations they have access to.
|
|
61
|
+
PostgreSQL constraints handle duplicate users.
|
|
62
|
+
|
|
63
|
+
Args:
|
|
64
|
+
extra_headers: Send extra headers
|
|
65
|
+
|
|
66
|
+
extra_query: Add additional query parameters to the request
|
|
67
|
+
|
|
68
|
+
extra_body: Add additional JSON properties to the request
|
|
69
|
+
|
|
70
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
71
|
+
"""
|
|
72
|
+
if not conversation_ext_id:
|
|
73
|
+
raise ValueError(
|
|
74
|
+
f"Expected a non-empty value for `conversation_ext_id` but received {conversation_ext_id!r}"
|
|
75
|
+
)
|
|
76
|
+
return self._post(
|
|
77
|
+
f"/api/conversation/{conversation_ext_id}/user",
|
|
78
|
+
body=maybe_transform({"user_ext_id": user_ext_id}, user_add_params.UserAddParams),
|
|
79
|
+
options=make_request_options(
|
|
80
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
81
|
+
),
|
|
82
|
+
cast_to=UserAddResponse,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
def remove(
|
|
86
|
+
self,
|
|
87
|
+
conversation_ext_id: str,
|
|
88
|
+
*,
|
|
89
|
+
user_ext_id: str,
|
|
90
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
91
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
92
|
+
extra_headers: Headers | None = None,
|
|
93
|
+
extra_query: Query | None = None,
|
|
94
|
+
extra_body: Body | None = None,
|
|
95
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
96
|
+
) -> UserRemoveResponse:
|
|
97
|
+
"""
|
|
98
|
+
Remove a user from a conversation.
|
|
99
|
+
|
|
100
|
+
RLS ensures the user can only modify conversations they have access to.
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
extra_headers: Send extra headers
|
|
104
|
+
|
|
105
|
+
extra_query: Add additional query parameters to the request
|
|
106
|
+
|
|
107
|
+
extra_body: Add additional JSON properties to the request
|
|
108
|
+
|
|
109
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
110
|
+
"""
|
|
111
|
+
if not conversation_ext_id:
|
|
112
|
+
raise ValueError(
|
|
113
|
+
f"Expected a non-empty value for `conversation_ext_id` but received {conversation_ext_id!r}"
|
|
114
|
+
)
|
|
115
|
+
return self._delete(
|
|
116
|
+
f"/api/conversation/{conversation_ext_id}/user",
|
|
117
|
+
body=maybe_transform({"user_ext_id": user_ext_id}, user_remove_params.UserRemoveParams),
|
|
118
|
+
options=make_request_options(
|
|
119
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
120
|
+
),
|
|
121
|
+
cast_to=UserRemoveResponse,
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class AsyncUserResource(AsyncAPIResource):
|
|
126
|
+
@cached_property
|
|
127
|
+
def with_raw_response(self) -> AsyncUserResourceWithRawResponse:
|
|
128
|
+
"""
|
|
129
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
130
|
+
the raw response object instead of the parsed content.
|
|
131
|
+
|
|
132
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#accessing-raw-response-data-eg-headers
|
|
133
|
+
"""
|
|
134
|
+
return AsyncUserResourceWithRawResponse(self)
|
|
135
|
+
|
|
136
|
+
@cached_property
|
|
137
|
+
def with_streaming_response(self) -> AsyncUserResourceWithStreamingResponse:
|
|
138
|
+
"""
|
|
139
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
140
|
+
|
|
141
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#with_streaming_response
|
|
142
|
+
"""
|
|
143
|
+
return AsyncUserResourceWithStreamingResponse(self)
|
|
144
|
+
|
|
145
|
+
async def add(
|
|
146
|
+
self,
|
|
147
|
+
conversation_ext_id: str,
|
|
148
|
+
*,
|
|
149
|
+
user_ext_id: str,
|
|
150
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
151
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
152
|
+
extra_headers: Headers | None = None,
|
|
153
|
+
extra_query: Query | None = None,
|
|
154
|
+
extra_body: Body | None = None,
|
|
155
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
156
|
+
) -> UserAddResponse:
|
|
157
|
+
"""
|
|
158
|
+
Add a user to a conversation.
|
|
159
|
+
|
|
160
|
+
RLS ensures the user can only add users to conversations they have access to.
|
|
161
|
+
PostgreSQL constraints handle duplicate users.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
extra_headers: Send extra headers
|
|
165
|
+
|
|
166
|
+
extra_query: Add additional query parameters to the request
|
|
167
|
+
|
|
168
|
+
extra_body: Add additional JSON properties to the request
|
|
169
|
+
|
|
170
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
171
|
+
"""
|
|
172
|
+
if not conversation_ext_id:
|
|
173
|
+
raise ValueError(
|
|
174
|
+
f"Expected a non-empty value for `conversation_ext_id` but received {conversation_ext_id!r}"
|
|
175
|
+
)
|
|
176
|
+
return await self._post(
|
|
177
|
+
f"/api/conversation/{conversation_ext_id}/user",
|
|
178
|
+
body=await async_maybe_transform({"user_ext_id": user_ext_id}, user_add_params.UserAddParams),
|
|
179
|
+
options=make_request_options(
|
|
180
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
181
|
+
),
|
|
182
|
+
cast_to=UserAddResponse,
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
async def remove(
|
|
186
|
+
self,
|
|
187
|
+
conversation_ext_id: str,
|
|
188
|
+
*,
|
|
189
|
+
user_ext_id: str,
|
|
190
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
191
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
192
|
+
extra_headers: Headers | None = None,
|
|
193
|
+
extra_query: Query | None = None,
|
|
194
|
+
extra_body: Body | None = None,
|
|
195
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
196
|
+
) -> UserRemoveResponse:
|
|
197
|
+
"""
|
|
198
|
+
Remove a user from a conversation.
|
|
199
|
+
|
|
200
|
+
RLS ensures the user can only modify conversations they have access to.
|
|
201
|
+
|
|
202
|
+
Args:
|
|
203
|
+
extra_headers: Send extra headers
|
|
204
|
+
|
|
205
|
+
extra_query: Add additional query parameters to the request
|
|
206
|
+
|
|
207
|
+
extra_body: Add additional JSON properties to the request
|
|
208
|
+
|
|
209
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
210
|
+
"""
|
|
211
|
+
if not conversation_ext_id:
|
|
212
|
+
raise ValueError(
|
|
213
|
+
f"Expected a non-empty value for `conversation_ext_id` but received {conversation_ext_id!r}"
|
|
214
|
+
)
|
|
215
|
+
return await self._delete(
|
|
216
|
+
f"/api/conversation/{conversation_ext_id}/user",
|
|
217
|
+
body=await async_maybe_transform({"user_ext_id": user_ext_id}, user_remove_params.UserRemoveParams),
|
|
218
|
+
options=make_request_options(
|
|
219
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
220
|
+
),
|
|
221
|
+
cast_to=UserRemoveResponse,
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
class UserResourceWithRawResponse:
|
|
226
|
+
def __init__(self, user: UserResource) -> None:
|
|
227
|
+
self._user = user
|
|
228
|
+
|
|
229
|
+
self.add = to_raw_response_wrapper(
|
|
230
|
+
user.add,
|
|
231
|
+
)
|
|
232
|
+
self.remove = to_raw_response_wrapper(
|
|
233
|
+
user.remove,
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
class AsyncUserResourceWithRawResponse:
|
|
238
|
+
def __init__(self, user: AsyncUserResource) -> None:
|
|
239
|
+
self._user = user
|
|
240
|
+
|
|
241
|
+
self.add = async_to_raw_response_wrapper(
|
|
242
|
+
user.add,
|
|
243
|
+
)
|
|
244
|
+
self.remove = async_to_raw_response_wrapper(
|
|
245
|
+
user.remove,
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
class UserResourceWithStreamingResponse:
|
|
250
|
+
def __init__(self, user: UserResource) -> None:
|
|
251
|
+
self._user = user
|
|
252
|
+
|
|
253
|
+
self.add = to_streamed_response_wrapper(
|
|
254
|
+
user.add,
|
|
255
|
+
)
|
|
256
|
+
self.remove = to_streamed_response_wrapper(
|
|
257
|
+
user.remove,
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
class AsyncUserResourceWithStreamingResponse:
|
|
262
|
+
def __init__(self, user: AsyncUserResource) -> None:
|
|
263
|
+
self._user = user
|
|
264
|
+
|
|
265
|
+
self.add = async_to_streamed_response_wrapper(
|
|
266
|
+
user.add,
|
|
267
|
+
)
|
|
268
|
+
self.remove = async_to_streamed_response_wrapper(
|
|
269
|
+
user.remove,
|
|
270
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from .document import (
|
|
4
|
+
DocumentResource,
|
|
5
|
+
AsyncDocumentResource,
|
|
6
|
+
DocumentResourceWithRawResponse,
|
|
7
|
+
AsyncDocumentResourceWithRawResponse,
|
|
8
|
+
DocumentResourceWithStreamingResponse,
|
|
9
|
+
AsyncDocumentResourceWithStreamingResponse,
|
|
10
|
+
)
|
|
11
|
+
from .annotation import (
|
|
12
|
+
AnnotationResource,
|
|
13
|
+
AsyncAnnotationResource,
|
|
14
|
+
AnnotationResourceWithRawResponse,
|
|
15
|
+
AsyncAnnotationResourceWithRawResponse,
|
|
16
|
+
AnnotationResourceWithStreamingResponse,
|
|
17
|
+
AsyncAnnotationResourceWithStreamingResponse,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"AnnotationResource",
|
|
22
|
+
"AsyncAnnotationResource",
|
|
23
|
+
"AnnotationResourceWithRawResponse",
|
|
24
|
+
"AsyncAnnotationResourceWithRawResponse",
|
|
25
|
+
"AnnotationResourceWithStreamingResponse",
|
|
26
|
+
"AsyncAnnotationResourceWithStreamingResponse",
|
|
27
|
+
"DocumentResource",
|
|
28
|
+
"AsyncDocumentResource",
|
|
29
|
+
"DocumentResourceWithRawResponse",
|
|
30
|
+
"AsyncDocumentResourceWithRawResponse",
|
|
31
|
+
"DocumentResourceWithStreamingResponse",
|
|
32
|
+
"AsyncDocumentResourceWithStreamingResponse",
|
|
33
|
+
]
|
|
@@ -0,0 +1,384 @@
|
|
|
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 Optional
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
10
|
+
from ...._utils import maybe_transform, async_maybe_transform
|
|
11
|
+
from ...._compat import cached_property
|
|
12
|
+
from ...._resource import SyncAPIResource, AsyncAPIResource
|
|
13
|
+
from ...._response import (
|
|
14
|
+
to_raw_response_wrapper,
|
|
15
|
+
to_streamed_response_wrapper,
|
|
16
|
+
async_to_raw_response_wrapper,
|
|
17
|
+
async_to_streamed_response_wrapper,
|
|
18
|
+
)
|
|
19
|
+
from ...._base_client import make_request_options
|
|
20
|
+
from ....types.api.document import annotation_create_params, annotation_update_params
|
|
21
|
+
from ....types.api.document.doc_tag_response import DocTagResponse
|
|
22
|
+
from ....types.api.document.annotation_delete_response import AnnotationDeleteResponse
|
|
23
|
+
|
|
24
|
+
__all__ = ["AnnotationResource", "AsyncAnnotationResource"]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class AnnotationResource(SyncAPIResource):
|
|
28
|
+
@cached_property
|
|
29
|
+
def with_raw_response(self) -> AnnotationResourceWithRawResponse:
|
|
30
|
+
"""
|
|
31
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
32
|
+
the raw response object instead of the parsed content.
|
|
33
|
+
|
|
34
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#accessing-raw-response-data-eg-headers
|
|
35
|
+
"""
|
|
36
|
+
return AnnotationResourceWithRawResponse(self)
|
|
37
|
+
|
|
38
|
+
@cached_property
|
|
39
|
+
def with_streaming_response(self) -> AnnotationResourceWithStreamingResponse:
|
|
40
|
+
"""
|
|
41
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
42
|
+
|
|
43
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#with_streaming_response
|
|
44
|
+
"""
|
|
45
|
+
return AnnotationResourceWithStreamingResponse(self)
|
|
46
|
+
|
|
47
|
+
def create(
|
|
48
|
+
self,
|
|
49
|
+
doc_ext_id: str,
|
|
50
|
+
*,
|
|
51
|
+
note: Optional[str] | NotGiven = NOT_GIVEN,
|
|
52
|
+
page_ref: Optional[int] | NotGiven = NOT_GIVEN,
|
|
53
|
+
tag_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
54
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
55
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
56
|
+
extra_headers: Headers | None = None,
|
|
57
|
+
extra_query: Query | None = None,
|
|
58
|
+
extra_body: Body | None = None,
|
|
59
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
60
|
+
) -> DocTagResponse:
|
|
61
|
+
"""
|
|
62
|
+
Create an annotation for a document.
|
|
63
|
+
|
|
64
|
+
If tag_name is provided, uses existing tag or creates new one. If tag_name is
|
|
65
|
+
not provided, auto-generates a system tag. The shared status inherits from
|
|
66
|
+
document unless explicitly overridden.
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
extra_headers: Send extra headers
|
|
70
|
+
|
|
71
|
+
extra_query: Add additional query parameters to the request
|
|
72
|
+
|
|
73
|
+
extra_body: Add additional JSON properties to the request
|
|
74
|
+
|
|
75
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
76
|
+
"""
|
|
77
|
+
if not doc_ext_id:
|
|
78
|
+
raise ValueError(f"Expected a non-empty value for `doc_ext_id` but received {doc_ext_id!r}")
|
|
79
|
+
return self._post(
|
|
80
|
+
f"/api/document/{doc_ext_id}/annotation",
|
|
81
|
+
body=maybe_transform(
|
|
82
|
+
{
|
|
83
|
+
"note": note,
|
|
84
|
+
"page_ref": page_ref,
|
|
85
|
+
"tag_name": tag_name,
|
|
86
|
+
},
|
|
87
|
+
annotation_create_params.AnnotationCreateParams,
|
|
88
|
+
),
|
|
89
|
+
options=make_request_options(
|
|
90
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
91
|
+
),
|
|
92
|
+
cast_to=DocTagResponse,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
def update(
|
|
96
|
+
self,
|
|
97
|
+
doctag_ext_id: str,
|
|
98
|
+
*,
|
|
99
|
+
doc_ext_id: str,
|
|
100
|
+
note: Optional[str] | NotGiven = NOT_GIVEN,
|
|
101
|
+
page_ref: Optional[int] | NotGiven = NOT_GIVEN,
|
|
102
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
103
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
104
|
+
extra_headers: Headers | None = None,
|
|
105
|
+
extra_query: Query | None = None,
|
|
106
|
+
extra_body: Body | None = None,
|
|
107
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
108
|
+
) -> DocTagResponse:
|
|
109
|
+
"""
|
|
110
|
+
Update an annotation (doctag) for a document.
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
extra_headers: Send extra headers
|
|
114
|
+
|
|
115
|
+
extra_query: Add additional query parameters to the request
|
|
116
|
+
|
|
117
|
+
extra_body: Add additional JSON properties to the request
|
|
118
|
+
|
|
119
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
120
|
+
"""
|
|
121
|
+
if not doc_ext_id:
|
|
122
|
+
raise ValueError(f"Expected a non-empty value for `doc_ext_id` but received {doc_ext_id!r}")
|
|
123
|
+
if not doctag_ext_id:
|
|
124
|
+
raise ValueError(f"Expected a non-empty value for `doctag_ext_id` but received {doctag_ext_id!r}")
|
|
125
|
+
return self._patch(
|
|
126
|
+
f"/api/document/{doc_ext_id}/annotation/{doctag_ext_id}",
|
|
127
|
+
body=maybe_transform(
|
|
128
|
+
{
|
|
129
|
+
"note": note,
|
|
130
|
+
"page_ref": page_ref,
|
|
131
|
+
},
|
|
132
|
+
annotation_update_params.AnnotationUpdateParams,
|
|
133
|
+
),
|
|
134
|
+
options=make_request_options(
|
|
135
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
136
|
+
),
|
|
137
|
+
cast_to=DocTagResponse,
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
def delete(
|
|
141
|
+
self,
|
|
142
|
+
doctag_ext_id: str,
|
|
143
|
+
*,
|
|
144
|
+
doc_ext_id: str,
|
|
145
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
146
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
147
|
+
extra_headers: Headers | None = None,
|
|
148
|
+
extra_query: Query | None = None,
|
|
149
|
+
extra_body: Body | None = None,
|
|
150
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
151
|
+
) -> AnnotationDeleteResponse:
|
|
152
|
+
"""
|
|
153
|
+
Delete a specific annotation (doctag) for a document.
|
|
154
|
+
|
|
155
|
+
Args:
|
|
156
|
+
extra_headers: Send extra headers
|
|
157
|
+
|
|
158
|
+
extra_query: Add additional query parameters to the request
|
|
159
|
+
|
|
160
|
+
extra_body: Add additional JSON properties to the request
|
|
161
|
+
|
|
162
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
163
|
+
"""
|
|
164
|
+
if not doc_ext_id:
|
|
165
|
+
raise ValueError(f"Expected a non-empty value for `doc_ext_id` but received {doc_ext_id!r}")
|
|
166
|
+
if not doctag_ext_id:
|
|
167
|
+
raise ValueError(f"Expected a non-empty value for `doctag_ext_id` but received {doctag_ext_id!r}")
|
|
168
|
+
return self._delete(
|
|
169
|
+
f"/api/document/{doc_ext_id}/annotation/{doctag_ext_id}",
|
|
170
|
+
options=make_request_options(
|
|
171
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
172
|
+
),
|
|
173
|
+
cast_to=AnnotationDeleteResponse,
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
class AsyncAnnotationResource(AsyncAPIResource):
|
|
178
|
+
@cached_property
|
|
179
|
+
def with_raw_response(self) -> AsyncAnnotationResourceWithRawResponse:
|
|
180
|
+
"""
|
|
181
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
182
|
+
the raw response object instead of the parsed content.
|
|
183
|
+
|
|
184
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#accessing-raw-response-data-eg-headers
|
|
185
|
+
"""
|
|
186
|
+
return AsyncAnnotationResourceWithRawResponse(self)
|
|
187
|
+
|
|
188
|
+
@cached_property
|
|
189
|
+
def with_streaming_response(self) -> AsyncAnnotationResourceWithStreamingResponse:
|
|
190
|
+
"""
|
|
191
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
192
|
+
|
|
193
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#with_streaming_response
|
|
194
|
+
"""
|
|
195
|
+
return AsyncAnnotationResourceWithStreamingResponse(self)
|
|
196
|
+
|
|
197
|
+
async def create(
|
|
198
|
+
self,
|
|
199
|
+
doc_ext_id: str,
|
|
200
|
+
*,
|
|
201
|
+
note: Optional[str] | NotGiven = NOT_GIVEN,
|
|
202
|
+
page_ref: Optional[int] | NotGiven = NOT_GIVEN,
|
|
203
|
+
tag_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
204
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
205
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
206
|
+
extra_headers: Headers | None = None,
|
|
207
|
+
extra_query: Query | None = None,
|
|
208
|
+
extra_body: Body | None = None,
|
|
209
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
210
|
+
) -> DocTagResponse:
|
|
211
|
+
"""
|
|
212
|
+
Create an annotation for a document.
|
|
213
|
+
|
|
214
|
+
If tag_name is provided, uses existing tag or creates new one. If tag_name is
|
|
215
|
+
not provided, auto-generates a system tag. The shared status inherits from
|
|
216
|
+
document unless explicitly overridden.
|
|
217
|
+
|
|
218
|
+
Args:
|
|
219
|
+
extra_headers: Send extra headers
|
|
220
|
+
|
|
221
|
+
extra_query: Add additional query parameters to the request
|
|
222
|
+
|
|
223
|
+
extra_body: Add additional JSON properties to the request
|
|
224
|
+
|
|
225
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
226
|
+
"""
|
|
227
|
+
if not doc_ext_id:
|
|
228
|
+
raise ValueError(f"Expected a non-empty value for `doc_ext_id` but received {doc_ext_id!r}")
|
|
229
|
+
return await self._post(
|
|
230
|
+
f"/api/document/{doc_ext_id}/annotation",
|
|
231
|
+
body=await async_maybe_transform(
|
|
232
|
+
{
|
|
233
|
+
"note": note,
|
|
234
|
+
"page_ref": page_ref,
|
|
235
|
+
"tag_name": tag_name,
|
|
236
|
+
},
|
|
237
|
+
annotation_create_params.AnnotationCreateParams,
|
|
238
|
+
),
|
|
239
|
+
options=make_request_options(
|
|
240
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
241
|
+
),
|
|
242
|
+
cast_to=DocTagResponse,
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
async def update(
|
|
246
|
+
self,
|
|
247
|
+
doctag_ext_id: str,
|
|
248
|
+
*,
|
|
249
|
+
doc_ext_id: str,
|
|
250
|
+
note: Optional[str] | NotGiven = NOT_GIVEN,
|
|
251
|
+
page_ref: Optional[int] | NotGiven = NOT_GIVEN,
|
|
252
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
253
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
254
|
+
extra_headers: Headers | None = None,
|
|
255
|
+
extra_query: Query | None = None,
|
|
256
|
+
extra_body: Body | None = None,
|
|
257
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
258
|
+
) -> DocTagResponse:
|
|
259
|
+
"""
|
|
260
|
+
Update an annotation (doctag) for a document.
|
|
261
|
+
|
|
262
|
+
Args:
|
|
263
|
+
extra_headers: Send extra headers
|
|
264
|
+
|
|
265
|
+
extra_query: Add additional query parameters to the request
|
|
266
|
+
|
|
267
|
+
extra_body: Add additional JSON properties to the request
|
|
268
|
+
|
|
269
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
270
|
+
"""
|
|
271
|
+
if not doc_ext_id:
|
|
272
|
+
raise ValueError(f"Expected a non-empty value for `doc_ext_id` but received {doc_ext_id!r}")
|
|
273
|
+
if not doctag_ext_id:
|
|
274
|
+
raise ValueError(f"Expected a non-empty value for `doctag_ext_id` but received {doctag_ext_id!r}")
|
|
275
|
+
return await self._patch(
|
|
276
|
+
f"/api/document/{doc_ext_id}/annotation/{doctag_ext_id}",
|
|
277
|
+
body=await async_maybe_transform(
|
|
278
|
+
{
|
|
279
|
+
"note": note,
|
|
280
|
+
"page_ref": page_ref,
|
|
281
|
+
},
|
|
282
|
+
annotation_update_params.AnnotationUpdateParams,
|
|
283
|
+
),
|
|
284
|
+
options=make_request_options(
|
|
285
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
286
|
+
),
|
|
287
|
+
cast_to=DocTagResponse,
|
|
288
|
+
)
|
|
289
|
+
|
|
290
|
+
async def delete(
|
|
291
|
+
self,
|
|
292
|
+
doctag_ext_id: str,
|
|
293
|
+
*,
|
|
294
|
+
doc_ext_id: str,
|
|
295
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
296
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
297
|
+
extra_headers: Headers | None = None,
|
|
298
|
+
extra_query: Query | None = None,
|
|
299
|
+
extra_body: Body | None = None,
|
|
300
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
301
|
+
) -> AnnotationDeleteResponse:
|
|
302
|
+
"""
|
|
303
|
+
Delete a specific annotation (doctag) for a document.
|
|
304
|
+
|
|
305
|
+
Args:
|
|
306
|
+
extra_headers: Send extra headers
|
|
307
|
+
|
|
308
|
+
extra_query: Add additional query parameters to the request
|
|
309
|
+
|
|
310
|
+
extra_body: Add additional JSON properties to the request
|
|
311
|
+
|
|
312
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
313
|
+
"""
|
|
314
|
+
if not doc_ext_id:
|
|
315
|
+
raise ValueError(f"Expected a non-empty value for `doc_ext_id` but received {doc_ext_id!r}")
|
|
316
|
+
if not doctag_ext_id:
|
|
317
|
+
raise ValueError(f"Expected a non-empty value for `doctag_ext_id` but received {doctag_ext_id!r}")
|
|
318
|
+
return await self._delete(
|
|
319
|
+
f"/api/document/{doc_ext_id}/annotation/{doctag_ext_id}",
|
|
320
|
+
options=make_request_options(
|
|
321
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
322
|
+
),
|
|
323
|
+
cast_to=AnnotationDeleteResponse,
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
class AnnotationResourceWithRawResponse:
|
|
328
|
+
def __init__(self, annotation: AnnotationResource) -> None:
|
|
329
|
+
self._annotation = annotation
|
|
330
|
+
|
|
331
|
+
self.create = to_raw_response_wrapper(
|
|
332
|
+
annotation.create,
|
|
333
|
+
)
|
|
334
|
+
self.update = to_raw_response_wrapper(
|
|
335
|
+
annotation.update,
|
|
336
|
+
)
|
|
337
|
+
self.delete = to_raw_response_wrapper(
|
|
338
|
+
annotation.delete,
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
class AsyncAnnotationResourceWithRawResponse:
|
|
343
|
+
def __init__(self, annotation: AsyncAnnotationResource) -> None:
|
|
344
|
+
self._annotation = annotation
|
|
345
|
+
|
|
346
|
+
self.create = async_to_raw_response_wrapper(
|
|
347
|
+
annotation.create,
|
|
348
|
+
)
|
|
349
|
+
self.update = async_to_raw_response_wrapper(
|
|
350
|
+
annotation.update,
|
|
351
|
+
)
|
|
352
|
+
self.delete = async_to_raw_response_wrapper(
|
|
353
|
+
annotation.delete,
|
|
354
|
+
)
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
class AnnotationResourceWithStreamingResponse:
|
|
358
|
+
def __init__(self, annotation: AnnotationResource) -> None:
|
|
359
|
+
self._annotation = annotation
|
|
360
|
+
|
|
361
|
+
self.create = to_streamed_response_wrapper(
|
|
362
|
+
annotation.create,
|
|
363
|
+
)
|
|
364
|
+
self.update = to_streamed_response_wrapper(
|
|
365
|
+
annotation.update,
|
|
366
|
+
)
|
|
367
|
+
self.delete = to_streamed_response_wrapper(
|
|
368
|
+
annotation.delete,
|
|
369
|
+
)
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
class AsyncAnnotationResourceWithStreamingResponse:
|
|
373
|
+
def __init__(self, annotation: AsyncAnnotationResource) -> None:
|
|
374
|
+
self._annotation = annotation
|
|
375
|
+
|
|
376
|
+
self.create = async_to_streamed_response_wrapper(
|
|
377
|
+
annotation.create,
|
|
378
|
+
)
|
|
379
|
+
self.update = async_to_streamed_response_wrapper(
|
|
380
|
+
annotation.update,
|
|
381
|
+
)
|
|
382
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
383
|
+
annotation.delete,
|
|
384
|
+
)
|