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.

Files changed (123) hide show
  1. agentlin_client/__init__.py +90 -0
  2. agentlin_client/_base_client.py +1995 -0
  3. agentlin_client/_client.py +403 -0
  4. agentlin_client/_compat.py +219 -0
  5. agentlin_client/_constants.py +14 -0
  6. agentlin_client/_exceptions.py +108 -0
  7. agentlin_client/_files.py +123 -0
  8. agentlin_client/_models.py +835 -0
  9. agentlin_client/_qs.py +150 -0
  10. agentlin_client/_resource.py +43 -0
  11. agentlin_client/_response.py +832 -0
  12. agentlin_client/_streaming.py +333 -0
  13. agentlin_client/_types.py +260 -0
  14. agentlin_client/_utils/__init__.py +64 -0
  15. agentlin_client/_utils/_compat.py +45 -0
  16. agentlin_client/_utils/_datetime_parse.py +136 -0
  17. agentlin_client/_utils/_logs.py +25 -0
  18. agentlin_client/_utils/_proxy.py +65 -0
  19. agentlin_client/_utils/_reflection.py +42 -0
  20. agentlin_client/_utils/_resources_proxy.py +24 -0
  21. agentlin_client/_utils/_streams.py +12 -0
  22. agentlin_client/_utils/_sync.py +86 -0
  23. agentlin_client/_utils/_transform.py +457 -0
  24. agentlin_client/_utils/_typing.py +156 -0
  25. agentlin_client/_utils/_utils.py +421 -0
  26. agentlin_client/_version.py +4 -0
  27. agentlin_client/lib/.keep +4 -0
  28. agentlin_client/py.typed +0 -0
  29. agentlin_client/resources/__init__.py +33 -0
  30. agentlin_client/resources/conversations/__init__.py +33 -0
  31. agentlin_client/resources/conversations/conversations.py +489 -0
  32. agentlin_client/resources/conversations/items.py +558 -0
  33. agentlin_client/resources/responses.py +1136 -0
  34. agentlin_client/types/__init__.py +22 -0
  35. agentlin_client/types/conversation_create_params.py +28 -0
  36. agentlin_client/types/conversation_delete_response.py +15 -0
  37. agentlin_client/types/conversation_update_params.py +20 -0
  38. agentlin_client/types/conversations/__init__.py +74 -0
  39. agentlin_client/types/conversations/code_interpreter_tool_call.py +55 -0
  40. agentlin_client/types/conversations/code_interpreter_tool_call_param.py +54 -0
  41. agentlin_client/types/conversations/computer_screenshot_image.py +22 -0
  42. agentlin_client/types/conversations/computer_screenshot_image_param.py +21 -0
  43. agentlin_client/types/conversations/computer_tool_call.py +201 -0
  44. agentlin_client/types/conversations/computer_tool_call_output_resource.py +37 -0
  45. agentlin_client/types/conversations/computer_tool_call_param.py +199 -0
  46. agentlin_client/types/conversations/computer_tool_call_safety_check.py +16 -0
  47. agentlin_client/types/conversations/computer_tool_call_safety_check_param.py +18 -0
  48. agentlin_client/types/conversations/conversation_item.py +133 -0
  49. agentlin_client/types/conversations/conversation_item_list.py +26 -0
  50. agentlin_client/types/conversations/conversation_resource.py +32 -0
  51. agentlin_client/types/conversations/custom_tool_call.py +25 -0
  52. agentlin_client/types/conversations/custom_tool_call_output.py +26 -0
  53. agentlin_client/types/conversations/custom_tool_call_output_param.py +27 -0
  54. agentlin_client/types/conversations/custom_tool_call_param.py +24 -0
  55. agentlin_client/types/conversations/easy_input_message.py +26 -0
  56. agentlin_client/types/conversations/easy_input_message_param.py +27 -0
  57. agentlin_client/types/conversations/file_search_tool_call.py +42 -0
  58. agentlin_client/types/conversations/file_search_tool_call_param.py +44 -0
  59. agentlin_client/types/conversations/function_and_custom_tool_call_output.py +15 -0
  60. agentlin_client/types/conversations/function_and_custom_tool_call_output_param.py +16 -0
  61. agentlin_client/types/conversations/function_call_item_status.py +7 -0
  62. agentlin_client/types/conversations/function_tool_call.py +32 -0
  63. agentlin_client/types/conversations/function_tool_call_output_resource.py +33 -0
  64. agentlin_client/types/conversations/function_tool_call_param.py +31 -0
  65. agentlin_client/types/conversations/function_tool_call_resource.py +10 -0
  66. agentlin_client/types/conversations/image_gen_tool_call.py +22 -0
  67. agentlin_client/types/conversations/image_gen_tool_call_param.py +22 -0
  68. agentlin_client/types/conversations/includable.py +14 -0
  69. agentlin_client/types/conversations/input_content.py +32 -0
  70. agentlin_client/types/conversations/input_content_param.py +30 -0
  71. agentlin_client/types/conversations/input_file_content.py +25 -0
  72. agentlin_client/types/conversations/input_file_content_param.py +25 -0
  73. agentlin_client/types/conversations/input_image_content.py +28 -0
  74. agentlin_client/types/conversations/input_image_content_param.py +28 -0
  75. agentlin_client/types/conversations/input_item.py +209 -0
  76. agentlin_client/types/conversations/input_item_param.py +203 -0
  77. agentlin_client/types/conversations/input_message.py +30 -0
  78. agentlin_client/types/conversations/input_message_param.py +31 -0
  79. agentlin_client/types/conversations/input_text_content.py +15 -0
  80. agentlin_client/types/conversations/input_text_content_param.py +15 -0
  81. agentlin_client/types/conversations/item_create_params.py +24 -0
  82. agentlin_client/types/conversations/item_list_params.py +50 -0
  83. agentlin_client/types/conversations/item_retrieve_params.py +22 -0
  84. agentlin_client/types/conversations/local_shell_tool_call.py +45 -0
  85. agentlin_client/types/conversations/local_shell_tool_call_output.py +22 -0
  86. agentlin_client/types/conversations/local_shell_tool_call_output_param.py +22 -0
  87. agentlin_client/types/conversations/local_shell_tool_call_param.py +47 -0
  88. agentlin_client/types/conversations/mcp_approval_request.py +24 -0
  89. agentlin_client/types/conversations/mcp_approval_request_param.py +24 -0
  90. agentlin_client/types/conversations/mcp_approval_response_resource.py +25 -0
  91. agentlin_client/types/conversations/mcp_list_tools.py +39 -0
  92. agentlin_client/types/conversations/mcp_list_tools_param.py +39 -0
  93. agentlin_client/types/conversations/mcp_tool_call.py +44 -0
  94. agentlin_client/types/conversations/mcp_tool_call_param.py +44 -0
  95. agentlin_client/types/conversations/output_message.py +34 -0
  96. agentlin_client/types/conversations/output_message_param.py +34 -0
  97. agentlin_client/types/conversations/output_text_content.py +117 -0
  98. agentlin_client/types/conversations/output_text_content_param.py +115 -0
  99. agentlin_client/types/conversations/reasoning_item.py +44 -0
  100. agentlin_client/types/conversations/reasoning_item_param.py +45 -0
  101. agentlin_client/types/conversations/reasoning_text_content.py +15 -0
  102. agentlin_client/types/conversations/reasoning_text_content_param.py +15 -0
  103. agentlin_client/types/conversations/refusal_content.py +15 -0
  104. agentlin_client/types/conversations/refusal_content_param.py +15 -0
  105. agentlin_client/types/conversations/web_search_tool_call.py +67 -0
  106. agentlin_client/types/conversations/web_search_tool_call_param.py +66 -0
  107. agentlin_client/types/mcp_tool_filter.py +20 -0
  108. agentlin_client/types/mcp_tool_filter_param.py +22 -0
  109. agentlin_client/types/model_response_properties_standard.py +87 -0
  110. agentlin_client/types/response.py +166 -0
  111. agentlin_client/types/response_create_params.py +497 -0
  112. agentlin_client/types/response_list_input_items_params.py +34 -0
  113. agentlin_client/types/response_list_input_items_response.py +70 -0
  114. agentlin_client/types/response_properties.py +328 -0
  115. agentlin_client/types/response_retrieve_params.py +42 -0
  116. agentlin_client/types/response_tool.py +495 -0
  117. agentlin_client/types/response_tool_param.py +491 -0
  118. agentlin_client/types/text_response_format_configuration.py +59 -0
  119. agentlin_client/types/text_response_format_configuration_param.py +54 -0
  120. agentlin_client-0.1.0.dist-info/METADATA +429 -0
  121. agentlin_client-0.1.0.dist-info/RECORD +123 -0
  122. agentlin_client-0.1.0.dist-info/WHEEL +4 -0
  123. agentlin_client-0.1.0.dist-info/licenses/LICENSE +7 -0
