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,300 @@
|
|
|
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 Dict, 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 ...types.api import assistant_query_params, assistant_retrieve_params
|
|
20
|
+
from ..._base_client import make_request_options
|
|
21
|
+
|
|
22
|
+
__all__ = ["AssistantResource", "AsyncAssistantResource"]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class AssistantResource(SyncAPIResource):
|
|
26
|
+
@cached_property
|
|
27
|
+
def with_raw_response(self) -> AssistantResourceWithRawResponse:
|
|
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 AssistantResourceWithRawResponse(self)
|
|
35
|
+
|
|
36
|
+
@cached_property
|
|
37
|
+
def with_streaming_response(self) -> AssistantResourceWithStreamingResponse:
|
|
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 AssistantResourceWithStreamingResponse(self)
|
|
44
|
+
|
|
45
|
+
def retrieve(
|
|
46
|
+
self,
|
|
47
|
+
*,
|
|
48
|
+
content: str,
|
|
49
|
+
workspace_ext_id: str,
|
|
50
|
+
config_ext_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
51
|
+
parent_message_ext_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
52
|
+
tools: Dict[str, assistant_retrieve_params.Tools] | NotGiven = NOT_GIVEN,
|
|
53
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
54
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
55
|
+
extra_headers: Headers | None = None,
|
|
56
|
+
extra_query: Query | None = None,
|
|
57
|
+
extra_body: Body | None = None,
|
|
58
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
59
|
+
) -> object:
|
|
60
|
+
"""Retrieve relevant document chunks for a user message.
|
|
61
|
+
|
|
62
|
+
Returns tool responses
|
|
63
|
+
with context from documents without generating an answer.
|
|
64
|
+
|
|
65
|
+
Args:
|
|
66
|
+
extra_headers: Send extra headers
|
|
67
|
+
|
|
68
|
+
extra_query: Add additional query parameters to the request
|
|
69
|
+
|
|
70
|
+
extra_body: Add additional JSON properties to the request
|
|
71
|
+
|
|
72
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
73
|
+
"""
|
|
74
|
+
return self._post(
|
|
75
|
+
"/api/assistant/retrieve",
|
|
76
|
+
body=maybe_transform(
|
|
77
|
+
{
|
|
78
|
+
"content": content,
|
|
79
|
+
"workspace_ext_id": workspace_ext_id,
|
|
80
|
+
"config_ext_id": config_ext_id,
|
|
81
|
+
"parent_message_ext_id": parent_message_ext_id,
|
|
82
|
+
"tools": tools,
|
|
83
|
+
},
|
|
84
|
+
assistant_retrieve_params.AssistantRetrieveParams,
|
|
85
|
+
),
|
|
86
|
+
options=make_request_options(
|
|
87
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
88
|
+
),
|
|
89
|
+
cast_to=object,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
def query(
|
|
93
|
+
self,
|
|
94
|
+
*,
|
|
95
|
+
content: str,
|
|
96
|
+
workspace_ext_id: str,
|
|
97
|
+
config_ext_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
98
|
+
parent_message_ext_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
99
|
+
tools: Dict[str, assistant_query_params.Tools] | NotGiven = NOT_GIVEN,
|
|
100
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
101
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
102
|
+
extra_headers: Headers | None = None,
|
|
103
|
+
extra_query: Query | None = None,
|
|
104
|
+
extra_body: Body | None = None,
|
|
105
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
106
|
+
) -> object:
|
|
107
|
+
"""Process a user query against documents in a workspace.
|
|
108
|
+
|
|
109
|
+
Performs retrieval
|
|
110
|
+
augmented generation with streaming response.
|
|
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
|
+
return self._post(
|
|
122
|
+
"/api/assistant/query",
|
|
123
|
+
body=maybe_transform(
|
|
124
|
+
{
|
|
125
|
+
"content": content,
|
|
126
|
+
"workspace_ext_id": workspace_ext_id,
|
|
127
|
+
"config_ext_id": config_ext_id,
|
|
128
|
+
"parent_message_ext_id": parent_message_ext_id,
|
|
129
|
+
"tools": tools,
|
|
130
|
+
},
|
|
131
|
+
assistant_query_params.AssistantQueryParams,
|
|
132
|
+
),
|
|
133
|
+
options=make_request_options(
|
|
134
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
135
|
+
),
|
|
136
|
+
cast_to=object,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
class AsyncAssistantResource(AsyncAPIResource):
|
|
141
|
+
@cached_property
|
|
142
|
+
def with_raw_response(self) -> AsyncAssistantResourceWithRawResponse:
|
|
143
|
+
"""
|
|
144
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
145
|
+
the raw response object instead of the parsed content.
|
|
146
|
+
|
|
147
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#accessing-raw-response-data-eg-headers
|
|
148
|
+
"""
|
|
149
|
+
return AsyncAssistantResourceWithRawResponse(self)
|
|
150
|
+
|
|
151
|
+
@cached_property
|
|
152
|
+
def with_streaming_response(self) -> AsyncAssistantResourceWithStreamingResponse:
|
|
153
|
+
"""
|
|
154
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
155
|
+
|
|
156
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#with_streaming_response
|
|
157
|
+
"""
|
|
158
|
+
return AsyncAssistantResourceWithStreamingResponse(self)
|
|
159
|
+
|
|
160
|
+
async def retrieve(
|
|
161
|
+
self,
|
|
162
|
+
*,
|
|
163
|
+
content: str,
|
|
164
|
+
workspace_ext_id: str,
|
|
165
|
+
config_ext_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
166
|
+
parent_message_ext_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
167
|
+
tools: Dict[str, assistant_retrieve_params.Tools] | NotGiven = NOT_GIVEN,
|
|
168
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
169
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
170
|
+
extra_headers: Headers | None = None,
|
|
171
|
+
extra_query: Query | None = None,
|
|
172
|
+
extra_body: Body | None = None,
|
|
173
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
174
|
+
) -> object:
|
|
175
|
+
"""Retrieve relevant document chunks for a user message.
|
|
176
|
+
|
|
177
|
+
Returns tool responses
|
|
178
|
+
with context from documents without generating an answer.
|
|
179
|
+
|
|
180
|
+
Args:
|
|
181
|
+
extra_headers: Send extra headers
|
|
182
|
+
|
|
183
|
+
extra_query: Add additional query parameters to the request
|
|
184
|
+
|
|
185
|
+
extra_body: Add additional JSON properties to the request
|
|
186
|
+
|
|
187
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
188
|
+
"""
|
|
189
|
+
return await self._post(
|
|
190
|
+
"/api/assistant/retrieve",
|
|
191
|
+
body=await async_maybe_transform(
|
|
192
|
+
{
|
|
193
|
+
"content": content,
|
|
194
|
+
"workspace_ext_id": workspace_ext_id,
|
|
195
|
+
"config_ext_id": config_ext_id,
|
|
196
|
+
"parent_message_ext_id": parent_message_ext_id,
|
|
197
|
+
"tools": tools,
|
|
198
|
+
},
|
|
199
|
+
assistant_retrieve_params.AssistantRetrieveParams,
|
|
200
|
+
),
|
|
201
|
+
options=make_request_options(
|
|
202
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
203
|
+
),
|
|
204
|
+
cast_to=object,
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
async def query(
|
|
208
|
+
self,
|
|
209
|
+
*,
|
|
210
|
+
content: str,
|
|
211
|
+
workspace_ext_id: str,
|
|
212
|
+
config_ext_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
213
|
+
parent_message_ext_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
214
|
+
tools: Dict[str, assistant_query_params.Tools] | NotGiven = NOT_GIVEN,
|
|
215
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
216
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
217
|
+
extra_headers: Headers | None = None,
|
|
218
|
+
extra_query: Query | None = None,
|
|
219
|
+
extra_body: Body | None = None,
|
|
220
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
221
|
+
) -> object:
|
|
222
|
+
"""Process a user query against documents in a workspace.
|
|
223
|
+
|
|
224
|
+
Performs retrieval
|
|
225
|
+
augmented generation with streaming response.
|
|
226
|
+
|
|
227
|
+
Args:
|
|
228
|
+
extra_headers: Send extra headers
|
|
229
|
+
|
|
230
|
+
extra_query: Add additional query parameters to the request
|
|
231
|
+
|
|
232
|
+
extra_body: Add additional JSON properties to the request
|
|
233
|
+
|
|
234
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
235
|
+
"""
|
|
236
|
+
return await self._post(
|
|
237
|
+
"/api/assistant/query",
|
|
238
|
+
body=await async_maybe_transform(
|
|
239
|
+
{
|
|
240
|
+
"content": content,
|
|
241
|
+
"workspace_ext_id": workspace_ext_id,
|
|
242
|
+
"config_ext_id": config_ext_id,
|
|
243
|
+
"parent_message_ext_id": parent_message_ext_id,
|
|
244
|
+
"tools": tools,
|
|
245
|
+
},
|
|
246
|
+
assistant_query_params.AssistantQueryParams,
|
|
247
|
+
),
|
|
248
|
+
options=make_request_options(
|
|
249
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
250
|
+
),
|
|
251
|
+
cast_to=object,
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
class AssistantResourceWithRawResponse:
|
|
256
|
+
def __init__(self, assistant: AssistantResource) -> None:
|
|
257
|
+
self._assistant = assistant
|
|
258
|
+
|
|
259
|
+
self.retrieve = to_raw_response_wrapper(
|
|
260
|
+
assistant.retrieve,
|
|
261
|
+
)
|
|
262
|
+
self.query = to_raw_response_wrapper(
|
|
263
|
+
assistant.query,
|
|
264
|
+
)
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
class AsyncAssistantResourceWithRawResponse:
|
|
268
|
+
def __init__(self, assistant: AsyncAssistantResource) -> None:
|
|
269
|
+
self._assistant = assistant
|
|
270
|
+
|
|
271
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
272
|
+
assistant.retrieve,
|
|
273
|
+
)
|
|
274
|
+
self.query = async_to_raw_response_wrapper(
|
|
275
|
+
assistant.query,
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
class AssistantResourceWithStreamingResponse:
|
|
280
|
+
def __init__(self, assistant: AssistantResource) -> None:
|
|
281
|
+
self._assistant = assistant
|
|
282
|
+
|
|
283
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
284
|
+
assistant.retrieve,
|
|
285
|
+
)
|
|
286
|
+
self.query = to_streamed_response_wrapper(
|
|
287
|
+
assistant.query,
|
|
288
|
+
)
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
class AsyncAssistantResourceWithStreamingResponse:
|
|
292
|
+
def __init__(self, assistant: AsyncAssistantResource) -> None:
|
|
293
|
+
self._assistant = assistant
|
|
294
|
+
|
|
295
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
296
|
+
assistant.retrieve,
|
|
297
|
+
)
|
|
298
|
+
self.query = async_to_streamed_response_wrapper(
|
|
299
|
+
assistant.query,
|
|
300
|
+
)
|