forked from openai/openai-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_create_params.py
More file actions
371 lines (266 loc) · 14.5 KB
/
Copy pathrun_create_params.py
File metadata and controls
371 lines (266 loc) · 14.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from __future__ import annotations
from typing import Dict, Union, Iterable, Optional
from typing_extensions import Literal, Required, TypeAlias, TypedDict
from ..._types import SequenceNotStr
from ..responses.tool_param import ToolParam
from ..shared_params.metadata import Metadata
from ..shared.reasoning_effort import ReasoningEffort
from ..graders.grader_inputs_param import GraderInputsParam
from ..responses.response_input_text_param import ResponseInputTextParam
from ..responses.response_input_audio_param import ResponseInputAudioParam
from .create_eval_jsonl_run_data_source_param import CreateEvalJSONLRunDataSourceParam
from ..responses.response_format_text_config_param import ResponseFormatTextConfigParam
from .create_eval_completions_run_data_source_param import CreateEvalCompletionsRunDataSourceParam
__all__ = [
"RunCreateParams",
"DataSource",
"DataSourceCreateEvalResponsesRunDataSource",
"DataSourceCreateEvalResponsesRunDataSourceSource",
"DataSourceCreateEvalResponsesRunDataSourceSourceFileContent",
"DataSourceCreateEvalResponsesRunDataSourceSourceFileContentContent",
"DataSourceCreateEvalResponsesRunDataSourceSourceFileID",
"DataSourceCreateEvalResponsesRunDataSourceSourceResponses",
"DataSourceCreateEvalResponsesRunDataSourceInputMessages",
"DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplate",
"DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplate",
"DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateChatMessage",
"DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItem",
"DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContent",
"DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContentOutputText",
"DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContentInputImage",
"DataSourceCreateEvalResponsesRunDataSourceInputMessagesItemReference",
"DataSourceCreateEvalResponsesRunDataSourceSamplingParams",
"DataSourceCreateEvalResponsesRunDataSourceSamplingParamsText",
]
class RunCreateParams(TypedDict, total=False):
data_source: Required[DataSource]
"""Details about the run's data source."""
metadata: Optional[Metadata]
"""Set of 16 key-value pairs that can be attached to an object.
This can be useful for storing additional information about the object in a
structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with
a maximum length of 512 characters.
"""
name: str
"""The name of the run."""
class DataSourceCreateEvalResponsesRunDataSourceSourceFileContentContent(TypedDict, total=False):
item: Required[Dict[str, object]]
sample: Dict[str, object]
class DataSourceCreateEvalResponsesRunDataSourceSourceFileContent(TypedDict, total=False):
content: Required[Iterable[DataSourceCreateEvalResponsesRunDataSourceSourceFileContentContent]]
"""The content of the jsonl file."""
type: Required[Literal["file_content"]]
"""The type of jsonl source. Always `file_content`."""
class DataSourceCreateEvalResponsesRunDataSourceSourceFileID(TypedDict, total=False):
id: Required[str]
"""The identifier of the file."""
type: Required[Literal["file_id"]]
"""The type of jsonl source. Always `file_id`."""
class DataSourceCreateEvalResponsesRunDataSourceSourceResponses(TypedDict, total=False):
"""A EvalResponsesSource object describing a run data source configuration."""
type: Required[Literal["responses"]]
"""The type of run data source. Always `responses`."""
created_after: Optional[int]
"""Only include items created after this timestamp (inclusive).
This is a query parameter used to select responses.
"""
created_before: Optional[int]
"""Only include items created before this timestamp (inclusive).
This is a query parameter used to select responses.
"""
instructions_search: Optional[str]
"""Optional string to search the 'instructions' field.
This is a query parameter used to select responses.
"""
metadata: Optional[object]
"""Metadata filter for the responses.
This is a query parameter used to select responses.
"""
model: Optional[str]
"""The name of the model to find responses for.
This is a query parameter used to select responses.
"""
reasoning_effort: Optional[ReasoningEffort]
"""
Constrains effort on reasoning for
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`.
Reducing reasoning effort can result in faster responses and fewer tokens used
on reasoning in a response.
- `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported
reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool
calls are supported for all reasoning values in gpt-5.1.
- All models before `gpt-5.1` default to `medium` reasoning effort, and do not
support `none`.
- The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
- `xhigh` is supported for all models after `gpt-5.1-codex-max`.
"""
temperature: Optional[float]
"""Sampling temperature. This is a query parameter used to select responses."""
tools: Optional[SequenceNotStr[str]]
"""List of tool names. This is a query parameter used to select responses."""
top_p: Optional[float]
"""Nucleus sampling parameter. This is a query parameter used to select responses."""
users: Optional[SequenceNotStr[str]]
"""List of user identifiers. This is a query parameter used to select responses."""
DataSourceCreateEvalResponsesRunDataSourceSource: TypeAlias = Union[
DataSourceCreateEvalResponsesRunDataSourceSourceFileContent,
DataSourceCreateEvalResponsesRunDataSourceSourceFileID,
DataSourceCreateEvalResponsesRunDataSourceSourceResponses,
]
class DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateChatMessage(TypedDict, total=False):
content: Required[str]
"""The content of the message."""
role: Required[str]
"""The role of the message (e.g. "system", "assistant", "user")."""
class DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContentOutputText(
TypedDict, total=False
):
"""A text output from the model."""
text: Required[str]
"""The text output from the model."""
type: Required[Literal["output_text"]]
"""The type of the output text. Always `output_text`."""
class DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContentInputImage(
TypedDict, total=False
):
"""An image input block used within EvalItem content arrays."""
image_url: Required[str]
"""The URL of the image input."""
type: Required[Literal["input_image"]]
"""The type of the image input. Always `input_image`."""
detail: str
"""The detail level of the image to be sent to the model.
One of `high`, `low`, or `auto`. Defaults to `auto`.
"""
DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContent: TypeAlias = Union[
str,
ResponseInputTextParam,
DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContentOutputText,
DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContentInputImage,
ResponseInputAudioParam,
GraderInputsParam,
]
class DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItem(TypedDict, total=False):
"""
A message input to the model with a role indicating instruction following
hierarchy. Instructions given with the `developer` or `system` role take
precedence over instructions given with the `user` role. Messages with the
`assistant` role are presumed to have been generated by the model in previous
interactions.
"""
content: Required[DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContent]
"""Inputs to the model - can contain template strings.
Supports text, output text, input images, and input audio, either as a single
item or an array of items.
"""
role: Required[Literal["user", "assistant", "system", "developer"]]
"""The role of the message input.
One of `user`, `assistant`, `system`, or `developer`.
"""
type: Literal["message"]
"""The type of the message input. Always `message`."""
DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplate: TypeAlias = Union[
DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateChatMessage,
DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItem,
]
class DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplate(TypedDict, total=False):
template: Required[Iterable[DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplate]]
"""A list of chat messages forming the prompt or context.
May include variable references to the `item` namespace, ie {{item.name}}.
"""
type: Required[Literal["template"]]
"""The type of input messages. Always `template`."""
class DataSourceCreateEvalResponsesRunDataSourceInputMessagesItemReference(TypedDict, total=False):
item_reference: Required[str]
"""A reference to a variable in the `item` namespace. Ie, "item.name" """
type: Required[Literal["item_reference"]]
"""The type of input messages. Always `item_reference`."""
DataSourceCreateEvalResponsesRunDataSourceInputMessages: TypeAlias = Union[
DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplate,
DataSourceCreateEvalResponsesRunDataSourceInputMessagesItemReference,
]
class DataSourceCreateEvalResponsesRunDataSourceSamplingParamsText(TypedDict, total=False):
"""Configuration options for a text response from the model.
Can be plain
text or structured JSON data. Learn more:
- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
- [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
"""
format: ResponseFormatTextConfigParam
"""An object specifying the format that the model must output.
Configuring `{ "type": "json_schema" }` enables Structured Outputs, which
ensures the model will match your supplied JSON schema. Learn more in the
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
The default format is `{ "type": "text" }` with no additional options.
**Not recommended for gpt-4o and newer models:**
Setting to `{ "type": "json_object" }` enables the older JSON mode, which
ensures the message the model generates is valid JSON. Using `json_schema` is
preferred for models that support it.
"""
class DataSourceCreateEvalResponsesRunDataSourceSamplingParams(TypedDict, total=False):
max_completion_tokens: int
"""The maximum number of tokens in the generated output."""
reasoning_effort: Optional[ReasoningEffort]
"""
Constrains effort on reasoning for
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`.
Reducing reasoning effort can result in faster responses and fewer tokens used
on reasoning in a response.
- `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported
reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool
calls are supported for all reasoning values in gpt-5.1.
- All models before `gpt-5.1` default to `medium` reasoning effort, and do not
support `none`.
- The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
- `xhigh` is supported for all models after `gpt-5.1-codex-max`.
"""
seed: int
"""A seed value to initialize the randomness, during sampling."""
temperature: float
"""A higher temperature increases randomness in the outputs."""
text: DataSourceCreateEvalResponsesRunDataSourceSamplingParamsText
"""Configuration options for a text response from the model.
Can be plain text or structured JSON data. Learn more:
- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
- [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
"""
tools: Iterable[ToolParam]
"""An array of tools the model may call while generating a response.
You can specify which tool to use by setting the `tool_choice` parameter.
The two categories of tools you can provide the model are:
- **Built-in tools**: Tools that are provided by OpenAI that extend the model's
capabilities, like
[web search](https://platform.openai.com/docs/guides/tools-web-search) or
[file search](https://platform.openai.com/docs/guides/tools-file-search).
Learn more about
[built-in tools](https://platform.openai.com/docs/guides/tools).
- **Function calls (custom tools)**: Functions that are defined by you, enabling
the model to call your own code. Learn more about
[function calling](https://platform.openai.com/docs/guides/function-calling).
"""
top_p: float
"""An alternative to temperature for nucleus sampling; 1.0 includes all tokens."""
class DataSourceCreateEvalResponsesRunDataSource(TypedDict, total=False):
"""A ResponsesRunDataSource object describing a model sampling configuration."""
source: Required[DataSourceCreateEvalResponsesRunDataSourceSource]
"""Determines what populates the `item` namespace in this run's data source."""
type: Required[Literal["responses"]]
"""The type of run data source. Always `responses`."""
input_messages: DataSourceCreateEvalResponsesRunDataSourceInputMessages
"""Used when sampling from a model.
Dictates the structure of the messages passed into the model. Can either be a
reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template
with variable references to the `item` namespace.
"""
model: str
"""The name of the model to use for generating completions (e.g. "o3-mini")."""
sampling_params: DataSourceCreateEvalResponsesRunDataSourceSamplingParams
DataSource: TypeAlias = Union[
CreateEvalJSONLRunDataSourceParam,
CreateEvalCompletionsRunDataSourceParam,
DataSourceCreateEvalResponsesRunDataSource,
]