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,497 @@
|
|
|
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, List, Union, Iterable, Optional
|
|
6
|
+
from typing_extensions import Literal, Required, TypeAlias, TypedDict
|
|
7
|
+
|
|
8
|
+
from .response_tool_param import ResponseToolParam
|
|
9
|
+
from .conversations.includable import Includable
|
|
10
|
+
from .conversations.input_item_param import InputItemParam
|
|
11
|
+
from .conversations.input_file_content_param import InputFileContentParam
|
|
12
|
+
from .conversations.input_text_content_param import InputTextContentParam
|
|
13
|
+
from .conversations.input_image_content_param import InputImageContentParam
|
|
14
|
+
from .text_response_format_configuration_param import TextResponseFormatConfigurationParam
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"ResponseCreateParams",
|
|
18
|
+
"Conversation",
|
|
19
|
+
"ConversationConversationParam",
|
|
20
|
+
"Prompt",
|
|
21
|
+
"PromptVariables",
|
|
22
|
+
"Reasoning",
|
|
23
|
+
"StreamOptions",
|
|
24
|
+
"Text",
|
|
25
|
+
"ToolChoice",
|
|
26
|
+
"ToolChoiceToolChoiceOptions",
|
|
27
|
+
"ToolChoiceAllowedTools",
|
|
28
|
+
"ToolChoiceToolChoiceTypes",
|
|
29
|
+
"ToolChoiceFunction",
|
|
30
|
+
"ToolChoiceMcp",
|
|
31
|
+
"ToolChoiceCustom",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class ResponseCreateParams(TypedDict, total=False):
|
|
36
|
+
background: Optional[bool]
|
|
37
|
+
"""
|
|
38
|
+
Whether to run the model response in the background.
|
|
39
|
+
[Learn more](https://platform.openai.com/docs/guides/background).
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
conversation: Optional[Conversation]
|
|
43
|
+
"""The conversation that this response belongs to.
|
|
44
|
+
|
|
45
|
+
Items from this conversation are prepended to `input_items` for this response
|
|
46
|
+
request. Input items and output items from this response are automatically added
|
|
47
|
+
to this conversation after this response completes.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
include: Optional[List[Includable]]
|
|
51
|
+
"""Specify additional output data to include in the model response.
|
|
52
|
+
|
|
53
|
+
Currently supported values are:
|
|
54
|
+
|
|
55
|
+
- `web_search_call.action.sources`: Include the sources of the web search tool
|
|
56
|
+
call.
|
|
57
|
+
- `code_interpreter_call.outputs`: Includes the outputs of python code execution
|
|
58
|
+
in code interpreter tool call items.
|
|
59
|
+
- `computer_call_output.output.image_url`: Include image urls from the computer
|
|
60
|
+
call output.
|
|
61
|
+
- `file_search_call.results`: Include the search results of the file search tool
|
|
62
|
+
call.
|
|
63
|
+
- `message.input_image.image_url`: Include image urls from the input message.
|
|
64
|
+
- `message.output_text.logprobs`: Include logprobs with assistant messages.
|
|
65
|
+
- `reasoning.encrypted_content`: Includes an encrypted version of reasoning
|
|
66
|
+
tokens in reasoning item outputs. This enables reasoning items to be used in
|
|
67
|
+
multi-turn conversations when using the Responses API statelessly (like when
|
|
68
|
+
the `store` parameter is set to `false`, or when an organization is enrolled
|
|
69
|
+
in the zero data retention program).
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
input: Union[str, Iterable[InputItemParam]]
|
|
73
|
+
"""Text, image, or file inputs to the model, used to generate a response.
|
|
74
|
+
|
|
75
|
+
Learn more:
|
|
76
|
+
|
|
77
|
+
- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
|
|
78
|
+
- [Image inputs](https://platform.openai.com/docs/guides/images)
|
|
79
|
+
- [File inputs](https://platform.openai.com/docs/guides/pdf-files)
|
|
80
|
+
- [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
|
|
81
|
+
- [Function calling](https://platform.openai.com/docs/guides/function-calling)
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
instructions: Optional[str]
|
|
85
|
+
"""A system (or developer) message inserted into the model's context.
|
|
86
|
+
|
|
87
|
+
When using along with `previous_response_id`, the instructions from a previous
|
|
88
|
+
response will not be carried over to the next response. This makes it simple to
|
|
89
|
+
swap out system (or developer) messages in new responses.
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
max_output_tokens: Optional[int]
|
|
93
|
+
"""
|
|
94
|
+
An upper bound for the number of tokens that can be generated for a response,
|
|
95
|
+
including visible output tokens and
|
|
96
|
+
[reasoning tokens](https://platform.openai.com/docs/guides/reasoning).
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
max_tool_calls: Optional[int]
|
|
100
|
+
"""
|
|
101
|
+
The maximum number of total calls to built-in tools that can be processed in a
|
|
102
|
+
response. This maximum number applies across all built-in tool calls, not per
|
|
103
|
+
individual tool. Any further attempts to call a tool by the model will be
|
|
104
|
+
ignored.
|
|
105
|
+
"""
|
|
106
|
+
|
|
107
|
+
metadata: Optional[Dict[str, str]]
|
|
108
|
+
"""Set of 16 key-value pairs that can be attached to an object.
|
|
109
|
+
|
|
110
|
+
This can be useful for storing additional information about the object in a
|
|
111
|
+
structured format, and querying for objects via API or the dashboard.
|
|
112
|
+
|
|
113
|
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
|
114
|
+
a maximum length of 512 characters.
|
|
115
|
+
"""
|
|
116
|
+
|
|
117
|
+
model: Literal[
|
|
118
|
+
"o1-pro",
|
|
119
|
+
"o1-pro-2025-03-19",
|
|
120
|
+
"o3-pro",
|
|
121
|
+
"o3-pro-2025-06-10",
|
|
122
|
+
"o3-deep-research",
|
|
123
|
+
"o3-deep-research-2025-06-26",
|
|
124
|
+
"o4-mini-deep-research",
|
|
125
|
+
"o4-mini-deep-research-2025-06-26",
|
|
126
|
+
"computer-use-preview",
|
|
127
|
+
"computer-use-preview-2025-03-11",
|
|
128
|
+
"gpt-5-codex",
|
|
129
|
+
"gpt-5-pro",
|
|
130
|
+
"gpt-5-pro-2025-10-06",
|
|
131
|
+
]
|
|
132
|
+
"""Model ID used to generate the response, like `gpt-4o` or `o3`.
|
|
133
|
+
|
|
134
|
+
OpenAI offers a wide range of models with different capabilities, performance
|
|
135
|
+
characteristics, and price points. Refer to the
|
|
136
|
+
[model guide](https://platform.openai.com/docs/models) to browse and compare
|
|
137
|
+
available models.
|
|
138
|
+
"""
|
|
139
|
+
|
|
140
|
+
parallel_tool_calls: Optional[bool]
|
|
141
|
+
"""Whether to allow the model to run tool calls in parallel."""
|
|
142
|
+
|
|
143
|
+
previous_response_id: Optional[str]
|
|
144
|
+
"""The unique ID of the previous response to the model.
|
|
145
|
+
|
|
146
|
+
Use this to create multi-turn conversations. Learn more about
|
|
147
|
+
[conversation state](https://platform.openai.com/docs/guides/conversation-state).
|
|
148
|
+
Cannot be used in conjunction with `conversation`.
|
|
149
|
+
"""
|
|
150
|
+
|
|
151
|
+
prompt: Optional[Prompt]
|
|
152
|
+
"""
|
|
153
|
+
Reference to a prompt template and its variables.
|
|
154
|
+
[Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
|
|
155
|
+
"""
|
|
156
|
+
|
|
157
|
+
prompt_cache_key: str
|
|
158
|
+
"""
|
|
159
|
+
Used by OpenAI to cache responses for similar requests to optimize your cache
|
|
160
|
+
hit rates. Replaces the `user` field.
|
|
161
|
+
[Learn more](https://platform.openai.com/docs/guides/prompt-caching).
|
|
162
|
+
"""
|
|
163
|
+
|
|
164
|
+
reasoning: Optional[Reasoning]
|
|
165
|
+
"""**gpt-5 and o-series models only**
|
|
166
|
+
|
|
167
|
+
Configuration options for
|
|
168
|
+
[reasoning models](https://platform.openai.com/docs/guides/reasoning).
|
|
169
|
+
"""
|
|
170
|
+
|
|
171
|
+
safety_identifier: str
|
|
172
|
+
"""
|
|
173
|
+
A stable identifier used to help detect users of your application that may be
|
|
174
|
+
violating OpenAI's usage policies. The IDs should be a string that uniquely
|
|
175
|
+
identifies each user. We recommend hashing their username or email address, in
|
|
176
|
+
order to avoid sending us any identifying information.
|
|
177
|
+
[Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
|
|
178
|
+
"""
|
|
179
|
+
|
|
180
|
+
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]]
|
|
181
|
+
"""Specifies the processing type used for serving the request.
|
|
182
|
+
|
|
183
|
+
- If set to 'auto', then the request will be processed with the service tier
|
|
184
|
+
configured in the Project settings. Unless otherwise configured, the Project
|
|
185
|
+
will use 'default'.
|
|
186
|
+
- If set to 'default', then the request will be processed with the standard
|
|
187
|
+
pricing and performance for the selected model.
|
|
188
|
+
- If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
|
|
189
|
+
'[priority](https://openai.com/api-priority-processing/)', then the request
|
|
190
|
+
will be processed with the corresponding service tier.
|
|
191
|
+
- When not set, the default behavior is 'auto'.
|
|
192
|
+
|
|
193
|
+
When the `service_tier` parameter is set, the response body will include the
|
|
194
|
+
`service_tier` value based on the processing mode actually used to serve the
|
|
195
|
+
request. This response value may be different from the value set in the
|
|
196
|
+
parameter.
|
|
197
|
+
"""
|
|
198
|
+
|
|
199
|
+
store: Optional[bool]
|
|
200
|
+
"""Whether to store the generated model response for later retrieval via API."""
|
|
201
|
+
|
|
202
|
+
stream: Optional[bool]
|
|
203
|
+
"""
|
|
204
|
+
If set to true, the model response data will be streamed to the client as it is
|
|
205
|
+
generated using
|
|
206
|
+
[server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
|
|
207
|
+
See the
|
|
208
|
+
[Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming)
|
|
209
|
+
for more information.
|
|
210
|
+
"""
|
|
211
|
+
|
|
212
|
+
stream_options: Optional[StreamOptions]
|
|
213
|
+
"""Options for streaming responses. Only set this when you set `stream: true`."""
|
|
214
|
+
|
|
215
|
+
temperature: Optional[float]
|
|
216
|
+
"""What sampling temperature to use, between 0 and 2.
|
|
217
|
+
|
|
218
|
+
Higher values like 0.8 will make the output more random, while lower values like
|
|
219
|
+
0.2 will make it more focused and deterministic. We generally recommend altering
|
|
220
|
+
this or `top_p` but not both.
|
|
221
|
+
"""
|
|
222
|
+
|
|
223
|
+
text: Text
|
|
224
|
+
"""Configuration options for a text response from the model.
|
|
225
|
+
|
|
226
|
+
Can be plain text or structured JSON data. Learn more:
|
|
227
|
+
|
|
228
|
+
- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
|
|
229
|
+
- [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
|
|
230
|
+
"""
|
|
231
|
+
|
|
232
|
+
tool_choice: ToolChoice
|
|
233
|
+
"""
|
|
234
|
+
How the model should select which tool (or tools) to use when generating a
|
|
235
|
+
response. See the `tools` parameter to see how to specify which tools the model
|
|
236
|
+
can call.
|
|
237
|
+
"""
|
|
238
|
+
|
|
239
|
+
tools: Iterable[ResponseToolParam]
|
|
240
|
+
"""An array of tools the model may call while generating a response.
|
|
241
|
+
|
|
242
|
+
You can specify which tool to use by setting the `tool_choice` parameter.
|
|
243
|
+
|
|
244
|
+
We support the following categories of tools:
|
|
245
|
+
|
|
246
|
+
- **Built-in tools**: Tools that are provided by OpenAI that extend the model's
|
|
247
|
+
capabilities, like
|
|
248
|
+
[web search](https://platform.openai.com/docs/guides/tools-web-search) or
|
|
249
|
+
[file search](https://platform.openai.com/docs/guides/tools-file-search).
|
|
250
|
+
Learn more about
|
|
251
|
+
[built-in tools](https://platform.openai.com/docs/guides/tools).
|
|
252
|
+
- **MCP Tools**: Integrations with third-party systems via custom MCP servers or
|
|
253
|
+
predefined connectors such as Google Drive and SharePoint. Learn more about
|
|
254
|
+
[MCP Tools](https://platform.openai.com/docs/guides/tools-connectors-mcp).
|
|
255
|
+
- **Function calls (custom tools)**: Functions that are defined by you, enabling
|
|
256
|
+
the model to call your own code with strongly typed arguments and outputs.
|
|
257
|
+
Learn more about
|
|
258
|
+
[function calling](https://platform.openai.com/docs/guides/function-calling).
|
|
259
|
+
You can also use custom tools to call your own code.
|
|
260
|
+
"""
|
|
261
|
+
|
|
262
|
+
top_logprobs: Optional[int]
|
|
263
|
+
"""
|
|
264
|
+
An integer between 0 and 20 specifying the number of most likely tokens to
|
|
265
|
+
return at each token position, each with an associated log probability.
|
|
266
|
+
"""
|
|
267
|
+
|
|
268
|
+
top_p: Optional[float]
|
|
269
|
+
"""
|
|
270
|
+
An alternative to sampling with temperature, called nucleus sampling, where the
|
|
271
|
+
model considers the results of the tokens with top_p probability mass. So 0.1
|
|
272
|
+
means only the tokens comprising the top 10% probability mass are considered.
|
|
273
|
+
|
|
274
|
+
We generally recommend altering this or `temperature` but not both.
|
|
275
|
+
"""
|
|
276
|
+
|
|
277
|
+
truncation: Optional[Literal["auto", "disabled"]]
|
|
278
|
+
"""The truncation strategy to use for the model response.
|
|
279
|
+
|
|
280
|
+
- `auto`: If the input to this Response exceeds the model's context window size,
|
|
281
|
+
the model will truncate the response to fit the context window by dropping
|
|
282
|
+
items from the beginning of the conversation.
|
|
283
|
+
- `disabled` (default): If the input size will exceed the context window size
|
|
284
|
+
for a model, the request will fail with a 400 error.
|
|
285
|
+
"""
|
|
286
|
+
|
|
287
|
+
user: str
|
|
288
|
+
"""This field is being replaced by `safety_identifier` and `prompt_cache_key`.
|
|
289
|
+
|
|
290
|
+
Use `prompt_cache_key` instead to maintain caching optimizations. A stable
|
|
291
|
+
identifier for your end-users. Used to boost cache hit rates by better bucketing
|
|
292
|
+
similar requests and to help OpenAI detect and prevent abuse.
|
|
293
|
+
[Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
|
|
294
|
+
"""
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
class ConversationConversationParam(TypedDict, total=False):
|
|
298
|
+
id: Required[str]
|
|
299
|
+
"""The unique ID of the conversation."""
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
Conversation: TypeAlias = Union[str, ConversationConversationParam]
|
|
303
|
+
|
|
304
|
+
PromptVariables: TypeAlias = Union[str, InputTextContentParam, InputImageContentParam, InputFileContentParam]
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
class Prompt(TypedDict, total=False):
|
|
308
|
+
id: Required[str]
|
|
309
|
+
"""The unique identifier of the prompt template to use."""
|
|
310
|
+
|
|
311
|
+
variables: Optional[Dict[str, PromptVariables]]
|
|
312
|
+
"""Optional map of values to substitute in for variables in your prompt.
|
|
313
|
+
|
|
314
|
+
The substitution values can either be strings, or other Response input types
|
|
315
|
+
like images or files.
|
|
316
|
+
"""
|
|
317
|
+
|
|
318
|
+
version: Optional[str]
|
|
319
|
+
"""Optional version of the prompt template."""
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
class Reasoning(TypedDict, total=False):
|
|
323
|
+
effort: Optional[Literal["minimal", "low", "medium", "high"]]
|
|
324
|
+
"""
|
|
325
|
+
Constrains effort on reasoning for
|
|
326
|
+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
|
327
|
+
supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
|
328
|
+
effort can result in faster responses and fewer tokens used on reasoning in a
|
|
329
|
+
response.
|
|
330
|
+
|
|
331
|
+
Note: The `gpt-5-pro` model defaults to (and only supports) `high` reasoning
|
|
332
|
+
effort.
|
|
333
|
+
"""
|
|
334
|
+
|
|
335
|
+
generate_summary: Optional[Literal["auto", "concise", "detailed"]]
|
|
336
|
+
"""**Deprecated:** use `summary` instead.
|
|
337
|
+
|
|
338
|
+
A summary of the reasoning performed by the model. This can be useful for
|
|
339
|
+
debugging and understanding the model's reasoning process. One of `auto`,
|
|
340
|
+
`concise`, or `detailed`.
|
|
341
|
+
"""
|
|
342
|
+
|
|
343
|
+
summary: Optional[Literal["auto", "concise", "detailed"]]
|
|
344
|
+
"""A summary of the reasoning performed by the model.
|
|
345
|
+
|
|
346
|
+
This can be useful for debugging and understanding the model's reasoning
|
|
347
|
+
process. One of `auto`, `concise`, or `detailed`.
|
|
348
|
+
"""
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
class StreamOptions(TypedDict, total=False):
|
|
352
|
+
include_obfuscation: bool
|
|
353
|
+
"""When true, stream obfuscation will be enabled.
|
|
354
|
+
|
|
355
|
+
Stream obfuscation adds random characters to an `obfuscation` field on streaming
|
|
356
|
+
delta events to normalize payload sizes as a mitigation to certain side-channel
|
|
357
|
+
attacks. These obfuscation fields are included by default, but add a small
|
|
358
|
+
amount of overhead to the data stream. You can set `include_obfuscation` to
|
|
359
|
+
false to optimize for bandwidth if you trust the network links between your
|
|
360
|
+
application and the OpenAI API.
|
|
361
|
+
"""
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
class Text(TypedDict, total=False):
|
|
365
|
+
format: TextResponseFormatConfigurationParam
|
|
366
|
+
"""An object specifying the format that the model must output.
|
|
367
|
+
|
|
368
|
+
Configuring `{ "type": "json_schema" }` enables Structured Outputs, which
|
|
369
|
+
ensures the model will match your supplied JSON schema. Learn more in the
|
|
370
|
+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
|
|
371
|
+
|
|
372
|
+
The default format is `{ "type": "text" }` with no additional options.
|
|
373
|
+
|
|
374
|
+
**Not recommended for gpt-4o and newer models:**
|
|
375
|
+
|
|
376
|
+
Setting to `{ "type": "json_object" }` enables the older JSON mode, which
|
|
377
|
+
ensures the message the model generates is valid JSON. Using `json_schema` is
|
|
378
|
+
preferred for models that support it.
|
|
379
|
+
"""
|
|
380
|
+
|
|
381
|
+
verbosity: Optional[Literal["low", "medium", "high"]]
|
|
382
|
+
"""Constrains the verbosity of the model's response.
|
|
383
|
+
|
|
384
|
+
Lower values will result in more concise responses, while higher values will
|
|
385
|
+
result in more verbose responses. Currently supported values are `low`,
|
|
386
|
+
`medium`, and `high`.
|
|
387
|
+
"""
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
class ToolChoiceToolChoiceOptions(TypedDict, total=False):
|
|
391
|
+
type: Required[Literal["none", "auto", "required"]]
|
|
392
|
+
"""Controls which (if any) tool is called by the model.
|
|
393
|
+
|
|
394
|
+
`none` means the model will not call any tool and instead generates a message.
|
|
395
|
+
|
|
396
|
+
`auto` means the model can pick between generating a message or calling one or
|
|
397
|
+
more tools.
|
|
398
|
+
|
|
399
|
+
`required` means the model must call one or more tools.
|
|
400
|
+
|
|
401
|
+
Allowed values are:
|
|
402
|
+
|
|
403
|
+
- `none`
|
|
404
|
+
- `auto`
|
|
405
|
+
- `required`
|
|
406
|
+
"""
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
class ToolChoiceAllowedTools(TypedDict, total=False):
|
|
410
|
+
mode: Required[Literal["auto", "required"]]
|
|
411
|
+
"""Constrains the tools available to the model to a pre-defined set.
|
|
412
|
+
|
|
413
|
+
`auto` allows the model to pick from among the allowed tools and generate a
|
|
414
|
+
message.
|
|
415
|
+
|
|
416
|
+
`required` requires the model to call one or more of the allowed tools.
|
|
417
|
+
"""
|
|
418
|
+
|
|
419
|
+
tools: Required[Iterable[Dict[str, object]]]
|
|
420
|
+
"""A list of tool definitions that the model should be allowed to call.
|
|
421
|
+
|
|
422
|
+
For the Responses API, the list of tool definitions might look like:
|
|
423
|
+
|
|
424
|
+
```json
|
|
425
|
+
[
|
|
426
|
+
{ "type": "function", "name": "get_weather" },
|
|
427
|
+
{ "type": "mcp", "server_label": "deepwiki" },
|
|
428
|
+
{ "type": "image_generation" }
|
|
429
|
+
]
|
|
430
|
+
```
|
|
431
|
+
"""
|
|
432
|
+
|
|
433
|
+
type: Required[Literal["allowed_tools"]]
|
|
434
|
+
"""Allowed tool configuration type. Always `allowed_tools`."""
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
class ToolChoiceToolChoiceTypes(TypedDict, total=False):
|
|
438
|
+
type: Required[
|
|
439
|
+
Literal[
|
|
440
|
+
"file_search",
|
|
441
|
+
"web_search_preview",
|
|
442
|
+
"computer_use_preview",
|
|
443
|
+
"web_search_preview_2025_03_11",
|
|
444
|
+
"image_generation",
|
|
445
|
+
"code_interpreter",
|
|
446
|
+
]
|
|
447
|
+
]
|
|
448
|
+
"""The type of hosted tool the model should to use.
|
|
449
|
+
|
|
450
|
+
Learn more about
|
|
451
|
+
[built-in tools](https://platform.openai.com/docs/guides/tools).
|
|
452
|
+
|
|
453
|
+
Allowed values are:
|
|
454
|
+
|
|
455
|
+
- `file_search`
|
|
456
|
+
- `web_search_preview`
|
|
457
|
+
- `computer_use_preview`
|
|
458
|
+
- `code_interpreter`
|
|
459
|
+
- `image_generation`
|
|
460
|
+
"""
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
class ToolChoiceFunction(TypedDict, total=False):
|
|
464
|
+
name: Required[str]
|
|
465
|
+
"""The name of the function to call."""
|
|
466
|
+
|
|
467
|
+
type: Required[Literal["function"]]
|
|
468
|
+
"""For function calling, the type is always `function`."""
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
class ToolChoiceMcp(TypedDict, total=False):
|
|
472
|
+
server_label: Required[str]
|
|
473
|
+
"""The label of the MCP server to use."""
|
|
474
|
+
|
|
475
|
+
type: Required[Literal["mcp"]]
|
|
476
|
+
"""For MCP tools, the type is always `mcp`."""
|
|
477
|
+
|
|
478
|
+
name: Optional[str]
|
|
479
|
+
"""The name of the tool to call on the server."""
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
class ToolChoiceCustom(TypedDict, total=False):
|
|
483
|
+
name: Required[str]
|
|
484
|
+
"""The name of the custom tool to call."""
|
|
485
|
+
|
|
486
|
+
type: Required[Literal["custom"]]
|
|
487
|
+
"""For custom tool calling, the type is always `custom`."""
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
ToolChoice: TypeAlias = Union[
|
|
491
|
+
ToolChoiceToolChoiceOptions,
|
|
492
|
+
ToolChoiceAllowedTools,
|
|
493
|
+
ToolChoiceToolChoiceTypes,
|
|
494
|
+
ToolChoiceFunction,
|
|
495
|
+
ToolChoiceMcp,
|
|
496
|
+
ToolChoiceCustom,
|
|
497
|
+
]
|
|
@@ -0,0 +1,34 @@
|
|
|
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 List
|
|
6
|
+
from typing_extensions import Literal, TypedDict
|
|
7
|
+
|
|
8
|
+
from .conversations.includable import Includable
|
|
9
|
+
|
|
10
|
+
__all__ = ["ResponseListInputItemsParams"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ResponseListInputItemsParams(TypedDict, total=False):
|
|
14
|
+
after: str
|
|
15
|
+
"""An item ID to list items after, used in pagination."""
|
|
16
|
+
|
|
17
|
+
include: List[Includable]
|
|
18
|
+
"""Additional fields to include in the response.
|
|
19
|
+
|
|
20
|
+
See the `include` parameter for Response creation above for more information.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
limit: int
|
|
24
|
+
"""A limit on the number of objects to be returned.
|
|
25
|
+
|
|
26
|
+
Limit can range between 1 and 100, and the default is 20.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
order: Literal["asc", "desc"]
|
|
30
|
+
"""The order to return the input items in. Default is `desc`.
|
|
31
|
+
|
|
32
|
+
- `asc`: Return the input items in ascending order.
|
|
33
|
+
- `desc`: Return the input items in descending order.
|
|
34
|
+
"""
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List, Union
|
|
4
|
+
from typing_extensions import Literal, Annotated, TypeAlias
|
|
5
|
+
|
|
6
|
+
from .._utils import PropertyInfo
|
|
7
|
+
from .._models import BaseModel
|
|
8
|
+
from .conversations.input_message import InputMessage
|
|
9
|
+
from .conversations.mcp_tool_call import McpToolCall
|
|
10
|
+
from .conversations.mcp_list_tools import McpListTools
|
|
11
|
+
from .conversations.output_message import OutputMessage
|
|
12
|
+
from .conversations.computer_tool_call import ComputerToolCall
|
|
13
|
+
from .conversations.image_gen_tool_call import ImageGenToolCall
|
|
14
|
+
from .conversations.mcp_approval_request import McpApprovalRequest
|
|
15
|
+
from .conversations.web_search_tool_call import WebSearchToolCall
|
|
16
|
+
from .conversations.file_search_tool_call import FileSearchToolCall
|
|
17
|
+
from .conversations.local_shell_tool_call import LocalShellToolCall
|
|
18
|
+
from .conversations.code_interpreter_tool_call import CodeInterpreterToolCall
|
|
19
|
+
from .conversations.function_tool_call_resource import FunctionToolCallResource
|
|
20
|
+
from .conversations.local_shell_tool_call_output import LocalShellToolCallOutput
|
|
21
|
+
from .conversations.mcp_approval_response_resource import McpApprovalResponseResource
|
|
22
|
+
from .conversations.computer_tool_call_output_resource import ComputerToolCallOutputResource
|
|
23
|
+
from .conversations.function_tool_call_output_resource import FunctionToolCallOutputResource
|
|
24
|
+
|
|
25
|
+
__all__ = ["ResponseListInputItemsResponse", "Data", "DataMessage"]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class DataMessage(InputMessage):
|
|
29
|
+
id: str
|
|
30
|
+
"""The unique ID of the message input."""
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
Data: TypeAlias = Annotated[
|
|
34
|
+
Union[
|
|
35
|
+
DataMessage,
|
|
36
|
+
OutputMessage,
|
|
37
|
+
FileSearchToolCall,
|
|
38
|
+
ComputerToolCall,
|
|
39
|
+
ComputerToolCallOutputResource,
|
|
40
|
+
WebSearchToolCall,
|
|
41
|
+
FunctionToolCallResource,
|
|
42
|
+
FunctionToolCallOutputResource,
|
|
43
|
+
ImageGenToolCall,
|
|
44
|
+
CodeInterpreterToolCall,
|
|
45
|
+
LocalShellToolCall,
|
|
46
|
+
LocalShellToolCallOutput,
|
|
47
|
+
McpListTools,
|
|
48
|
+
McpApprovalRequest,
|
|
49
|
+
McpApprovalResponseResource,
|
|
50
|
+
McpToolCall,
|
|
51
|
+
],
|
|
52
|
+
PropertyInfo(discriminator="type"),
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class ResponseListInputItemsResponse(BaseModel):
|
|
57
|
+
data: List[Data]
|
|
58
|
+
"""A list of items used to generate this response."""
|
|
59
|
+
|
|
60
|
+
first_id: str
|
|
61
|
+
"""The ID of the first item in the list."""
|
|
62
|
+
|
|
63
|
+
has_more: bool
|
|
64
|
+
"""Whether there are more items available."""
|
|
65
|
+
|
|
66
|
+
last_id: str
|
|
67
|
+
"""The ID of the last item in the list."""
|
|
68
|
+
|
|
69
|
+
object: Literal["list"]
|
|
70
|
+
"""The type of object returned, must be `list`."""
|