@@ -0,0 +1,558 @@
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 Any, List, Iterable, cast
6
+ from typing_extensions import Literal
7
+
8
+ import httpx
9
+
10
+ from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
11
+ from ..._utils import maybe_transform, async_maybe_transform
12
+ from ..._compat import cached_property
13
+ from ..._resource import SyncAPIResource, AsyncAPIResource
14
+ from ..._response import (
15
+ to_raw_response_wrapper,
16
+ to_streamed_response_wrapper,
17
+ async_to_raw_response_wrapper,
18
+ async_to_streamed_response_wrapper,
19
+ )
20
+ from ..._base_client import make_request_options
21
+ from ...types.conversations import item_list_params, item_create_params, item_retrieve_params
22
+ from ...types.conversations.includable import Includable
23
+ from ...types.conversations.input_item_param import InputItemParam
24
+ from ...types.conversations.conversation_item import ConversationItem
25
+ from ...types.conversations.conversation_resource import ConversationResource
26
+ from ...types.conversations.conversation_item_list import ConversationItemList
27
+
28
+ __all__ = ["ItemsResource", "AsyncItemsResource"]
29
+
30
+
31
+ class ItemsResource(SyncAPIResource):
32
+ @cached_property
33
+ def with_raw_response(self) -> ItemsResourceWithRawResponse:
34
+ """
35
+ This property can be used as a prefix for any HTTP method call to return
36
+ the raw response object instead of the parsed content.
37
+
38
+ For more information, see https://www.github.com/LinXueyuanStdio/agentlin-client-python#accessing-raw-response-data-eg-headers
39
+ """
40
+ return ItemsResourceWithRawResponse(self)
41
+
42
+ @cached_property
43
+ def with_streaming_response(self) -> ItemsResourceWithStreamingResponse:
44
+ """
45
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
46
+
47
+ For more information, see https://www.github.com/LinXueyuanStdio/agentlin-client-python#with_streaming_response
48
+ """
49
+ return ItemsResourceWithStreamingResponse(self)
50
+
51
+ def create(
52
+ self,
53
+ conversation_id: str,
54
+ *,
55
+ items: Iterable[InputItemParam],
56
+ include: List[Includable] | Omit = omit,
57
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
58
+ # The extra values given here take precedence over values defined on the client or passed to this method.
59
+ extra_headers: Headers | None = None,
60
+ extra_query: Query | None = None,
61
+ extra_body: Body | None = None,
62
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
63
+ ) -> ConversationItemList:
64
+ """
65
+ Create items in a conversation with the given ID.
66
+
67
+ Args:
68
+ items: The items to add to the conversation. You may add up to 20 items at a time.
69
+
70
+ include: Additional fields to include in the response. See the `include` parameter for
71
+ [listing Conversation items above](https://platform.openai.com/docs/api-reference/conversations/list-items#conversations_list_items-include)
72
+ for more information.
73
+
74
+ extra_headers: Send extra headers
75
+
76
+ extra_query: Add additional query parameters to the request
77
+
78
+ extra_body: Add additional JSON properties to the request
79
+
80
+ timeout: Override the client-level default timeout for this request, in seconds
81
+ """
82
+ if not conversation_id:
83
+ raise ValueError(f"Expected a non-empty value for `conversation_id` but received {conversation_id!r}")
84
+ return self._post(
85
+ f"/conversations/{conversation_id}/items",
86
+ body=maybe_transform({"items": items}, item_create_params.ItemCreateParams),
87
+ options=make_request_options(
88
+ extra_headers=extra_headers,
89
+ extra_query=extra_query,
90
+ extra_body=extra_body,
91
+ timeout=timeout,
92
+ query=maybe_transform({"include": include}, item_create_params.ItemCreateParams),
93
+ ),
94
+ cast_to=ConversationItemList,
95
+ )
96
+
97
+ def retrieve(
98
+ self,
99
+ item_id: str,
100
+ *,
101
+ conversation_id: str,
102
+ include: List[Includable] | Omit = omit,
103
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
104
+ # The extra values given here take precedence over values defined on the client or passed to this method.
105
+ extra_headers: Headers | None = None,
106
+ extra_query: Query | None = None,
107
+ extra_body: Body | None = None,
108
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
109
+ ) -> ConversationItem:
110
+ """
111
+ Get a single item from a conversation with the given IDs.
112
+
113
+ Args:
114
+ include: Additional fields to include in the response. See the `include` parameter for
115
+ [listing Conversation items above](https://platform.openai.com/docs/api-reference/conversations/list-items#conversations_list_items-include)
116
+ for more information.
117
+
118
+ extra_headers: Send extra headers
119
+
120
+ extra_query: Add additional query parameters to the request
121
+
122
+ extra_body: Add additional JSON properties to the request
123
+
124
+ timeout: Override the client-level default timeout for this request, in seconds
125
+ """
126
+ if not conversation_id:
127
+ raise ValueError(f"Expected a non-empty value for `conversation_id` but received {conversation_id!r}")
128
+ if not item_id:
129
+ raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}")
130
+ return cast(
131
+ ConversationItem,
132
+ self._get(
133
+ f"/conversations/{conversation_id}/items/{item_id}",
134
+ options=make_request_options(
135
+ extra_headers=extra_headers,
136
+ extra_query=extra_query,
137
+ extra_body=extra_body,
138
+ timeout=timeout,
139
+ query=maybe_transform({"include": include}, item_retrieve_params.ItemRetrieveParams),
140
+ ),
141
+ cast_to=cast(Any, ConversationItem), # Union types cannot be passed in as arguments in the type system
142
+ ),
143
+ )
144
+
145
+ def list(
146
+ self,
147
+ conversation_id: str,
148
+ *,
149
+ after: str | Omit = omit,
150
+ include: List[Includable] | Omit = omit,
151
+ limit: int | Omit = omit,
152
+ order: Literal["asc", "desc"] | Omit = omit,
153
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
154
+ # The extra values given here take precedence over values defined on the client or passed to this method.
155
+ extra_headers: Headers | None = None,
156
+ extra_query: Query | None = None,
157
+ extra_body: Body | None = None,
158
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
159
+ ) -> ConversationItemList:
160
+ """
161
+ List all items for a conversation with the given ID.
162
+
163
+ Args:
164
+ after: An item ID to list items after, used in pagination.
165
+
166
+ include: Specify additional output data to include in the model response. Currently
167
+ supported values are:
168
+
169
+ - `web_search_call.action.sources`: Include the sources of the web search tool
170
+ call.
171
+ - `code_interpreter_call.outputs`: Includes the outputs of python code execution
172
+ in code interpreter tool call items.
173
+ - `computer_call_output.output.image_url`: Include image urls from the computer
174
+ call output.
175
+ - `file_search_call.results`: Include the search results of the file search tool
176
+ call.
177
+ - `message.input_image.image_url`: Include image urls from the input message.
178
+ - `message.output_text.logprobs`: Include logprobs with assistant messages.
179
+ - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
180
+ tokens in reasoning item outputs. This enables reasoning items to be used in
181
+ multi-turn conversations when using the Responses API statelessly (like when
182
+ the `store` parameter is set to `false`, or when an organization is enrolled
183
+ in the zero data retention program).
184
+
185
+ limit: A limit on the number of objects to be returned. Limit can range between 1 and
186
+ 100, and the default is 20.
187
+
188
+ order: The order to return the input items in. Default is `desc`.
189
+
190
+ - `asc`: Return the input items in ascending order.
191
+ - `desc`: Return the input items in descending order.
192
+
193
+ extra_headers: Send extra headers
194
+
195
+ extra_query: Add additional query parameters to the request
196
+
197
+ extra_body: Add additional JSON properties to the request
198
+
199
+ timeout: Override the client-level default timeout for this request, in seconds
200
+ """
201
+ if not conversation_id:
202
+ raise ValueError(f"Expected a non-empty value for `conversation_id` but received {conversation_id!r}")
203
+ return self._get(
204
+ f"/conversations/{conversation_id}/items",
205
+ options=make_request_options(
206
+ extra_headers=extra_headers,
207
+ extra_query=extra_query,
208
+ extra_body=extra_body,
209
+ timeout=timeout,
210
+ query=maybe_transform(
211
+ {
212
+ "after": after,
213
+ "include": include,
214
+ "limit": limit,
215
+ "order": order,
216
+ },
217
+ item_list_params.ItemListParams,
218
+ ),
219
+ ),
220
+ cast_to=ConversationItemList,
221
+ )
222
+
223
+ def delete(
224
+ self,
225
+ item_id: str,
226
+ *,
227
+ conversation_id: str,
228
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
229
+ # The extra values given here take precedence over values defined on the client or passed to this method.
230
+ extra_headers: Headers | None = None,
231
+ extra_query: Query | None = None,
232
+ extra_body: Body | None = None,
233
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
234
+ ) -> ConversationResource:
235
+ """
236
+ Delete an item from a conversation with the given IDs.
237
+
238
+ Args:
239
+ extra_headers: Send extra headers
240
+
241
+ extra_query: Add additional query parameters to the request
242
+
243
+ extra_body: Add additional JSON properties to the request
244
+
245
+ timeout: Override the client-level default timeout for this request, in seconds
246
+ """
247
+ if not conversation_id:
248
+ raise ValueError(f"Expected a non-empty value for `conversation_id` but received {conversation_id!r}")
249
+ if not item_id:
250
+ raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}")
251
+ return self._delete(
252
+ f"/conversations/{conversation_id}/items/{item_id}",
253
+ options=make_request_options(
254
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
255
+ ),
256
+ cast_to=ConversationResource,
257
+ )
258
+
259
+
260
+ class AsyncItemsResource(AsyncAPIResource):
261
+ @cached_property
262
+ def with_raw_response(self) -> AsyncItemsResourceWithRawResponse:
263
+ """
264
+ This property can be used as a prefix for any HTTP method call to return
265
+ the raw response object instead of the parsed content.
266
+
267
+ For more information, see https://www.github.com/LinXueyuanStdio/agentlin-client-python#accessing-raw-response-data-eg-headers
268
+ """
269
+ return AsyncItemsResourceWithRawResponse(self)
270
+
271
+ @cached_property
272
+ def with_streaming_response(self) -> AsyncItemsResourceWithStreamingResponse:
273
+ """
274
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
275
+
276
+ For more information, see https://www.github.com/LinXueyuanStdio/agentlin-client-python#with_streaming_response
277
+ """
278
+ return AsyncItemsResourceWithStreamingResponse(self)
279
+
280
+ async def create(
281
+ self,
282
+ conversation_id: str,
283
+ *,
284
+ items: Iterable[InputItemParam],
285
+ include: List[Includable] | Omit = omit,
286
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
287
+ # The extra values given here take precedence over values defined on the client or passed to this method.
288
+ extra_headers: Headers | None = None,
289
+ extra_query: Query | None = None,
290
+ extra_body: Body | None = None,
291
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
292
+ ) -> ConversationItemList:
293
+ """
294
+ Create items in a conversation with the given ID.
295
+
296
+ Args:
297
+ items: The items to add to the conversation. You may add up to 20 items at a time.
298
+
299
+ include: Additional fields to include in the response. See the `include` parameter for
300
+ [listing Conversation items above](https://platform.openai.com/docs/api-reference/conversations/list-items#conversations_list_items-include)
301
+ for more information.
302
+
303
+ extra_headers: Send extra headers
304
+
305
+ extra_query: Add additional query parameters to the request
306
+
307
+ extra_body: Add additional JSON properties to the request
308
+
309
+ timeout: Override the client-level default timeout for this request, in seconds
310
+ """
311
+ if not conversation_id:
312
+ raise ValueError(f"Expected a non-empty value for `conversation_id` but received {conversation_id!r}")
313
+ return await self._post(
314
+ f"/conversations/{conversation_id}/items",
315
+ body=await async_maybe_transform({"items": items}, item_create_params.ItemCreateParams),
316
+ options=make_request_options(
317
+ extra_headers=extra_headers,
318
+ extra_query=extra_query,
319
+ extra_body=extra_body,
320
+ timeout=timeout,
321
+ query=await async_maybe_transform({"include": include}, item_create_params.ItemCreateParams),
322
+ ),
323
+ cast_to=ConversationItemList,
324
+ )
325
+
326
+ async def retrieve(
327
+ self,
328
+ item_id: str,
329
+ *,
330
+ conversation_id: str,
331
+ include: List[Includable] | Omit = omit,
332
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
333
+ # The extra values given here take precedence over values defined on the client or passed to this method.
334
+ extra_headers: Headers | None = None,
335
+ extra_query: Query | None = None,
336
+ extra_body: Body | None = None,
337
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
338
+ ) -> ConversationItem:
339
+ """
340
+ Get a single item from a conversation with the given IDs.
341
+
342
+ Args:
343
+ include: Additional fields to include in the response. See the `include` parameter for
344
+ [listing Conversation items above](https://platform.openai.com/docs/api-reference/conversations/list-items#conversations_list_items-include)
345
+ for more information.
346
+
347
+ extra_headers: Send extra headers
348
+
349
+ extra_query: Add additional query parameters to the request
350
+
351
+ extra_body: Add additional JSON properties to the request
352
+
353
+ timeout: Override the client-level default timeout for this request, in seconds
354
+ """
355
+ if not conversation_id:
356
+ raise ValueError(f"Expected a non-empty value for `conversation_id` but received {conversation_id!r}")
357
+ if not item_id:
358
+ raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}")
359
+ return cast(
360
+ ConversationItem,
361
+ await self._get(
362
+ f"/conversations/{conversation_id}/items/{item_id}",
363
+ options=make_request_options(
364
+ extra_headers=extra_headers,
365
+ extra_query=extra_query,
366
+ extra_body=extra_body,
367
+ timeout=timeout,
368
+ query=await async_maybe_transform({"include": include}, item_retrieve_params.ItemRetrieveParams),
369
+ ),
370
+ cast_to=cast(Any, ConversationItem), # Union types cannot be passed in as arguments in the type system
371
+ ),
372
+ )
373
+
374
+ async def list(
375
+ self,
376
+ conversation_id: str,
377
+ *,
378
+ after: str | Omit = omit,
379
+ include: List[Includable] | Omit = omit,
380
+ limit: int | Omit = omit,
381
+ order: Literal["asc", "desc"] | Omit = omit,
382
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
383
+ # The extra values given here take precedence over values defined on the client or passed to this method.
384
+ extra_headers: Headers | None = None,
385
+ extra_query: Query | None = None,
386
+ extra_body: Body | None = None,
387
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
388
+ ) -> ConversationItemList:
389
+ """
390
+ List all items for a conversation with the given ID.
391
+
392
+ Args:
393
+ after: An item ID to list items after, used in pagination.
394
+
395
+ include: Specify additional output data to include in the model response. Currently
396
+ supported values are:
397
+
398
+ - `web_search_call.action.sources`: Include the sources of the web search tool
399
+ call.
400
+ - `code_interpreter_call.outputs`: Includes the outputs of python code execution
401
+ in code interpreter tool call items.
402
+ - `computer_call_output.output.image_url`: Include image urls from the computer
403
+ call output.
404
+ - `file_search_call.results`: Include the search results of the file search tool
405
+ call.
406
+ - `message.input_image.image_url`: Include image urls from the input message.
407
+ - `message.output_text.logprobs`: Include logprobs with assistant messages.
408
+ - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
409
+ tokens in reasoning item outputs. This enables reasoning items to be used in
410
+ multi-turn conversations when using the Responses API statelessly (like when
411
+ the `store` parameter is set to `false`, or when an organization is enrolled
412
+ in the zero data retention program).
413
+
414
+ limit: A limit on the number of objects to be returned. Limit can range between 1 and
415
+ 100, and the default is 20.
416
+
417
+ order: The order to return the input items in. Default is `desc`.
418
+
419
+ - `asc`: Return the input items in ascending order.
420
+ - `desc`: Return the input items in descending order.
421
+
422
+ extra_headers: Send extra headers
423
+
424
+ extra_query: Add additional query parameters to the request
425
+
426
+ extra_body: Add additional JSON properties to the request
427
+
428
+ timeout: Override the client-level default timeout for this request, in seconds
429
+ """
430
+ if not conversation_id:
431
+ raise ValueError(f"Expected a non-empty value for `conversation_id` but received {conversation_id!r}")
432
+ return await self._get(
433
+ f"/conversations/{conversation_id}/items",
434
+ options=make_request_options(
435
+ extra_headers=extra_headers,
436
+ extra_query=extra_query,
437
+ extra_body=extra_body,
438
+ timeout=timeout,
439
+ query=await async_maybe_transform(
440
+ {
441
+ "after": after,
442
+ "include": include,
443
+ "limit": limit,
444
+ "order": order,
445
+ },
446
+ item_list_params.ItemListParams,
447
+ ),
448
+ ),
449
+ cast_to=ConversationItemList,
450
+ )
451
+
452
+ async def delete(
453
+ self,
454
+ item_id: str,
455
+ *,
456
+ conversation_id: str,
457
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
458
+ # The extra values given here take precedence over values defined on the client or passed to this method.
459
+ extra_headers: Headers | None = None,
460
+ extra_query: Query | None = None,
461
+ extra_body: Body | None = None,
462
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
463
+ ) -> ConversationResource:
464
+ """
465
+ Delete an item from a conversation with the given IDs.
466
+
467
+ Args:
468
+ extra_headers: Send extra headers
469
+
470
+ extra_query: Add additional query parameters to the request
471
+
472
+ extra_body: Add additional JSON properties to the request
473
+
474
+ timeout: Override the client-level default timeout for this request, in seconds
475
+ """
476
+ if not conversation_id:
477
+ raise ValueError(f"Expected a non-empty value for `conversation_id` but received {conversation_id!r}")
478
+ if not item_id:
479
+ raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}")
480
+ return await self._delete(
481
+ f"/conversations/{conversation_id}/items/{item_id}",
482
+ options=make_request_options(
483
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
484
+ ),
485
+ cast_to=ConversationResource,
486
+ )
487
+
488
+
489
+ class ItemsResourceWithRawResponse:
490
+ def __init__(self, items: ItemsResource) -> None:
491
+ self._items = items
492
+
493
+ self.create = to_raw_response_wrapper(
494
+ items.create,
495
+ )
496
+ self.retrieve = to_raw_response_wrapper(
497
+ items.retrieve,
498
+ )
499
+ self.list = to_raw_response_wrapper(
500
+ items.list,
501
+ )
502
+ self.delete = to_raw_response_wrapper(
503
+ items.delete,
504
+ )
505
+
506
+
507
+ class AsyncItemsResourceWithRawResponse:
508
+ def __init__(self, items: AsyncItemsResource) -> None:
509
+ self._items = items
510
+
511
+ self.create = async_to_raw_response_wrapper(
512
+ items.create,
513
+ )
514
+ self.retrieve = async_to_raw_response_wrapper(
515
+ items.retrieve,
516
+ )
517
+ self.list = async_to_raw_response_wrapper(
518
+ items.list,
519
+ )
520
+ self.delete = async_to_raw_response_wrapper(
521
+ items.delete,
522
+ )
523
+
524
+
525
+ class ItemsResourceWithStreamingResponse:
526
+ def __init__(self, items: ItemsResource) -> None:
527
+ self._items = items
528
+
529
+ self.create = to_streamed_response_wrapper(
530
+ items.create,
531
+ )
532
+ self.retrieve = to_streamed_response_wrapper(
533
+ items.retrieve,
534
+ )
535
+ self.list = to_streamed_response_wrapper(
536
+ items.list,
537
+ )
538
+ self.delete = to_streamed_response_wrapper(
539
+ items.delete,
540
+ )
541
+
542
+
543
+ class AsyncItemsResourceWithStreamingResponse:
544
+ def __init__(self, items: AsyncItemsResource) -> None:
545
+ self._items = items
546
+
547
+ self.create = async_to_streamed_response_wrapper(
548
+ items.create,
549
+ )
550
+ self.retrieve = async_to_streamed_response_wrapper(
551
+ items.retrieve,
552
+ )
553
+ self.list = async_to_streamed_response_wrapper(
554
+ items.list,
555
+ )
556
+ self.delete = async_to_streamed_response_wrapper(
557
+ items.delete,
558
+ )