agentlin-client 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 agentlin-client might be problematic. Click here for more details.
- agentlin_client/__init__.py +90 -0
- agentlin_client/_base_client.py +1995 -0
- agentlin_client/_client.py +403 -0
- agentlin_client/_compat.py +219 -0
- agentlin_client/_constants.py +14 -0
- agentlin_client/_exceptions.py +108 -0
- agentlin_client/_files.py +123 -0
- agentlin_client/_models.py +835 -0
- agentlin_client/_qs.py +150 -0
- agentlin_client/_resource.py +43 -0
- agentlin_client/_response.py +832 -0
- agentlin_client/_streaming.py +333 -0
- agentlin_client/_types.py +260 -0
- agentlin_client/_utils/__init__.py +64 -0
- agentlin_client/_utils/_compat.py +45 -0
- agentlin_client/_utils/_datetime_parse.py +136 -0
- agentlin_client/_utils/_logs.py +25 -0
- agentlin_client/_utils/_proxy.py +65 -0
- agentlin_client/_utils/_reflection.py +42 -0
- agentlin_client/_utils/_resources_proxy.py +24 -0
- agentlin_client/_utils/_streams.py +12 -0
- agentlin_client/_utils/_sync.py +86 -0
- agentlin_client/_utils/_transform.py +457 -0
- agentlin_client/_utils/_typing.py +156 -0
- agentlin_client/_utils/_utils.py +421 -0
- agentlin_client/_version.py +4 -0
- agentlin_client/lib/.keep +4 -0
- agentlin_client/py.typed +0 -0
- agentlin_client/resources/__init__.py +33 -0
- agentlin_client/resources/conversations/__init__.py +33 -0
- agentlin_client/resources/conversations/conversations.py +489 -0
- agentlin_client/resources/conversations/items.py +558 -0
- agentlin_client/resources/responses.py +1136 -0
- agentlin_client/types/__init__.py +22 -0
- agentlin_client/types/conversation_create_params.py +28 -0
- agentlin_client/types/conversation_delete_response.py +15 -0
- agentlin_client/types/conversation_update_params.py +20 -0
- agentlin_client/types/conversations/__init__.py +74 -0
- agentlin_client/types/conversations/code_interpreter_tool_call.py +55 -0
- agentlin_client/types/conversations/code_interpreter_tool_call_param.py +54 -0
- agentlin_client/types/conversations/computer_screenshot_image.py +22 -0
- agentlin_client/types/conversations/computer_screenshot_image_param.py +21 -0
- agentlin_client/types/conversations/computer_tool_call.py +201 -0
- agentlin_client/types/conversations/computer_tool_call_output_resource.py +37 -0
- agentlin_client/types/conversations/computer_tool_call_param.py +199 -0
- agentlin_client/types/conversations/computer_tool_call_safety_check.py +16 -0
- agentlin_client/types/conversations/computer_tool_call_safety_check_param.py +18 -0
- agentlin_client/types/conversations/conversation_item.py +133 -0
- agentlin_client/types/conversations/conversation_item_list.py +26 -0
- agentlin_client/types/conversations/conversation_resource.py +32 -0
- agentlin_client/types/conversations/custom_tool_call.py +25 -0
- agentlin_client/types/conversations/custom_tool_call_output.py +26 -0
- agentlin_client/types/conversations/custom_tool_call_output_param.py +27 -0
- agentlin_client/types/conversations/custom_tool_call_param.py +24 -0
- agentlin_client/types/conversations/easy_input_message.py +26 -0
- agentlin_client/types/conversations/easy_input_message_param.py +27 -0
- agentlin_client/types/conversations/file_search_tool_call.py +42 -0
- agentlin_client/types/conversations/file_search_tool_call_param.py +44 -0
- agentlin_client/types/conversations/function_and_custom_tool_call_output.py +15 -0
- agentlin_client/types/conversations/function_and_custom_tool_call_output_param.py +16 -0
- agentlin_client/types/conversations/function_call_item_status.py +7 -0
- agentlin_client/types/conversations/function_tool_call.py +32 -0
- agentlin_client/types/conversations/function_tool_call_output_resource.py +33 -0
- agentlin_client/types/conversations/function_tool_call_param.py +31 -0
- agentlin_client/types/conversations/function_tool_call_resource.py +10 -0
- agentlin_client/types/conversations/image_gen_tool_call.py +22 -0
- agentlin_client/types/conversations/image_gen_tool_call_param.py +22 -0
- agentlin_client/types/conversations/includable.py +14 -0
- agentlin_client/types/conversations/input_content.py +32 -0
- agentlin_client/types/conversations/input_content_param.py +30 -0
- agentlin_client/types/conversations/input_file_content.py +25 -0
- agentlin_client/types/conversations/input_file_content_param.py +25 -0
- agentlin_client/types/conversations/input_image_content.py +28 -0
- agentlin_client/types/conversations/input_image_content_param.py +28 -0
- agentlin_client/types/conversations/input_item.py +209 -0
- agentlin_client/types/conversations/input_item_param.py +203 -0
- agentlin_client/types/conversations/input_message.py +30 -0
- agentlin_client/types/conversations/input_message_param.py +31 -0
- agentlin_client/types/conversations/input_text_content.py +15 -0
- agentlin_client/types/conversations/input_text_content_param.py +15 -0
- agentlin_client/types/conversations/item_create_params.py +24 -0
- agentlin_client/types/conversations/item_list_params.py +50 -0
- agentlin_client/types/conversations/item_retrieve_params.py +22 -0
- agentlin_client/types/conversations/local_shell_tool_call.py +45 -0
- agentlin_client/types/conversations/local_shell_tool_call_output.py +22 -0
- agentlin_client/types/conversations/local_shell_tool_call_output_param.py +22 -0
- agentlin_client/types/conversations/local_shell_tool_call_param.py +47 -0
- agentlin_client/types/conversations/mcp_approval_request.py +24 -0
- agentlin_client/types/conversations/mcp_approval_request_param.py +24 -0
- agentlin_client/types/conversations/mcp_approval_response_resource.py +25 -0
- agentlin_client/types/conversations/mcp_list_tools.py +39 -0
- agentlin_client/types/conversations/mcp_list_tools_param.py +39 -0
- agentlin_client/types/conversations/mcp_tool_call.py +44 -0
- agentlin_client/types/conversations/mcp_tool_call_param.py +44 -0
- agentlin_client/types/conversations/output_message.py +34 -0
- agentlin_client/types/conversations/output_message_param.py +34 -0
- agentlin_client/types/conversations/output_text_content.py +117 -0
- agentlin_client/types/conversations/output_text_content_param.py +115 -0
- agentlin_client/types/conversations/reasoning_item.py +44 -0
- agentlin_client/types/conversations/reasoning_item_param.py +45 -0
- agentlin_client/types/conversations/reasoning_text_content.py +15 -0
- agentlin_client/types/conversations/reasoning_text_content_param.py +15 -0
- agentlin_client/types/conversations/refusal_content.py +15 -0
- agentlin_client/types/conversations/refusal_content_param.py +15 -0
- agentlin_client/types/conversations/web_search_tool_call.py +67 -0
- agentlin_client/types/conversations/web_search_tool_call_param.py +66 -0
- agentlin_client/types/mcp_tool_filter.py +20 -0
- agentlin_client/types/mcp_tool_filter_param.py +22 -0
- agentlin_client/types/model_response_properties_standard.py +87 -0
- agentlin_client/types/response.py +166 -0
- agentlin_client/types/response_create_params.py +497 -0
- agentlin_client/types/response_list_input_items_params.py +34 -0
- agentlin_client/types/response_list_input_items_response.py +70 -0
- agentlin_client/types/response_properties.py +328 -0
- agentlin_client/types/response_retrieve_params.py +42 -0
- agentlin_client/types/response_tool.py +495 -0
- agentlin_client/types/response_tool_param.py +491 -0
- agentlin_client/types/text_response_format_configuration.py +59 -0
- agentlin_client/types/text_response_format_configuration_param.py +54 -0
- agentlin_client-0.1.0.dist-info/METADATA +429 -0
- agentlin_client-0.1.0.dist-info/RECORD +123 -0
- agentlin_client-0.1.0.dist-info/WHEEL +4 -0
- agentlin_client-0.1.0.dist-info/licenses/LICENSE +7 -0
|
@@ -0,0 +1,489 @@
|
|
|
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, Iterable, Optional
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from .items import (
|
|
10
|
+
ItemsResource,
|
|
11
|
+
AsyncItemsResource,
|
|
12
|
+
ItemsResourceWithRawResponse,
|
|
13
|
+
AsyncItemsResourceWithRawResponse,
|
|
14
|
+
ItemsResourceWithStreamingResponse,
|
|
15
|
+
AsyncItemsResourceWithStreamingResponse,
|
|
16
|
+
)
|
|
17
|
+
from ...types import conversation_create_params, conversation_update_params
|
|
18
|
+
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
19
|
+
from ..._utils import maybe_transform, async_maybe_transform
|
|
20
|
+
from ..._compat import cached_property
|
|
21
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
22
|
+
from ..._response import (
|
|
23
|
+
to_raw_response_wrapper,
|
|
24
|
+
to_streamed_response_wrapper,
|
|
25
|
+
async_to_raw_response_wrapper,
|
|
26
|
+
async_to_streamed_response_wrapper,
|
|
27
|
+
)
|
|
28
|
+
from ..._base_client import make_request_options
|
|
29
|
+
from ...types.conversation_delete_response import ConversationDeleteResponse
|
|
30
|
+
from ...types.conversations.input_item_param import InputItemParam
|
|
31
|
+
from ...types.conversations.conversation_resource import ConversationResource
|
|
32
|
+
|
|
33
|
+
__all__ = ["ConversationsResource", "AsyncConversationsResource"]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class ConversationsResource(SyncAPIResource):
|
|
37
|
+
@cached_property
|
|
38
|
+
def items(self) -> ItemsResource:
|
|
39
|
+
return ItemsResource(self._client)
|
|
40
|
+
|
|
41
|
+
@cached_property
|
|
42
|
+
def with_raw_response(self) -> ConversationsResourceWithRawResponse:
|
|
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/LinXueyuanStdio/agentlin-client-python#accessing-raw-response-data-eg-headers
|
|
48
|
+
"""
|
|
49
|
+
return ConversationsResourceWithRawResponse(self)
|
|
50
|
+
|
|
51
|
+
@cached_property
|
|
52
|
+
def with_streaming_response(self) -> ConversationsResourceWithStreamingResponse:
|
|
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/LinXueyuanStdio/agentlin-client-python#with_streaming_response
|
|
57
|
+
"""
|
|
58
|
+
return ConversationsResourceWithStreamingResponse(self)
|
|
59
|
+
|
|
60
|
+
def create(
|
|
61
|
+
self,
|
|
62
|
+
*,
|
|
63
|
+
items: Optional[Iterable[InputItemParam]] | Omit = omit,
|
|
64
|
+
metadata: Optional[Dict[str, str]] | Omit = omit,
|
|
65
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
66
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
67
|
+
extra_headers: Headers | None = None,
|
|
68
|
+
extra_query: Query | None = None,
|
|
69
|
+
extra_body: Body | None = None,
|
|
70
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
71
|
+
) -> ConversationResource:
|
|
72
|
+
"""
|
|
73
|
+
Create a conversation.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
items: Initial items to include in the conversation context. You may add up to 20 items
|
|
77
|
+
at a time.
|
|
78
|
+
|
|
79
|
+
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
|
|
80
|
+
for storing additional information about the object in a structured format, and
|
|
81
|
+
querying for objects via API or the dashboard.
|
|
82
|
+
|
|
83
|
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
|
84
|
+
a maximum length of 512 characters.
|
|
85
|
+
|
|
86
|
+
extra_headers: Send extra headers
|
|
87
|
+
|
|
88
|
+
extra_query: Add additional query parameters to the request
|
|
89
|
+
|
|
90
|
+
extra_body: Add additional JSON properties to the request
|
|
91
|
+
|
|
92
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
93
|
+
"""
|
|
94
|
+
return self._post(
|
|
95
|
+
"/conversations",
|
|
96
|
+
body=maybe_transform(
|
|
97
|
+
{
|
|
98
|
+
"items": items,
|
|
99
|
+
"metadata": metadata,
|
|
100
|
+
},
|
|
101
|
+
conversation_create_params.ConversationCreateParams,
|
|
102
|
+
),
|
|
103
|
+
options=make_request_options(
|
|
104
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
105
|
+
),
|
|
106
|
+
cast_to=ConversationResource,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
def retrieve(
|
|
110
|
+
self,
|
|
111
|
+
conversation_id: str,
|
|
112
|
+
*,
|
|
113
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
114
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
115
|
+
extra_headers: Headers | None = None,
|
|
116
|
+
extra_query: Query | None = None,
|
|
117
|
+
extra_body: Body | None = None,
|
|
118
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
119
|
+
) -> ConversationResource:
|
|
120
|
+
"""
|
|
121
|
+
Get a conversation
|
|
122
|
+
|
|
123
|
+
Args:
|
|
124
|
+
extra_headers: Send extra headers
|
|
125
|
+
|
|
126
|
+
extra_query: Add additional query parameters to the request
|
|
127
|
+
|
|
128
|
+
extra_body: Add additional JSON properties to the request
|
|
129
|
+
|
|
130
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
131
|
+
"""
|
|
132
|
+
if not conversation_id:
|
|
133
|
+
raise ValueError(f"Expected a non-empty value for `conversation_id` but received {conversation_id!r}")
|
|
134
|
+
return self._get(
|
|
135
|
+
f"/conversations/{conversation_id}",
|
|
136
|
+
options=make_request_options(
|
|
137
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
138
|
+
),
|
|
139
|
+
cast_to=ConversationResource,
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
def update(
|
|
143
|
+
self,
|
|
144
|
+
conversation_id: str,
|
|
145
|
+
*,
|
|
146
|
+
metadata: Optional[Dict[str, str]],
|
|
147
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
148
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
149
|
+
extra_headers: Headers | None = None,
|
|
150
|
+
extra_query: Query | None = None,
|
|
151
|
+
extra_body: Body | None = None,
|
|
152
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
153
|
+
) -> ConversationResource:
|
|
154
|
+
"""
|
|
155
|
+
Update a conversation
|
|
156
|
+
|
|
157
|
+
Args:
|
|
158
|
+
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
|
|
159
|
+
for storing additional information about the object in a structured format, and
|
|
160
|
+
querying for objects via API or the dashboard.
|
|
161
|
+
|
|
162
|
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
|
163
|
+
a maximum length of 512 characters.
|
|
164
|
+
|
|
165
|
+
extra_headers: Send extra headers
|
|
166
|
+
|
|
167
|
+
extra_query: Add additional query parameters to the request
|
|
168
|
+
|
|
169
|
+
extra_body: Add additional JSON properties to the request
|
|
170
|
+
|
|
171
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
172
|
+
"""
|
|
173
|
+
if not conversation_id:
|
|
174
|
+
raise ValueError(f"Expected a non-empty value for `conversation_id` but received {conversation_id!r}")
|
|
175
|
+
return self._post(
|
|
176
|
+
f"/conversations/{conversation_id}",
|
|
177
|
+
body=maybe_transform({"metadata": metadata}, conversation_update_params.ConversationUpdateParams),
|
|
178
|
+
options=make_request_options(
|
|
179
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
180
|
+
),
|
|
181
|
+
cast_to=ConversationResource,
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
def delete(
|
|
185
|
+
self,
|
|
186
|
+
conversation_id: str,
|
|
187
|
+
*,
|
|
188
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
189
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
190
|
+
extra_headers: Headers | None = None,
|
|
191
|
+
extra_query: Query | None = None,
|
|
192
|
+
extra_body: Body | None = None,
|
|
193
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
194
|
+
) -> ConversationDeleteResponse:
|
|
195
|
+
"""Delete a conversation.
|
|
196
|
+
|
|
197
|
+
Items in the conversation will not be deleted.
|
|
198
|
+
|
|
199
|
+
Args:
|
|
200
|
+
extra_headers: Send extra headers
|
|
201
|
+
|
|
202
|
+
extra_query: Add additional query parameters to the request
|
|
203
|
+
|
|
204
|
+
extra_body: Add additional JSON properties to the request
|
|
205
|
+
|
|
206
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
207
|
+
"""
|
|
208
|
+
if not conversation_id:
|
|
209
|
+
raise ValueError(f"Expected a non-empty value for `conversation_id` but received {conversation_id!r}")
|
|
210
|
+
return self._delete(
|
|
211
|
+
f"/conversations/{conversation_id}",
|
|
212
|
+
options=make_request_options(
|
|
213
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
214
|
+
),
|
|
215
|
+
cast_to=ConversationDeleteResponse,
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
class AsyncConversationsResource(AsyncAPIResource):
|
|
220
|
+
@cached_property
|
|
221
|
+
def items(self) -> AsyncItemsResource:
|
|
222
|
+
return AsyncItemsResource(self._client)
|
|
223
|
+
|
|
224
|
+
@cached_property
|
|
225
|
+
def with_raw_response(self) -> AsyncConversationsResourceWithRawResponse:
|
|
226
|
+
"""
|
|
227
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
228
|
+
the raw response object instead of the parsed content.
|
|
229
|
+
|
|
230
|
+
For more information, see https://www.github.com/LinXueyuanStdio/agentlin-client-python#accessing-raw-response-data-eg-headers
|
|
231
|
+
"""
|
|
232
|
+
return AsyncConversationsResourceWithRawResponse(self)
|
|
233
|
+
|
|
234
|
+
@cached_property
|
|
235
|
+
def with_streaming_response(self) -> AsyncConversationsResourceWithStreamingResponse:
|
|
236
|
+
"""
|
|
237
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
238
|
+
|
|
239
|
+
For more information, see https://www.github.com/LinXueyuanStdio/agentlin-client-python#with_streaming_response
|
|
240
|
+
"""
|
|
241
|
+
return AsyncConversationsResourceWithStreamingResponse(self)
|
|
242
|
+
|
|
243
|
+
async def create(
|
|
244
|
+
self,
|
|
245
|
+
*,
|
|
246
|
+
items: Optional[Iterable[InputItemParam]] | Omit = omit,
|
|
247
|
+
metadata: Optional[Dict[str, str]] | Omit = omit,
|
|
248
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
249
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
250
|
+
extra_headers: Headers | None = None,
|
|
251
|
+
extra_query: Query | None = None,
|
|
252
|
+
extra_body: Body | None = None,
|
|
253
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
254
|
+
) -> ConversationResource:
|
|
255
|
+
"""
|
|
256
|
+
Create a conversation.
|
|
257
|
+
|
|
258
|
+
Args:
|
|
259
|
+
items: Initial items to include in the conversation context. You may add up to 20 items
|
|
260
|
+
at a time.
|
|
261
|
+
|
|
262
|
+
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
|
|
263
|
+
for storing additional information about the object in a structured format, and
|
|
264
|
+
querying for objects via API or the dashboard.
|
|
265
|
+
|
|
266
|
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
|
267
|
+
a maximum length of 512 characters.
|
|
268
|
+
|
|
269
|
+
extra_headers: Send extra headers
|
|
270
|
+
|
|
271
|
+
extra_query: Add additional query parameters to the request
|
|
272
|
+
|
|
273
|
+
extra_body: Add additional JSON properties to the request
|
|
274
|
+
|
|
275
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
276
|
+
"""
|
|
277
|
+
return await self._post(
|
|
278
|
+
"/conversations",
|
|
279
|
+
body=await async_maybe_transform(
|
|
280
|
+
{
|
|
281
|
+
"items": items,
|
|
282
|
+
"metadata": metadata,
|
|
283
|
+
},
|
|
284
|
+
conversation_create_params.ConversationCreateParams,
|
|
285
|
+
),
|
|
286
|
+
options=make_request_options(
|
|
287
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
288
|
+
),
|
|
289
|
+
cast_to=ConversationResource,
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
async def retrieve(
|
|
293
|
+
self,
|
|
294
|
+
conversation_id: str,
|
|
295
|
+
*,
|
|
296
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
297
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
298
|
+
extra_headers: Headers | None = None,
|
|
299
|
+
extra_query: Query | None = None,
|
|
300
|
+
extra_body: Body | None = None,
|
|
301
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
302
|
+
) -> ConversationResource:
|
|
303
|
+
"""
|
|
304
|
+
Get a conversation
|
|
305
|
+
|
|
306
|
+
Args:
|
|
307
|
+
extra_headers: Send extra headers
|
|
308
|
+
|
|
309
|
+
extra_query: Add additional query parameters to the request
|
|
310
|
+
|
|
311
|
+
extra_body: Add additional JSON properties to the request
|
|
312
|
+
|
|
313
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
314
|
+
"""
|
|
315
|
+
if not conversation_id:
|
|
316
|
+
raise ValueError(f"Expected a non-empty value for `conversation_id` but received {conversation_id!r}")
|
|
317
|
+
return await self._get(
|
|
318
|
+
f"/conversations/{conversation_id}",
|
|
319
|
+
options=make_request_options(
|
|
320
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
321
|
+
),
|
|
322
|
+
cast_to=ConversationResource,
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
async def update(
|
|
326
|
+
self,
|
|
327
|
+
conversation_id: str,
|
|
328
|
+
*,
|
|
329
|
+
metadata: Optional[Dict[str, str]],
|
|
330
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
331
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
332
|
+
extra_headers: Headers | None = None,
|
|
333
|
+
extra_query: Query | None = None,
|
|
334
|
+
extra_body: Body | None = None,
|
|
335
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
336
|
+
) -> ConversationResource:
|
|
337
|
+
"""
|
|
338
|
+
Update a conversation
|
|
339
|
+
|
|
340
|
+
Args:
|
|
341
|
+
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
|
|
342
|
+
for storing additional information about the object in a structured format, and
|
|
343
|
+
querying for objects via API or the dashboard.
|
|
344
|
+
|
|
345
|
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
|
346
|
+
a maximum length of 512 characters.
|
|
347
|
+
|
|
348
|
+
extra_headers: Send extra headers
|
|
349
|
+
|
|
350
|
+
extra_query: Add additional query parameters to the request
|
|
351
|
+
|
|
352
|
+
extra_body: Add additional JSON properties to the request
|
|
353
|
+
|
|
354
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
355
|
+
"""
|
|
356
|
+
if not conversation_id:
|
|
357
|
+
raise ValueError(f"Expected a non-empty value for `conversation_id` but received {conversation_id!r}")
|
|
358
|
+
return await self._post(
|
|
359
|
+
f"/conversations/{conversation_id}",
|
|
360
|
+
body=await async_maybe_transform(
|
|
361
|
+
{"metadata": metadata}, conversation_update_params.ConversationUpdateParams
|
|
362
|
+
),
|
|
363
|
+
options=make_request_options(
|
|
364
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
365
|
+
),
|
|
366
|
+
cast_to=ConversationResource,
|
|
367
|
+
)
|
|
368
|
+
|
|
369
|
+
async def delete(
|
|
370
|
+
self,
|
|
371
|
+
conversation_id: str,
|
|
372
|
+
*,
|
|
373
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
374
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
375
|
+
extra_headers: Headers | None = None,
|
|
376
|
+
extra_query: Query | None = None,
|
|
377
|
+
extra_body: Body | None = None,
|
|
378
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
379
|
+
) -> ConversationDeleteResponse:
|
|
380
|
+
"""Delete a conversation.
|
|
381
|
+
|
|
382
|
+
Items in the conversation will not be deleted.
|
|
383
|
+
|
|
384
|
+
Args:
|
|
385
|
+
extra_headers: Send extra headers
|
|
386
|
+
|
|
387
|
+
extra_query: Add additional query parameters to the request
|
|
388
|
+
|
|
389
|
+
extra_body: Add additional JSON properties to the request
|
|
390
|
+
|
|
391
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
392
|
+
"""
|
|
393
|
+
if not conversation_id:
|
|
394
|
+
raise ValueError(f"Expected a non-empty value for `conversation_id` but received {conversation_id!r}")
|
|
395
|
+
return await self._delete(
|
|
396
|
+
f"/conversations/{conversation_id}",
|
|
397
|
+
options=make_request_options(
|
|
398
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
399
|
+
),
|
|
400
|
+
cast_to=ConversationDeleteResponse,
|
|
401
|
+
)
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
class ConversationsResourceWithRawResponse:
|
|
405
|
+
def __init__(self, conversations: ConversationsResource) -> None:
|
|
406
|
+
self._conversations = conversations
|
|
407
|
+
|
|
408
|
+
self.create = to_raw_response_wrapper(
|
|
409
|
+
conversations.create,
|
|
410
|
+
)
|
|
411
|
+
self.retrieve = to_raw_response_wrapper(
|
|
412
|
+
conversations.retrieve,
|
|
413
|
+
)
|
|
414
|
+
self.update = to_raw_response_wrapper(
|
|
415
|
+
conversations.update,
|
|
416
|
+
)
|
|
417
|
+
self.delete = to_raw_response_wrapper(
|
|
418
|
+
conversations.delete,
|
|
419
|
+
)
|
|
420
|
+
|
|
421
|
+
@cached_property
|
|
422
|
+
def items(self) -> ItemsResourceWithRawResponse:
|
|
423
|
+
return ItemsResourceWithRawResponse(self._conversations.items)
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
class AsyncConversationsResourceWithRawResponse:
|
|
427
|
+
def __init__(self, conversations: AsyncConversationsResource) -> None:
|
|
428
|
+
self._conversations = conversations
|
|
429
|
+
|
|
430
|
+
self.create = async_to_raw_response_wrapper(
|
|
431
|
+
conversations.create,
|
|
432
|
+
)
|
|
433
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
434
|
+
conversations.retrieve,
|
|
435
|
+
)
|
|
436
|
+
self.update = async_to_raw_response_wrapper(
|
|
437
|
+
conversations.update,
|
|
438
|
+
)
|
|
439
|
+
self.delete = async_to_raw_response_wrapper(
|
|
440
|
+
conversations.delete,
|
|
441
|
+
)
|
|
442
|
+
|
|
443
|
+
@cached_property
|
|
444
|
+
def items(self) -> AsyncItemsResourceWithRawResponse:
|
|
445
|
+
return AsyncItemsResourceWithRawResponse(self._conversations.items)
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
class ConversationsResourceWithStreamingResponse:
|
|
449
|
+
def __init__(self, conversations: ConversationsResource) -> None:
|
|
450
|
+
self._conversations = conversations
|
|
451
|
+
|
|
452
|
+
self.create = to_streamed_response_wrapper(
|
|
453
|
+
conversations.create,
|
|
454
|
+
)
|
|
455
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
456
|
+
conversations.retrieve,
|
|
457
|
+
)
|
|
458
|
+
self.update = to_streamed_response_wrapper(
|
|
459
|
+
conversations.update,
|
|
460
|
+
)
|
|
461
|
+
self.delete = to_streamed_response_wrapper(
|
|
462
|
+
conversations.delete,
|
|
463
|
+
)
|
|
464
|
+
|
|
465
|
+
@cached_property
|
|
466
|
+
def items(self) -> ItemsResourceWithStreamingResponse:
|
|
467
|
+
return ItemsResourceWithStreamingResponse(self._conversations.items)
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
class AsyncConversationsResourceWithStreamingResponse:
|
|
471
|
+
def __init__(self, conversations: AsyncConversationsResource) -> None:
|
|
472
|
+
self._conversations = conversations
|
|
473
|
+
|
|
474
|
+
self.create = async_to_streamed_response_wrapper(
|
|
475
|
+
conversations.create,
|
|
476
|
+
)
|
|
477
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
478
|
+
conversations.retrieve,
|
|
479
|
+
)
|
|
480
|
+
self.update = async_to_streamed_response_wrapper(
|
|
481
|
+
conversations.update,
|
|
482
|
+
)
|
|
483
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
484
|
+
conversations.delete,
|
|
485
|
+
)
|
|
486
|
+
|
|
487
|
+
@cached_property
|
|
488
|
+
def items(self) -> AsyncItemsResourceWithStreamingResponse:
|
|
489
|
+
return AsyncItemsResourceWithStreamingResponse(self._conversations.items)
|