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,555 @@
|
|
|
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 .user import (
|
|
8
|
+
UserResource,
|
|
9
|
+
AsyncUserResource,
|
|
10
|
+
UserResourceWithRawResponse,
|
|
11
|
+
AsyncUserResourceWithRawResponse,
|
|
12
|
+
UserResourceWithStreamingResponse,
|
|
13
|
+
AsyncUserResourceWithStreamingResponse,
|
|
14
|
+
)
|
|
15
|
+
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
16
|
+
from ...._utils import maybe_transform, async_maybe_transform
|
|
17
|
+
from ...._compat import cached_property
|
|
18
|
+
from ...._resource import SyncAPIResource, AsyncAPIResource
|
|
19
|
+
from ...._response import (
|
|
20
|
+
to_raw_response_wrapper,
|
|
21
|
+
to_streamed_response_wrapper,
|
|
22
|
+
async_to_raw_response_wrapper,
|
|
23
|
+
async_to_streamed_response_wrapper,
|
|
24
|
+
)
|
|
25
|
+
from ....types.api import conversation_update_title_params
|
|
26
|
+
from ...._base_client import make_request_options
|
|
27
|
+
from ....types.api.conversation_share_response import ConversationShareResponse
|
|
28
|
+
from ....types.api.conversation_delete_response import ConversationDeleteResponse
|
|
29
|
+
from ....types.api.conversation_update_title_response import ConversationUpdateTitleResponse
|
|
30
|
+
from ....types.api.conversation_delete_message_response import ConversationDeleteMessageResponse
|
|
31
|
+
from ....types.api.conversation_retrieve_threads_response import ConversationRetrieveThreadsResponse
|
|
32
|
+
|
|
33
|
+
__all__ = ["ConversationResource", "AsyncConversationResource"]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class ConversationResource(SyncAPIResource):
|
|
37
|
+
@cached_property
|
|
38
|
+
def user(self) -> UserResource:
|
|
39
|
+
return UserResource(self._client)
|
|
40
|
+
|
|
41
|
+
@cached_property
|
|
42
|
+
def with_raw_response(self) -> ConversationResourceWithRawResponse:
|
|
43
|
+
"""
|
|
44
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
45
|
+
the raw response object instead of the parsed content.
|
|
46
|
+
|
|
47
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#accessing-raw-response-data-eg-headers
|
|
48
|
+
"""
|
|
49
|
+
return ConversationResourceWithRawResponse(self)
|
|
50
|
+
|
|
51
|
+
@cached_property
|
|
52
|
+
def with_streaming_response(self) -> ConversationResourceWithStreamingResponse:
|
|
53
|
+
"""
|
|
54
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
55
|
+
|
|
56
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#with_streaming_response
|
|
57
|
+
"""
|
|
58
|
+
return ConversationResourceWithStreamingResponse(self)
|
|
59
|
+
|
|
60
|
+
def delete(
|
|
61
|
+
self,
|
|
62
|
+
conversation_ext_id: str,
|
|
63
|
+
*,
|
|
64
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
65
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
66
|
+
extra_headers: Headers | None = None,
|
|
67
|
+
extra_query: Query | None = None,
|
|
68
|
+
extra_body: Body | None = None,
|
|
69
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
70
|
+
) -> ConversationDeleteResponse:
|
|
71
|
+
"""Delete a conversation.
|
|
72
|
+
|
|
73
|
+
RLS ensures the user can only delete conversations they
|
|
74
|
+
have access to. Deleting a conversation will also delete all associated messages
|
|
75
|
+
due to cascade delete.
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
extra_headers: Send extra headers
|
|
79
|
+
|
|
80
|
+
extra_query: Add additional query parameters to the request
|
|
81
|
+
|
|
82
|
+
extra_body: Add additional JSON properties to the request
|
|
83
|
+
|
|
84
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
85
|
+
"""
|
|
86
|
+
if not conversation_ext_id:
|
|
87
|
+
raise ValueError(
|
|
88
|
+
f"Expected a non-empty value for `conversation_ext_id` but received {conversation_ext_id!r}"
|
|
89
|
+
)
|
|
90
|
+
return self._delete(
|
|
91
|
+
f"/api/conversation/{conversation_ext_id}",
|
|
92
|
+
options=make_request_options(
|
|
93
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
94
|
+
),
|
|
95
|
+
cast_to=ConversationDeleteResponse,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
def delete_message(
|
|
99
|
+
self,
|
|
100
|
+
message_ext_id: str,
|
|
101
|
+
*,
|
|
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
|
+
) -> ConversationDeleteMessageResponse:
|
|
109
|
+
"""
|
|
110
|
+
Delete a message along with all descendants.
|
|
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 message_ext_id:
|
|
122
|
+
raise ValueError(f"Expected a non-empty value for `message_ext_id` but received {message_ext_id!r}")
|
|
123
|
+
return self._delete(
|
|
124
|
+
f"/api/conversation/message/{message_ext_id}",
|
|
125
|
+
options=make_request_options(
|
|
126
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
127
|
+
),
|
|
128
|
+
cast_to=ConversationDeleteMessageResponse,
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
def retrieve_threads(
|
|
132
|
+
self,
|
|
133
|
+
conversation_ext_id: str,
|
|
134
|
+
*,
|
|
135
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
136
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
137
|
+
extra_headers: Headers | None = None,
|
|
138
|
+
extra_query: Query | None = None,
|
|
139
|
+
extra_body: Body | None = None,
|
|
140
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
141
|
+
) -> ConversationRetrieveThreadsResponse:
|
|
142
|
+
"""
|
|
143
|
+
Retrieve all conversation threads (leaf messages and their histories) for a
|
|
144
|
+
given conversation external ID.
|
|
145
|
+
|
|
146
|
+
Args:
|
|
147
|
+
extra_headers: Send extra headers
|
|
148
|
+
|
|
149
|
+
extra_query: Add additional query parameters to the request
|
|
150
|
+
|
|
151
|
+
extra_body: Add additional JSON properties to the request
|
|
152
|
+
|
|
153
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
154
|
+
"""
|
|
155
|
+
if not conversation_ext_id:
|
|
156
|
+
raise ValueError(
|
|
157
|
+
f"Expected a non-empty value for `conversation_ext_id` but received {conversation_ext_id!r}"
|
|
158
|
+
)
|
|
159
|
+
return self._get(
|
|
160
|
+
f"/api/conversation/{conversation_ext_id}/threads",
|
|
161
|
+
options=make_request_options(
|
|
162
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
163
|
+
),
|
|
164
|
+
cast_to=ConversationRetrieveThreadsResponse,
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
def share(
|
|
168
|
+
self,
|
|
169
|
+
conversation_ext_id: str,
|
|
170
|
+
*,
|
|
171
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
172
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
173
|
+
extra_headers: Headers | None = None,
|
|
174
|
+
extra_query: Query | None = None,
|
|
175
|
+
extra_body: Body | None = None,
|
|
176
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
177
|
+
) -> ConversationShareResponse:
|
|
178
|
+
"""
|
|
179
|
+
Share all messages in a conversation by setting their shared flag to true.
|
|
180
|
+
|
|
181
|
+
Only the conversation creator can share a conversation.
|
|
182
|
+
|
|
183
|
+
Args:
|
|
184
|
+
extra_headers: Send extra headers
|
|
185
|
+
|
|
186
|
+
extra_query: Add additional query parameters to the request
|
|
187
|
+
|
|
188
|
+
extra_body: Add additional JSON properties to the request
|
|
189
|
+
|
|
190
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
191
|
+
"""
|
|
192
|
+
if not conversation_ext_id:
|
|
193
|
+
raise ValueError(
|
|
194
|
+
f"Expected a non-empty value for `conversation_ext_id` but received {conversation_ext_id!r}"
|
|
195
|
+
)
|
|
196
|
+
return self._post(
|
|
197
|
+
f"/api/conversation/{conversation_ext_id}/share",
|
|
198
|
+
options=make_request_options(
|
|
199
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
200
|
+
),
|
|
201
|
+
cast_to=ConversationShareResponse,
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
def update_title(
|
|
205
|
+
self,
|
|
206
|
+
conversation_ext_id: str,
|
|
207
|
+
*,
|
|
208
|
+
title: str,
|
|
209
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
210
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
211
|
+
extra_headers: Headers | None = None,
|
|
212
|
+
extra_query: Query | None = None,
|
|
213
|
+
extra_body: Body | None = None,
|
|
214
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
215
|
+
) -> ConversationUpdateTitleResponse:
|
|
216
|
+
"""Update a conversation title.
|
|
217
|
+
|
|
218
|
+
RLS ensures the user can only update conversations
|
|
219
|
+
they have access to.
|
|
220
|
+
|
|
221
|
+
Args:
|
|
222
|
+
title: New conversation title (1-60 characters)
|
|
223
|
+
|
|
224
|
+
extra_headers: Send extra headers
|
|
225
|
+
|
|
226
|
+
extra_query: Add additional query parameters to the request
|
|
227
|
+
|
|
228
|
+
extra_body: Add additional JSON properties to the request
|
|
229
|
+
|
|
230
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
231
|
+
"""
|
|
232
|
+
if not conversation_ext_id:
|
|
233
|
+
raise ValueError(
|
|
234
|
+
f"Expected a non-empty value for `conversation_ext_id` but received {conversation_ext_id!r}"
|
|
235
|
+
)
|
|
236
|
+
return self._patch(
|
|
237
|
+
f"/api/conversation/{conversation_ext_id}/title",
|
|
238
|
+
body=maybe_transform({"title": title}, conversation_update_title_params.ConversationUpdateTitleParams),
|
|
239
|
+
options=make_request_options(
|
|
240
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
241
|
+
),
|
|
242
|
+
cast_to=ConversationUpdateTitleResponse,
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
class AsyncConversationResource(AsyncAPIResource):
|
|
247
|
+
@cached_property
|
|
248
|
+
def user(self) -> AsyncUserResource:
|
|
249
|
+
return AsyncUserResource(self._client)
|
|
250
|
+
|
|
251
|
+
@cached_property
|
|
252
|
+
def with_raw_response(self) -> AsyncConversationResourceWithRawResponse:
|
|
253
|
+
"""
|
|
254
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
255
|
+
the raw response object instead of the parsed content.
|
|
256
|
+
|
|
257
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#accessing-raw-response-data-eg-headers
|
|
258
|
+
"""
|
|
259
|
+
return AsyncConversationResourceWithRawResponse(self)
|
|
260
|
+
|
|
261
|
+
@cached_property
|
|
262
|
+
def with_streaming_response(self) -> AsyncConversationResourceWithStreamingResponse:
|
|
263
|
+
"""
|
|
264
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
265
|
+
|
|
266
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#with_streaming_response
|
|
267
|
+
"""
|
|
268
|
+
return AsyncConversationResourceWithStreamingResponse(self)
|
|
269
|
+
|
|
270
|
+
async def delete(
|
|
271
|
+
self,
|
|
272
|
+
conversation_ext_id: str,
|
|
273
|
+
*,
|
|
274
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
275
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
276
|
+
extra_headers: Headers | None = None,
|
|
277
|
+
extra_query: Query | None = None,
|
|
278
|
+
extra_body: Body | None = None,
|
|
279
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
280
|
+
) -> ConversationDeleteResponse:
|
|
281
|
+
"""Delete a conversation.
|
|
282
|
+
|
|
283
|
+
RLS ensures the user can only delete conversations they
|
|
284
|
+
have access to. Deleting a conversation will also delete all associated messages
|
|
285
|
+
due to cascade delete.
|
|
286
|
+
|
|
287
|
+
Args:
|
|
288
|
+
extra_headers: Send extra headers
|
|
289
|
+
|
|
290
|
+
extra_query: Add additional query parameters to the request
|
|
291
|
+
|
|
292
|
+
extra_body: Add additional JSON properties to the request
|
|
293
|
+
|
|
294
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
295
|
+
"""
|
|
296
|
+
if not conversation_ext_id:
|
|
297
|
+
raise ValueError(
|
|
298
|
+
f"Expected a non-empty value for `conversation_ext_id` but received {conversation_ext_id!r}"
|
|
299
|
+
)
|
|
300
|
+
return await self._delete(
|
|
301
|
+
f"/api/conversation/{conversation_ext_id}",
|
|
302
|
+
options=make_request_options(
|
|
303
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
304
|
+
),
|
|
305
|
+
cast_to=ConversationDeleteResponse,
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
async def delete_message(
|
|
309
|
+
self,
|
|
310
|
+
message_ext_id: str,
|
|
311
|
+
*,
|
|
312
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
313
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
314
|
+
extra_headers: Headers | None = None,
|
|
315
|
+
extra_query: Query | None = None,
|
|
316
|
+
extra_body: Body | None = None,
|
|
317
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
318
|
+
) -> ConversationDeleteMessageResponse:
|
|
319
|
+
"""
|
|
320
|
+
Delete a message along with all descendants.
|
|
321
|
+
|
|
322
|
+
Args:
|
|
323
|
+
extra_headers: Send extra headers
|
|
324
|
+
|
|
325
|
+
extra_query: Add additional query parameters to the request
|
|
326
|
+
|
|
327
|
+
extra_body: Add additional JSON properties to the request
|
|
328
|
+
|
|
329
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
330
|
+
"""
|
|
331
|
+
if not message_ext_id:
|
|
332
|
+
raise ValueError(f"Expected a non-empty value for `message_ext_id` but received {message_ext_id!r}")
|
|
333
|
+
return await self._delete(
|
|
334
|
+
f"/api/conversation/message/{message_ext_id}",
|
|
335
|
+
options=make_request_options(
|
|
336
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
337
|
+
),
|
|
338
|
+
cast_to=ConversationDeleteMessageResponse,
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
async def retrieve_threads(
|
|
342
|
+
self,
|
|
343
|
+
conversation_ext_id: str,
|
|
344
|
+
*,
|
|
345
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
346
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
347
|
+
extra_headers: Headers | None = None,
|
|
348
|
+
extra_query: Query | None = None,
|
|
349
|
+
extra_body: Body | None = None,
|
|
350
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
351
|
+
) -> ConversationRetrieveThreadsResponse:
|
|
352
|
+
"""
|
|
353
|
+
Retrieve all conversation threads (leaf messages and their histories) for a
|
|
354
|
+
given conversation external ID.
|
|
355
|
+
|
|
356
|
+
Args:
|
|
357
|
+
extra_headers: Send extra headers
|
|
358
|
+
|
|
359
|
+
extra_query: Add additional query parameters to the request
|
|
360
|
+
|
|
361
|
+
extra_body: Add additional JSON properties to the request
|
|
362
|
+
|
|
363
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
364
|
+
"""
|
|
365
|
+
if not conversation_ext_id:
|
|
366
|
+
raise ValueError(
|
|
367
|
+
f"Expected a non-empty value for `conversation_ext_id` but received {conversation_ext_id!r}"
|
|
368
|
+
)
|
|
369
|
+
return await self._get(
|
|
370
|
+
f"/api/conversation/{conversation_ext_id}/threads",
|
|
371
|
+
options=make_request_options(
|
|
372
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
373
|
+
),
|
|
374
|
+
cast_to=ConversationRetrieveThreadsResponse,
|
|
375
|
+
)
|
|
376
|
+
|
|
377
|
+
async def share(
|
|
378
|
+
self,
|
|
379
|
+
conversation_ext_id: str,
|
|
380
|
+
*,
|
|
381
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
382
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
383
|
+
extra_headers: Headers | None = None,
|
|
384
|
+
extra_query: Query | None = None,
|
|
385
|
+
extra_body: Body | None = None,
|
|
386
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
387
|
+
) -> ConversationShareResponse:
|
|
388
|
+
"""
|
|
389
|
+
Share all messages in a conversation by setting their shared flag to true.
|
|
390
|
+
|
|
391
|
+
Only the conversation creator can share a conversation.
|
|
392
|
+
|
|
393
|
+
Args:
|
|
394
|
+
extra_headers: Send extra headers
|
|
395
|
+
|
|
396
|
+
extra_query: Add additional query parameters to the request
|
|
397
|
+
|
|
398
|
+
extra_body: Add additional JSON properties to the request
|
|
399
|
+
|
|
400
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
401
|
+
"""
|
|
402
|
+
if not conversation_ext_id:
|
|
403
|
+
raise ValueError(
|
|
404
|
+
f"Expected a non-empty value for `conversation_ext_id` but received {conversation_ext_id!r}"
|
|
405
|
+
)
|
|
406
|
+
return await self._post(
|
|
407
|
+
f"/api/conversation/{conversation_ext_id}/share",
|
|
408
|
+
options=make_request_options(
|
|
409
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
410
|
+
),
|
|
411
|
+
cast_to=ConversationShareResponse,
|
|
412
|
+
)
|
|
413
|
+
|
|
414
|
+
async def update_title(
|
|
415
|
+
self,
|
|
416
|
+
conversation_ext_id: str,
|
|
417
|
+
*,
|
|
418
|
+
title: str,
|
|
419
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
420
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
421
|
+
extra_headers: Headers | None = None,
|
|
422
|
+
extra_query: Query | None = None,
|
|
423
|
+
extra_body: Body | None = None,
|
|
424
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
425
|
+
) -> ConversationUpdateTitleResponse:
|
|
426
|
+
"""Update a conversation title.
|
|
427
|
+
|
|
428
|
+
RLS ensures the user can only update conversations
|
|
429
|
+
they have access to.
|
|
430
|
+
|
|
431
|
+
Args:
|
|
432
|
+
title: New conversation title (1-60 characters)
|
|
433
|
+
|
|
434
|
+
extra_headers: Send extra headers
|
|
435
|
+
|
|
436
|
+
extra_query: Add additional query parameters to the request
|
|
437
|
+
|
|
438
|
+
extra_body: Add additional JSON properties to the request
|
|
439
|
+
|
|
440
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
441
|
+
"""
|
|
442
|
+
if not conversation_ext_id:
|
|
443
|
+
raise ValueError(
|
|
444
|
+
f"Expected a non-empty value for `conversation_ext_id` but received {conversation_ext_id!r}"
|
|
445
|
+
)
|
|
446
|
+
return await self._patch(
|
|
447
|
+
f"/api/conversation/{conversation_ext_id}/title",
|
|
448
|
+
body=await async_maybe_transform(
|
|
449
|
+
{"title": title}, conversation_update_title_params.ConversationUpdateTitleParams
|
|
450
|
+
),
|
|
451
|
+
options=make_request_options(
|
|
452
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
453
|
+
),
|
|
454
|
+
cast_to=ConversationUpdateTitleResponse,
|
|
455
|
+
)
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
class ConversationResourceWithRawResponse:
|
|
459
|
+
def __init__(self, conversation: ConversationResource) -> None:
|
|
460
|
+
self._conversation = conversation
|
|
461
|
+
|
|
462
|
+
self.delete = to_raw_response_wrapper(
|
|
463
|
+
conversation.delete,
|
|
464
|
+
)
|
|
465
|
+
self.delete_message = to_raw_response_wrapper(
|
|
466
|
+
conversation.delete_message,
|
|
467
|
+
)
|
|
468
|
+
self.retrieve_threads = to_raw_response_wrapper(
|
|
469
|
+
conversation.retrieve_threads,
|
|
470
|
+
)
|
|
471
|
+
self.share = to_raw_response_wrapper(
|
|
472
|
+
conversation.share,
|
|
473
|
+
)
|
|
474
|
+
self.update_title = to_raw_response_wrapper(
|
|
475
|
+
conversation.update_title,
|
|
476
|
+
)
|
|
477
|
+
|
|
478
|
+
@cached_property
|
|
479
|
+
def user(self) -> UserResourceWithRawResponse:
|
|
480
|
+
return UserResourceWithRawResponse(self._conversation.user)
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
class AsyncConversationResourceWithRawResponse:
|
|
484
|
+
def __init__(self, conversation: AsyncConversationResource) -> None:
|
|
485
|
+
self._conversation = conversation
|
|
486
|
+
|
|
487
|
+
self.delete = async_to_raw_response_wrapper(
|
|
488
|
+
conversation.delete,
|
|
489
|
+
)
|
|
490
|
+
self.delete_message = async_to_raw_response_wrapper(
|
|
491
|
+
conversation.delete_message,
|
|
492
|
+
)
|
|
493
|
+
self.retrieve_threads = async_to_raw_response_wrapper(
|
|
494
|
+
conversation.retrieve_threads,
|
|
495
|
+
)
|
|
496
|
+
self.share = async_to_raw_response_wrapper(
|
|
497
|
+
conversation.share,
|
|
498
|
+
)
|
|
499
|
+
self.update_title = async_to_raw_response_wrapper(
|
|
500
|
+
conversation.update_title,
|
|
501
|
+
)
|
|
502
|
+
|
|
503
|
+
@cached_property
|
|
504
|
+
def user(self) -> AsyncUserResourceWithRawResponse:
|
|
505
|
+
return AsyncUserResourceWithRawResponse(self._conversation.user)
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
class ConversationResourceWithStreamingResponse:
|
|
509
|
+
def __init__(self, conversation: ConversationResource) -> None:
|
|
510
|
+
self._conversation = conversation
|
|
511
|
+
|
|
512
|
+
self.delete = to_streamed_response_wrapper(
|
|
513
|
+
conversation.delete,
|
|
514
|
+
)
|
|
515
|
+
self.delete_message = to_streamed_response_wrapper(
|
|
516
|
+
conversation.delete_message,
|
|
517
|
+
)
|
|
518
|
+
self.retrieve_threads = to_streamed_response_wrapper(
|
|
519
|
+
conversation.retrieve_threads,
|
|
520
|
+
)
|
|
521
|
+
self.share = to_streamed_response_wrapper(
|
|
522
|
+
conversation.share,
|
|
523
|
+
)
|
|
524
|
+
self.update_title = to_streamed_response_wrapper(
|
|
525
|
+
conversation.update_title,
|
|
526
|
+
)
|
|
527
|
+
|
|
528
|
+
@cached_property
|
|
529
|
+
def user(self) -> UserResourceWithStreamingResponse:
|
|
530
|
+
return UserResourceWithStreamingResponse(self._conversation.user)
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
class AsyncConversationResourceWithStreamingResponse:
|
|
534
|
+
def __init__(self, conversation: AsyncConversationResource) -> None:
|
|
535
|
+
self._conversation = conversation
|
|
536
|
+
|
|
537
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
538
|
+
conversation.delete,
|
|
539
|
+
)
|
|
540
|
+
self.delete_message = async_to_streamed_response_wrapper(
|
|
541
|
+
conversation.delete_message,
|
|
542
|
+
)
|
|
543
|
+
self.retrieve_threads = async_to_streamed_response_wrapper(
|
|
544
|
+
conversation.retrieve_threads,
|
|
545
|
+
)
|
|
546
|
+
self.share = async_to_streamed_response_wrapper(
|
|
547
|
+
conversation.share,
|
|
548
|
+
)
|
|
549
|
+
self.update_title = async_to_streamed_response_wrapper(
|
|
550
|
+
conversation.update_title,
|
|
551
|
+
)
|
|
552
|
+
|
|
553
|
+
@cached_property
|
|
554
|
+
def user(self) -> AsyncUserResourceWithStreamingResponse:
|
|
555
|
+
return AsyncUserResourceWithStreamingResponse(self._conversation.user)
|