Evals
List evals
evals.list(EvalListParams**kwargs) -> SyncCursorPage[EvalListResponse]
get /evals
List evaluations for a project.
Parameters
-
after: Optional[str]Identifier for the last eval from the previous pagination request.
-
limit: Optional[int]Number of evals to retrieve.
-
order: Optional[Literal["asc", "desc"]]Sort order for evals by timestamp. Use
ascfor ascending order ordescfor descending order.-
"asc" -
"desc"
-
-
order_by: Optional[Literal["created_at", "updated_at"]]Evals can be ordered by creation time or last updated time. Use
created_atfor creation time orupdated_atfor last updated time.-
"created_at" -
"updated_at"
-
Returns
-
class EvalListResponse: …An Eval object with a data source config and testing criteria. An Eval represents a task to be done for your LLM integration. Like:
-
Improve the quality of my chatbot
-
See how well my chatbot handles customer support
-
Check if o4-mini is better at my usecase than gpt-4o
-
id: strUnique identifier for the evaluation.
-
created_at: intThe Unix timestamp (in seconds) for when the eval was created.
-
data_source_config: DataSourceConfigConfiguration of data sources used in runs of the evaluation.
-
class EvalCustomDataSourceConfig: …A CustomDataSourceConfig which specifies the schema of your
itemand optionallysamplenamespaces. The response schema defines the shape of the data that will be:-
Used to define your testing criteria and
-
What data is required when creating a run
-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["custom"]The type of data source. Always
custom."custom"
-
-
class DataSourceConfigLogs: …A LogsDataSourceConfig which specifies the metadata property of your logs query. This is usually metadata like
usecase=chatbotorprompt-version=v2, etc. The schema returned by this data source config is used to defined what variables are available in your evals.itemandsampleare both defined when using this data source config.-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["logs"]The type of data source. Always
logs."logs"
-
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.
-
-
class EvalStoredCompletionsDataSourceConfig: …Deprecated in favor of LogsDataSourceConfig.
-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["stored_completions"]The type of data source. Always
stored_completions."stored_completions"
-
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.
-
-
-
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: strThe name of the evaluation.
-
object: Literal["eval"]The object type.
"eval"
-
testing_criteria: List[TestingCriterion]A list of testing criteria.
-
class LabelModelGrader: …A LabelModelGrader object which uses a model to assign labels to each item in the evaluation.
-
input: List[Input]-
content: InputContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
text: strThe text input to the model.
-
type: Literal["input_text"]The type of the input item. Always
input_text."input_text"
-
-
class InputContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class InputContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
input_audio: InputAudio-
data: strBase64-encoded audio data.
-
format: Literal["mp3", "wav"]The format of the audio data. Currently supported formats are
mp3andwav.-
"mp3" -
"wav"
-
-
-
type: Literal["input_audio"]The type of the input item. Always
input_audio."input_audio"
-
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
labels: List[str]The labels to assign to each item in the evaluation.
-
model: strThe model to use for the evaluation. Must support structured outputs.
-
name: strThe name of the grader.
-
passing_labels: List[str]The labels that indicate a passing result. Must be a subset of labels.
-
type: Literal["label_model"]The object type, which is always
label_model."label_model"
-
-
class StringCheckGrader: …A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
input: strThe input text. This may include template strings.
-
name: strThe name of the grader.
-
operation: Literal["eq", "ne", "like", "ilike"]The string check operation to perform. One of
eq,ne,like, orilike.-
"eq" -
"ne" -
"like" -
"ilike"
-
-
reference: strThe reference text. This may include template strings.
-
type: Literal["string_check"]The object type, which is always
string_check."string_check"
-
-
class TestingCriterionEvalGraderTextSimilarity: …A TextSimilarityGrader object which grades text based on similarity metrics.
-
pass_threshold: floatThe threshold for the score.
-
-
class TestingCriterionEvalGraderPython: …A PythonGrader object that runs a python script on the input.
-
pass_threshold: Optional[float]The threshold for the score.
-
-
class TestingCriterionEvalGraderScoreModel: …A ScoreModelGrader object that uses a model to assign a score to the input.
-
pass_threshold: Optional[float]The threshold for the score.
-
-
-
Example
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
page = client.evals.list()
page = page.data[0]
print(page.id)
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"data_source_config": {
"schema": {
"foo": "bar"
},
"type": "custom"
},
"metadata": {
"foo": "string"
},
"name": "Chatbot effectiveness Evaluation",
"object": "eval",
"testing_criteria": [
{
"input": [
{
"content": "string",
"role": "user",
"type": "message"
}
],
"labels": [
"string"
],
"model": "model",
"name": "name",
"passing_labels": [
"string"
],
"type": "label_model"
}
]
}
],
"first_id": "first_id",
"has_more": true,
"last_id": "last_id",
"object": "list"
}
Example
from openai import OpenAI
client = OpenAI()
evals = client.evals.list(limit=1)
print(evals)
Response
{
"object": "list",
"data": [
{
"id": "eval_67abd54d9b0081909a86353f6fb9317a",
"object": "eval",
"data_source_config": {
"type": "stored_completions",
"metadata": {
"usecase": "push_notifications_summarizer"
},
"schema": {
"type": "object",
"properties": {
"item": {
"type": "object"
},
"sample": {
"type": "object"
}
},
"required": [
"item",
"sample"
]
}
},
"testing_criteria": [
{
"name": "Push Notification Summary Grader",
"id": "Push Notification Summary Grader-9b876f24-4762-4be9-aff4-db7a9b31c673",
"type": "label_model",
"model": "o3-mini",
"input": [
{
"type": "message",
"role": "developer",
"content": {
"type": "input_text",
"text": "\nLabel the following push notification summary as either correct or incorrect.\nThe push notification and the summary will be provided below.\nA good push notificiation summary is concise and snappy.\nIf it is good, then label it as correct, if not, then incorrect.\n"
}
},
{
"type": "message",
"role": "user",
"content": {
"type": "input_text",
"text": "\nPush notifications: {{item.input}}\nSummary: {{sample.output_text}}\n"
}
}
],
"passing_labels": [
"correct"
],
"labels": [
"correct",
"incorrect"
],
"sampling_params": null
}
],
"name": "Push Notification Summary Grader",
"created_at": 1739314509,
"metadata": {
"description": "A stored completions eval for push notification summaries"
}
}
],
"first_id": "eval_67abd54d9b0081909a86353f6fb9317a",
"last_id": "eval_67aa884cf6688190b58f657d4441c8b7",
"has_more": true
}
Create eval
evals.create(EvalCreateParams**kwargs) -> EvalCreateResponse
post /evals
Create the structure of an evaluation that can be used to test a model's performance. An evaluation is a set of testing criteria and the config for a data source, which dictates the schema of the data used in the evaluation. After creating an evaluation, you can run it on different models and model parameters. We support several types of graders and datasources. For more information, see the Evals guide.
Parameters
-
data_source_config: DataSourceConfigThe configuration for the data source used for the evaluation runs. Dictates the schema of the data used in the evaluation.
-
class DataSourceConfigCustom: …A CustomDataSourceConfig object that defines the schema for the data source used for the evaluation runs. This schema is used to define the shape of the data that will be:
-
Used to define your testing criteria and
-
What data is required when creating a run
-
item_schema: Dict[str, object]The json schema for each row in the data source.
-
type: Literal["custom"]The type of data source. Always
custom."custom"
-
include_sample_schema: Optional[bool]Whether the eval should expect you to populate the sample namespace (ie, by generating responses off of your data source)
-
-
class DataSourceConfigLogs: …A data source config which specifies the metadata property of your logs query. This is usually metadata like
usecase=chatbotorprompt-version=v2, etc.-
type: Literal["logs"]The type of data source. Always
logs."logs"
-
metadata: Optional[Dict[str, object]]Metadata filters for the logs data source.
-
-
class DataSourceConfigStoredCompletions: …Deprecated in favor of LogsDataSourceConfig.
-
type: Literal["stored_completions"]The type of data source. Always
stored_completions."stored_completions"
-
metadata: Optional[Dict[str, object]]Metadata filters for the stored completions data source.
-
-
-
testing_criteria: Iterable[TestingCriterion]A list of graders for all eval runs in this group. Graders can reference variables in the data source using double curly braces notation, like
{{item.variable_name}}. To reference the model's output, use thesamplenamespace (ie,{{sample.output_text}}).-
class TestingCriterionLabelModel: …A LabelModelGrader object which uses a model to assign labels to each item in the evaluation.
-
input: Iterable[TestingCriterionLabelModelInput]A list of chat messages forming the prompt or context. May include variable references to the
itemnamespace, ie {{item.name}}.-
class TestingCriterionLabelModelInputSimpleInputMessage: …-
content: strThe content of the message.
-
role: strThe role of the message (e.g. "system", "assistant", "user").
-
-
class TestingCriterionLabelModelInputEvalItem: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: TestingCriterionLabelModelInputEvalItemContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
text: strThe text input to the model.
-
type: Literal["input_text"]The type of the input item. Always
input_text."input_text"
-
-
class TestingCriterionLabelModelInputEvalItemContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class TestingCriterionLabelModelInputEvalItemContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
input_audio: InputAudio-
data: strBase64-encoded audio data.
-
format: Literal["mp3", "wav"]The format of the audio data. Currently supported formats are
mp3andwav.-
"mp3" -
"wav"
-
-
-
type: Literal["input_audio"]The type of the input item. Always
input_audio."input_audio"
-
-
Sequence[GraderInputsParamItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
-
labels: Sequence[str]The labels to classify to each item in the evaluation.
-
model: strThe model to use for the evaluation. Must support structured outputs.
-
name: strThe name of the grader.
-
passing_labels: Sequence[str]The labels that indicate a passing result. Must be a subset of labels.
-
type: Literal["label_model"]The object type, which is always
label_model."label_model"
-
-
class StringCheckGrader: …A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
input: strThe input text. This may include template strings.
-
name: strThe name of the grader.
-
operation: Literal["eq", "ne", "like", "ilike"]The string check operation to perform. One of
eq,ne,like, orilike.-
"eq" -
"ne" -
"like" -
"ilike"
-
-
reference: strThe reference text. This may include template strings.
-
type: Literal["string_check"]The object type, which is always
string_check."string_check"
-
-
class TestingCriterionTextSimilarity: …A TextSimilarityGrader object which grades text based on similarity metrics.
-
pass_threshold: floatThe threshold for the score.
-
-
class TestingCriterionPython: …A PythonGrader object that runs a python script on the input.
-
pass_threshold: Optional[float]The threshold for the score.
-
-
class TestingCriterionScoreModel: …A ScoreModelGrader object that uses a model to assign a score to the input.
-
pass_threshold: Optional[float]The threshold for the score.
-
-
-
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: Optional[str]The name of the evaluation.
Returns
-
class EvalCreateResponse: …An Eval object with a data source config and testing criteria. An Eval represents a task to be done for your LLM integration. Like:
-
Improve the quality of my chatbot
-
See how well my chatbot handles customer support
-
Check if o4-mini is better at my usecase than gpt-4o
-
id: strUnique identifier for the evaluation.
-
created_at: intThe Unix timestamp (in seconds) for when the eval was created.
-
data_source_config: DataSourceConfigConfiguration of data sources used in runs of the evaluation.
-
class EvalCustomDataSourceConfig: …A CustomDataSourceConfig which specifies the schema of your
itemand optionallysamplenamespaces. The response schema defines the shape of the data that will be:-
Used to define your testing criteria and
-
What data is required when creating a run
-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["custom"]The type of data source. Always
custom."custom"
-
-
class DataSourceConfigLogs: …A LogsDataSourceConfig which specifies the metadata property of your logs query. This is usually metadata like
usecase=chatbotorprompt-version=v2, etc. The schema returned by this data source config is used to defined what variables are available in your evals.itemandsampleare both defined when using this data source config.-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["logs"]The type of data source. Always
logs."logs"
-
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.
-
-
class EvalStoredCompletionsDataSourceConfig: …Deprecated in favor of LogsDataSourceConfig.
-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["stored_completions"]The type of data source. Always
stored_completions."stored_completions"
-
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.
-
-
-
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: strThe name of the evaluation.
-
object: Literal["eval"]The object type.
"eval"
-
testing_criteria: List[TestingCriterion]A list of testing criteria.
-
class LabelModelGrader: …A LabelModelGrader object which uses a model to assign labels to each item in the evaluation.
-
input: List[Input]-
content: InputContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
text: strThe text input to the model.
-
type: Literal["input_text"]The type of the input item. Always
input_text."input_text"
-
-
class InputContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class InputContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
input_audio: InputAudio-
data: strBase64-encoded audio data.
-
format: Literal["mp3", "wav"]The format of the audio data. Currently supported formats are
mp3andwav.-
"mp3" -
"wav"
-
-
-
type: Literal["input_audio"]The type of the input item. Always
input_audio."input_audio"
-
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
labels: List[str]The labels to assign to each item in the evaluation.
-
model: strThe model to use for the evaluation. Must support structured outputs.
-
name: strThe name of the grader.
-
passing_labels: List[str]The labels that indicate a passing result. Must be a subset of labels.
-
type: Literal["label_model"]The object type, which is always
label_model."label_model"
-
-
class StringCheckGrader: …A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
input: strThe input text. This may include template strings.
-
name: strThe name of the grader.
-
operation: Literal["eq", "ne", "like", "ilike"]The string check operation to perform. One of
eq,ne,like, orilike.-
"eq" -
"ne" -
"like" -
"ilike"
-
-
reference: strThe reference text. This may include template strings.
-
type: Literal["string_check"]The object type, which is always
string_check."string_check"
-
-
class TestingCriterionEvalGraderTextSimilarity: …A TextSimilarityGrader object which grades text based on similarity metrics.
-
pass_threshold: floatThe threshold for the score.
-
-
class TestingCriterionEvalGraderPython: …A PythonGrader object that runs a python script on the input.
-
pass_threshold: Optional[float]The threshold for the score.
-
-
class TestingCriterionEvalGraderScoreModel: …A ScoreModelGrader object that uses a model to assign a score to the input.
-
pass_threshold: Optional[float]The threshold for the score.
-
-
-
Example
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
eval = client.evals.create(
data_source_config={
"item_schema": {
"foo": "bar"
},
"type": "custom",
},
testing_criteria=[{
"input": [{
"content": "content",
"role": "role",
}],
"labels": ["string"],
"model": "model",
"name": "name",
"passing_labels": ["string"],
"type": "label_model",
}],
)
print(eval.id)
Response
{
"id": "id",
"created_at": 0,
"data_source_config": {
"schema": {
"foo": "bar"
},
"type": "custom"
},
"metadata": {
"foo": "string"
},
"name": "Chatbot effectiveness Evaluation",
"object": "eval",
"testing_criteria": [
{
"input": [
{
"content": "string",
"role": "user",
"type": "message"
}
],
"labels": [
"string"
],
"model": "model",
"name": "name",
"passing_labels": [
"string"
],
"type": "label_model"
}
]
}
Example
from openai import OpenAI
client = OpenAI()
eval_obj = client.evals.create(
name="Sentiment",
data_source_config={
"type": "stored_completions",
"metadata": {"usecase": "chatbot"}
},
testing_criteria=[
{
"type": "label_model",
"model": "o3-mini",
"input": [
{"role": "developer", "content": "Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'"},
{"role": "user", "content": "Statement: {{item.input}}"}
],
"passing_labels": ["positive"],
"labels": ["positive", "neutral", "negative"],
"name": "Example label grader"
}
]
)
print(eval_obj)
Response
{
"object": "eval",
"id": "eval_67b7fa9a81a88190ab4aa417e397ea21",
"data_source_config": {
"type": "stored_completions",
"metadata": {
"usecase": "chatbot"
},
"schema": {
"type": "object",
"properties": {
"item": {
"type": "object"
},
"sample": {
"type": "object"
}
},
"required": [
"item",
"sample"
]
},
"testing_criteria": [
{
"name": "Example label grader",
"type": "label_model",
"model": "o3-mini",
"input": [
{
"type": "message",
"role": "developer",
"content": {
"type": "input_text",
"text": "Classify the sentiment of the following statement as one of positive, neutral, or negative"
}
},
{
"type": "message",
"role": "user",
"content": {
"type": "input_text",
"text": "Statement: {{item.input}}"
}
}
],
"passing_labels": [
"positive"
],
"labels": [
"positive",
"neutral",
"negative"
]
}
],
"name": "Sentiment",
"created_at": 1740110490,
"metadata": {
"description": "An eval for sentiment analysis"
}
}
Get an eval
evals.retrieve(streval_id) -> EvalRetrieveResponse
get /evals/{eval_id}
Get an evaluation by ID.
Parameters
eval_id: str
Returns
-
class EvalRetrieveResponse: …An Eval object with a data source config and testing criteria. An Eval represents a task to be done for your LLM integration. Like:
-
Improve the quality of my chatbot
-
See how well my chatbot handles customer support
-
Check if o4-mini is better at my usecase than gpt-4o
-
id: strUnique identifier for the evaluation.
-
created_at: intThe Unix timestamp (in seconds) for when the eval was created.
-
data_source_config: DataSourceConfigConfiguration of data sources used in runs of the evaluation.
-
class EvalCustomDataSourceConfig: …A CustomDataSourceConfig which specifies the schema of your
itemand optionallysamplenamespaces. The response schema defines the shape of the data that will be:-
Used to define your testing criteria and
-
What data is required when creating a run
-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["custom"]The type of data source. Always
custom."custom"
-
-
class DataSourceConfigLogs: …A LogsDataSourceConfig which specifies the metadata property of your logs query. This is usually metadata like
usecase=chatbotorprompt-version=v2, etc. The schema returned by this data source config is used to defined what variables are available in your evals.itemandsampleare both defined when using this data source config.-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["logs"]The type of data source. Always
logs."logs"
-
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.
-
-
class EvalStoredCompletionsDataSourceConfig: …Deprecated in favor of LogsDataSourceConfig.
-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["stored_completions"]The type of data source. Always
stored_completions."stored_completions"
-
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.
-
-
-
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: strThe name of the evaluation.
-
object: Literal["eval"]The object type.
"eval"
-
testing_criteria: List[TestingCriterion]A list of testing criteria.
-
class LabelModelGrader: …A LabelModelGrader object which uses a model to assign labels to each item in the evaluation.
-
input: List[Input]-
content: InputContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
text: strThe text input to the model.
-
type: Literal["input_text"]The type of the input item. Always
input_text."input_text"
-
-
class InputContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class InputContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
input_audio: InputAudio-
data: strBase64-encoded audio data.
-
format: Literal["mp3", "wav"]The format of the audio data. Currently supported formats are
mp3andwav.-
"mp3" -
"wav"
-
-
-
type: Literal["input_audio"]The type of the input item. Always
input_audio."input_audio"
-
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
labels: List[str]The labels to assign to each item in the evaluation.
-
model: strThe model to use for the evaluation. Must support structured outputs.
-
name: strThe name of the grader.
-
passing_labels: List[str]The labels that indicate a passing result. Must be a subset of labels.
-
type: Literal["label_model"]The object type, which is always
label_model."label_model"
-
-
class StringCheckGrader: …A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
input: strThe input text. This may include template strings.
-
name: strThe name of the grader.
-
operation: Literal["eq", "ne", "like", "ilike"]The string check operation to perform. One of
eq,ne,like, orilike.-
"eq" -
"ne" -
"like" -
"ilike"
-
-
reference: strThe reference text. This may include template strings.
-
type: Literal["string_check"]The object type, which is always
string_check."string_check"
-
-
class TestingCriterionEvalGraderTextSimilarity: …A TextSimilarityGrader object which grades text based on similarity metrics.
-
pass_threshold: floatThe threshold for the score.
-
-
class TestingCriterionEvalGraderPython: …A PythonGrader object that runs a python script on the input.
-
pass_threshold: Optional[float]The threshold for the score.
-
-
class TestingCriterionEvalGraderScoreModel: …A ScoreModelGrader object that uses a model to assign a score to the input.
-
pass_threshold: Optional[float]The threshold for the score.
-
-
-
Example
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
eval = client.evals.retrieve(
"eval_id",
)
print(eval.id)
Response
{
"id": "id",
"created_at": 0,
"data_source_config": {
"schema": {
"foo": "bar"
},
"type": "custom"
},
"metadata": {
"foo": "string"
},
"name": "Chatbot effectiveness Evaluation",
"object": "eval",
"testing_criteria": [
{
"input": [
{
"content": "string",
"role": "user",
"type": "message"
}
],
"labels": [
"string"
],
"model": "model",
"name": "name",
"passing_labels": [
"string"
],
"type": "label_model"
}
]
}
Example
from openai import OpenAI
client = OpenAI()
eval_obj = client.evals.retrieve("eval_67abd54d9b0081909a86353f6fb9317a")
print(eval_obj)
Response
{
"object": "eval",
"id": "eval_67abd54d9b0081909a86353f6fb9317a",
"data_source_config": {
"type": "custom",
"schema": {
"type": "object",
"properties": {
"item": {
"type": "object",
"properties": {
"input": {
"type": "string"
},
"ground_truth": {
"type": "string"
}
},
"required": [
"input",
"ground_truth"
]
}
},
"required": [
"item"
]
}
},
"testing_criteria": [
{
"name": "String check",
"id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2",
"type": "string_check",
"input": "{{item.input}}",
"reference": "{{item.ground_truth}}",
"operation": "eq"
}
],
"name": "External Data Eval",
"created_at": 1739314509,
"metadata": {},
}
Update an eval
evals.update(streval_id, EvalUpdateParams**kwargs) -> EvalUpdateResponse
post /evals/{eval_id}
Update certain properties of an evaluation.
Parameters
-
eval_id: str -
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: Optional[str]Rename the evaluation.
Returns
-
class EvalUpdateResponse: …An Eval object with a data source config and testing criteria. An Eval represents a task to be done for your LLM integration. Like:
-
Improve the quality of my chatbot
-
See how well my chatbot handles customer support
-
Check if o4-mini is better at my usecase than gpt-4o
-
id: strUnique identifier for the evaluation.
-
created_at: intThe Unix timestamp (in seconds) for when the eval was created.
-
data_source_config: DataSourceConfigConfiguration of data sources used in runs of the evaluation.
-
class EvalCustomDataSourceConfig: …A CustomDataSourceConfig which specifies the schema of your
itemand optionallysamplenamespaces. The response schema defines the shape of the data that will be:-
Used to define your testing criteria and
-
What data is required when creating a run
-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["custom"]The type of data source. Always
custom."custom"
-
-
class DataSourceConfigLogs: …A LogsDataSourceConfig which specifies the metadata property of your logs query. This is usually metadata like
usecase=chatbotorprompt-version=v2, etc. The schema returned by this data source config is used to defined what variables are available in your evals.itemandsampleare both defined when using this data source config.-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["logs"]The type of data source. Always
logs."logs"
-
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.
-
-
class EvalStoredCompletionsDataSourceConfig: …Deprecated in favor of LogsDataSourceConfig.
-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["stored_completions"]The type of data source. Always
stored_completions."stored_completions"
-
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.
-
-
-
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: strThe name of the evaluation.
-
object: Literal["eval"]The object type.
"eval"
-
testing_criteria: List[TestingCriterion]A list of testing criteria.
-
class LabelModelGrader: …A LabelModelGrader object which uses a model to assign labels to each item in the evaluation.
-
input: List[Input]-
content: InputContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
text: strThe text input to the model.
-
type: Literal["input_text"]The type of the input item. Always
input_text."input_text"
-
-
class InputContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class InputContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
input_audio: InputAudio-
data: strBase64-encoded audio data.
-
format: Literal["mp3", "wav"]The format of the audio data. Currently supported formats are
mp3andwav.-
"mp3" -
"wav"
-
-
-
type: Literal["input_audio"]The type of the input item. Always
input_audio."input_audio"
-
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
labels: List[str]The labels to assign to each item in the evaluation.
-
model: strThe model to use for the evaluation. Must support structured outputs.
-
name: strThe name of the grader.
-
passing_labels: List[str]The labels that indicate a passing result. Must be a subset of labels.
-
type: Literal["label_model"]The object type, which is always
label_model."label_model"
-
-
class StringCheckGrader: …A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
input: strThe input text. This may include template strings.
-
name: strThe name of the grader.
-
operation: Literal["eq", "ne", "like", "ilike"]The string check operation to perform. One of
eq,ne,like, orilike.-
"eq" -
"ne" -
"like" -
"ilike"
-
-
reference: strThe reference text. This may include template strings.
-
type: Literal["string_check"]The object type, which is always
string_check."string_check"
-
-
class TestingCriterionEvalGraderTextSimilarity: …A TextSimilarityGrader object which grades text based on similarity metrics.
-
pass_threshold: floatThe threshold for the score.
-
-
class TestingCriterionEvalGraderPython: …A PythonGrader object that runs a python script on the input.
-
pass_threshold: Optional[float]The threshold for the score.
-
-
class TestingCriterionEvalGraderScoreModel: …A ScoreModelGrader object that uses a model to assign a score to the input.
-
pass_threshold: Optional[float]The threshold for the score.
-
-
-
Example
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
eval = client.evals.update(
eval_id="eval_id",
)
print(eval.id)
Response
{
"id": "id",
"created_at": 0,
"data_source_config": {
"schema": {
"foo": "bar"
},
"type": "custom"
},
"metadata": {
"foo": "string"
},
"name": "Chatbot effectiveness Evaluation",
"object": "eval",
"testing_criteria": [
{
"input": [
{
"content": "string",
"role": "user",
"type": "message"
}
],
"labels": [
"string"
],
"model": "model",
"name": "name",
"passing_labels": [
"string"
],
"type": "label_model"
}
]
}
Example
from openai import OpenAI
client = OpenAI()
updated_eval = client.evals.update(
"eval_67abd54d9b0081909a86353f6fb9317a",
name="Updated Eval",
metadata={"description": "Updated description"}
)
print(updated_eval)
Response
{
"object": "eval",
"id": "eval_67abd54d9b0081909a86353f6fb9317a",
"data_source_config": {
"type": "custom",
"schema": {
"type": "object",
"properties": {
"item": {
"type": "object",
"properties": {
"input": {
"type": "string"
},
"ground_truth": {
"type": "string"
}
},
"required": [
"input",
"ground_truth"
]
}
},
"required": [
"item"
]
}
},
"testing_criteria": [
{
"name": "String check",
"id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2",
"type": "string_check",
"input": "{{item.input}}",
"reference": "{{item.ground_truth}}",
"operation": "eq"
}
],
"name": "Updated Eval",
"created_at": 1739314509,
"metadata": {"description": "Updated description"},
}
Delete an eval
evals.delete(streval_id) -> EvalDeleteResponse
delete /evals/{eval_id}
Delete an evaluation.
Parameters
eval_id: str
Returns
-
class EvalDeleteResponse: …-
deleted: bool -
eval_id: str -
object: str
-
Example
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
eval = client.evals.delete(
"eval_id",
)
print(eval.eval_id)
Response
{
"deleted": true,
"eval_id": "eval_abc123",
"object": "eval.deleted"
}
Example
from openai import OpenAI
client = OpenAI()
deleted = client.evals.delete("eval_abc123")
print(deleted)
Response
{
"object": "eval.deleted",
"deleted": true,
"eval_id": "eval_abc123"
}
Domain Types
Eval Custom Data Source Config
-
class EvalCustomDataSourceConfig: …A CustomDataSourceConfig which specifies the schema of your
itemand optionallysamplenamespaces. The response schema defines the shape of the data that will be:-
Used to define your testing criteria and
-
What data is required when creating a run
-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["custom"]The type of data source. Always
custom."custom"
-
Eval Stored Completions Data Source Config
-
class EvalStoredCompletionsDataSourceConfig: …Deprecated in favor of LogsDataSourceConfig.
-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["stored_completions"]The type of data source. Always
stored_completions."stored_completions"
-
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.
-
Eval List Response
-
class EvalListResponse: …An Eval object with a data source config and testing criteria. An Eval represents a task to be done for your LLM integration. Like:
-
Improve the quality of my chatbot
-
See how well my chatbot handles customer support
-
Check if o4-mini is better at my usecase than gpt-4o
-
id: strUnique identifier for the evaluation.
-
created_at: intThe Unix timestamp (in seconds) for when the eval was created.
-
data_source_config: DataSourceConfigConfiguration of data sources used in runs of the evaluation.
-
class EvalCustomDataSourceConfig: …A CustomDataSourceConfig which specifies the schema of your
itemand optionallysamplenamespaces. The response schema defines the shape of the data that will be:-
Used to define your testing criteria and
-
What data is required when creating a run
-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["custom"]The type of data source. Always
custom."custom"
-
-
class DataSourceConfigLogs: …A LogsDataSourceConfig which specifies the metadata property of your logs query. This is usually metadata like
usecase=chatbotorprompt-version=v2, etc. The schema returned by this data source config is used to defined what variables are available in your evals.itemandsampleare both defined when using this data source config.-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["logs"]The type of data source. Always
logs."logs"
-
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.
-
-
class EvalStoredCompletionsDataSourceConfig: …Deprecated in favor of LogsDataSourceConfig.
-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["stored_completions"]The type of data source. Always
stored_completions."stored_completions"
-
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.
-
-
-
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: strThe name of the evaluation.
-
object: Literal["eval"]The object type.
"eval"
-
testing_criteria: List[TestingCriterion]A list of testing criteria.
-
class LabelModelGrader: …A LabelModelGrader object which uses a model to assign labels to each item in the evaluation.
-
input: List[Input]-
content: InputContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
text: strThe text input to the model.
-
type: Literal["input_text"]The type of the input item. Always
input_text."input_text"
-
-
class InputContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class InputContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
input_audio: InputAudio-
data: strBase64-encoded audio data.
-
format: Literal["mp3", "wav"]The format of the audio data. Currently supported formats are
mp3andwav.-
"mp3" -
"wav"
-
-
-
type: Literal["input_audio"]The type of the input item. Always
input_audio."input_audio"
-
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
labels: List[str]The labels to assign to each item in the evaluation.
-
model: strThe model to use for the evaluation. Must support structured outputs.
-
name: strThe name of the grader.
-
passing_labels: List[str]The labels that indicate a passing result. Must be a subset of labels.
-
type: Literal["label_model"]The object type, which is always
label_model."label_model"
-
-
class StringCheckGrader: …A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
input: strThe input text. This may include template strings.
-
name: strThe name of the grader.
-
operation: Literal["eq", "ne", "like", "ilike"]The string check operation to perform. One of
eq,ne,like, orilike.-
"eq" -
"ne" -
"like" -
"ilike"
-
-
reference: strThe reference text. This may include template strings.
-
type: Literal["string_check"]The object type, which is always
string_check."string_check"
-
-
class TestingCriterionEvalGraderTextSimilarity: …A TextSimilarityGrader object which grades text based on similarity metrics.
-
pass_threshold: floatThe threshold for the score.
-
-
class TestingCriterionEvalGraderPython: …A PythonGrader object that runs a python script on the input.
-
pass_threshold: Optional[float]The threshold for the score.
-
-
class TestingCriterionEvalGraderScoreModel: …A ScoreModelGrader object that uses a model to assign a score to the input.
-
pass_threshold: Optional[float]The threshold for the score.
-
-
-
Eval Create Response
-
class EvalCreateResponse: …An Eval object with a data source config and testing criteria. An Eval represents a task to be done for your LLM integration. Like:
-
Improve the quality of my chatbot
-
See how well my chatbot handles customer support
-
Check if o4-mini is better at my usecase than gpt-4o
-
id: strUnique identifier for the evaluation.
-
created_at: intThe Unix timestamp (in seconds) for when the eval was created.
-
data_source_config: DataSourceConfigConfiguration of data sources used in runs of the evaluation.
-
class EvalCustomDataSourceConfig: …A CustomDataSourceConfig which specifies the schema of your
itemand optionallysamplenamespaces. The response schema defines the shape of the data that will be:-
Used to define your testing criteria and
-
What data is required when creating a run
-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["custom"]The type of data source. Always
custom."custom"
-
-
class DataSourceConfigLogs: …A LogsDataSourceConfig which specifies the metadata property of your logs query. This is usually metadata like
usecase=chatbotorprompt-version=v2, etc. The schema returned by this data source config is used to defined what variables are available in your evals.itemandsampleare both defined when using this data source config.-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["logs"]The type of data source. Always
logs."logs"
-
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.
-
-
class EvalStoredCompletionsDataSourceConfig: …Deprecated in favor of LogsDataSourceConfig.
-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["stored_completions"]The type of data source. Always
stored_completions."stored_completions"
-
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.
-
-
-
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: strThe name of the evaluation.
-
object: Literal["eval"]The object type.
"eval"
-
testing_criteria: List[TestingCriterion]A list of testing criteria.
-
class LabelModelGrader: …A LabelModelGrader object which uses a model to assign labels to each item in the evaluation.
-
input: List[Input]-
content: InputContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
text: strThe text input to the model.
-
type: Literal["input_text"]The type of the input item. Always
input_text."input_text"
-
-
class InputContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class InputContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
input_audio: InputAudio-
data: strBase64-encoded audio data.
-
format: Literal["mp3", "wav"]The format of the audio data. Currently supported formats are
mp3andwav.-
"mp3" -
"wav"
-
-
-
type: Literal["input_audio"]The type of the input item. Always
input_audio."input_audio"
-
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
labels: List[str]The labels to assign to each item in the evaluation.
-
model: strThe model to use for the evaluation. Must support structured outputs.
-
name: strThe name of the grader.
-
passing_labels: List[str]The labels that indicate a passing result. Must be a subset of labels.
-
type: Literal["label_model"]The object type, which is always
label_model."label_model"
-
-
class StringCheckGrader: …A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
input: strThe input text. This may include template strings.
-
name: strThe name of the grader.
-
operation: Literal["eq", "ne", "like", "ilike"]The string check operation to perform. One of
eq,ne,like, orilike.-
"eq" -
"ne" -
"like" -
"ilike"
-
-
reference: strThe reference text. This may include template strings.
-
type: Literal["string_check"]The object type, which is always
string_check."string_check"
-
-
class TestingCriterionEvalGraderTextSimilarity: …A TextSimilarityGrader object which grades text based on similarity metrics.
-
pass_threshold: floatThe threshold for the score.
-
-
class TestingCriterionEvalGraderPython: …A PythonGrader object that runs a python script on the input.
-
pass_threshold: Optional[float]The threshold for the score.
-
-
class TestingCriterionEvalGraderScoreModel: …A ScoreModelGrader object that uses a model to assign a score to the input.
-
pass_threshold: Optional[float]The threshold for the score.
-
-
-
Eval Retrieve Response
-
class EvalRetrieveResponse: …An Eval object with a data source config and testing criteria. An Eval represents a task to be done for your LLM integration. Like:
-
Improve the quality of my chatbot
-
See how well my chatbot handles customer support
-
Check if o4-mini is better at my usecase than gpt-4o
-
id: strUnique identifier for the evaluation.
-
created_at: intThe Unix timestamp (in seconds) for when the eval was created.
-
data_source_config: DataSourceConfigConfiguration of data sources used in runs of the evaluation.
-
class EvalCustomDataSourceConfig: …A CustomDataSourceConfig which specifies the schema of your
itemand optionallysamplenamespaces. The response schema defines the shape of the data that will be:-
Used to define your testing criteria and
-
What data is required when creating a run
-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["custom"]The type of data source. Always
custom."custom"
-
-
class DataSourceConfigLogs: …A LogsDataSourceConfig which specifies the metadata property of your logs query. This is usually metadata like
usecase=chatbotorprompt-version=v2, etc. The schema returned by this data source config is used to defined what variables are available in your evals.itemandsampleare both defined when using this data source config.-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["logs"]The type of data source. Always
logs."logs"
-
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.
-
-
class EvalStoredCompletionsDataSourceConfig: …Deprecated in favor of LogsDataSourceConfig.
-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["stored_completions"]The type of data source. Always
stored_completions."stored_completions"
-
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.
-
-
-
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: strThe name of the evaluation.
-
object: Literal["eval"]The object type.
"eval"
-
testing_criteria: List[TestingCriterion]A list of testing criteria.
-
class LabelModelGrader: …A LabelModelGrader object which uses a model to assign labels to each item in the evaluation.
-
input: List[Input]-
content: InputContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
text: strThe text input to the model.
-
type: Literal["input_text"]The type of the input item. Always
input_text."input_text"
-
-
class InputContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class InputContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
input_audio: InputAudio-
data: strBase64-encoded audio data.
-
format: Literal["mp3", "wav"]The format of the audio data. Currently supported formats are
mp3andwav.-
"mp3" -
"wav"
-
-
-
type: Literal["input_audio"]The type of the input item. Always
input_audio."input_audio"
-
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
labels: List[str]The labels to assign to each item in the evaluation.
-
model: strThe model to use for the evaluation. Must support structured outputs.
-
name: strThe name of the grader.
-
passing_labels: List[str]The labels that indicate a passing result. Must be a subset of labels.
-
type: Literal["label_model"]The object type, which is always
label_model."label_model"
-
-
class StringCheckGrader: …A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
input: strThe input text. This may include template strings.
-
name: strThe name of the grader.
-
operation: Literal["eq", "ne", "like", "ilike"]The string check operation to perform. One of
eq,ne,like, orilike.-
"eq" -
"ne" -
"like" -
"ilike"
-
-
reference: strThe reference text. This may include template strings.
-
type: Literal["string_check"]The object type, which is always
string_check."string_check"
-
-
class TestingCriterionEvalGraderTextSimilarity: …A TextSimilarityGrader object which grades text based on similarity metrics.
-
pass_threshold: floatThe threshold for the score.
-
-
class TestingCriterionEvalGraderPython: …A PythonGrader object that runs a python script on the input.
-
pass_threshold: Optional[float]The threshold for the score.
-
-
class TestingCriterionEvalGraderScoreModel: …A ScoreModelGrader object that uses a model to assign a score to the input.
-
pass_threshold: Optional[float]The threshold for the score.
-
-
-
Eval Update Response
-
class EvalUpdateResponse: …An Eval object with a data source config and testing criteria. An Eval represents a task to be done for your LLM integration. Like:
-
Improve the quality of my chatbot
-
See how well my chatbot handles customer support
-
Check if o4-mini is better at my usecase than gpt-4o
-
id: strUnique identifier for the evaluation.
-
created_at: intThe Unix timestamp (in seconds) for when the eval was created.
-
data_source_config: DataSourceConfigConfiguration of data sources used in runs of the evaluation.
-
class EvalCustomDataSourceConfig: …A CustomDataSourceConfig which specifies the schema of your
itemand optionallysamplenamespaces. The response schema defines the shape of the data that will be:-
Used to define your testing criteria and
-
What data is required when creating a run
-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["custom"]The type of data source. Always
custom."custom"
-
-
class DataSourceConfigLogs: …A LogsDataSourceConfig which specifies the metadata property of your logs query. This is usually metadata like
usecase=chatbotorprompt-version=v2, etc. The schema returned by this data source config is used to defined what variables are available in your evals.itemandsampleare both defined when using this data source config.-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["logs"]The type of data source. Always
logs."logs"
-
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.
-
-
class EvalStoredCompletionsDataSourceConfig: …Deprecated in favor of LogsDataSourceConfig.
-
schema: Dict[str, object]The json schema for the run data source items. Learn how to build JSON schemas here.
-
type: Literal["stored_completions"]The type of data source. Always
stored_completions."stored_completions"
-
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.
-
-
-
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: strThe name of the evaluation.
-
object: Literal["eval"]The object type.
"eval"
-
testing_criteria: List[TestingCriterion]A list of testing criteria.
-
class LabelModelGrader: …A LabelModelGrader object which uses a model to assign labels to each item in the evaluation.
-
input: List[Input]-
content: InputContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
text: strThe text input to the model.
-
type: Literal["input_text"]The type of the input item. Always
input_text."input_text"
-
-
class InputContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class InputContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
input_audio: InputAudio-
data: strBase64-encoded audio data.
-
format: Literal["mp3", "wav"]The format of the audio data. Currently supported formats are
mp3andwav.-
"mp3" -
"wav"
-
-
-
type: Literal["input_audio"]The type of the input item. Always
input_audio."input_audio"
-
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
labels: List[str]The labels to assign to each item in the evaluation.
-
model: strThe model to use for the evaluation. Must support structured outputs.
-
name: strThe name of the grader.
-
passing_labels: List[str]The labels that indicate a passing result. Must be a subset of labels.
-
type: Literal["label_model"]The object type, which is always
label_model."label_model"
-
-
class StringCheckGrader: …A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
input: strThe input text. This may include template strings.
-
name: strThe name of the grader.
-
operation: Literal["eq", "ne", "like", "ilike"]The string check operation to perform. One of
eq,ne,like, orilike.-
"eq" -
"ne" -
"like" -
"ilike"
-
-
reference: strThe reference text. This may include template strings.
-
type: Literal["string_check"]The object type, which is always
string_check."string_check"
-
-
class TestingCriterionEvalGraderTextSimilarity: …A TextSimilarityGrader object which grades text based on similarity metrics.
-
pass_threshold: floatThe threshold for the score.
-
-
class TestingCriterionEvalGraderPython: …A PythonGrader object that runs a python script on the input.
-
pass_threshold: Optional[float]The threshold for the score.
-
-
class TestingCriterionEvalGraderScoreModel: …A ScoreModelGrader object that uses a model to assign a score to the input.
-
pass_threshold: Optional[float]The threshold for the score.
-
-
-
Eval Delete Response
-
class EvalDeleteResponse: …-
deleted: bool -
eval_id: str -
object: str
-
Runs
Get eval runs
evals.runs.list(streval_id, RunListParams**kwargs) -> SyncCursorPage[RunListResponse]
get /evals/{eval_id}/runs
Get a list of runs for an evaluation.
Parameters
-
eval_id: str -
after: Optional[str]Identifier for the last run from the previous pagination request.
-
limit: Optional[int]Number of runs to retrieve.
-
order: Optional[Literal["asc", "desc"]]Sort order for runs by timestamp. Use
ascfor ascending order ordescfor descending order. Defaults toasc.-
"asc" -
"desc"
-
-
status: Optional[Literal["queued", "in_progress", "completed", 2 more]]Filter runs by status. One of
queued|in_progress|failed|completed|canceled.-
"queued" -
"in_progress" -
"completed" -
"canceled" -
"failed"
-
Returns
-
class RunListResponse: …A schema representing an evaluation run.
-
id: strUnique identifier for the evaluation run.
-
created_at: intUnix timestamp (in seconds) when the evaluation run was created.
-
data_source: DataSourceInformation about the run's data source.
-
class CreateEvalJSONLRunDataSource: …A JsonlRunDataSource object with that specifies a JSONL file that matches the eval
-
source: SourceDetermines what populates the
itemnamespace in the data source.-
class SourceFileContent: …-
content: List[SourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class SourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
-
type: Literal["jsonl"]The type of data source. Always
jsonl."jsonl"
-
-
class CreateEvalCompletionsRunDataSource: …A CompletionsRunDataSource object describing a model sampling configuration.
-
source: SourceDetermines what populates the
itemnamespace in this run's data source.-
class SourceFileContent: …-
content: List[SourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class SourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
class SourceStoredCompletions: …A StoredCompletionsRunDataSource configuration describing a set of filters
-
type: Literal["stored_completions"]The type of source. Always
stored_completions."stored_completions"
-
created_after: Optional[int]An optional Unix timestamp to filter items created after this time.
-
created_before: Optional[int]An optional Unix timestamp to filter items created before this time.
-
limit: Optional[int]An optional maximum number of items to return.
-
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.
-
model: Optional[str]An optional model to filter by (e.g., 'gpt-4o').
-
-
-
type: Literal["completions"]The type of run data source. Always
completions."completions"
-
input_messages: Optional[InputMessages]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 theitemnamespace.-
class InputMessagesTemplate: …-
template: List[InputMessagesTemplateTemplate]A list of chat messages forming the prompt or context. May include variable references to the
itemnamespace, ie {{item.name}}.-
class EasyInputMessage: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: Union[str, ResponseInputMessageContentList]Text, image, or audio input to the model, used to generate a response. Can also contain previous assistant responses.
-
strA text input to the model.
-
List[ResponseInputContent]-
class ResponseInputText: …A text input to the model.
-
text: strThe text input to the model.
-
type: Literal["input_text"]The type of the input item. Always
input_text."input_text"
-
-
class ResponseInputImage: …An image input to the model. Learn about image inputs.
-
detail: Literal["low", "high", "auto", "original"]The detail level of the image to be sent to the model. One of
high,low,auto, ororiginal. Defaults toauto.-
"low" -
"high" -
"auto" -
"original"
-
-
type: Literal["input_image"]The type of the input item. Always
input_image."input_image"
-
file_id: Optional[str]The ID of the file to be sent to the model.
-
image_url: Optional[str]The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.
-
-
class ResponseInputFile: …A file input to the model.
-
type: Literal["input_file"]The type of the input item. Always
input_file."input_file"
-
detail: Optional[Literal["low", "high"]]The detail level of the file to be sent to the model. Use
lowfor the default rendering behavior, orhighto render the file at higher quality. Defaults tolow.-
"low" -
"high"
-
-
file_data: Optional[str]The content of the file to be sent to the model.
-
file_id: Optional[str]The ID of the file to be sent to the model.
-
file_url: Optional[str]The URL of the file to be sent to the model.
-
filename: Optional[str]The name of the file to be sent to the model.
-
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
phase: Optional[Literal["commentary", "final_answer"]]Labels an
assistantmessage as intermediate commentary (commentary) or the final answer (final_answer). For models likegpt-5.3-codexand beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages.-
"commentary" -
"final_answer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
class InputMessagesTemplateTemplateEvalItem: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: InputMessagesTemplateTemplateEvalItemContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class InputMessagesTemplateTemplateEvalItemContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class InputMessagesTemplateTemplateEvalItemContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
input_audio: InputAudio-
data: strBase64-encoded audio data.
-
format: Literal["mp3", "wav"]The format of the audio data. Currently supported formats are
mp3andwav.-
"mp3" -
"wav"
-
-
-
type: Literal["input_audio"]The type of the input item. Always
input_audio."input_audio"
-
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
-
type: Literal["template"]The type of input messages. Always
template."template"
-
-
class InputMessagesItemReference: …-
item_reference: strA reference to a variable in the
itemnamespace. Ie, "item.input_trajectory" -
type: Literal["item_reference"]The type of input messages. Always
item_reference."item_reference"
-
-
-
model: Optional[str]The name of the model to use for generating completions (e.g. "o3-mini").
-
sampling_params: Optional[SamplingParams]-
max_completion_tokens: Optional[int]The maximum number of tokens in the generated output.
-
reasoning_effort: Optional[ReasoningEffort]Constrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.-
gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1. -
All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. -
The
gpt-5-promodel defaults to (and only supports)highreasoning effort. -
xhighis supported for all models aftergpt-5.1-codex-max. -
"none" -
"minimal" -
"low" -
"medium" -
"high" -
"xhigh"
-
-
response_format: Optional[SamplingParamsResponseFormat]An object specifying the format that the model must output.
Setting to
{ "type": "json_schema", "json_schema": {...} }enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.Setting to
{ "type": "json_object" }enables the older JSON mode, which ensures the message the model generates is valid JSON. Usingjson_schemais preferred for models that support it.-
class ResponseFormatText: …Default response format. Used to generate text responses.
-
type: Literal["text"]The type of response format being defined. Always
text."text"
-
-
class ResponseFormatJSONSchema: …JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.
-
json_schema: JSONSchemaStructured Outputs configuration options, including a JSON Schema.
-
name: strThe name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
description: Optional[str]A description of what the response format is for, used by the model to determine how to respond in the format.
-
schema: Optional[Dict[str, object]]The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.
-
strict: Optional[bool]Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the
schemafield. Only a subset of JSON Schema is supported whenstrictistrue. To learn more, read the Structured Outputs guide.
-
-
type: Literal["json_schema"]The type of response format being defined. Always
json_schema."json_schema"
-
-
class ResponseFormatJSONObject: …JSON object response format. An older method of generating JSON responses. Using
json_schemais recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.-
type: Literal["json_object"]The type of response format being defined. Always
json_object."json_object"
-
-
-
seed: Optional[int]A seed value to initialize the randomness, during sampling.
-
temperature: Optional[float]A higher temperature increases randomness in the outputs.
-
tools: Optional[List[ChatCompletionFunctionTool]]A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
-
function: FunctionDefinition-
name: strThe name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
description: Optional[str]A description of what the function does, used by the model to choose when and how to call the function.
-
parameters: Optional[FunctionParameters]The parameters the functions accepts, described as a JSON Schema object. See the guide for examples, and the JSON Schema reference for documentation about the format.
Omitting
parametersdefines a function with an empty parameter list. -
strict: Optional[bool]Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the
parametersfield. Only a subset of JSON Schema is supported whenstrictistrue. Learn more about Structured Outputs in the function calling guide.
-
-
type: Literal["function"]The type of the tool. Currently, only
functionis supported."function"
-
-
top_p: Optional[float]An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
class DataSourceResponses: …A ResponsesRunDataSource object describing a model sampling configuration.
-
source: DataSourceResponsesSourceDetermines what populates the
itemnamespace in this run's data source.-
class DataSourceResponsesSourceFileContent: …-
content: List[DataSourceResponsesSourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class DataSourceResponsesSourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
class DataSourceResponsesSourceResponses: …A EvalResponsesSource object describing a run data source configuration.
-
type: Literal["responses"]The type of run data source. Always
responses."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. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1.- All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. - The
gpt-5-promodel defaults to (and only supports)highreasoning effort. xhighis supported for all models aftergpt-5.1-codex-max.
-
temperature: Optional[float]Sampling temperature. This is a query parameter used to select responses.
-
tools: Optional[List[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[List[str]]List of user identifiers. This is a query parameter used to select responses.
-
-
-
type: Literal["responses"]The type of run data source. Always
responses."responses"
-
input_messages: Optional[DataSourceResponsesInputMessages]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 theitemnamespace.-
class DataSourceResponsesInputMessagesTemplate: …-
template: List[DataSourceResponsesInputMessagesTemplateTemplate]A list of chat messages forming the prompt or context. May include variable references to the
itemnamespace, ie {{item.name}}.-
class DataSourceResponsesInputMessagesTemplateTemplateChatMessage: …-
content: strThe content of the message.
-
role: strThe role of the message (e.g. "system", "assistant", "user").
-
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItem: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
-
type: Literal["template"]The type of input messages. Always
template."template"
-
-
class DataSourceResponsesInputMessagesItemReference: …-
item_reference: strA reference to a variable in the
itemnamespace. Ie, "item.name" -
type: Literal["item_reference"]The type of input messages. Always
item_reference."item_reference"
-
-
-
model: Optional[str]The name of the model to use for generating completions (e.g. "o3-mini").
-
sampling_params: Optional[DataSourceResponsesSamplingParams]-
max_completion_tokens: Optional[int]The maximum number of tokens in the generated output.
-
reasoning_effort: Optional[ReasoningEffort]Constrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1.- All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. - The
gpt-5-promodel defaults to (and only supports)highreasoning effort. xhighis supported for all models aftergpt-5.1-codex-max.
-
seed: Optional[int]A seed value to initialize the randomness, during sampling.
-
temperature: Optional[float]A higher temperature increases randomness in the outputs.
-
text: Optional[DataSourceResponsesSamplingParamsText]Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:
-
format: Optional[ResponseFormatTextConfig]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.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. Usingjson_schemais preferred for models that support it.-
class ResponseFormatText: …Default response format. Used to generate text responses.
-
class ResponseFormatTextJSONSchemaConfig: …JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.
-
name: strThe name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
schema: Dict[str, object]The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.
-
type: Literal["json_schema"]The type of response format being defined. Always
json_schema."json_schema"
-
description: Optional[str]A description of what the response format is for, used by the model to determine how to respond in the format.
-
strict: Optional[bool]Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the
schemafield. Only a subset of JSON Schema is supported whenstrictistrue. To learn more, read the Structured Outputs guide.
-
-
class ResponseFormatJSONObject: …JSON object response format. An older method of generating JSON responses. Using
json_schemais recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.
-
-
tools: Optional[List[Tool]]An array of tools the model may call while generating a response. You can specify which tool to use by setting the
tool_choiceparameter.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 or file search. Learn more about built-in tools.
-
Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code. Learn more about function calling.
-
class FunctionTool: …Defines a function in your own code the model can choose to call. Learn more about function calling.
-
name: strThe name of the function to call.
-
parameters: Optional[Dict[str, object]]A JSON schema object describing the parameters of the function.
-
strict: Optional[bool]Whether to enforce strict parameter validation. Default
true. -
type: Literal["function"]The type of the function tool. Always
function."function"
-
defer_loading: Optional[bool]Whether this function is deferred and loaded via tool search.
-
description: Optional[str]A description of the function. Used by the model to determine whether or not to call the function.
-
-
class FileSearchTool: …A tool that searches for relevant content from uploaded files. Learn more about the file search tool.
-
type: Literal["file_search"]The type of the file search tool. Always
file_search."file_search"
-
vector_store_ids: List[str]The IDs of the vector stores to search.
-
filters: Optional[Filters]A filter to apply.
-
class ComparisonFilter: …A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
key: strThe key to compare against the value.
-
type: Literal["eq", "ne", "gt", 5 more]Specifies the comparison operator:
eq,ne,gt,gte,lt,lte,in,nin.-
eq: equals -
ne: not equal -
gt: greater than -
gte: greater than or equal -
lt: less than -
lte: less than or equal -
in: in -
nin: not in -
"eq" -
"ne" -
"gt" -
"gte" -
"lt" -
"lte" -
"in" -
"nin"
-
-
value: Union[str, float, bool, List[Union[str, float]]]The value to compare against the attribute key; supports string, number, or boolean types.
-
str -
float -
bool -
List[Union[str, float]]-
str -
float
-
-
-
-
class CompoundFilter: …Combine multiple filters using
andoror.-
filters: List[Filter]Array of filters to combine. Items can be
ComparisonFilterorCompoundFilter.-
class ComparisonFilter: …A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
object
-
-
type: Literal["and", "or"]Type of operation:
andoror.-
"and" -
"or"
-
-
-
-
max_num_results: Optional[int]The maximum number of results to return. This number should be between 1 and 50 inclusive.
-
ranking_options: Optional[RankingOptions]Ranking options for search.
-
hybrid_search: Optional[RankingOptionsHybridSearch]Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.
-
embedding_weight: floatThe weight of the embedding in the reciprocal ranking fusion.
-
text_weight: floatThe weight of the text in the reciprocal ranking fusion.
-
-
ranker: Optional[Literal["auto", "default-2024-11-15"]]The ranker to use for the file search.
-
"auto" -
"default-2024-11-15"
-
-
score_threshold: Optional[float]The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.
-
-
-
class ComputerTool: …A tool that controls a virtual computer. Learn more about the computer tool.
-
type: Literal["computer"]The type of the computer tool. Always
computer."computer"
-
-
class ComputerUsePreviewTool: …A tool that controls a virtual computer. Learn more about the computer tool.
-
display_height: intThe height of the computer display.
-
display_width: intThe width of the computer display.
-
environment: Literal["windows", "mac", "linux", 2 more]The type of computer environment to control.
-
"windows" -
"mac" -
"linux" -
"ubuntu" -
"browser"
-
-
type: Literal["computer_use_preview"]The type of the computer use tool. Always
computer_use_preview."computer_use_preview"
-
-
class WebSearchTool: …Search the Internet for sources related to the prompt. Learn more about the web search tool.
-
type: Literal["web_search", "web_search_2025_08_26"]The type of the web search tool. One of
web_searchorweb_search_2025_08_26.-
"web_search" -
"web_search_2025_08_26"
-
-
filters: Optional[Filters]Filters for the search.
-
allowed_domains: Optional[List[str]]Allowed domains for the search. If not provided, all domains are allowed. Subdomains of the provided domains are allowed as well.
Example:
["pubmed.ncbi.nlm.nih.gov"]
-
-
search_context_size: Optional[Literal["low", "medium", "high"]]High level guidance for the amount of context window space to use for the search. One of
low,medium, orhigh.mediumis the default.-
"low" -
"medium" -
"high"
-
-
user_location: Optional[UserLocation]The approximate location of the user.
-
city: Optional[str]Free text input for the city of the user, e.g.
San Francisco. -
country: Optional[str]The two-letter ISO country code of the user, e.g.
US. -
region: Optional[str]Free text input for the region of the user, e.g.
California. -
timezone: Optional[str]The IANA timezone of the user, e.g.
America/Los_Angeles. -
type: Optional[Literal["approximate"]]The type of location approximation. Always
approximate."approximate"
-
-
-
class Mcp: …Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
-
server_label: strA label for this MCP server, used to identify it in tool calls.
-
type: Literal["mcp"]The type of the MCP tool. Always
mcp."mcp"
-
allowed_tools: Optional[McpAllowedTools]List of allowed tool names or a filter object.
-
List[str]A string array of allowed tool names
-
class McpAllowedToolsMcpToolFilter: …A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
-
authorization: Optional[str]An OAuth access token that can be used with a remote MCP server, either with a custom MCP server URL or a service connector. Your application must handle the OAuth authorization flow and provide the token here.
-
connector_id: Optional[Literal["connector_dropbox", "connector_gmail", "connector_googlecalendar", 5 more]]Identifier for service connectors, like those available in ChatGPT. One of
server_urlorconnector_idmust be provided. Learn more about service connectors here.Currently supported
connector_idvalues are:-
Dropbox:
connector_dropbox -
Gmail:
connector_gmail -
Google Calendar:
connector_googlecalendar -
Google Drive:
connector_googledrive -
Microsoft Teams:
connector_microsoftteams -
Outlook Calendar:
connector_outlookcalendar -
Outlook Email:
connector_outlookemail -
SharePoint:
connector_sharepoint -
"connector_dropbox" -
"connector_gmail" -
"connector_googlecalendar" -
"connector_googledrive" -
"connector_microsoftteams" -
"connector_outlookcalendar" -
"connector_outlookemail" -
"connector_sharepoint"
-
-
defer_loading: Optional[bool]Whether this MCP tool is deferred and discovered via tool search.
-
headers: Optional[Dict[str, str]]Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.
-
require_approval: Optional[McpRequireApproval]Specify which of the MCP server's tools require approval.
-
class McpRequireApprovalMcpToolApprovalFilter: …Specify which of the MCP server's tools require approval. Can be
always,never, or a filter object associated with tools that require approval.-
always: Optional[McpRequireApprovalMcpToolApprovalFilterAlways]A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
never: Optional[McpRequireApprovalMcpToolApprovalFilterNever]A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
-
Literal["always", "never"]Specify a single approval policy for all tools. One of
alwaysornever. When set toalways, all tools will require approval. When set tonever, all tools will not require approval.-
"always" -
"never"
-
-
-
server_description: Optional[str]Optional description of the MCP server, used to provide more context.
-
server_url: Optional[str]The URL for the MCP server. One of
server_urlorconnector_idmust be provided.
-
-
class CodeInterpreter: …A tool that runs Python code to help generate a response to a prompt.
-
container: CodeInterpreterContainerThe code interpreter container. Can be a container ID or an object that specifies uploaded file IDs to make available to your code, along with an optional
memory_limitsetting.-
strThe container ID.
-
class CodeInterpreterContainerCodeInterpreterToolAuto: …Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.
-
type: Literal["auto"]Always
auto."auto"
-
file_ids: Optional[List[str]]An optional list of uploaded files to make available to your code.
-
memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]The memory limit for the code interpreter container.
-
"1g" -
"4g" -
"16g" -
"64g"
-
-
network_policy: Optional[CodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicy]Network access policy for the container.
-
class ContainerNetworkPolicyDisabled: …-
type: Literal["disabled"]Disable outbound network access. Always
disabled."disabled"
-
-
class ContainerNetworkPolicyAllowlist: …-
allowed_domains: List[str]A list of allowed domains when type is
allowlist. -
type: Literal["allowlist"]Allow outbound network access only to specified domains. Always
allowlist."allowlist"
-
domain_secrets: Optional[List[ContainerNetworkPolicyDomainSecret]]Optional domain-scoped secrets for allowlisted domains.
-
domain: strThe domain associated with the secret.
-
name: strThe name of the secret to inject for the domain.
-
value: strThe secret value to inject for the domain.
-
-
-
-
-
-
type: Literal["code_interpreter"]The type of the code interpreter tool. Always
code_interpreter."code_interpreter"
-
-
class ImageGeneration: …A tool that generates images using the GPT image models.
-
type: Literal["image_generation"]The type of the image generation tool. Always
image_generation."image_generation"
-
action: Optional[Literal["generate", "edit", "auto"]]Whether to generate a new image or edit an existing image. Default:
auto.-
"generate" -
"edit" -
"auto"
-
-
background: Optional[Literal["transparent", "opaque", "auto"]]Allows to set transparency for the background of the generated image(s). This parameter is only supported for GPT image models that support transparent backgrounds. Must be one of
transparent,opaque, orauto(default value). Whenautois used, the model will automatically determine the best background for the image.gpt-image-2andgpt-image-2-2026-04-21do not support transparent backgrounds. Requests withbackgroundset totransparentwill return an error for these models; useopaqueorautoinstead.If
transparent, the output format needs to support transparency, so it should be set to eitherpng(default value) orwebp.-
"transparent" -
"opaque" -
"auto"
-
-
input_fidelity: Optional[Literal["high", "low"]]Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for
gpt-image-1andgpt-image-1.5and later models, unsupported forgpt-image-1-mini. Supportshighandlow. Defaults tolow.-
"high" -
"low"
-
-
input_image_mask: Optional[ImageGenerationInputImageMask]Optional mask for inpainting. Contains
image_url(string, optional) andfile_id(string, optional).-
file_id: Optional[str]File ID for the mask image.
-
image_url: Optional[str]Base64-encoded mask image.
-
-
model: Optional[Union[str, Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-2", 3 more], null]]The image generation model to use. Default:
gpt-image-1.-
str -
Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-2", 3 more]The image generation model to use. Default:
gpt-image-1.-
"gpt-image-1" -
"gpt-image-1-mini" -
"gpt-image-2" -
"gpt-image-2-2026-04-21" -
"gpt-image-1.5" -
"chatgpt-image-latest"
-
-
-
moderation: Optional[Literal["auto", "low"]]Moderation level for the generated image. Default:
auto.-
"auto" -
"low"
-
-
output_compression: Optional[int]Compression level for the output image. Default: 100.
-
output_format: Optional[Literal["png", "webp", "jpeg"]]The output format of the generated image. One of
png,webp, orjpeg. Default:png.-
"png" -
"webp" -
"jpeg"
-
-
partial_images: Optional[int]Number of partial images to generate in streaming mode, from 0 (default value) to 3.
-
quality: Optional[Literal["low", "medium", "high", "auto"]]The quality of the generated image. One of
low,medium,high, orauto. Default:auto.-
"low" -
"medium" -
"high" -
"auto"
-
-
size: Optional[Union[str, Literal["1024x1024", "1024x1536", "1536x1024", "auto"], null]]The size of the generated images. For
gpt-image-2andgpt-image-2-2026-04-21, arbitrary resolutions are supported asWIDTHxHEIGHTstrings, for example1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above2560x1440are experimental, and the maximum supported resolution is3840x2160. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes1024x1024,1536x1024, and1024x1536are supported by the GPT image models;autois supported for models that allow automatic sizing. Fordall-e-2, use one of256x256,512x512, or1024x1024. Fordall-e-3, use one of1024x1024,1792x1024, or1024x1792.-
str -
Literal["1024x1024", "1024x1536", "1536x1024", "auto"]The size of the generated images. For
gpt-image-2andgpt-image-2-2026-04-21, arbitrary resolutions are supported asWIDTHxHEIGHTstrings, for example1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above2560x1440are experimental, and the maximum supported resolution is3840x2160. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes1024x1024,1536x1024, and1024x1536are supported by the GPT image models;autois supported for models that allow automatic sizing. Fordall-e-2, use one of256x256,512x512, or1024x1024. Fordall-e-3, use one of1024x1024,1792x1024, or1024x1792.-
"1024x1024" -
"1024x1536" -
"1536x1024" -
"auto"
-
-
-
-
class LocalShell: …A tool that allows the model to execute shell commands in a local environment.
-
type: Literal["local_shell"]The type of the local shell tool. Always
local_shell."local_shell"
-
-
class FunctionShellTool: …A tool that allows the model to execute shell commands.
-
type: Literal["shell"]The type of the shell tool. Always
shell."shell"
-
environment: Optional[Environment]-
class ContainerAuto: …-
type: Literal["container_auto"]Automatically creates a container for this request
"container_auto"
-
file_ids: Optional[List[str]]An optional list of uploaded files to make available to your code.
-
memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]The memory limit for the container.
-
"1g" -
"4g" -
"16g" -
"64g"
-
-
network_policy: Optional[NetworkPolicy]Network access policy for the container.
-
class ContainerNetworkPolicyDisabled: … -
class ContainerNetworkPolicyAllowlist: …
-
-
skills: Optional[List[Skill]]An optional list of skills referenced by id or inline data.
-
class SkillReference: …-
skill_id: strThe ID of the referenced skill.
-
type: Literal["skill_reference"]References a skill created with the /v1/skills endpoint.
"skill_reference"
-
version: Optional[str]Optional skill version. Use a positive integer or 'latest'. Omit for default.
-
-
class InlineSkill: …-
description: strThe description of the skill.
-
name: strThe name of the skill.
-
source: InlineSkillSourceInline skill payload
-
data: strBase64-encoded skill zip bundle.
-
media_type: Literal["application/zip"]The media type of the inline skill payload. Must be
application/zip."application/zip"
-
type: Literal["base64"]The type of the inline skill source. Must be
base64."base64"
-
-
type: Literal["inline"]Defines an inline skill for this request.
"inline"
-
-
-
-
class LocalEnvironment: …-
type: Literal["local"]Use a local computer environment.
"local"
-
skills: Optional[List[LocalSkill]]An optional list of skills.
-
description: strThe description of the skill.
-
name: strThe name of the skill.
-
path: strThe path to the directory containing the skill.
-
-
-
class ContainerReference: …-
container_id: strThe ID of the referenced container.
-
type: Literal["container_reference"]References a container created with the /v1/containers endpoint
"container_reference"
-
-
-
-
class CustomTool: …A custom tool that processes input using a specified format. Learn more about custom tools
-
name: strThe name of the custom tool, used to identify it in tool calls.
-
type: Literal["custom"]The type of the custom tool. Always
custom."custom"
-
defer_loading: Optional[bool]Whether this tool should be deferred and discovered via tool search.
-
description: Optional[str]Optional description of the custom tool, used to provide more context.
-
format: Optional[CustomToolInputFormat]The input format for the custom tool. Default is unconstrained text.
-
class Text: …Unconstrained free-form text.
-
type: Literal["text"]Unconstrained text format. Always
text."text"
-
-
class Grammar: …A grammar defined by the user.
-
definition: strThe grammar definition.
-
syntax: Literal["lark", "regex"]The syntax of the grammar definition. One of
larkorregex.-
"lark" -
"regex"
-
-
type: Literal["grammar"]Grammar format. Always
grammar."grammar"
-
-
-
-
class NamespaceTool: …Groups function/custom tools under a shared namespace.
-
description: strA description of the namespace shown to the model.
-
name: strThe namespace name used in tool calls (for example,
crm). -
tools: List[Tool]The function/custom tools available inside this namespace.
-
class ToolFunction: …-
name: str -
type: Literal["function"]"function"
-
defer_loading: Optional[bool]Whether this function should be deferred and discovered via tool search.
-
description: Optional[str] -
parameters: Optional[object] -
strict: Optional[bool]
-
-
class CustomTool: …A custom tool that processes input using a specified format. Learn more about custom tools
-
-
type: Literal["namespace"]The type of the tool. Always
namespace."namespace"
-
-
class ToolSearchTool: …Hosted or BYOT tool search configuration for deferred tools.
-
type: Literal["tool_search"]The type of the tool. Always
tool_search."tool_search"
-
description: Optional[str]Description shown to the model for a client-executed tool search tool.
-
execution: Optional[Literal["server", "client"]]Whether tool search is executed by the server or by the client.
-
"server" -
"client"
-
-
parameters: Optional[object]Parameter schema for a client-executed tool search tool.
-
-
class WebSearchPreviewTool: …This tool searches the web for relevant results to use in a response. Learn more about the web search tool.
-
type: Literal["web_search_preview", "web_search_preview_2025_03_11"]The type of the web search tool. One of
web_search_previeworweb_search_preview_2025_03_11.-
"web_search_preview" -
"web_search_preview_2025_03_11"
-
-
search_content_types: Optional[List[Literal["text", "image"]]]-
"text" -
"image"
-
-
search_context_size: Optional[Literal["low", "medium", "high"]]High level guidance for the amount of context window space to use for the search. One of
low,medium, orhigh.mediumis the default.-
"low" -
"medium" -
"high"
-
-
user_location: Optional[UserLocation]The user's location.
-
type: Literal["approximate"]The type of location approximation. Always
approximate."approximate"
-
city: Optional[str]Free text input for the city of the user, e.g.
San Francisco. -
country: Optional[str]The two-letter ISO country code of the user, e.g.
US. -
region: Optional[str]Free text input for the region of the user, e.g.
California. -
timezone: Optional[str]The IANA timezone of the user, e.g.
America/Los_Angeles.
-
-
-
class ApplyPatchTool: …Allows the assistant to create, delete, or update files using unified diffs.
-
type: Literal["apply_patch"]The type of the tool. Always
apply_patch."apply_patch"
-
-
-
top_p: Optional[float]An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
-
error: EvalAPIErrorAn object representing an error response from the Eval API.
-
code: strThe error code.
-
message: strThe error message.
-
-
eval_id: strThe identifier of the associated evaluation.
-
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.
-
model: strThe model that is evaluated, if applicable.
-
name: strThe name of the evaluation run.
-
object: Literal["eval.run"]The type of the object. Always "eval.run".
"eval.run"
-
per_model_usage: List[PerModelUsage]Usage statistics for each model during the evaluation run.
-
cached_tokens: intThe number of tokens retrieved from cache.
-
completion_tokens: intThe number of completion tokens generated.
-
invocation_count: intThe number of invocations.
-
model_name: strThe name of the model.
-
prompt_tokens: intThe number of prompt tokens used.
-
total_tokens: intThe total number of tokens used.
-
-
per_testing_criteria_results: List[PerTestingCriteriaResult]Results per testing criteria applied during the evaluation run.
-
failed: intNumber of tests failed for this criteria.
-
passed: intNumber of tests passed for this criteria.
-
testing_criteria: strA description of the testing criteria.
-
-
report_url: strThe URL to the rendered evaluation run report on the UI dashboard.
-
result_counts: ResultCountsCounters summarizing the outcomes of the evaluation run.
-
errored: intNumber of output items that resulted in an error.
-
failed: intNumber of output items that failed to pass the evaluation.
-
passed: intNumber of output items that passed the evaluation.
-
total: intTotal number of executed output items.
-
-
status: strThe status of the evaluation run.
-
Example
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
page = client.evals.runs.list(
eval_id="eval_id",
)
page = page.data[0]
print(page.id)
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"data_source": {
"source": {
"content": [
{
"item": {
"foo": "bar"
},
"sample": {
"foo": "bar"
}
}
],
"type": "file_content"
},
"type": "jsonl"
},
"error": {
"code": "code",
"message": "message"
},
"eval_id": "eval_id",
"metadata": {
"foo": "string"
},
"model": "model",
"name": "name",
"object": "eval.run",
"per_model_usage": [
{
"cached_tokens": 0,
"completion_tokens": 0,
"invocation_count": 0,
"model_name": "model_name",
"prompt_tokens": 0,
"total_tokens": 0
}
],
"per_testing_criteria_results": [
{
"failed": 0,
"passed": 0,
"testing_criteria": "testing_criteria"
}
],
"report_url": "https://example.com",
"result_counts": {
"errored": 0,
"failed": 0,
"passed": 0,
"total": 0
},
"status": "status"
}
],
"first_id": "first_id",
"has_more": true,
"last_id": "last_id",
"object": "list"
}
Example
from openai import OpenAI
client = OpenAI()
runs = client.evals.runs.list("egroup_67abd54d9b0081909a86353f6fb9317a")
print(runs)
Response
{
"object": "list",
"data": [
{
"object": "eval.run",
"id": "evalrun_67e0c7d31560819090d60c0780591042",
"eval_id": "eval_67e0c726d560819083f19a957c4c640b",
"report_url": "https://platform.openai.com/evaluations/eval_67e0c726d560819083f19a957c4c640b",
"status": "completed",
"model": "o3-mini",
"name": "bulk_with_negative_examples_o3-mini",
"created_at": 1742784467,
"result_counts": {
"total": 1,
"errored": 0,
"failed": 0,
"passed": 1
},
"per_model_usage": [
{
"model_name": "o3-mini",
"invocation_count": 1,
"prompt_tokens": 563,
"completion_tokens": 874,
"total_tokens": 1437,
"cached_tokens": 0
}
],
"per_testing_criteria_results": [
{
"testing_criteria": "Push Notification Summary Grader-1808cd0b-eeec-4e0b-a519-337e79f4f5d1",
"passed": 1,
"failed": 0
}
],
"data_source": {
"type": "completions",
"source": {
"type": "file_content",
"content": [
{
"item": {
"notifications": "\n- New message from Sarah: \"Can you call me later?\"\n- Your package has been delivered!\n- Flash sale: 20% off electronics for the next 2 hours!\n"
}
}
]
},
"input_messages": {
"type": "template",
"template": [
{
"type": "message",
"role": "developer",
"content": {
"type": "input_text",
"text": "\n\n\n\nYou are a helpful assistant that takes in an array of push notifications and returns a collapsed summary of them.\nThe push notification will be provided as follows:\n<push_notifications>\n...notificationlist...\n</push_notifications>\n\nYou should return just the summary and nothing else.\n\n\nYou should return a summary that is concise and snappy.\n\n\nHere is an example of a good summary:\n<push_notifications>\n- Traffic alert: Accident reported on Main Street.- Package out for delivery: Expected by 5 PM.- New friend suggestion: Connect with Emma.\n</push_notifications>\n<summary>\nTraffic alert, package expected by 5pm, suggestion for new friend (Emily).\n</summary>\n\n\nHere is an example of a bad summary:\n<push_notifications>\n- Traffic alert: Accident reported on Main Street.- Package out for delivery: Expected by 5 PM.- New friend suggestion: Connect with Emma.\n</push_notifications>\n<summary>\nTraffic alert reported on main street. You have a package that will arrive by 5pm, Emily is a new friend suggested for you.\n</summary>\n"
}
},
{
"type": "message",
"role": "user",
"content": {
"type": "input_text",
"text": "<push_notifications>{{item.notifications}}</push_notifications>"
}
}
]
},
"model": "o3-mini",
"sampling_params": null
},
"error": null,
"metadata": {}
}
],
"first_id": "evalrun_67e0c7d31560819090d60c0780591042",
"last_id": "evalrun_67e0c7d31560819090d60c0780591042",
"has_more": true
}
Create eval run
evals.runs.create(streval_id, RunCreateParams**kwargs) -> RunCreateResponse
post /evals/{eval_id}/runs
Kicks off a new run for a given evaluation, specifying the data source, and what model configuration to use to test. The datasource will be validated against the schema specified in the config of the evaluation.
Parameters
-
eval_id: str -
data_source: DataSourceDetails about the run's data source.
-
class CreateEvalJSONLRunDataSource: …A JsonlRunDataSource object with that specifies a JSONL file that matches the eval
-
source: SourceDetermines what populates the
itemnamespace in the data source.-
class SourceFileContent: …-
content: List[SourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class SourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
-
type: Literal["jsonl"]The type of data source. Always
jsonl."jsonl"
-
-
class CreateEvalCompletionsRunDataSource: …A CompletionsRunDataSource object describing a model sampling configuration.
-
source: SourceDetermines what populates the
itemnamespace in this run's data source.-
class SourceFileContent: …-
content: List[SourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class SourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
class SourceStoredCompletions: …A StoredCompletionsRunDataSource configuration describing a set of filters
-
type: Literal["stored_completions"]The type of source. Always
stored_completions."stored_completions"
-
created_after: Optional[int]An optional Unix timestamp to filter items created after this time.
-
created_before: Optional[int]An optional Unix timestamp to filter items created before this time.
-
limit: Optional[int]An optional maximum number of items to return.
-
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.
-
model: Optional[str]An optional model to filter by (e.g., 'gpt-4o').
-
-
-
type: Literal["completions"]The type of run data source. Always
completions."completions"
-
input_messages: Optional[InputMessages]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 theitemnamespace.-
class InputMessagesTemplate: …-
template: List[InputMessagesTemplateTemplate]A list of chat messages forming the prompt or context. May include variable references to the
itemnamespace, ie {{item.name}}.-
class EasyInputMessage: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: Union[str, ResponseInputMessageContentList]Text, image, or audio input to the model, used to generate a response. Can also contain previous assistant responses.
-
strA text input to the model.
-
List[ResponseInputContent]-
class ResponseInputText: …A text input to the model.
-
text: strThe text input to the model.
-
type: Literal["input_text"]The type of the input item. Always
input_text."input_text"
-
-
class ResponseInputImage: …An image input to the model. Learn about image inputs.
-
detail: Literal["low", "high", "auto", "original"]The detail level of the image to be sent to the model. One of
high,low,auto, ororiginal. Defaults toauto.-
"low" -
"high" -
"auto" -
"original"
-
-
type: Literal["input_image"]The type of the input item. Always
input_image."input_image"
-
file_id: Optional[str]The ID of the file to be sent to the model.
-
image_url: Optional[str]The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.
-
-
class ResponseInputFile: …A file input to the model.
-
type: Literal["input_file"]The type of the input item. Always
input_file."input_file"
-
detail: Optional[Literal["low", "high"]]The detail level of the file to be sent to the model. Use
lowfor the default rendering behavior, orhighto render the file at higher quality. Defaults tolow.-
"low" -
"high"
-
-
file_data: Optional[str]The content of the file to be sent to the model.
-
file_id: Optional[str]The ID of the file to be sent to the model.
-
file_url: Optional[str]The URL of the file to be sent to the model.
-
filename: Optional[str]The name of the file to be sent to the model.
-
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
phase: Optional[Literal["commentary", "final_answer"]]Labels an
assistantmessage as intermediate commentary (commentary) or the final answer (final_answer). For models likegpt-5.3-codexand beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages.-
"commentary" -
"final_answer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
class InputMessagesTemplateTemplateEvalItem: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: InputMessagesTemplateTemplateEvalItemContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class InputMessagesTemplateTemplateEvalItemContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class InputMessagesTemplateTemplateEvalItemContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
input_audio: InputAudio-
data: strBase64-encoded audio data.
-
format: Literal["mp3", "wav"]The format of the audio data. Currently supported formats are
mp3andwav.-
"mp3" -
"wav"
-
-
-
type: Literal["input_audio"]The type of the input item. Always
input_audio."input_audio"
-
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
-
type: Literal["template"]The type of input messages. Always
template."template"
-
-
class InputMessagesItemReference: …-
item_reference: strA reference to a variable in the
itemnamespace. Ie, "item.input_trajectory" -
type: Literal["item_reference"]The type of input messages. Always
item_reference."item_reference"
-
-
-
model: Optional[str]The name of the model to use for generating completions (e.g. "o3-mini").
-
sampling_params: Optional[SamplingParams]-
max_completion_tokens: Optional[int]The maximum number of tokens in the generated output.
-
reasoning_effort: Optional[ReasoningEffort]Constrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.-
gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1. -
All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. -
The
gpt-5-promodel defaults to (and only supports)highreasoning effort. -
xhighis supported for all models aftergpt-5.1-codex-max. -
"none" -
"minimal" -
"low" -
"medium" -
"high" -
"xhigh"
-
-
response_format: Optional[SamplingParamsResponseFormat]An object specifying the format that the model must output.
Setting to
{ "type": "json_schema", "json_schema": {...} }enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.Setting to
{ "type": "json_object" }enables the older JSON mode, which ensures the message the model generates is valid JSON. Usingjson_schemais preferred for models that support it.-
class ResponseFormatText: …Default response format. Used to generate text responses.
-
type: Literal["text"]The type of response format being defined. Always
text."text"
-
-
class ResponseFormatJSONSchema: …JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.
-
json_schema: JSONSchemaStructured Outputs configuration options, including a JSON Schema.
-
name: strThe name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
description: Optional[str]A description of what the response format is for, used by the model to determine how to respond in the format.
-
schema: Optional[Dict[str, object]]The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.
-
strict: Optional[bool]Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the
schemafield. Only a subset of JSON Schema is supported whenstrictistrue. To learn more, read the Structured Outputs guide.
-
-
type: Literal["json_schema"]The type of response format being defined. Always
json_schema."json_schema"
-
-
class ResponseFormatJSONObject: …JSON object response format. An older method of generating JSON responses. Using
json_schemais recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.-
type: Literal["json_object"]The type of response format being defined. Always
json_object."json_object"
-
-
-
seed: Optional[int]A seed value to initialize the randomness, during sampling.
-
temperature: Optional[float]A higher temperature increases randomness in the outputs.
-
tools: Optional[List[ChatCompletionFunctionTool]]A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
-
function: FunctionDefinition-
name: strThe name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
description: Optional[str]A description of what the function does, used by the model to choose when and how to call the function.
-
parameters: Optional[FunctionParameters]The parameters the functions accepts, described as a JSON Schema object. See the guide for examples, and the JSON Schema reference for documentation about the format.
Omitting
parametersdefines a function with an empty parameter list. -
strict: Optional[bool]Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the
parametersfield. Only a subset of JSON Schema is supported whenstrictistrue. Learn more about Structured Outputs in the function calling guide.
-
-
type: Literal["function"]The type of the tool. Currently, only
functionis supported."function"
-
-
top_p: Optional[float]An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
class DataSourceCreateEvalResponsesRunDataSource: …A ResponsesRunDataSource object describing a model sampling configuration.
-
source: DataSourceCreateEvalResponsesRunDataSourceSourceDetermines what populates the
itemnamespace in this run's data source.-
class DataSourceCreateEvalResponsesRunDataSourceSourceFileContent: …-
content: Iterable[DataSourceCreateEvalResponsesRunDataSourceSourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class DataSourceCreateEvalResponsesRunDataSourceSourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
class DataSourceCreateEvalResponsesRunDataSourceSourceResponses: …A EvalResponsesSource object describing a run data source configuration.
-
type: Literal["responses"]The type of run data source. Always
responses."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. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1.- All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. - The
gpt-5-promodel defaults to (and only supports)highreasoning effort. xhighis supported for all models aftergpt-5.1-codex-max.
-
temperature: Optional[float]Sampling temperature. This is a query parameter used to select responses.
-
tools: Optional[Sequence[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[Sequence[str]]List of user identifiers. This is a query parameter used to select responses.
-
-
-
type: Literal["responses"]The type of run data source. Always
responses."responses"
-
input_messages: Optional[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 theitemnamespace.-
class DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplate: …-
template: Iterable[DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplate]A list of chat messages forming the prompt or context. May include variable references to the
itemnamespace, ie {{item.name}}.-
class DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateChatMessage: …-
content: strThe content of the message.
-
role: strThe role of the message (e.g. "system", "assistant", "user").
-
-
class DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItem: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
Sequence[GraderInputsParamItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
-
type: Literal["template"]The type of input messages. Always
template."template"
-
-
class DataSourceCreateEvalResponsesRunDataSourceInputMessagesItemReference: …-
item_reference: strA reference to a variable in the
itemnamespace. Ie, "item.name" -
type: Literal["item_reference"]The type of input messages. Always
item_reference."item_reference"
-
-
-
model: Optional[str]The name of the model to use for generating completions (e.g. "o3-mini").
-
sampling_params: Optional[DataSourceCreateEvalResponsesRunDataSourceSamplingParams]-
max_completion_tokens: Optional[int]The maximum number of tokens in the generated output.
-
reasoning_effort: Optional[ReasoningEffort]Constrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1.- All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. - The
gpt-5-promodel defaults to (and only supports)highreasoning effort. xhighis supported for all models aftergpt-5.1-codex-max.
-
seed: Optional[int]A seed value to initialize the randomness, during sampling.
-
temperature: Optional[float]A higher temperature increases randomness in the outputs.
-
text: Optional[DataSourceCreateEvalResponsesRunDataSourceSamplingParamsText]Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:
-
format: Optional[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.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. Usingjson_schemais preferred for models that support it.-
class ResponseFormatText: …Default response format. Used to generate text responses.
-
class ResponseFormatTextJSONSchemaConfig: …JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.
-
name: strThe name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
schema: Dict[str, object]The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.
-
type: Literal["json_schema"]The type of response format being defined. Always
json_schema."json_schema"
-
description: Optional[str]A description of what the response format is for, used by the model to determine how to respond in the format.
-
strict: Optional[bool]Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the
schemafield. Only a subset of JSON Schema is supported whenstrictistrue. To learn more, read the Structured Outputs guide.
-
-
class ResponseFormatJSONObject: …JSON object response format. An older method of generating JSON responses. Using
json_schemais recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.
-
-
tools: Optional[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_choiceparameter.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 or file search. Learn more about built-in tools.
-
Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code. Learn more about function calling.
-
class FunctionTool: …Defines a function in your own code the model can choose to call. Learn more about function calling.
-
name: strThe name of the function to call.
-
parameters: Optional[Dict[str, object]]A JSON schema object describing the parameters of the function.
-
strict: Optional[bool]Whether to enforce strict parameter validation. Default
true. -
type: Literal["function"]The type of the function tool. Always
function."function"
-
defer_loading: Optional[bool]Whether this function is deferred and loaded via tool search.
-
description: Optional[str]A description of the function. Used by the model to determine whether or not to call the function.
-
-
class FileSearchTool: …A tool that searches for relevant content from uploaded files. Learn more about the file search tool.
-
type: Literal["file_search"]The type of the file search tool. Always
file_search."file_search"
-
vector_store_ids: List[str]The IDs of the vector stores to search.
-
filters: Optional[Filters]A filter to apply.
-
class ComparisonFilter: …A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
key: strThe key to compare against the value.
-
type: Literal["eq", "ne", "gt", 5 more]Specifies the comparison operator:
eq,ne,gt,gte,lt,lte,in,nin.-
eq: equals -
ne: not equal -
gt: greater than -
gte: greater than or equal -
lt: less than -
lte: less than or equal -
in: in -
nin: not in -
"eq" -
"ne" -
"gt" -
"gte" -
"lt" -
"lte" -
"in" -
"nin"
-
-
value: Union[str, float, bool, List[Union[str, float]]]The value to compare against the attribute key; supports string, number, or boolean types.
-
str -
float -
bool -
List[Union[str, float]]-
str -
float
-
-
-
-
class CompoundFilter: …Combine multiple filters using
andoror.-
filters: List[Filter]Array of filters to combine. Items can be
ComparisonFilterorCompoundFilter.-
class ComparisonFilter: …A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
object
-
-
type: Literal["and", "or"]Type of operation:
andoror.-
"and" -
"or"
-
-
-
-
max_num_results: Optional[int]The maximum number of results to return. This number should be between 1 and 50 inclusive.
-
ranking_options: Optional[RankingOptions]Ranking options for search.
-
hybrid_search: Optional[RankingOptionsHybridSearch]Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.
-
embedding_weight: floatThe weight of the embedding in the reciprocal ranking fusion.
-
text_weight: floatThe weight of the text in the reciprocal ranking fusion.
-
-
ranker: Optional[Literal["auto", "default-2024-11-15"]]The ranker to use for the file search.
-
"auto" -
"default-2024-11-15"
-
-
score_threshold: Optional[float]The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.
-
-
-
class ComputerTool: …A tool that controls a virtual computer. Learn more about the computer tool.
-
type: Literal["computer"]The type of the computer tool. Always
computer."computer"
-
-
class ComputerUsePreviewTool: …A tool that controls a virtual computer. Learn more about the computer tool.
-
display_height: intThe height of the computer display.
-
display_width: intThe width of the computer display.
-
environment: Literal["windows", "mac", "linux", 2 more]The type of computer environment to control.
-
"windows" -
"mac" -
"linux" -
"ubuntu" -
"browser"
-
-
type: Literal["computer_use_preview"]The type of the computer use tool. Always
computer_use_preview."computer_use_preview"
-
-
class WebSearchTool: …Search the Internet for sources related to the prompt. Learn more about the web search tool.
-
type: Literal["web_search", "web_search_2025_08_26"]The type of the web search tool. One of
web_searchorweb_search_2025_08_26.-
"web_search" -
"web_search_2025_08_26"
-
-
filters: Optional[Filters]Filters for the search.
-
allowed_domains: Optional[List[str]]Allowed domains for the search. If not provided, all domains are allowed. Subdomains of the provided domains are allowed as well.
Example:
["pubmed.ncbi.nlm.nih.gov"]
-
-
search_context_size: Optional[Literal["low", "medium", "high"]]High level guidance for the amount of context window space to use for the search. One of
low,medium, orhigh.mediumis the default.-
"low" -
"medium" -
"high"
-
-
user_location: Optional[UserLocation]The approximate location of the user.
-
city: Optional[str]Free text input for the city of the user, e.g.
San Francisco. -
country: Optional[str]The two-letter ISO country code of the user, e.g.
US. -
region: Optional[str]Free text input for the region of the user, e.g.
California. -
timezone: Optional[str]The IANA timezone of the user, e.g.
America/Los_Angeles. -
type: Optional[Literal["approximate"]]The type of location approximation. Always
approximate."approximate"
-
-
-
class Mcp: …Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
-
server_label: strA label for this MCP server, used to identify it in tool calls.
-
type: Literal["mcp"]The type of the MCP tool. Always
mcp."mcp"
-
allowed_tools: Optional[McpAllowedTools]List of allowed tool names or a filter object.
-
List[str]A string array of allowed tool names
-
class McpAllowedToolsMcpToolFilter: …A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
-
authorization: Optional[str]An OAuth access token that can be used with a remote MCP server, either with a custom MCP server URL or a service connector. Your application must handle the OAuth authorization flow and provide the token here.
-
connector_id: Optional[Literal["connector_dropbox", "connector_gmail", "connector_googlecalendar", 5 more]]Identifier for service connectors, like those available in ChatGPT. One of
server_urlorconnector_idmust be provided. Learn more about service connectors here.Currently supported
connector_idvalues are:-
Dropbox:
connector_dropbox -
Gmail:
connector_gmail -
Google Calendar:
connector_googlecalendar -
Google Drive:
connector_googledrive -
Microsoft Teams:
connector_microsoftteams -
Outlook Calendar:
connector_outlookcalendar -
Outlook Email:
connector_outlookemail -
SharePoint:
connector_sharepoint -
"connector_dropbox" -
"connector_gmail" -
"connector_googlecalendar" -
"connector_googledrive" -
"connector_microsoftteams" -
"connector_outlookcalendar" -
"connector_outlookemail" -
"connector_sharepoint"
-
-
defer_loading: Optional[bool]Whether this MCP tool is deferred and discovered via tool search.
-
headers: Optional[Dict[str, str]]Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.
-
require_approval: Optional[McpRequireApproval]Specify which of the MCP server's tools require approval.
-
class McpRequireApprovalMcpToolApprovalFilter: …Specify which of the MCP server's tools require approval. Can be
always,never, or a filter object associated with tools that require approval.-
always: Optional[McpRequireApprovalMcpToolApprovalFilterAlways]A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
never: Optional[McpRequireApprovalMcpToolApprovalFilterNever]A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
-
Literal["always", "never"]Specify a single approval policy for all tools. One of
alwaysornever. When set toalways, all tools will require approval. When set tonever, all tools will not require approval.-
"always" -
"never"
-
-
-
server_description: Optional[str]Optional description of the MCP server, used to provide more context.
-
server_url: Optional[str]The URL for the MCP server. One of
server_urlorconnector_idmust be provided.
-
-
class CodeInterpreter: …A tool that runs Python code to help generate a response to a prompt.
-
container: CodeInterpreterContainerThe code interpreter container. Can be a container ID or an object that specifies uploaded file IDs to make available to your code, along with an optional
memory_limitsetting.-
strThe container ID.
-
class CodeInterpreterContainerCodeInterpreterToolAuto: …Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.
-
type: Literal["auto"]Always
auto."auto"
-
file_ids: Optional[List[str]]An optional list of uploaded files to make available to your code.
-
memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]The memory limit for the code interpreter container.
-
"1g" -
"4g" -
"16g" -
"64g"
-
-
network_policy: Optional[CodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicy]Network access policy for the container.
-
class ContainerNetworkPolicyDisabled: …-
type: Literal["disabled"]Disable outbound network access. Always
disabled."disabled"
-
-
class ContainerNetworkPolicyAllowlist: …-
allowed_domains: List[str]A list of allowed domains when type is
allowlist. -
type: Literal["allowlist"]Allow outbound network access only to specified domains. Always
allowlist."allowlist"
-
domain_secrets: Optional[List[ContainerNetworkPolicyDomainSecret]]Optional domain-scoped secrets for allowlisted domains.
-
domain: strThe domain associated with the secret.
-
name: strThe name of the secret to inject for the domain.
-
value: strThe secret value to inject for the domain.
-
-
-
-
-
-
type: Literal["code_interpreter"]The type of the code interpreter tool. Always
code_interpreter."code_interpreter"
-
-
class ImageGeneration: …A tool that generates images using the GPT image models.
-
type: Literal["image_generation"]The type of the image generation tool. Always
image_generation."image_generation"
-
action: Optional[Literal["generate", "edit", "auto"]]Whether to generate a new image or edit an existing image. Default:
auto.-
"generate" -
"edit" -
"auto"
-
-
background: Optional[Literal["transparent", "opaque", "auto"]]Allows to set transparency for the background of the generated image(s). This parameter is only supported for GPT image models that support transparent backgrounds. Must be one of
transparent,opaque, orauto(default value). Whenautois used, the model will automatically determine the best background for the image.gpt-image-2andgpt-image-2-2026-04-21do not support transparent backgrounds. Requests withbackgroundset totransparentwill return an error for these models; useopaqueorautoinstead.If
transparent, the output format needs to support transparency, so it should be set to eitherpng(default value) orwebp.-
"transparent" -
"opaque" -
"auto"
-
-
input_fidelity: Optional[Literal["high", "low"]]Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for
gpt-image-1andgpt-image-1.5and later models, unsupported forgpt-image-1-mini. Supportshighandlow. Defaults tolow.-
"high" -
"low"
-
-
input_image_mask: Optional[ImageGenerationInputImageMask]Optional mask for inpainting. Contains
image_url(string, optional) andfile_id(string, optional).-
file_id: Optional[str]File ID for the mask image.
-
image_url: Optional[str]Base64-encoded mask image.
-
-
model: Optional[Union[str, Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-2", 3 more], null]]The image generation model to use. Default:
gpt-image-1.-
str -
Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-2", 3 more]The image generation model to use. Default:
gpt-image-1.-
"gpt-image-1" -
"gpt-image-1-mini" -
"gpt-image-2" -
"gpt-image-2-2026-04-21" -
"gpt-image-1.5" -
"chatgpt-image-latest"
-
-
-
moderation: Optional[Literal["auto", "low"]]Moderation level for the generated image. Default:
auto.-
"auto" -
"low"
-
-
output_compression: Optional[int]Compression level for the output image. Default: 100.
-
output_format: Optional[Literal["png", "webp", "jpeg"]]The output format of the generated image. One of
png,webp, orjpeg. Default:png.-
"png" -
"webp" -
"jpeg"
-
-
partial_images: Optional[int]Number of partial images to generate in streaming mode, from 0 (default value) to 3.
-
quality: Optional[Literal["low", "medium", "high", "auto"]]The quality of the generated image. One of
low,medium,high, orauto. Default:auto.-
"low" -
"medium" -
"high" -
"auto"
-
-
size: Optional[Union[str, Literal["1024x1024", "1024x1536", "1536x1024", "auto"], null]]The size of the generated images. For
gpt-image-2andgpt-image-2-2026-04-21, arbitrary resolutions are supported asWIDTHxHEIGHTstrings, for example1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above2560x1440are experimental, and the maximum supported resolution is3840x2160. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes1024x1024,1536x1024, and1024x1536are supported by the GPT image models;autois supported for models that allow automatic sizing. Fordall-e-2, use one of256x256,512x512, or1024x1024. Fordall-e-3, use one of1024x1024,1792x1024, or1024x1792.-
str -
Literal["1024x1024", "1024x1536", "1536x1024", "auto"]The size of the generated images. For
gpt-image-2andgpt-image-2-2026-04-21, arbitrary resolutions are supported asWIDTHxHEIGHTstrings, for example1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above2560x1440are experimental, and the maximum supported resolution is3840x2160. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes1024x1024,1536x1024, and1024x1536are supported by the GPT image models;autois supported for models that allow automatic sizing. Fordall-e-2, use one of256x256,512x512, or1024x1024. Fordall-e-3, use one of1024x1024,1792x1024, or1024x1792.-
"1024x1024" -
"1024x1536" -
"1536x1024" -
"auto"
-
-
-
-
class LocalShell: …A tool that allows the model to execute shell commands in a local environment.
-
type: Literal["local_shell"]The type of the local shell tool. Always
local_shell."local_shell"
-
-
class FunctionShellTool: …A tool that allows the model to execute shell commands.
-
type: Literal["shell"]The type of the shell tool. Always
shell."shell"
-
environment: Optional[Environment]-
class ContainerAuto: …-
type: Literal["container_auto"]Automatically creates a container for this request
"container_auto"
-
file_ids: Optional[List[str]]An optional list of uploaded files to make available to your code.
-
memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]The memory limit for the container.
-
"1g" -
"4g" -
"16g" -
"64g"
-
-
network_policy: Optional[NetworkPolicy]Network access policy for the container.
-
class ContainerNetworkPolicyDisabled: … -
class ContainerNetworkPolicyAllowlist: …
-
-
skills: Optional[List[Skill]]An optional list of skills referenced by id or inline data.
-
class SkillReference: …-
skill_id: strThe ID of the referenced skill.
-
type: Literal["skill_reference"]References a skill created with the /v1/skills endpoint.
"skill_reference"
-
version: Optional[str]Optional skill version. Use a positive integer or 'latest'. Omit for default.
-
-
class InlineSkill: …-
description: strThe description of the skill.
-
name: strThe name of the skill.
-
source: InlineSkillSourceInline skill payload
-
data: strBase64-encoded skill zip bundle.
-
media_type: Literal["application/zip"]The media type of the inline skill payload. Must be
application/zip."application/zip"
-
type: Literal["base64"]The type of the inline skill source. Must be
base64."base64"
-
-
type: Literal["inline"]Defines an inline skill for this request.
"inline"
-
-
-
-
class LocalEnvironment: …-
type: Literal["local"]Use a local computer environment.
"local"
-
skills: Optional[List[LocalSkill]]An optional list of skills.
-
description: strThe description of the skill.
-
name: strThe name of the skill.
-
path: strThe path to the directory containing the skill.
-
-
-
class ContainerReference: …-
container_id: strThe ID of the referenced container.
-
type: Literal["container_reference"]References a container created with the /v1/containers endpoint
"container_reference"
-
-
-
-
class CustomTool: …A custom tool that processes input using a specified format. Learn more about custom tools
-
name: strThe name of the custom tool, used to identify it in tool calls.
-
type: Literal["custom"]The type of the custom tool. Always
custom."custom"
-
defer_loading: Optional[bool]Whether this tool should be deferred and discovered via tool search.
-
description: Optional[str]Optional description of the custom tool, used to provide more context.
-
format: Optional[CustomToolInputFormat]The input format for the custom tool. Default is unconstrained text.
-
class Text: …Unconstrained free-form text.
-
type: Literal["text"]Unconstrained text format. Always
text."text"
-
-
class Grammar: …A grammar defined by the user.
-
definition: strThe grammar definition.
-
syntax: Literal["lark", "regex"]The syntax of the grammar definition. One of
larkorregex.-
"lark" -
"regex"
-
-
type: Literal["grammar"]Grammar format. Always
grammar."grammar"
-
-
-
-
class NamespaceTool: …Groups function/custom tools under a shared namespace.
-
description: strA description of the namespace shown to the model.
-
name: strThe namespace name used in tool calls (for example,
crm). -
tools: List[Tool]The function/custom tools available inside this namespace.
-
class ToolFunction: …-
name: str -
type: Literal["function"]"function"
-
defer_loading: Optional[bool]Whether this function should be deferred and discovered via tool search.
-
description: Optional[str] -
parameters: Optional[object] -
strict: Optional[bool]
-
-
class CustomTool: …A custom tool that processes input using a specified format. Learn more about custom tools
-
-
type: Literal["namespace"]The type of the tool. Always
namespace."namespace"
-
-
class ToolSearchTool: …Hosted or BYOT tool search configuration for deferred tools.
-
type: Literal["tool_search"]The type of the tool. Always
tool_search."tool_search"
-
description: Optional[str]Description shown to the model for a client-executed tool search tool.
-
execution: Optional[Literal["server", "client"]]Whether tool search is executed by the server or by the client.
-
"server" -
"client"
-
-
parameters: Optional[object]Parameter schema for a client-executed tool search tool.
-
-
class WebSearchPreviewTool: …This tool searches the web for relevant results to use in a response. Learn more about the web search tool.
-
type: Literal["web_search_preview", "web_search_preview_2025_03_11"]The type of the web search tool. One of
web_search_previeworweb_search_preview_2025_03_11.-
"web_search_preview" -
"web_search_preview_2025_03_11"
-
-
search_content_types: Optional[List[Literal["text", "image"]]]-
"text" -
"image"
-
-
search_context_size: Optional[Literal["low", "medium", "high"]]High level guidance for the amount of context window space to use for the search. One of
low,medium, orhigh.mediumis the default.-
"low" -
"medium" -
"high"
-
-
user_location: Optional[UserLocation]The user's location.
-
type: Literal["approximate"]The type of location approximation. Always
approximate."approximate"
-
city: Optional[str]Free text input for the city of the user, e.g.
San Francisco. -
country: Optional[str]The two-letter ISO country code of the user, e.g.
US. -
region: Optional[str]Free text input for the region of the user, e.g.
California. -
timezone: Optional[str]The IANA timezone of the user, e.g.
America/Los_Angeles.
-
-
-
class ApplyPatchTool: …Allows the assistant to create, delete, or update files using unified diffs.
-
type: Literal["apply_patch"]The type of the tool. Always
apply_patch."apply_patch"
-
-
-
top_p: Optional[float]An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
-
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: Optional[str]The name of the run.
Returns
-
class RunCreateResponse: …A schema representing an evaluation run.
-
id: strUnique identifier for the evaluation run.
-
created_at: intUnix timestamp (in seconds) when the evaluation run was created.
-
data_source: DataSourceInformation about the run's data source.
-
class CreateEvalJSONLRunDataSource: …A JsonlRunDataSource object with that specifies a JSONL file that matches the eval
-
source: SourceDetermines what populates the
itemnamespace in the data source.-
class SourceFileContent: …-
content: List[SourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class SourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
-
type: Literal["jsonl"]The type of data source. Always
jsonl."jsonl"
-
-
class CreateEvalCompletionsRunDataSource: …A CompletionsRunDataSource object describing a model sampling configuration.
-
source: SourceDetermines what populates the
itemnamespace in this run's data source.-
class SourceFileContent: …-
content: List[SourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class SourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
class SourceStoredCompletions: …A StoredCompletionsRunDataSource configuration describing a set of filters
-
type: Literal["stored_completions"]The type of source. Always
stored_completions."stored_completions"
-
created_after: Optional[int]An optional Unix timestamp to filter items created after this time.
-
created_before: Optional[int]An optional Unix timestamp to filter items created before this time.
-
limit: Optional[int]An optional maximum number of items to return.
-
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.
-
model: Optional[str]An optional model to filter by (e.g., 'gpt-4o').
-
-
-
type: Literal["completions"]The type of run data source. Always
completions."completions"
-
input_messages: Optional[InputMessages]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 theitemnamespace.-
class InputMessagesTemplate: …-
template: List[InputMessagesTemplateTemplate]A list of chat messages forming the prompt or context. May include variable references to the
itemnamespace, ie {{item.name}}.-
class EasyInputMessage: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: Union[str, ResponseInputMessageContentList]Text, image, or audio input to the model, used to generate a response. Can also contain previous assistant responses.
-
strA text input to the model.
-
List[ResponseInputContent]-
class ResponseInputText: …A text input to the model.
-
text: strThe text input to the model.
-
type: Literal["input_text"]The type of the input item. Always
input_text."input_text"
-
-
class ResponseInputImage: …An image input to the model. Learn about image inputs.
-
detail: Literal["low", "high", "auto", "original"]The detail level of the image to be sent to the model. One of
high,low,auto, ororiginal. Defaults toauto.-
"low" -
"high" -
"auto" -
"original"
-
-
type: Literal["input_image"]The type of the input item. Always
input_image."input_image"
-
file_id: Optional[str]The ID of the file to be sent to the model.
-
image_url: Optional[str]The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.
-
-
class ResponseInputFile: …A file input to the model.
-
type: Literal["input_file"]The type of the input item. Always
input_file."input_file"
-
detail: Optional[Literal["low", "high"]]The detail level of the file to be sent to the model. Use
lowfor the default rendering behavior, orhighto render the file at higher quality. Defaults tolow.-
"low" -
"high"
-
-
file_data: Optional[str]The content of the file to be sent to the model.
-
file_id: Optional[str]The ID of the file to be sent to the model.
-
file_url: Optional[str]The URL of the file to be sent to the model.
-
filename: Optional[str]The name of the file to be sent to the model.
-
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
phase: Optional[Literal["commentary", "final_answer"]]Labels an
assistantmessage as intermediate commentary (commentary) or the final answer (final_answer). For models likegpt-5.3-codexand beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages.-
"commentary" -
"final_answer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
class InputMessagesTemplateTemplateEvalItem: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: InputMessagesTemplateTemplateEvalItemContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class InputMessagesTemplateTemplateEvalItemContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class InputMessagesTemplateTemplateEvalItemContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
input_audio: InputAudio-
data: strBase64-encoded audio data.
-
format: Literal["mp3", "wav"]The format of the audio data. Currently supported formats are
mp3andwav.-
"mp3" -
"wav"
-
-
-
type: Literal["input_audio"]The type of the input item. Always
input_audio."input_audio"
-
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
-
type: Literal["template"]The type of input messages. Always
template."template"
-
-
class InputMessagesItemReference: …-
item_reference: strA reference to a variable in the
itemnamespace. Ie, "item.input_trajectory" -
type: Literal["item_reference"]The type of input messages. Always
item_reference."item_reference"
-
-
-
model: Optional[str]The name of the model to use for generating completions (e.g. "o3-mini").
-
sampling_params: Optional[SamplingParams]-
max_completion_tokens: Optional[int]The maximum number of tokens in the generated output.
-
reasoning_effort: Optional[ReasoningEffort]Constrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.-
gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1. -
All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. -
The
gpt-5-promodel defaults to (and only supports)highreasoning effort. -
xhighis supported for all models aftergpt-5.1-codex-max. -
"none" -
"minimal" -
"low" -
"medium" -
"high" -
"xhigh"
-
-
response_format: Optional[SamplingParamsResponseFormat]An object specifying the format that the model must output.
Setting to
{ "type": "json_schema", "json_schema": {...} }enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.Setting to
{ "type": "json_object" }enables the older JSON mode, which ensures the message the model generates is valid JSON. Usingjson_schemais preferred for models that support it.-
class ResponseFormatText: …Default response format. Used to generate text responses.
-
type: Literal["text"]The type of response format being defined. Always
text."text"
-
-
class ResponseFormatJSONSchema: …JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.
-
json_schema: JSONSchemaStructured Outputs configuration options, including a JSON Schema.
-
name: strThe name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
description: Optional[str]A description of what the response format is for, used by the model to determine how to respond in the format.
-
schema: Optional[Dict[str, object]]The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.
-
strict: Optional[bool]Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the
schemafield. Only a subset of JSON Schema is supported whenstrictistrue. To learn more, read the Structured Outputs guide.
-
-
type: Literal["json_schema"]The type of response format being defined. Always
json_schema."json_schema"
-
-
class ResponseFormatJSONObject: …JSON object response format. An older method of generating JSON responses. Using
json_schemais recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.-
type: Literal["json_object"]The type of response format being defined. Always
json_object."json_object"
-
-
-
seed: Optional[int]A seed value to initialize the randomness, during sampling.
-
temperature: Optional[float]A higher temperature increases randomness in the outputs.
-
tools: Optional[List[ChatCompletionFunctionTool]]A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
-
function: FunctionDefinition-
name: strThe name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
description: Optional[str]A description of what the function does, used by the model to choose when and how to call the function.
-
parameters: Optional[FunctionParameters]The parameters the functions accepts, described as a JSON Schema object. See the guide for examples, and the JSON Schema reference for documentation about the format.
Omitting
parametersdefines a function with an empty parameter list. -
strict: Optional[bool]Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the
parametersfield. Only a subset of JSON Schema is supported whenstrictistrue. Learn more about Structured Outputs in the function calling guide.
-
-
type: Literal["function"]The type of the tool. Currently, only
functionis supported."function"
-
-
top_p: Optional[float]An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
class DataSourceResponses: …A ResponsesRunDataSource object describing a model sampling configuration.
-
source: DataSourceResponsesSourceDetermines what populates the
itemnamespace in this run's data source.-
class DataSourceResponsesSourceFileContent: …-
content: List[DataSourceResponsesSourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class DataSourceResponsesSourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
class DataSourceResponsesSourceResponses: …A EvalResponsesSource object describing a run data source configuration.
-
type: Literal["responses"]The type of run data source. Always
responses."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. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1.- All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. - The
gpt-5-promodel defaults to (and only supports)highreasoning effort. xhighis supported for all models aftergpt-5.1-codex-max.
-
temperature: Optional[float]Sampling temperature. This is a query parameter used to select responses.
-
tools: Optional[List[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[List[str]]List of user identifiers. This is a query parameter used to select responses.
-
-
-
type: Literal["responses"]The type of run data source. Always
responses."responses"
-
input_messages: Optional[DataSourceResponsesInputMessages]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 theitemnamespace.-
class DataSourceResponsesInputMessagesTemplate: …-
template: List[DataSourceResponsesInputMessagesTemplateTemplate]A list of chat messages forming the prompt or context. May include variable references to the
itemnamespace, ie {{item.name}}.-
class DataSourceResponsesInputMessagesTemplateTemplateChatMessage: …-
content: strThe content of the message.
-
role: strThe role of the message (e.g. "system", "assistant", "user").
-
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItem: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
-
type: Literal["template"]The type of input messages. Always
template."template"
-
-
class DataSourceResponsesInputMessagesItemReference: …-
item_reference: strA reference to a variable in the
itemnamespace. Ie, "item.name" -
type: Literal["item_reference"]The type of input messages. Always
item_reference."item_reference"
-
-
-
model: Optional[str]The name of the model to use for generating completions (e.g. "o3-mini").
-
sampling_params: Optional[DataSourceResponsesSamplingParams]-
max_completion_tokens: Optional[int]The maximum number of tokens in the generated output.
-
reasoning_effort: Optional[ReasoningEffort]Constrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1.- All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. - The
gpt-5-promodel defaults to (and only supports)highreasoning effort. xhighis supported for all models aftergpt-5.1-codex-max.
-
seed: Optional[int]A seed value to initialize the randomness, during sampling.
-
temperature: Optional[float]A higher temperature increases randomness in the outputs.
-
text: Optional[DataSourceResponsesSamplingParamsText]Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:
-
format: Optional[ResponseFormatTextConfig]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.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. Usingjson_schemais preferred for models that support it.-
class ResponseFormatText: …Default response format. Used to generate text responses.
-
class ResponseFormatTextJSONSchemaConfig: …JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.
-
name: strThe name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
schema: Dict[str, object]The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.
-
type: Literal["json_schema"]The type of response format being defined. Always
json_schema."json_schema"
-
description: Optional[str]A description of what the response format is for, used by the model to determine how to respond in the format.
-
strict: Optional[bool]Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the
schemafield. Only a subset of JSON Schema is supported whenstrictistrue. To learn more, read the Structured Outputs guide.
-
-
class ResponseFormatJSONObject: …JSON object response format. An older method of generating JSON responses. Using
json_schemais recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.
-
-
tools: Optional[List[Tool]]An array of tools the model may call while generating a response. You can specify which tool to use by setting the
tool_choiceparameter.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 or file search. Learn more about built-in tools.
-
Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code. Learn more about function calling.
-
class FunctionTool: …Defines a function in your own code the model can choose to call. Learn more about function calling.
-
name: strThe name of the function to call.
-
parameters: Optional[Dict[str, object]]A JSON schema object describing the parameters of the function.
-
strict: Optional[bool]Whether to enforce strict parameter validation. Default
true. -
type: Literal["function"]The type of the function tool. Always
function."function"
-
defer_loading: Optional[bool]Whether this function is deferred and loaded via tool search.
-
description: Optional[str]A description of the function. Used by the model to determine whether or not to call the function.
-
-
class FileSearchTool: …A tool that searches for relevant content from uploaded files. Learn more about the file search tool.
-
type: Literal["file_search"]The type of the file search tool. Always
file_search."file_search"
-
vector_store_ids: List[str]The IDs of the vector stores to search.
-
filters: Optional[Filters]A filter to apply.
-
class ComparisonFilter: …A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
key: strThe key to compare against the value.
-
type: Literal["eq", "ne", "gt", 5 more]Specifies the comparison operator:
eq,ne,gt,gte,lt,lte,in,nin.-
eq: equals -
ne: not equal -
gt: greater than -
gte: greater than or equal -
lt: less than -
lte: less than or equal -
in: in -
nin: not in -
"eq" -
"ne" -
"gt" -
"gte" -
"lt" -
"lte" -
"in" -
"nin"
-
-
value: Union[str, float, bool, List[Union[str, float]]]The value to compare against the attribute key; supports string, number, or boolean types.
-
str -
float -
bool -
List[Union[str, float]]-
str -
float
-
-
-
-
class CompoundFilter: …Combine multiple filters using
andoror.-
filters: List[Filter]Array of filters to combine. Items can be
ComparisonFilterorCompoundFilter.-
class ComparisonFilter: …A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
object
-
-
type: Literal["and", "or"]Type of operation:
andoror.-
"and" -
"or"
-
-
-
-
max_num_results: Optional[int]The maximum number of results to return. This number should be between 1 and 50 inclusive.
-
ranking_options: Optional[RankingOptions]Ranking options for search.
-
hybrid_search: Optional[RankingOptionsHybridSearch]Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.
-
embedding_weight: floatThe weight of the embedding in the reciprocal ranking fusion.
-
text_weight: floatThe weight of the text in the reciprocal ranking fusion.
-
-
ranker: Optional[Literal["auto", "default-2024-11-15"]]The ranker to use for the file search.
-
"auto" -
"default-2024-11-15"
-
-
score_threshold: Optional[float]The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.
-
-
-
class ComputerTool: …A tool that controls a virtual computer. Learn more about the computer tool.
-
type: Literal["computer"]The type of the computer tool. Always
computer."computer"
-
-
class ComputerUsePreviewTool: …A tool that controls a virtual computer. Learn more about the computer tool.
-
display_height: intThe height of the computer display.
-
display_width: intThe width of the computer display.
-
environment: Literal["windows", "mac", "linux", 2 more]The type of computer environment to control.
-
"windows" -
"mac" -
"linux" -
"ubuntu" -
"browser"
-
-
type: Literal["computer_use_preview"]The type of the computer use tool. Always
computer_use_preview."computer_use_preview"
-
-
class WebSearchTool: …Search the Internet for sources related to the prompt. Learn more about the web search tool.
-
type: Literal["web_search", "web_search_2025_08_26"]The type of the web search tool. One of
web_searchorweb_search_2025_08_26.-
"web_search" -
"web_search_2025_08_26"
-
-
filters: Optional[Filters]Filters for the search.
-
allowed_domains: Optional[List[str]]Allowed domains for the search. If not provided, all domains are allowed. Subdomains of the provided domains are allowed as well.
Example:
["pubmed.ncbi.nlm.nih.gov"]
-
-
search_context_size: Optional[Literal["low", "medium", "high"]]High level guidance for the amount of context window space to use for the search. One of
low,medium, orhigh.mediumis the default.-
"low" -
"medium" -
"high"
-
-
user_location: Optional[UserLocation]The approximate location of the user.
-
city: Optional[str]Free text input for the city of the user, e.g.
San Francisco. -
country: Optional[str]The two-letter ISO country code of the user, e.g.
US. -
region: Optional[str]Free text input for the region of the user, e.g.
California. -
timezone: Optional[str]The IANA timezone of the user, e.g.
America/Los_Angeles. -
type: Optional[Literal["approximate"]]The type of location approximation. Always
approximate."approximate"
-
-
-
class Mcp: …Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
-
server_label: strA label for this MCP server, used to identify it in tool calls.
-
type: Literal["mcp"]The type of the MCP tool. Always
mcp."mcp"
-
allowed_tools: Optional[McpAllowedTools]List of allowed tool names or a filter object.
-
List[str]A string array of allowed tool names
-
class McpAllowedToolsMcpToolFilter: …A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
-
authorization: Optional[str]An OAuth access token that can be used with a remote MCP server, either with a custom MCP server URL or a service connector. Your application must handle the OAuth authorization flow and provide the token here.
-
connector_id: Optional[Literal["connector_dropbox", "connector_gmail", "connector_googlecalendar", 5 more]]Identifier for service connectors, like those available in ChatGPT. One of
server_urlorconnector_idmust be provided. Learn more about service connectors here.Currently supported
connector_idvalues are:-
Dropbox:
connector_dropbox -
Gmail:
connector_gmail -
Google Calendar:
connector_googlecalendar -
Google Drive:
connector_googledrive -
Microsoft Teams:
connector_microsoftteams -
Outlook Calendar:
connector_outlookcalendar -
Outlook Email:
connector_outlookemail -
SharePoint:
connector_sharepoint -
"connector_dropbox" -
"connector_gmail" -
"connector_googlecalendar" -
"connector_googledrive" -
"connector_microsoftteams" -
"connector_outlookcalendar" -
"connector_outlookemail" -
"connector_sharepoint"
-
-
defer_loading: Optional[bool]Whether this MCP tool is deferred and discovered via tool search.
-
headers: Optional[Dict[str, str]]Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.
-
require_approval: Optional[McpRequireApproval]Specify which of the MCP server's tools require approval.
-
class McpRequireApprovalMcpToolApprovalFilter: …Specify which of the MCP server's tools require approval. Can be
always,never, or a filter object associated with tools that require approval.-
always: Optional[McpRequireApprovalMcpToolApprovalFilterAlways]A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
never: Optional[McpRequireApprovalMcpToolApprovalFilterNever]A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
-
Literal["always", "never"]Specify a single approval policy for all tools. One of
alwaysornever. When set toalways, all tools will require approval. When set tonever, all tools will not require approval.-
"always" -
"never"
-
-
-
server_description: Optional[str]Optional description of the MCP server, used to provide more context.
-
server_url: Optional[str]The URL for the MCP server. One of
server_urlorconnector_idmust be provided.
-
-
class CodeInterpreter: …A tool that runs Python code to help generate a response to a prompt.
-
container: CodeInterpreterContainerThe code interpreter container. Can be a container ID or an object that specifies uploaded file IDs to make available to your code, along with an optional
memory_limitsetting.-
strThe container ID.
-
class CodeInterpreterContainerCodeInterpreterToolAuto: …Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.
-
type: Literal["auto"]Always
auto."auto"
-
file_ids: Optional[List[str]]An optional list of uploaded files to make available to your code.
-
memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]The memory limit for the code interpreter container.
-
"1g" -
"4g" -
"16g" -
"64g"
-
-
network_policy: Optional[CodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicy]Network access policy for the container.
-
class ContainerNetworkPolicyDisabled: …-
type: Literal["disabled"]Disable outbound network access. Always
disabled."disabled"
-
-
class ContainerNetworkPolicyAllowlist: …-
allowed_domains: List[str]A list of allowed domains when type is
allowlist. -
type: Literal["allowlist"]Allow outbound network access only to specified domains. Always
allowlist."allowlist"
-
domain_secrets: Optional[List[ContainerNetworkPolicyDomainSecret]]Optional domain-scoped secrets for allowlisted domains.
-
domain: strThe domain associated with the secret.
-
name: strThe name of the secret to inject for the domain.
-
value: strThe secret value to inject for the domain.
-
-
-
-
-
-
type: Literal["code_interpreter"]The type of the code interpreter tool. Always
code_interpreter."code_interpreter"
-
-
class ImageGeneration: …A tool that generates images using the GPT image models.
-
type: Literal["image_generation"]The type of the image generation tool. Always
image_generation."image_generation"
-
action: Optional[Literal["generate", "edit", "auto"]]Whether to generate a new image or edit an existing image. Default:
auto.-
"generate" -
"edit" -
"auto"
-
-
background: Optional[Literal["transparent", "opaque", "auto"]]Allows to set transparency for the background of the generated image(s). This parameter is only supported for GPT image models that support transparent backgrounds. Must be one of
transparent,opaque, orauto(default value). Whenautois used, the model will automatically determine the best background for the image.gpt-image-2andgpt-image-2-2026-04-21do not support transparent backgrounds. Requests withbackgroundset totransparentwill return an error for these models; useopaqueorautoinstead.If
transparent, the output format needs to support transparency, so it should be set to eitherpng(default value) orwebp.-
"transparent" -
"opaque" -
"auto"
-
-
input_fidelity: Optional[Literal["high", "low"]]Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for
gpt-image-1andgpt-image-1.5and later models, unsupported forgpt-image-1-mini. Supportshighandlow. Defaults tolow.-
"high" -
"low"
-
-
input_image_mask: Optional[ImageGenerationInputImageMask]Optional mask for inpainting. Contains
image_url(string, optional) andfile_id(string, optional).-
file_id: Optional[str]File ID for the mask image.
-
image_url: Optional[str]Base64-encoded mask image.
-
-
model: Optional[Union[str, Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-2", 3 more], null]]The image generation model to use. Default:
gpt-image-1.-
str -
Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-2", 3 more]The image generation model to use. Default:
gpt-image-1.-
"gpt-image-1" -
"gpt-image-1-mini" -
"gpt-image-2" -
"gpt-image-2-2026-04-21" -
"gpt-image-1.5" -
"chatgpt-image-latest"
-
-
-
moderation: Optional[Literal["auto", "low"]]Moderation level for the generated image. Default:
auto.-
"auto" -
"low"
-
-
output_compression: Optional[int]Compression level for the output image. Default: 100.
-
output_format: Optional[Literal["png", "webp", "jpeg"]]The output format of the generated image. One of
png,webp, orjpeg. Default:png.-
"png" -
"webp" -
"jpeg"
-
-
partial_images: Optional[int]Number of partial images to generate in streaming mode, from 0 (default value) to 3.
-
quality: Optional[Literal["low", "medium", "high", "auto"]]The quality of the generated image. One of
low,medium,high, orauto. Default:auto.-
"low" -
"medium" -
"high" -
"auto"
-
-
size: Optional[Union[str, Literal["1024x1024", "1024x1536", "1536x1024", "auto"], null]]The size of the generated images. For
gpt-image-2andgpt-image-2-2026-04-21, arbitrary resolutions are supported asWIDTHxHEIGHTstrings, for example1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above2560x1440are experimental, and the maximum supported resolution is3840x2160. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes1024x1024,1536x1024, and1024x1536are supported by the GPT image models;autois supported for models that allow automatic sizing. Fordall-e-2, use one of256x256,512x512, or1024x1024. Fordall-e-3, use one of1024x1024,1792x1024, or1024x1792.-
str -
Literal["1024x1024", "1024x1536", "1536x1024", "auto"]The size of the generated images. For
gpt-image-2andgpt-image-2-2026-04-21, arbitrary resolutions are supported asWIDTHxHEIGHTstrings, for example1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above2560x1440are experimental, and the maximum supported resolution is3840x2160. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes1024x1024,1536x1024, and1024x1536are supported by the GPT image models;autois supported for models that allow automatic sizing. Fordall-e-2, use one of256x256,512x512, or1024x1024. Fordall-e-3, use one of1024x1024,1792x1024, or1024x1792.-
"1024x1024" -
"1024x1536" -
"1536x1024" -
"auto"
-
-
-
-
class LocalShell: …A tool that allows the model to execute shell commands in a local environment.
-
type: Literal["local_shell"]The type of the local shell tool. Always
local_shell."local_shell"
-
-
class FunctionShellTool: …A tool that allows the model to execute shell commands.
-
type: Literal["shell"]The type of the shell tool. Always
shell."shell"
-
environment: Optional[Environment]-
class ContainerAuto: …-
type: Literal["container_auto"]Automatically creates a container for this request
"container_auto"
-
file_ids: Optional[List[str]]An optional list of uploaded files to make available to your code.
-
memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]The memory limit for the container.
-
"1g" -
"4g" -
"16g" -
"64g"
-
-
network_policy: Optional[NetworkPolicy]Network access policy for the container.
-
class ContainerNetworkPolicyDisabled: … -
class ContainerNetworkPolicyAllowlist: …
-
-
skills: Optional[List[Skill]]An optional list of skills referenced by id or inline data.
-
class SkillReference: …-
skill_id: strThe ID of the referenced skill.
-
type: Literal["skill_reference"]References a skill created with the /v1/skills endpoint.
"skill_reference"
-
version: Optional[str]Optional skill version. Use a positive integer or 'latest'. Omit for default.
-
-
class InlineSkill: …-
description: strThe description of the skill.
-
name: strThe name of the skill.
-
source: InlineSkillSourceInline skill payload
-
data: strBase64-encoded skill zip bundle.
-
media_type: Literal["application/zip"]The media type of the inline skill payload. Must be
application/zip."application/zip"
-
type: Literal["base64"]The type of the inline skill source. Must be
base64."base64"
-
-
type: Literal["inline"]Defines an inline skill for this request.
"inline"
-
-
-
-
class LocalEnvironment: …-
type: Literal["local"]Use a local computer environment.
"local"
-
skills: Optional[List[LocalSkill]]An optional list of skills.
-
description: strThe description of the skill.
-
name: strThe name of the skill.
-
path: strThe path to the directory containing the skill.
-
-
-
class ContainerReference: …-
container_id: strThe ID of the referenced container.
-
type: Literal["container_reference"]References a container created with the /v1/containers endpoint
"container_reference"
-
-
-
-
class CustomTool: …A custom tool that processes input using a specified format. Learn more about custom tools
-
name: strThe name of the custom tool, used to identify it in tool calls.
-
type: Literal["custom"]The type of the custom tool. Always
custom."custom"
-
defer_loading: Optional[bool]Whether this tool should be deferred and discovered via tool search.
-
description: Optional[str]Optional description of the custom tool, used to provide more context.
-
format: Optional[CustomToolInputFormat]The input format for the custom tool. Default is unconstrained text.
-
class Text: …Unconstrained free-form text.
-
type: Literal["text"]Unconstrained text format. Always
text."text"
-
-
class Grammar: …A grammar defined by the user.
-
definition: strThe grammar definition.
-
syntax: Literal["lark", "regex"]The syntax of the grammar definition. One of
larkorregex.-
"lark" -
"regex"
-
-
type: Literal["grammar"]Grammar format. Always
grammar."grammar"
-
-
-
-
class NamespaceTool: …Groups function/custom tools under a shared namespace.
-
description: strA description of the namespace shown to the model.
-
name: strThe namespace name used in tool calls (for example,
crm). -
tools: List[Tool]The function/custom tools available inside this namespace.
-
class ToolFunction: …-
name: str -
type: Literal["function"]"function"
-
defer_loading: Optional[bool]Whether this function should be deferred and discovered via tool search.
-
description: Optional[str] -
parameters: Optional[object] -
strict: Optional[bool]
-
-
class CustomTool: …A custom tool that processes input using a specified format. Learn more about custom tools
-
-
type: Literal["namespace"]The type of the tool. Always
namespace."namespace"
-
-
class ToolSearchTool: …Hosted or BYOT tool search configuration for deferred tools.
-
type: Literal["tool_search"]The type of the tool. Always
tool_search."tool_search"
-
description: Optional[str]Description shown to the model for a client-executed tool search tool.
-
execution: Optional[Literal["server", "client"]]Whether tool search is executed by the server or by the client.
-
"server" -
"client"
-
-
parameters: Optional[object]Parameter schema for a client-executed tool search tool.
-
-
class WebSearchPreviewTool: …This tool searches the web for relevant results to use in a response. Learn more about the web search tool.
-
type: Literal["web_search_preview", "web_search_preview_2025_03_11"]The type of the web search tool. One of
web_search_previeworweb_search_preview_2025_03_11.-
"web_search_preview" -
"web_search_preview_2025_03_11"
-
-
search_content_types: Optional[List[Literal["text", "image"]]]-
"text" -
"image"
-
-
search_context_size: Optional[Literal["low", "medium", "high"]]High level guidance for the amount of context window space to use for the search. One of
low,medium, orhigh.mediumis the default.-
"low" -
"medium" -
"high"
-
-
user_location: Optional[UserLocation]The user's location.
-
type: Literal["approximate"]The type of location approximation. Always
approximate."approximate"
-
city: Optional[str]Free text input for the city of the user, e.g.
San Francisco. -
country: Optional[str]The two-letter ISO country code of the user, e.g.
US. -
region: Optional[str]Free text input for the region of the user, e.g.
California. -
timezone: Optional[str]The IANA timezone of the user, e.g.
America/Los_Angeles.
-
-
-
class ApplyPatchTool: …Allows the assistant to create, delete, or update files using unified diffs.
-
type: Literal["apply_patch"]The type of the tool. Always
apply_patch."apply_patch"
-
-
-
top_p: Optional[float]An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
-
error: EvalAPIErrorAn object representing an error response from the Eval API.
-
code: strThe error code.
-
message: strThe error message.
-
-
eval_id: strThe identifier of the associated evaluation.
-
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.
-
model: strThe model that is evaluated, if applicable.
-
name: strThe name of the evaluation run.
-
object: Literal["eval.run"]The type of the object. Always "eval.run".
"eval.run"
-
per_model_usage: List[PerModelUsage]Usage statistics for each model during the evaluation run.
-
cached_tokens: intThe number of tokens retrieved from cache.
-
completion_tokens: intThe number of completion tokens generated.
-
invocation_count: intThe number of invocations.
-
model_name: strThe name of the model.
-
prompt_tokens: intThe number of prompt tokens used.
-
total_tokens: intThe total number of tokens used.
-
-
per_testing_criteria_results: List[PerTestingCriteriaResult]Results per testing criteria applied during the evaluation run.
-
failed: intNumber of tests failed for this criteria.
-
passed: intNumber of tests passed for this criteria.
-
testing_criteria: strA description of the testing criteria.
-
-
report_url: strThe URL to the rendered evaluation run report on the UI dashboard.
-
result_counts: ResultCountsCounters summarizing the outcomes of the evaluation run.
-
errored: intNumber of output items that resulted in an error.
-
failed: intNumber of output items that failed to pass the evaluation.
-
passed: intNumber of output items that passed the evaluation.
-
total: intTotal number of executed output items.
-
-
status: strThe status of the evaluation run.
-
Example
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
run = client.evals.runs.create(
eval_id="eval_id",
data_source={
"source": {
"content": [{
"item": {
"foo": "bar"
}
}],
"type": "file_content",
},
"type": "jsonl",
},
)
print(run.id)
Response
{
"id": "id",
"created_at": 0,
"data_source": {
"source": {
"content": [
{
"item": {
"foo": "bar"
},
"sample": {
"foo": "bar"
}
}
],
"type": "file_content"
},
"type": "jsonl"
},
"error": {
"code": "code",
"message": "message"
},
"eval_id": "eval_id",
"metadata": {
"foo": "string"
},
"model": "model",
"name": "name",
"object": "eval.run",
"per_model_usage": [
{
"cached_tokens": 0,
"completion_tokens": 0,
"invocation_count": 0,
"model_name": "model_name",
"prompt_tokens": 0,
"total_tokens": 0
}
],
"per_testing_criteria_results": [
{
"failed": 0,
"passed": 0,
"testing_criteria": "testing_criteria"
}
],
"report_url": "https://example.com",
"result_counts": {
"errored": 0,
"failed": 0,
"passed": 0,
"total": 0
},
"status": "status"
}
Example
from openai import OpenAI
client = OpenAI()
run = client.evals.runs.create(
"eval_67e579652b548190aaa83ada4b125f47",
name="gpt-4o-mini",
data_source={
"type": "completions",
"input_messages": {
"type": "template",
"template": [
{
"role": "developer",
"content": "Categorize a given news headline into one of the following topics: Technology, Markets, World, Business, or Sports.\n\n# Steps\n\n1. Analyze the content of the news headline to understand its primary focus.\n2. Extract the subject matter, identifying any key indicators or keywords.\n3. Use the identified indicators to determine the most suitable category out of the five options: Technology, Markets, World, Business, or Sports.\n4. Ensure only one category is selected per headline.\n\n# Output Format\n\nRespond with the chosen category as a single word. For instance: \"Technology\", \"Markets\", \"World\", \"Business\", or \"Sports\".\n\n# Examples\n\n**Input**: \"Apple Unveils New iPhone Model, Featuring Advanced AI Features\" \n**Output**: \"Technology\"\n\n**Input**: \"Global Stocks Mixed as Investors Await Central Bank Decisions\" \n**Output**: \"Markets\"\n\n**Input**: \"War in Ukraine: Latest Updates on Negotiation Status\" \n**Output**: \"World\"\n\n**Input**: \"Microsoft in Talks to Acquire Gaming Company for $2 Billion\" \n**Output**: \"Business\"\n\n**Input**: \"Manchester United Secures Win in Premier League Football Match\" \n**Output**: \"Sports\" \n\n# Notes\n\n- If the headline appears to fit into more than one category, choose the most dominant theme.\n- Keywords or phrases such as \"stocks\", \"company acquisition\", \"match\", or technological brands can be good indicators for classification.\n"
},
{
"role": "user",
"content": "{{item.input}}"
}
]
},
"sampling_params": {
"temperature": 1,
"max_completions_tokens": 2048,
"top_p": 1,
"seed": 42
},
"model": "gpt-4o-mini",
"source": {
"type": "file_content",
"content": [
{
"item": {
"input": "Tech Company Launches Advanced Artificial Intelligence Platform",
"ground_truth": "Technology"
}
}
]
}
}
)
print(run)
Response
{
"object": "eval.run",
"id": "evalrun_67e57965b480819094274e3a32235e4c",
"eval_id": "eval_67e579652b548190aaa83ada4b125f47",
"report_url": "https://platform.openai.com/evaluations/eval_67e579652b548190aaa83ada4b125f47&run_id=evalrun_67e57965b480819094274e3a32235e4c",
"status": "queued",
"model": "gpt-4o-mini",
"name": "gpt-4o-mini",
"created_at": 1743092069,
"result_counts": {
"total": 0,
"errored": 0,
"failed": 0,
"passed": 0
},
"per_model_usage": null,
"per_testing_criteria_results": null,
"data_source": {
"type": "completions",
"source": {
"type": "file_content",
"content": [
{
"item": {
"input": "Tech Company Launches Advanced Artificial Intelligence Platform",
"ground_truth": "Technology"
}
}
]
},
"input_messages": {
"type": "template",
"template": [
{
"type": "message",
"role": "developer",
"content": {
"type": "input_text",
"text": "Categorize a given news headline into one of the following topics: Technology, Markets, World, Business, or Sports.\n\n# Steps\n\n1. Analyze the content of the news headline to understand its primary focus.\n2. Extract the subject matter, identifying any key indicators or keywords.\n3. Use the identified indicators to determine the most suitable category out of the five options: Technology, Markets, World, Business, or Sports.\n4. Ensure only one category is selected per headline.\n\n# Output Format\n\nRespond with the chosen category as a single word. For instance: \"Technology\", \"Markets\", \"World\", \"Business\", or \"Sports\".\n\n# Examples\n\n**Input**: \"Apple Unveils New iPhone Model, Featuring Advanced AI Features\" \n**Output**: \"Technology\"\n\n**Input**: \"Global Stocks Mixed as Investors Await Central Bank Decisions\" \n**Output**: \"Markets\"\n\n**Input**: \"War in Ukraine: Latest Updates on Negotiation Status\" \n**Output**: \"World\"\n\n**Input**: \"Microsoft in Talks to Acquire Gaming Company for $2 Billion\" \n**Output**: \"Business\"\n\n**Input**: \"Manchester United Secures Win in Premier League Football Match\" \n**Output**: \"Sports\" \n\n# Notes\n\n- If the headline appears to fit into more than one category, choose the most dominant theme.\n- Keywords or phrases such as \"stocks\", \"company acquisition\", \"match\", or technological brands can be good indicators for classification.\n"
}
},
{
"type": "message",
"role": "user",
"content": {
"type": "input_text",
"text": "{{item.input}}"
}
}
]
},
"model": "gpt-4o-mini",
"sampling_params": {
"seed": 42,
"temperature": 1.0,
"top_p": 1.0,
"max_completions_tokens": 2048
}
},
"error": null,
"metadata": {}
}
Get an eval run
evals.runs.retrieve(strrun_id, RunRetrieveParams**kwargs) -> RunRetrieveResponse
get /evals/{eval_id}/runs/{run_id}
Get an evaluation run by ID.
Parameters
-
eval_id: str -
run_id: str
Returns
-
class RunRetrieveResponse: …A schema representing an evaluation run.
-
id: strUnique identifier for the evaluation run.
-
created_at: intUnix timestamp (in seconds) when the evaluation run was created.
-
data_source: DataSourceInformation about the run's data source.
-
class CreateEvalJSONLRunDataSource: …A JsonlRunDataSource object with that specifies a JSONL file that matches the eval
-
source: SourceDetermines what populates the
itemnamespace in the data source.-
class SourceFileContent: …-
content: List[SourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class SourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
-
type: Literal["jsonl"]The type of data source. Always
jsonl."jsonl"
-
-
class CreateEvalCompletionsRunDataSource: …A CompletionsRunDataSource object describing a model sampling configuration.
-
source: SourceDetermines what populates the
itemnamespace in this run's data source.-
class SourceFileContent: …-
content: List[SourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class SourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
class SourceStoredCompletions: …A StoredCompletionsRunDataSource configuration describing a set of filters
-
type: Literal["stored_completions"]The type of source. Always
stored_completions."stored_completions"
-
created_after: Optional[int]An optional Unix timestamp to filter items created after this time.
-
created_before: Optional[int]An optional Unix timestamp to filter items created before this time.
-
limit: Optional[int]An optional maximum number of items to return.
-
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.
-
model: Optional[str]An optional model to filter by (e.g., 'gpt-4o').
-
-
-
type: Literal["completions"]The type of run data source. Always
completions."completions"
-
input_messages: Optional[InputMessages]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 theitemnamespace.-
class InputMessagesTemplate: …-
template: List[InputMessagesTemplateTemplate]A list of chat messages forming the prompt or context. May include variable references to the
itemnamespace, ie {{item.name}}.-
class EasyInputMessage: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: Union[str, ResponseInputMessageContentList]Text, image, or audio input to the model, used to generate a response. Can also contain previous assistant responses.
-
strA text input to the model.
-
List[ResponseInputContent]-
class ResponseInputText: …A text input to the model.
-
text: strThe text input to the model.
-
type: Literal["input_text"]The type of the input item. Always
input_text."input_text"
-
-
class ResponseInputImage: …An image input to the model. Learn about image inputs.
-
detail: Literal["low", "high", "auto", "original"]The detail level of the image to be sent to the model. One of
high,low,auto, ororiginal. Defaults toauto.-
"low" -
"high" -
"auto" -
"original"
-
-
type: Literal["input_image"]The type of the input item. Always
input_image."input_image"
-
file_id: Optional[str]The ID of the file to be sent to the model.
-
image_url: Optional[str]The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.
-
-
class ResponseInputFile: …A file input to the model.
-
type: Literal["input_file"]The type of the input item. Always
input_file."input_file"
-
detail: Optional[Literal["low", "high"]]The detail level of the file to be sent to the model. Use
lowfor the default rendering behavior, orhighto render the file at higher quality. Defaults tolow.-
"low" -
"high"
-
-
file_data: Optional[str]The content of the file to be sent to the model.
-
file_id: Optional[str]The ID of the file to be sent to the model.
-
file_url: Optional[str]The URL of the file to be sent to the model.
-
filename: Optional[str]The name of the file to be sent to the model.
-
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
phase: Optional[Literal["commentary", "final_answer"]]Labels an
assistantmessage as intermediate commentary (commentary) or the final answer (final_answer). For models likegpt-5.3-codexand beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages.-
"commentary" -
"final_answer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
class InputMessagesTemplateTemplateEvalItem: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: InputMessagesTemplateTemplateEvalItemContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class InputMessagesTemplateTemplateEvalItemContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class InputMessagesTemplateTemplateEvalItemContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
input_audio: InputAudio-
data: strBase64-encoded audio data.
-
format: Literal["mp3", "wav"]The format of the audio data. Currently supported formats are
mp3andwav.-
"mp3" -
"wav"
-
-
-
type: Literal["input_audio"]The type of the input item. Always
input_audio."input_audio"
-
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
-
type: Literal["template"]The type of input messages. Always
template."template"
-
-
class InputMessagesItemReference: …-
item_reference: strA reference to a variable in the
itemnamespace. Ie, "item.input_trajectory" -
type: Literal["item_reference"]The type of input messages. Always
item_reference."item_reference"
-
-
-
model: Optional[str]The name of the model to use for generating completions (e.g. "o3-mini").
-
sampling_params: Optional[SamplingParams]-
max_completion_tokens: Optional[int]The maximum number of tokens in the generated output.
-
reasoning_effort: Optional[ReasoningEffort]Constrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.-
gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1. -
All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. -
The
gpt-5-promodel defaults to (and only supports)highreasoning effort. -
xhighis supported for all models aftergpt-5.1-codex-max. -
"none" -
"minimal" -
"low" -
"medium" -
"high" -
"xhigh"
-
-
response_format: Optional[SamplingParamsResponseFormat]An object specifying the format that the model must output.
Setting to
{ "type": "json_schema", "json_schema": {...} }enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.Setting to
{ "type": "json_object" }enables the older JSON mode, which ensures the message the model generates is valid JSON. Usingjson_schemais preferred for models that support it.-
class ResponseFormatText: …Default response format. Used to generate text responses.
-
type: Literal["text"]The type of response format being defined. Always
text."text"
-
-
class ResponseFormatJSONSchema: …JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.
-
json_schema: JSONSchemaStructured Outputs configuration options, including a JSON Schema.
-
name: strThe name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
description: Optional[str]A description of what the response format is for, used by the model to determine how to respond in the format.
-
schema: Optional[Dict[str, object]]The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.
-
strict: Optional[bool]Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the
schemafield. Only a subset of JSON Schema is supported whenstrictistrue. To learn more, read the Structured Outputs guide.
-
-
type: Literal["json_schema"]The type of response format being defined. Always
json_schema."json_schema"
-
-
class ResponseFormatJSONObject: …JSON object response format. An older method of generating JSON responses. Using
json_schemais recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.-
type: Literal["json_object"]The type of response format being defined. Always
json_object."json_object"
-
-
-
seed: Optional[int]A seed value to initialize the randomness, during sampling.
-
temperature: Optional[float]A higher temperature increases randomness in the outputs.
-
tools: Optional[List[ChatCompletionFunctionTool]]A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
-
function: FunctionDefinition-
name: strThe name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
description: Optional[str]A description of what the function does, used by the model to choose when and how to call the function.
-
parameters: Optional[FunctionParameters]The parameters the functions accepts, described as a JSON Schema object. See the guide for examples, and the JSON Schema reference for documentation about the format.
Omitting
parametersdefines a function with an empty parameter list. -
strict: Optional[bool]Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the
parametersfield. Only a subset of JSON Schema is supported whenstrictistrue. Learn more about Structured Outputs in the function calling guide.
-
-
type: Literal["function"]The type of the tool. Currently, only
functionis supported."function"
-
-
top_p: Optional[float]An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
class DataSourceResponses: …A ResponsesRunDataSource object describing a model sampling configuration.
-
source: DataSourceResponsesSourceDetermines what populates the
itemnamespace in this run's data source.-
class DataSourceResponsesSourceFileContent: …-
content: List[DataSourceResponsesSourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class DataSourceResponsesSourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
class DataSourceResponsesSourceResponses: …A EvalResponsesSource object describing a run data source configuration.
-
type: Literal["responses"]The type of run data source. Always
responses."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. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1.- All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. - The
gpt-5-promodel defaults to (and only supports)highreasoning effort. xhighis supported for all models aftergpt-5.1-codex-max.
-
temperature: Optional[float]Sampling temperature. This is a query parameter used to select responses.
-
tools: Optional[List[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[List[str]]List of user identifiers. This is a query parameter used to select responses.
-
-
-
type: Literal["responses"]The type of run data source. Always
responses."responses"
-
input_messages: Optional[DataSourceResponsesInputMessages]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 theitemnamespace.-
class DataSourceResponsesInputMessagesTemplate: …-
template: List[DataSourceResponsesInputMessagesTemplateTemplate]A list of chat messages forming the prompt or context. May include variable references to the
itemnamespace, ie {{item.name}}.-
class DataSourceResponsesInputMessagesTemplateTemplateChatMessage: …-
content: strThe content of the message.
-
role: strThe role of the message (e.g. "system", "assistant", "user").
-
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItem: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
-
type: Literal["template"]The type of input messages. Always
template."template"
-
-
class DataSourceResponsesInputMessagesItemReference: …-
item_reference: strA reference to a variable in the
itemnamespace. Ie, "item.name" -
type: Literal["item_reference"]The type of input messages. Always
item_reference."item_reference"
-
-
-
model: Optional[str]The name of the model to use for generating completions (e.g. "o3-mini").
-
sampling_params: Optional[DataSourceResponsesSamplingParams]-
max_completion_tokens: Optional[int]The maximum number of tokens in the generated output.
-
reasoning_effort: Optional[ReasoningEffort]Constrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1.- All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. - The
gpt-5-promodel defaults to (and only supports)highreasoning effort. xhighis supported for all models aftergpt-5.1-codex-max.
-
seed: Optional[int]A seed value to initialize the randomness, during sampling.
-
temperature: Optional[float]A higher temperature increases randomness in the outputs.
-
text: Optional[DataSourceResponsesSamplingParamsText]Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:
-
format: Optional[ResponseFormatTextConfig]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.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. Usingjson_schemais preferred for models that support it.-
class ResponseFormatText: …Default response format. Used to generate text responses.
-
class ResponseFormatTextJSONSchemaConfig: …JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.
-
name: strThe name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
schema: Dict[str, object]The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.
-
type: Literal["json_schema"]The type of response format being defined. Always
json_schema."json_schema"
-
description: Optional[str]A description of what the response format is for, used by the model to determine how to respond in the format.
-
strict: Optional[bool]Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the
schemafield. Only a subset of JSON Schema is supported whenstrictistrue. To learn more, read the Structured Outputs guide.
-
-
class ResponseFormatJSONObject: …JSON object response format. An older method of generating JSON responses. Using
json_schemais recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.
-
-
tools: Optional[List[Tool]]An array of tools the model may call while generating a response. You can specify which tool to use by setting the
tool_choiceparameter.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 or file search. Learn more about built-in tools.
-
Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code. Learn more about function calling.
-
class FunctionTool: …Defines a function in your own code the model can choose to call. Learn more about function calling.
-
name: strThe name of the function to call.
-
parameters: Optional[Dict[str, object]]A JSON schema object describing the parameters of the function.
-
strict: Optional[bool]Whether to enforce strict parameter validation. Default
true. -
type: Literal["function"]The type of the function tool. Always
function."function"
-
defer_loading: Optional[bool]Whether this function is deferred and loaded via tool search.
-
description: Optional[str]A description of the function. Used by the model to determine whether or not to call the function.
-
-
class FileSearchTool: …A tool that searches for relevant content from uploaded files. Learn more about the file search tool.
-
type: Literal["file_search"]The type of the file search tool. Always
file_search."file_search"
-
vector_store_ids: List[str]The IDs of the vector stores to search.
-
filters: Optional[Filters]A filter to apply.
-
class ComparisonFilter: …A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
key: strThe key to compare against the value.
-
type: Literal["eq", "ne", "gt", 5 more]Specifies the comparison operator:
eq,ne,gt,gte,lt,lte,in,nin.-
eq: equals -
ne: not equal -
gt: greater than -
gte: greater than or equal -
lt: less than -
lte: less than or equal -
in: in -
nin: not in -
"eq" -
"ne" -
"gt" -
"gte" -
"lt" -
"lte" -
"in" -
"nin"
-
-
value: Union[str, float, bool, List[Union[str, float]]]The value to compare against the attribute key; supports string, number, or boolean types.
-
str -
float -
bool -
List[Union[str, float]]-
str -
float
-
-
-
-
class CompoundFilter: …Combine multiple filters using
andoror.-
filters: List[Filter]Array of filters to combine. Items can be
ComparisonFilterorCompoundFilter.-
class ComparisonFilter: …A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
object
-
-
type: Literal["and", "or"]Type of operation:
andoror.-
"and" -
"or"
-
-
-
-
max_num_results: Optional[int]The maximum number of results to return. This number should be between 1 and 50 inclusive.
-
ranking_options: Optional[RankingOptions]Ranking options for search.
-
hybrid_search: Optional[RankingOptionsHybridSearch]Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.
-
embedding_weight: floatThe weight of the embedding in the reciprocal ranking fusion.
-
text_weight: floatThe weight of the text in the reciprocal ranking fusion.
-
-
ranker: Optional[Literal["auto", "default-2024-11-15"]]The ranker to use for the file search.
-
"auto" -
"default-2024-11-15"
-
-
score_threshold: Optional[float]The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.
-
-
-
class ComputerTool: …A tool that controls a virtual computer. Learn more about the computer tool.
-
type: Literal["computer"]The type of the computer tool. Always
computer."computer"
-
-
class ComputerUsePreviewTool: …A tool that controls a virtual computer. Learn more about the computer tool.
-
display_height: intThe height of the computer display.
-
display_width: intThe width of the computer display.
-
environment: Literal["windows", "mac", "linux", 2 more]The type of computer environment to control.
-
"windows" -
"mac" -
"linux" -
"ubuntu" -
"browser"
-
-
type: Literal["computer_use_preview"]The type of the computer use tool. Always
computer_use_preview."computer_use_preview"
-
-
class WebSearchTool: …Search the Internet for sources related to the prompt. Learn more about the web search tool.
-
type: Literal["web_search", "web_search_2025_08_26"]The type of the web search tool. One of
web_searchorweb_search_2025_08_26.-
"web_search" -
"web_search_2025_08_26"
-
-
filters: Optional[Filters]Filters for the search.
-
allowed_domains: Optional[List[str]]Allowed domains for the search. If not provided, all domains are allowed. Subdomains of the provided domains are allowed as well.
Example:
["pubmed.ncbi.nlm.nih.gov"]
-
-
search_context_size: Optional[Literal["low", "medium", "high"]]High level guidance for the amount of context window space to use for the search. One of
low,medium, orhigh.mediumis the default.-
"low" -
"medium" -
"high"
-
-
user_location: Optional[UserLocation]The approximate location of the user.
-
city: Optional[str]Free text input for the city of the user, e.g.
San Francisco. -
country: Optional[str]The two-letter ISO country code of the user, e.g.
US. -
region: Optional[str]Free text input for the region of the user, e.g.
California. -
timezone: Optional[str]The IANA timezone of the user, e.g.
America/Los_Angeles. -
type: Optional[Literal["approximate"]]The type of location approximation. Always
approximate."approximate"
-
-
-
class Mcp: …Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
-
server_label: strA label for this MCP server, used to identify it in tool calls.
-
type: Literal["mcp"]The type of the MCP tool. Always
mcp."mcp"
-
allowed_tools: Optional[McpAllowedTools]List of allowed tool names or a filter object.
-
List[str]A string array of allowed tool names
-
class McpAllowedToolsMcpToolFilter: …A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
-
authorization: Optional[str]An OAuth access token that can be used with a remote MCP server, either with a custom MCP server URL or a service connector. Your application must handle the OAuth authorization flow and provide the token here.
-
connector_id: Optional[Literal["connector_dropbox", "connector_gmail", "connector_googlecalendar", 5 more]]Identifier for service connectors, like those available in ChatGPT. One of
server_urlorconnector_idmust be provided. Learn more about service connectors here.Currently supported
connector_idvalues are:-
Dropbox:
connector_dropbox -
Gmail:
connector_gmail -
Google Calendar:
connector_googlecalendar -
Google Drive:
connector_googledrive -
Microsoft Teams:
connector_microsoftteams -
Outlook Calendar:
connector_outlookcalendar -
Outlook Email:
connector_outlookemail -
SharePoint:
connector_sharepoint -
"connector_dropbox" -
"connector_gmail" -
"connector_googlecalendar" -
"connector_googledrive" -
"connector_microsoftteams" -
"connector_outlookcalendar" -
"connector_outlookemail" -
"connector_sharepoint"
-
-
defer_loading: Optional[bool]Whether this MCP tool is deferred and discovered via tool search.
-
headers: Optional[Dict[str, str]]Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.
-
require_approval: Optional[McpRequireApproval]Specify which of the MCP server's tools require approval.
-
class McpRequireApprovalMcpToolApprovalFilter: …Specify which of the MCP server's tools require approval. Can be
always,never, or a filter object associated with tools that require approval.-
always: Optional[McpRequireApprovalMcpToolApprovalFilterAlways]A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
never: Optional[McpRequireApprovalMcpToolApprovalFilterNever]A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
-
Literal["always", "never"]Specify a single approval policy for all tools. One of
alwaysornever. When set toalways, all tools will require approval. When set tonever, all tools will not require approval.-
"always" -
"never"
-
-
-
server_description: Optional[str]Optional description of the MCP server, used to provide more context.
-
server_url: Optional[str]The URL for the MCP server. One of
server_urlorconnector_idmust be provided.
-
-
class CodeInterpreter: …A tool that runs Python code to help generate a response to a prompt.
-
container: CodeInterpreterContainerThe code interpreter container. Can be a container ID or an object that specifies uploaded file IDs to make available to your code, along with an optional
memory_limitsetting.-
strThe container ID.
-
class CodeInterpreterContainerCodeInterpreterToolAuto: …Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.
-
type: Literal["auto"]Always
auto."auto"
-
file_ids: Optional[List[str]]An optional list of uploaded files to make available to your code.
-
memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]The memory limit for the code interpreter container.
-
"1g" -
"4g" -
"16g" -
"64g"
-
-
network_policy: Optional[CodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicy]Network access policy for the container.
-
class ContainerNetworkPolicyDisabled: …-
type: Literal["disabled"]Disable outbound network access. Always
disabled."disabled"
-
-
class ContainerNetworkPolicyAllowlist: …-
allowed_domains: List[str]A list of allowed domains when type is
allowlist. -
type: Literal["allowlist"]Allow outbound network access only to specified domains. Always
allowlist."allowlist"
-
domain_secrets: Optional[List[ContainerNetworkPolicyDomainSecret]]Optional domain-scoped secrets for allowlisted domains.
-
domain: strThe domain associated with the secret.
-
name: strThe name of the secret to inject for the domain.
-
value: strThe secret value to inject for the domain.
-
-
-
-
-
-
type: Literal["code_interpreter"]The type of the code interpreter tool. Always
code_interpreter."code_interpreter"
-
-
class ImageGeneration: …A tool that generates images using the GPT image models.
-
type: Literal["image_generation"]The type of the image generation tool. Always
image_generation."image_generation"
-
action: Optional[Literal["generate", "edit", "auto"]]Whether to generate a new image or edit an existing image. Default:
auto.-
"generate" -
"edit" -
"auto"
-
-
background: Optional[Literal["transparent", "opaque", "auto"]]Allows to set transparency for the background of the generated image(s). This parameter is only supported for GPT image models that support transparent backgrounds. Must be one of
transparent,opaque, orauto(default value). Whenautois used, the model will automatically determine the best background for the image.gpt-image-2andgpt-image-2-2026-04-21do not support transparent backgrounds. Requests withbackgroundset totransparentwill return an error for these models; useopaqueorautoinstead.If
transparent, the output format needs to support transparency, so it should be set to eitherpng(default value) orwebp.-
"transparent" -
"opaque" -
"auto"
-
-
input_fidelity: Optional[Literal["high", "low"]]Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for
gpt-image-1andgpt-image-1.5and later models, unsupported forgpt-image-1-mini. Supportshighandlow. Defaults tolow.-
"high" -
"low"
-
-
input_image_mask: Optional[ImageGenerationInputImageMask]Optional mask for inpainting. Contains
image_url(string, optional) andfile_id(string, optional).-
file_id: Optional[str]File ID for the mask image.
-
image_url: Optional[str]Base64-encoded mask image.
-
-
model: Optional[Union[str, Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-2", 3 more], null]]The image generation model to use. Default:
gpt-image-1.-
str -
Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-2", 3 more]The image generation model to use. Default:
gpt-image-1.-
"gpt-image-1" -
"gpt-image-1-mini" -
"gpt-image-2" -
"gpt-image-2-2026-04-21" -
"gpt-image-1.5" -
"chatgpt-image-latest"
-
-
-
moderation: Optional[Literal["auto", "low"]]Moderation level for the generated image. Default:
auto.-
"auto" -
"low"
-
-
output_compression: Optional[int]Compression level for the output image. Default: 100.
-
output_format: Optional[Literal["png", "webp", "jpeg"]]The output format of the generated image. One of
png,webp, orjpeg. Default:png.-
"png" -
"webp" -
"jpeg"
-
-
partial_images: Optional[int]Number of partial images to generate in streaming mode, from 0 (default value) to 3.
-
quality: Optional[Literal["low", "medium", "high", "auto"]]The quality of the generated image. One of
low,medium,high, orauto. Default:auto.-
"low" -
"medium" -
"high" -
"auto"
-
-
size: Optional[Union[str, Literal["1024x1024", "1024x1536", "1536x1024", "auto"], null]]The size of the generated images. For
gpt-image-2andgpt-image-2-2026-04-21, arbitrary resolutions are supported asWIDTHxHEIGHTstrings, for example1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above2560x1440are experimental, and the maximum supported resolution is3840x2160. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes1024x1024,1536x1024, and1024x1536are supported by the GPT image models;autois supported for models that allow automatic sizing. Fordall-e-2, use one of256x256,512x512, or1024x1024. Fordall-e-3, use one of1024x1024,1792x1024, or1024x1792.-
str -
Literal["1024x1024", "1024x1536", "1536x1024", "auto"]The size of the generated images. For
gpt-image-2andgpt-image-2-2026-04-21, arbitrary resolutions are supported asWIDTHxHEIGHTstrings, for example1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above2560x1440are experimental, and the maximum supported resolution is3840x2160. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes1024x1024,1536x1024, and1024x1536are supported by the GPT image models;autois supported for models that allow automatic sizing. Fordall-e-2, use one of256x256,512x512, or1024x1024. Fordall-e-3, use one of1024x1024,1792x1024, or1024x1792.-
"1024x1024" -
"1024x1536" -
"1536x1024" -
"auto"
-
-
-
-
class LocalShell: …A tool that allows the model to execute shell commands in a local environment.
-
type: Literal["local_shell"]The type of the local shell tool. Always
local_shell."local_shell"
-
-
class FunctionShellTool: …A tool that allows the model to execute shell commands.
-
type: Literal["shell"]The type of the shell tool. Always
shell."shell"
-
environment: Optional[Environment]-
class ContainerAuto: …-
type: Literal["container_auto"]Automatically creates a container for this request
"container_auto"
-
file_ids: Optional[List[str]]An optional list of uploaded files to make available to your code.
-
memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]The memory limit for the container.
-
"1g" -
"4g" -
"16g" -
"64g"
-
-
network_policy: Optional[NetworkPolicy]Network access policy for the container.
-
class ContainerNetworkPolicyDisabled: … -
class ContainerNetworkPolicyAllowlist: …
-
-
skills: Optional[List[Skill]]An optional list of skills referenced by id or inline data.
-
class SkillReference: …-
skill_id: strThe ID of the referenced skill.
-
type: Literal["skill_reference"]References a skill created with the /v1/skills endpoint.
"skill_reference"
-
version: Optional[str]Optional skill version. Use a positive integer or 'latest'. Omit for default.
-
-
class InlineSkill: …-
description: strThe description of the skill.
-
name: strThe name of the skill.
-
source: InlineSkillSourceInline skill payload
-
data: strBase64-encoded skill zip bundle.
-
media_type: Literal["application/zip"]The media type of the inline skill payload. Must be
application/zip."application/zip"
-
type: Literal["base64"]The type of the inline skill source. Must be
base64."base64"
-
-
type: Literal["inline"]Defines an inline skill for this request.
"inline"
-
-
-
-
class LocalEnvironment: …-
type: Literal["local"]Use a local computer environment.
"local"
-
skills: Optional[List[LocalSkill]]An optional list of skills.
-
description: strThe description of the skill.
-
name: strThe name of the skill.
-
path: strThe path to the directory containing the skill.
-
-
-
class ContainerReference: …-
container_id: strThe ID of the referenced container.
-
type: Literal["container_reference"]References a container created with the /v1/containers endpoint
"container_reference"
-
-
-
-
class CustomTool: …A custom tool that processes input using a specified format. Learn more about custom tools
-
name: strThe name of the custom tool, used to identify it in tool calls.
-
type: Literal["custom"]The type of the custom tool. Always
custom."custom"
-
defer_loading: Optional[bool]Whether this tool should be deferred and discovered via tool search.
-
description: Optional[str]Optional description of the custom tool, used to provide more context.
-
format: Optional[CustomToolInputFormat]The input format for the custom tool. Default is unconstrained text.
-
class Text: …Unconstrained free-form text.
-
type: Literal["text"]Unconstrained text format. Always
text."text"
-
-
class Grammar: …A grammar defined by the user.
-
definition: strThe grammar definition.
-
syntax: Literal["lark", "regex"]The syntax of the grammar definition. One of
larkorregex.-
"lark" -
"regex"
-
-
type: Literal["grammar"]Grammar format. Always
grammar."grammar"
-
-
-
-
class NamespaceTool: …Groups function/custom tools under a shared namespace.
-
description: strA description of the namespace shown to the model.
-
name: strThe namespace name used in tool calls (for example,
crm). -
tools: List[Tool]The function/custom tools available inside this namespace.
-
class ToolFunction: …-
name: str -
type: Literal["function"]"function"
-
defer_loading: Optional[bool]Whether this function should be deferred and discovered via tool search.
-
description: Optional[str] -
parameters: Optional[object] -
strict: Optional[bool]
-
-
class CustomTool: …A custom tool that processes input using a specified format. Learn more about custom tools
-
-
type: Literal["namespace"]The type of the tool. Always
namespace."namespace"
-
-
class ToolSearchTool: …Hosted or BYOT tool search configuration for deferred tools.
-
type: Literal["tool_search"]The type of the tool. Always
tool_search."tool_search"
-
description: Optional[str]Description shown to the model for a client-executed tool search tool.
-
execution: Optional[Literal["server", "client"]]Whether tool search is executed by the server or by the client.
-
"server" -
"client"
-
-
parameters: Optional[object]Parameter schema for a client-executed tool search tool.
-
-
class WebSearchPreviewTool: …This tool searches the web for relevant results to use in a response. Learn more about the web search tool.
-
type: Literal["web_search_preview", "web_search_preview_2025_03_11"]The type of the web search tool. One of
web_search_previeworweb_search_preview_2025_03_11.-
"web_search_preview" -
"web_search_preview_2025_03_11"
-
-
search_content_types: Optional[List[Literal["text", "image"]]]-
"text" -
"image"
-
-
search_context_size: Optional[Literal["low", "medium", "high"]]High level guidance for the amount of context window space to use for the search. One of
low,medium, orhigh.mediumis the default.-
"low" -
"medium" -
"high"
-
-
user_location: Optional[UserLocation]The user's location.
-
type: Literal["approximate"]The type of location approximation. Always
approximate."approximate"
-
city: Optional[str]Free text input for the city of the user, e.g.
San Francisco. -
country: Optional[str]The two-letter ISO country code of the user, e.g.
US. -
region: Optional[str]Free text input for the region of the user, e.g.
California. -
timezone: Optional[str]The IANA timezone of the user, e.g.
America/Los_Angeles.
-
-
-
class ApplyPatchTool: …Allows the assistant to create, delete, or update files using unified diffs.
-
type: Literal["apply_patch"]The type of the tool. Always
apply_patch."apply_patch"
-
-
-
top_p: Optional[float]An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
-
error: EvalAPIErrorAn object representing an error response from the Eval API.
-
code: strThe error code.
-
message: strThe error message.
-
-
eval_id: strThe identifier of the associated evaluation.
-
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.
-
model: strThe model that is evaluated, if applicable.
-
name: strThe name of the evaluation run.
-
object: Literal["eval.run"]The type of the object. Always "eval.run".
"eval.run"
-
per_model_usage: List[PerModelUsage]Usage statistics for each model during the evaluation run.
-
cached_tokens: intThe number of tokens retrieved from cache.
-
completion_tokens: intThe number of completion tokens generated.
-
invocation_count: intThe number of invocations.
-
model_name: strThe name of the model.
-
prompt_tokens: intThe number of prompt tokens used.
-
total_tokens: intThe total number of tokens used.
-
-
per_testing_criteria_results: List[PerTestingCriteriaResult]Results per testing criteria applied during the evaluation run.
-
failed: intNumber of tests failed for this criteria.
-
passed: intNumber of tests passed for this criteria.
-
testing_criteria: strA description of the testing criteria.
-
-
report_url: strThe URL to the rendered evaluation run report on the UI dashboard.
-
result_counts: ResultCountsCounters summarizing the outcomes of the evaluation run.
-
errored: intNumber of output items that resulted in an error.
-
failed: intNumber of output items that failed to pass the evaluation.
-
passed: intNumber of output items that passed the evaluation.
-
total: intTotal number of executed output items.
-
-
status: strThe status of the evaluation run.
-
Example
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
run = client.evals.runs.retrieve(
run_id="run_id",
eval_id="eval_id",
)
print(run.id)
Response
{
"id": "id",
"created_at": 0,
"data_source": {
"source": {
"content": [
{
"item": {
"foo": "bar"
},
"sample": {
"foo": "bar"
}
}
],
"type": "file_content"
},
"type": "jsonl"
},
"error": {
"code": "code",
"message": "message"
},
"eval_id": "eval_id",
"metadata": {
"foo": "string"
},
"model": "model",
"name": "name",
"object": "eval.run",
"per_model_usage": [
{
"cached_tokens": 0,
"completion_tokens": 0,
"invocation_count": 0,
"model_name": "model_name",
"prompt_tokens": 0,
"total_tokens": 0
}
],
"per_testing_criteria_results": [
{
"failed": 0,
"passed": 0,
"testing_criteria": "testing_criteria"
}
],
"report_url": "https://example.com",
"result_counts": {
"errored": 0,
"failed": 0,
"passed": 0,
"total": 0
},
"status": "status"
}
Example
from openai import OpenAI
client = OpenAI()
run = client.evals.runs.retrieve(
"eval_67abd54d9b0081909a86353f6fb9317a",
"evalrun_67abd54d60ec8190832b46859da808f7"
)
print(run)
Response
{
"object": "eval.run",
"id": "evalrun_67abd54d60ec8190832b46859da808f7",
"eval_id": "eval_67abd54d9b0081909a86353f6fb9317a",
"report_url": "https://platform.openai.com/evaluations/eval_67abd54d9b0081909a86353f6fb9317a?run_id=evalrun_67abd54d60ec8190832b46859da808f7",
"status": "queued",
"model": "gpt-4o-mini",
"name": "gpt-4o-mini",
"created_at": 1743092069,
"result_counts": {
"total": 0,
"errored": 0,
"failed": 0,
"passed": 0
},
"per_model_usage": null,
"per_testing_criteria_results": null,
"data_source": {
"type": "completions",
"source": {
"type": "file_content",
"content": [
{
"item": {
"input": "Tech Company Launches Advanced Artificial Intelligence Platform",
"ground_truth": "Technology"
}
},
{
"item": {
"input": "Central Bank Increases Interest Rates Amid Inflation Concerns",
"ground_truth": "Markets"
}
},
{
"item": {
"input": "International Summit Addresses Climate Change Strategies",
"ground_truth": "World"
}
},
{
"item": {
"input": "Major Retailer Reports Record-Breaking Holiday Sales",
"ground_truth": "Business"
}
},
{
"item": {
"input": "National Team Qualifies for World Championship Finals",
"ground_truth": "Sports"
}
},
{
"item": {
"input": "Stock Markets Rally After Positive Economic Data Released",
"ground_truth": "Markets"
}
},
{
"item": {
"input": "Global Manufacturer Announces Merger with Competitor",
"ground_truth": "Business"
}
},
{
"item": {
"input": "Breakthrough in Renewable Energy Technology Unveiled",
"ground_truth": "Technology"
}
},
{
"item": {
"input": "World Leaders Sign Historic Climate Agreement",
"ground_truth": "World"
}
},
{
"item": {
"input": "Professional Athlete Sets New Record in Championship Event",
"ground_truth": "Sports"
}
},
{
"item": {
"input": "Financial Institutions Adapt to New Regulatory Requirements",
"ground_truth": "Business"
}
},
{
"item": {
"input": "Tech Conference Showcases Advances in Artificial Intelligence",
"ground_truth": "Technology"
}
},
{
"item": {
"input": "Global Markets Respond to Oil Price Fluctuations",
"ground_truth": "Markets"
}
},
{
"item": {
"input": "International Cooperation Strengthened Through New Treaty",
"ground_truth": "World"
}
},
{
"item": {
"input": "Sports League Announces Revised Schedule for Upcoming Season",
"ground_truth": "Sports"
}
}
]
},
"input_messages": {
"type": "template",
"template": [
{
"type": "message",
"role": "developer",
"content": {
"type": "input_text",
"text": "Categorize a given news headline into one of the following topics: Technology, Markets, World, Business, or Sports.\n\n# Steps\n\n1. Analyze the content of the news headline to understand its primary focus.\n2. Extract the subject matter, identifying any key indicators or keywords.\n3. Use the identified indicators to determine the most suitable category out of the five options: Technology, Markets, World, Business, or Sports.\n4. Ensure only one category is selected per headline.\n\n# Output Format\n\nRespond with the chosen category as a single word. For instance: \"Technology\", \"Markets\", \"World\", \"Business\", or \"Sports\".\n\n# Examples\n\n**Input**: \"Apple Unveils New iPhone Model, Featuring Advanced AI Features\" \n**Output**: \"Technology\"\n\n**Input**: \"Global Stocks Mixed as Investors Await Central Bank Decisions\" \n**Output**: \"Markets\"\n\n**Input**: \"War in Ukraine: Latest Updates on Negotiation Status\" \n**Output**: \"World\"\n\n**Input**: \"Microsoft in Talks to Acquire Gaming Company for $2 Billion\" \n**Output**: \"Business\"\n\n**Input**: \"Manchester United Secures Win in Premier League Football Match\" \n**Output**: \"Sports\" \n\n# Notes\n\n- If the headline appears to fit into more than one category, choose the most dominant theme.\n- Keywords or phrases such as \"stocks\", \"company acquisition\", \"match\", or technological brands can be good indicators for classification.\n"
}
},
{
"type": "message",
"role": "user",
"content": {
"type": "input_text",
"text": "{{item.input}}"
}
}
]
},
"model": "gpt-4o-mini",
"sampling_params": {
"seed": 42,
"temperature": 1.0,
"top_p": 1.0,
"max_completions_tokens": 2048
}
},
"error": null,
"metadata": {}
}
Cancel eval run
evals.runs.cancel(strrun_id, RunCancelParams**kwargs) -> RunCancelResponse
post /evals/{eval_id}/runs/{run_id}
Cancel an ongoing evaluation run.
Parameters
-
eval_id: str -
run_id: str
Returns
-
class RunCancelResponse: …A schema representing an evaluation run.
-
id: strUnique identifier for the evaluation run.
-
created_at: intUnix timestamp (in seconds) when the evaluation run was created.
-
data_source: DataSourceInformation about the run's data source.
-
class CreateEvalJSONLRunDataSource: …A JsonlRunDataSource object with that specifies a JSONL file that matches the eval
-
source: SourceDetermines what populates the
itemnamespace in the data source.-
class SourceFileContent: …-
content: List[SourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class SourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
-
type: Literal["jsonl"]The type of data source. Always
jsonl."jsonl"
-
-
class CreateEvalCompletionsRunDataSource: …A CompletionsRunDataSource object describing a model sampling configuration.
-
source: SourceDetermines what populates the
itemnamespace in this run's data source.-
class SourceFileContent: …-
content: List[SourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class SourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
class SourceStoredCompletions: …A StoredCompletionsRunDataSource configuration describing a set of filters
-
type: Literal["stored_completions"]The type of source. Always
stored_completions."stored_completions"
-
created_after: Optional[int]An optional Unix timestamp to filter items created after this time.
-
created_before: Optional[int]An optional Unix timestamp to filter items created before this time.
-
limit: Optional[int]An optional maximum number of items to return.
-
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.
-
model: Optional[str]An optional model to filter by (e.g., 'gpt-4o').
-
-
-
type: Literal["completions"]The type of run data source. Always
completions."completions"
-
input_messages: Optional[InputMessages]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 theitemnamespace.-
class InputMessagesTemplate: …-
template: List[InputMessagesTemplateTemplate]A list of chat messages forming the prompt or context. May include variable references to the
itemnamespace, ie {{item.name}}.-
class EasyInputMessage: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: Union[str, ResponseInputMessageContentList]Text, image, or audio input to the model, used to generate a response. Can also contain previous assistant responses.
-
strA text input to the model.
-
List[ResponseInputContent]-
class ResponseInputText: …A text input to the model.
-
text: strThe text input to the model.
-
type: Literal["input_text"]The type of the input item. Always
input_text."input_text"
-
-
class ResponseInputImage: …An image input to the model. Learn about image inputs.
-
detail: Literal["low", "high", "auto", "original"]The detail level of the image to be sent to the model. One of
high,low,auto, ororiginal. Defaults toauto.-
"low" -
"high" -
"auto" -
"original"
-
-
type: Literal["input_image"]The type of the input item. Always
input_image."input_image"
-
file_id: Optional[str]The ID of the file to be sent to the model.
-
image_url: Optional[str]The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.
-
-
class ResponseInputFile: …A file input to the model.
-
type: Literal["input_file"]The type of the input item. Always
input_file."input_file"
-
detail: Optional[Literal["low", "high"]]The detail level of the file to be sent to the model. Use
lowfor the default rendering behavior, orhighto render the file at higher quality. Defaults tolow.-
"low" -
"high"
-
-
file_data: Optional[str]The content of the file to be sent to the model.
-
file_id: Optional[str]The ID of the file to be sent to the model.
-
file_url: Optional[str]The URL of the file to be sent to the model.
-
filename: Optional[str]The name of the file to be sent to the model.
-
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
phase: Optional[Literal["commentary", "final_answer"]]Labels an
assistantmessage as intermediate commentary (commentary) or the final answer (final_answer). For models likegpt-5.3-codexand beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages.-
"commentary" -
"final_answer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
class InputMessagesTemplateTemplateEvalItem: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: InputMessagesTemplateTemplateEvalItemContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class InputMessagesTemplateTemplateEvalItemContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class InputMessagesTemplateTemplateEvalItemContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
input_audio: InputAudio-
data: strBase64-encoded audio data.
-
format: Literal["mp3", "wav"]The format of the audio data. Currently supported formats are
mp3andwav.-
"mp3" -
"wav"
-
-
-
type: Literal["input_audio"]The type of the input item. Always
input_audio."input_audio"
-
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
-
type: Literal["template"]The type of input messages. Always
template."template"
-
-
class InputMessagesItemReference: …-
item_reference: strA reference to a variable in the
itemnamespace. Ie, "item.input_trajectory" -
type: Literal["item_reference"]The type of input messages. Always
item_reference."item_reference"
-
-
-
model: Optional[str]The name of the model to use for generating completions (e.g. "o3-mini").
-
sampling_params: Optional[SamplingParams]-
max_completion_tokens: Optional[int]The maximum number of tokens in the generated output.
-
reasoning_effort: Optional[ReasoningEffort]Constrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.-
gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1. -
All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. -
The
gpt-5-promodel defaults to (and only supports)highreasoning effort. -
xhighis supported for all models aftergpt-5.1-codex-max. -
"none" -
"minimal" -
"low" -
"medium" -
"high" -
"xhigh"
-
-
response_format: Optional[SamplingParamsResponseFormat]An object specifying the format that the model must output.
Setting to
{ "type": "json_schema", "json_schema": {...} }enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.Setting to
{ "type": "json_object" }enables the older JSON mode, which ensures the message the model generates is valid JSON. Usingjson_schemais preferred for models that support it.-
class ResponseFormatText: …Default response format. Used to generate text responses.
-
type: Literal["text"]The type of response format being defined. Always
text."text"
-
-
class ResponseFormatJSONSchema: …JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.
-
json_schema: JSONSchemaStructured Outputs configuration options, including a JSON Schema.
-
name: strThe name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
description: Optional[str]A description of what the response format is for, used by the model to determine how to respond in the format.
-
schema: Optional[Dict[str, object]]The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.
-
strict: Optional[bool]Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the
schemafield. Only a subset of JSON Schema is supported whenstrictistrue. To learn more, read the Structured Outputs guide.
-
-
type: Literal["json_schema"]The type of response format being defined. Always
json_schema."json_schema"
-
-
class ResponseFormatJSONObject: …JSON object response format. An older method of generating JSON responses. Using
json_schemais recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.-
type: Literal["json_object"]The type of response format being defined. Always
json_object."json_object"
-
-
-
seed: Optional[int]A seed value to initialize the randomness, during sampling.
-
temperature: Optional[float]A higher temperature increases randomness in the outputs.
-
tools: Optional[List[ChatCompletionFunctionTool]]A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
-
function: FunctionDefinition-
name: strThe name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
description: Optional[str]A description of what the function does, used by the model to choose when and how to call the function.
-
parameters: Optional[FunctionParameters]The parameters the functions accepts, described as a JSON Schema object. See the guide for examples, and the JSON Schema reference for documentation about the format.
Omitting
parametersdefines a function with an empty parameter list. -
strict: Optional[bool]Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the
parametersfield. Only a subset of JSON Schema is supported whenstrictistrue. Learn more about Structured Outputs in the function calling guide.
-
-
type: Literal["function"]The type of the tool. Currently, only
functionis supported."function"
-
-
top_p: Optional[float]An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
class DataSourceResponses: …A ResponsesRunDataSource object describing a model sampling configuration.
-
source: DataSourceResponsesSourceDetermines what populates the
itemnamespace in this run's data source.-
class DataSourceResponsesSourceFileContent: …-
content: List[DataSourceResponsesSourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class DataSourceResponsesSourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
class DataSourceResponsesSourceResponses: …A EvalResponsesSource object describing a run data source configuration.
-
type: Literal["responses"]The type of run data source. Always
responses."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. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1.- All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. - The
gpt-5-promodel defaults to (and only supports)highreasoning effort. xhighis supported for all models aftergpt-5.1-codex-max.
-
temperature: Optional[float]Sampling temperature. This is a query parameter used to select responses.
-
tools: Optional[List[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[List[str]]List of user identifiers. This is a query parameter used to select responses.
-
-
-
type: Literal["responses"]The type of run data source. Always
responses."responses"
-
input_messages: Optional[DataSourceResponsesInputMessages]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 theitemnamespace.-
class DataSourceResponsesInputMessagesTemplate: …-
template: List[DataSourceResponsesInputMessagesTemplateTemplate]A list of chat messages forming the prompt or context. May include variable references to the
itemnamespace, ie {{item.name}}.-
class DataSourceResponsesInputMessagesTemplateTemplateChatMessage: …-
content: strThe content of the message.
-
role: strThe role of the message (e.g. "system", "assistant", "user").
-
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItem: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
-
type: Literal["template"]The type of input messages. Always
template."template"
-
-
class DataSourceResponsesInputMessagesItemReference: …-
item_reference: strA reference to a variable in the
itemnamespace. Ie, "item.name" -
type: Literal["item_reference"]The type of input messages. Always
item_reference."item_reference"
-
-
-
model: Optional[str]The name of the model to use for generating completions (e.g. "o3-mini").
-
sampling_params: Optional[DataSourceResponsesSamplingParams]-
max_completion_tokens: Optional[int]The maximum number of tokens in the generated output.
-
reasoning_effort: Optional[ReasoningEffort]Constrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1.- All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. - The
gpt-5-promodel defaults to (and only supports)highreasoning effort. xhighis supported for all models aftergpt-5.1-codex-max.
-
seed: Optional[int]A seed value to initialize the randomness, during sampling.
-
temperature: Optional[float]A higher temperature increases randomness in the outputs.
-
text: Optional[DataSourceResponsesSamplingParamsText]Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:
-
format: Optional[ResponseFormatTextConfig]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.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. Usingjson_schemais preferred for models that support it.-
class ResponseFormatText: …Default response format. Used to generate text responses.
-
class ResponseFormatTextJSONSchemaConfig: …JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.
-
name: strThe name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
schema: Dict[str, object]The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.
-
type: Literal["json_schema"]The type of response format being defined. Always
json_schema."json_schema"
-
description: Optional[str]A description of what the response format is for, used by the model to determine how to respond in the format.
-
strict: Optional[bool]Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the
schemafield. Only a subset of JSON Schema is supported whenstrictistrue. To learn more, read the Structured Outputs guide.
-
-
class ResponseFormatJSONObject: …JSON object response format. An older method of generating JSON responses. Using
json_schemais recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.
-
-
tools: Optional[List[Tool]]An array of tools the model may call while generating a response. You can specify which tool to use by setting the
tool_choiceparameter.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 or file search. Learn more about built-in tools.
-
Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code. Learn more about function calling.
-
class FunctionTool: …Defines a function in your own code the model can choose to call. Learn more about function calling.
-
name: strThe name of the function to call.
-
parameters: Optional[Dict[str, object]]A JSON schema object describing the parameters of the function.
-
strict: Optional[bool]Whether to enforce strict parameter validation. Default
true. -
type: Literal["function"]The type of the function tool. Always
function."function"
-
defer_loading: Optional[bool]Whether this function is deferred and loaded via tool search.
-
description: Optional[str]A description of the function. Used by the model to determine whether or not to call the function.
-
-
class FileSearchTool: …A tool that searches for relevant content from uploaded files. Learn more about the file search tool.
-
type: Literal["file_search"]The type of the file search tool. Always
file_search."file_search"
-
vector_store_ids: List[str]The IDs of the vector stores to search.
-
filters: Optional[Filters]A filter to apply.
-
class ComparisonFilter: …A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
key: strThe key to compare against the value.
-
type: Literal["eq", "ne", "gt", 5 more]Specifies the comparison operator:
eq,ne,gt,gte,lt,lte,in,nin.-
eq: equals -
ne: not equal -
gt: greater than -
gte: greater than or equal -
lt: less than -
lte: less than or equal -
in: in -
nin: not in -
"eq" -
"ne" -
"gt" -
"gte" -
"lt" -
"lte" -
"in" -
"nin"
-
-
value: Union[str, float, bool, List[Union[str, float]]]The value to compare against the attribute key; supports string, number, or boolean types.
-
str -
float -
bool -
List[Union[str, float]]-
str -
float
-
-
-
-
class CompoundFilter: …Combine multiple filters using
andoror.-
filters: List[Filter]Array of filters to combine. Items can be
ComparisonFilterorCompoundFilter.-
class ComparisonFilter: …A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
object
-
-
type: Literal["and", "or"]Type of operation:
andoror.-
"and" -
"or"
-
-
-
-
max_num_results: Optional[int]The maximum number of results to return. This number should be between 1 and 50 inclusive.
-
ranking_options: Optional[RankingOptions]Ranking options for search.
-
hybrid_search: Optional[RankingOptionsHybridSearch]Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.
-
embedding_weight: floatThe weight of the embedding in the reciprocal ranking fusion.
-
text_weight: floatThe weight of the text in the reciprocal ranking fusion.
-
-
ranker: Optional[Literal["auto", "default-2024-11-15"]]The ranker to use for the file search.
-
"auto" -
"default-2024-11-15"
-
-
score_threshold: Optional[float]The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.
-
-
-
class ComputerTool: …A tool that controls a virtual computer. Learn more about the computer tool.
-
type: Literal["computer"]The type of the computer tool. Always
computer."computer"
-
-
class ComputerUsePreviewTool: …A tool that controls a virtual computer. Learn more about the computer tool.
-
display_height: intThe height of the computer display.
-
display_width: intThe width of the computer display.
-
environment: Literal["windows", "mac", "linux", 2 more]The type of computer environment to control.
-
"windows" -
"mac" -
"linux" -
"ubuntu" -
"browser"
-
-
type: Literal["computer_use_preview"]The type of the computer use tool. Always
computer_use_preview."computer_use_preview"
-
-
class WebSearchTool: …Search the Internet for sources related to the prompt. Learn more about the web search tool.
-
type: Literal["web_search", "web_search_2025_08_26"]The type of the web search tool. One of
web_searchorweb_search_2025_08_26.-
"web_search" -
"web_search_2025_08_26"
-
-
filters: Optional[Filters]Filters for the search.
-
allowed_domains: Optional[List[str]]Allowed domains for the search. If not provided, all domains are allowed. Subdomains of the provided domains are allowed as well.
Example:
["pubmed.ncbi.nlm.nih.gov"]
-
-
search_context_size: Optional[Literal["low", "medium", "high"]]High level guidance for the amount of context window space to use for the search. One of
low,medium, orhigh.mediumis the default.-
"low" -
"medium" -
"high"
-
-
user_location: Optional[UserLocation]The approximate location of the user.
-
city: Optional[str]Free text input for the city of the user, e.g.
San Francisco. -
country: Optional[str]The two-letter ISO country code of the user, e.g.
US. -
region: Optional[str]Free text input for the region of the user, e.g.
California. -
timezone: Optional[str]The IANA timezone of the user, e.g.
America/Los_Angeles. -
type: Optional[Literal["approximate"]]The type of location approximation. Always
approximate."approximate"
-
-
-
class Mcp: …Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
-
server_label: strA label for this MCP server, used to identify it in tool calls.
-
type: Literal["mcp"]The type of the MCP tool. Always
mcp."mcp"
-
allowed_tools: Optional[McpAllowedTools]List of allowed tool names or a filter object.
-
List[str]A string array of allowed tool names
-
class McpAllowedToolsMcpToolFilter: …A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
-
authorization: Optional[str]An OAuth access token that can be used with a remote MCP server, either with a custom MCP server URL or a service connector. Your application must handle the OAuth authorization flow and provide the token here.
-
connector_id: Optional[Literal["connector_dropbox", "connector_gmail", "connector_googlecalendar", 5 more]]Identifier for service connectors, like those available in ChatGPT. One of
server_urlorconnector_idmust be provided. Learn more about service connectors here.Currently supported
connector_idvalues are:-
Dropbox:
connector_dropbox -
Gmail:
connector_gmail -
Google Calendar:
connector_googlecalendar -
Google Drive:
connector_googledrive -
Microsoft Teams:
connector_microsoftteams -
Outlook Calendar:
connector_outlookcalendar -
Outlook Email:
connector_outlookemail -
SharePoint:
connector_sharepoint -
"connector_dropbox" -
"connector_gmail" -
"connector_googlecalendar" -
"connector_googledrive" -
"connector_microsoftteams" -
"connector_outlookcalendar" -
"connector_outlookemail" -
"connector_sharepoint"
-
-
defer_loading: Optional[bool]Whether this MCP tool is deferred and discovered via tool search.
-
headers: Optional[Dict[str, str]]Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.
-
require_approval: Optional[McpRequireApproval]Specify which of the MCP server's tools require approval.
-
class McpRequireApprovalMcpToolApprovalFilter: …Specify which of the MCP server's tools require approval. Can be
always,never, or a filter object associated with tools that require approval.-
always: Optional[McpRequireApprovalMcpToolApprovalFilterAlways]A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
never: Optional[McpRequireApprovalMcpToolApprovalFilterNever]A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
-
Literal["always", "never"]Specify a single approval policy for all tools. One of
alwaysornever. When set toalways, all tools will require approval. When set tonever, all tools will not require approval.-
"always" -
"never"
-
-
-
server_description: Optional[str]Optional description of the MCP server, used to provide more context.
-
server_url: Optional[str]The URL for the MCP server. One of
server_urlorconnector_idmust be provided.
-
-
class CodeInterpreter: …A tool that runs Python code to help generate a response to a prompt.
-
container: CodeInterpreterContainerThe code interpreter container. Can be a container ID or an object that specifies uploaded file IDs to make available to your code, along with an optional
memory_limitsetting.-
strThe container ID.
-
class CodeInterpreterContainerCodeInterpreterToolAuto: …Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.
-
type: Literal["auto"]Always
auto."auto"
-
file_ids: Optional[List[str]]An optional list of uploaded files to make available to your code.
-
memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]The memory limit for the code interpreter container.
-
"1g" -
"4g" -
"16g" -
"64g"
-
-
network_policy: Optional[CodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicy]Network access policy for the container.
-
class ContainerNetworkPolicyDisabled: …-
type: Literal["disabled"]Disable outbound network access. Always
disabled."disabled"
-
-
class ContainerNetworkPolicyAllowlist: …-
allowed_domains: List[str]A list of allowed domains when type is
allowlist. -
type: Literal["allowlist"]Allow outbound network access only to specified domains. Always
allowlist."allowlist"
-
domain_secrets: Optional[List[ContainerNetworkPolicyDomainSecret]]Optional domain-scoped secrets for allowlisted domains.
-
domain: strThe domain associated with the secret.
-
name: strThe name of the secret to inject for the domain.
-
value: strThe secret value to inject for the domain.
-
-
-
-
-
-
type: Literal["code_interpreter"]The type of the code interpreter tool. Always
code_interpreter."code_interpreter"
-
-
class ImageGeneration: …A tool that generates images using the GPT image models.
-
type: Literal["image_generation"]The type of the image generation tool. Always
image_generation."image_generation"
-
action: Optional[Literal["generate", "edit", "auto"]]Whether to generate a new image or edit an existing image. Default:
auto.-
"generate" -
"edit" -
"auto"
-
-
background: Optional[Literal["transparent", "opaque", "auto"]]Allows to set transparency for the background of the generated image(s). This parameter is only supported for GPT image models that support transparent backgrounds. Must be one of
transparent,opaque, orauto(default value). Whenautois used, the model will automatically determine the best background for the image.gpt-image-2andgpt-image-2-2026-04-21do not support transparent backgrounds. Requests withbackgroundset totransparentwill return an error for these models; useopaqueorautoinstead.If
transparent, the output format needs to support transparency, so it should be set to eitherpng(default value) orwebp.-
"transparent" -
"opaque" -
"auto"
-
-
input_fidelity: Optional[Literal["high", "low"]]Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for
gpt-image-1andgpt-image-1.5and later models, unsupported forgpt-image-1-mini. Supportshighandlow. Defaults tolow.-
"high" -
"low"
-
-
input_image_mask: Optional[ImageGenerationInputImageMask]Optional mask for inpainting. Contains
image_url(string, optional) andfile_id(string, optional).-
file_id: Optional[str]File ID for the mask image.
-
image_url: Optional[str]Base64-encoded mask image.
-
-
model: Optional[Union[str, Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-2", 3 more], null]]The image generation model to use. Default:
gpt-image-1.-
str -
Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-2", 3 more]The image generation model to use. Default:
gpt-image-1.-
"gpt-image-1" -
"gpt-image-1-mini" -
"gpt-image-2" -
"gpt-image-2-2026-04-21" -
"gpt-image-1.5" -
"chatgpt-image-latest"
-
-
-
moderation: Optional[Literal["auto", "low"]]Moderation level for the generated image. Default:
auto.-
"auto" -
"low"
-
-
output_compression: Optional[int]Compression level for the output image. Default: 100.
-
output_format: Optional[Literal["png", "webp", "jpeg"]]The output format of the generated image. One of
png,webp, orjpeg. Default:png.-
"png" -
"webp" -
"jpeg"
-
-
partial_images: Optional[int]Number of partial images to generate in streaming mode, from 0 (default value) to 3.
-
quality: Optional[Literal["low", "medium", "high", "auto"]]The quality of the generated image. One of
low,medium,high, orauto. Default:auto.-
"low" -
"medium" -
"high" -
"auto"
-
-
size: Optional[Union[str, Literal["1024x1024", "1024x1536", "1536x1024", "auto"], null]]The size of the generated images. For
gpt-image-2andgpt-image-2-2026-04-21, arbitrary resolutions are supported asWIDTHxHEIGHTstrings, for example1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above2560x1440are experimental, and the maximum supported resolution is3840x2160. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes1024x1024,1536x1024, and1024x1536are supported by the GPT image models;autois supported for models that allow automatic sizing. Fordall-e-2, use one of256x256,512x512, or1024x1024. Fordall-e-3, use one of1024x1024,1792x1024, or1024x1792.-
str -
Literal["1024x1024", "1024x1536", "1536x1024", "auto"]The size of the generated images. For
gpt-image-2andgpt-image-2-2026-04-21, arbitrary resolutions are supported asWIDTHxHEIGHTstrings, for example1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above2560x1440are experimental, and the maximum supported resolution is3840x2160. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes1024x1024,1536x1024, and1024x1536are supported by the GPT image models;autois supported for models that allow automatic sizing. Fordall-e-2, use one of256x256,512x512, or1024x1024. Fordall-e-3, use one of1024x1024,1792x1024, or1024x1792.-
"1024x1024" -
"1024x1536" -
"1536x1024" -
"auto"
-
-
-
-
class LocalShell: …A tool that allows the model to execute shell commands in a local environment.
-
type: Literal["local_shell"]The type of the local shell tool. Always
local_shell."local_shell"
-
-
class FunctionShellTool: …A tool that allows the model to execute shell commands.
-
type: Literal["shell"]The type of the shell tool. Always
shell."shell"
-
environment: Optional[Environment]-
class ContainerAuto: …-
type: Literal["container_auto"]Automatically creates a container for this request
"container_auto"
-
file_ids: Optional[List[str]]An optional list of uploaded files to make available to your code.
-
memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]The memory limit for the container.
-
"1g" -
"4g" -
"16g" -
"64g"
-
-
network_policy: Optional[NetworkPolicy]Network access policy for the container.
-
class ContainerNetworkPolicyDisabled: … -
class ContainerNetworkPolicyAllowlist: …
-
-
skills: Optional[List[Skill]]An optional list of skills referenced by id or inline data.
-
class SkillReference: …-
skill_id: strThe ID of the referenced skill.
-
type: Literal["skill_reference"]References a skill created with the /v1/skills endpoint.
"skill_reference"
-
version: Optional[str]Optional skill version. Use a positive integer or 'latest'. Omit for default.
-
-
class InlineSkill: …-
description: strThe description of the skill.
-
name: strThe name of the skill.
-
source: InlineSkillSourceInline skill payload
-
data: strBase64-encoded skill zip bundle.
-
media_type: Literal["application/zip"]The media type of the inline skill payload. Must be
application/zip."application/zip"
-
type: Literal["base64"]The type of the inline skill source. Must be
base64."base64"
-
-
type: Literal["inline"]Defines an inline skill for this request.
"inline"
-
-
-
-
class LocalEnvironment: …-
type: Literal["local"]Use a local computer environment.
"local"
-
skills: Optional[List[LocalSkill]]An optional list of skills.
-
description: strThe description of the skill.
-
name: strThe name of the skill.
-
path: strThe path to the directory containing the skill.
-
-
-
class ContainerReference: …-
container_id: strThe ID of the referenced container.
-
type: Literal["container_reference"]References a container created with the /v1/containers endpoint
"container_reference"
-
-
-
-
class CustomTool: …A custom tool that processes input using a specified format. Learn more about custom tools
-
name: strThe name of the custom tool, used to identify it in tool calls.
-
type: Literal["custom"]The type of the custom tool. Always
custom."custom"
-
defer_loading: Optional[bool]Whether this tool should be deferred and discovered via tool search.
-
description: Optional[str]Optional description of the custom tool, used to provide more context.
-
format: Optional[CustomToolInputFormat]The input format for the custom tool. Default is unconstrained text.
-
class Text: …Unconstrained free-form text.
-
type: Literal["text"]Unconstrained text format. Always
text."text"
-
-
class Grammar: …A grammar defined by the user.
-
definition: strThe grammar definition.
-
syntax: Literal["lark", "regex"]The syntax of the grammar definition. One of
larkorregex.-
"lark" -
"regex"
-
-
type: Literal["grammar"]Grammar format. Always
grammar."grammar"
-
-
-
-
class NamespaceTool: …Groups function/custom tools under a shared namespace.
-
description: strA description of the namespace shown to the model.
-
name: strThe namespace name used in tool calls (for example,
crm). -
tools: List[Tool]The function/custom tools available inside this namespace.
-
class ToolFunction: …-
name: str -
type: Literal["function"]"function"
-
defer_loading: Optional[bool]Whether this function should be deferred and discovered via tool search.
-
description: Optional[str] -
parameters: Optional[object] -
strict: Optional[bool]
-
-
class CustomTool: …A custom tool that processes input using a specified format. Learn more about custom tools
-
-
type: Literal["namespace"]The type of the tool. Always
namespace."namespace"
-
-
class ToolSearchTool: …Hosted or BYOT tool search configuration for deferred tools.
-
type: Literal["tool_search"]The type of the tool. Always
tool_search."tool_search"
-
description: Optional[str]Description shown to the model for a client-executed tool search tool.
-
execution: Optional[Literal["server", "client"]]Whether tool search is executed by the server or by the client.
-
"server" -
"client"
-
-
parameters: Optional[object]Parameter schema for a client-executed tool search tool.
-
-
class WebSearchPreviewTool: …This tool searches the web for relevant results to use in a response. Learn more about the web search tool.
-
type: Literal["web_search_preview", "web_search_preview_2025_03_11"]The type of the web search tool. One of
web_search_previeworweb_search_preview_2025_03_11.-
"web_search_preview" -
"web_search_preview_2025_03_11"
-
-
search_content_types: Optional[List[Literal["text", "image"]]]-
"text" -
"image"
-
-
search_context_size: Optional[Literal["low", "medium", "high"]]High level guidance for the amount of context window space to use for the search. One of
low,medium, orhigh.mediumis the default.-
"low" -
"medium" -
"high"
-
-
user_location: Optional[UserLocation]The user's location.
-
type: Literal["approximate"]The type of location approximation. Always
approximate."approximate"
-
city: Optional[str]Free text input for the city of the user, e.g.
San Francisco. -
country: Optional[str]The two-letter ISO country code of the user, e.g.
US. -
region: Optional[str]Free text input for the region of the user, e.g.
California. -
timezone: Optional[str]The IANA timezone of the user, e.g.
America/Los_Angeles.
-
-
-
class ApplyPatchTool: …Allows the assistant to create, delete, or update files using unified diffs.
-
type: Literal["apply_patch"]The type of the tool. Always
apply_patch."apply_patch"
-
-
-
top_p: Optional[float]An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
-
error: EvalAPIErrorAn object representing an error response from the Eval API.
-
code: strThe error code.
-
message: strThe error message.
-
-
eval_id: strThe identifier of the associated evaluation.
-
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.
-
model: strThe model that is evaluated, if applicable.
-
name: strThe name of the evaluation run.
-
object: Literal["eval.run"]The type of the object. Always "eval.run".
"eval.run"
-
per_model_usage: List[PerModelUsage]Usage statistics for each model during the evaluation run.
-
cached_tokens: intThe number of tokens retrieved from cache.
-
completion_tokens: intThe number of completion tokens generated.
-
invocation_count: intThe number of invocations.
-
model_name: strThe name of the model.
-
prompt_tokens: intThe number of prompt tokens used.
-
total_tokens: intThe total number of tokens used.
-
-
per_testing_criteria_results: List[PerTestingCriteriaResult]Results per testing criteria applied during the evaluation run.
-
failed: intNumber of tests failed for this criteria.
-
passed: intNumber of tests passed for this criteria.
-
testing_criteria: strA description of the testing criteria.
-
-
report_url: strThe URL to the rendered evaluation run report on the UI dashboard.
-
result_counts: ResultCountsCounters summarizing the outcomes of the evaluation run.
-
errored: intNumber of output items that resulted in an error.
-
failed: intNumber of output items that failed to pass the evaluation.
-
passed: intNumber of output items that passed the evaluation.
-
total: intTotal number of executed output items.
-
-
status: strThe status of the evaluation run.
-
Example
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
response = client.evals.runs.cancel(
run_id="run_id",
eval_id="eval_id",
)
print(response.id)
Response
{
"id": "id",
"created_at": 0,
"data_source": {
"source": {
"content": [
{
"item": {
"foo": "bar"
},
"sample": {
"foo": "bar"
}
}
],
"type": "file_content"
},
"type": "jsonl"
},
"error": {
"code": "code",
"message": "message"
},
"eval_id": "eval_id",
"metadata": {
"foo": "string"
},
"model": "model",
"name": "name",
"object": "eval.run",
"per_model_usage": [
{
"cached_tokens": 0,
"completion_tokens": 0,
"invocation_count": 0,
"model_name": "model_name",
"prompt_tokens": 0,
"total_tokens": 0
}
],
"per_testing_criteria_results": [
{
"failed": 0,
"passed": 0,
"testing_criteria": "testing_criteria"
}
],
"report_url": "https://example.com",
"result_counts": {
"errored": 0,
"failed": 0,
"passed": 0,
"total": 0
},
"status": "status"
}
Example
from openai import OpenAI
client = OpenAI()
canceled_run = client.evals.runs.cancel(
"eval_67abd54d9b0081909a86353f6fb9317a",
"evalrun_67abd54d60ec8190832b46859da808f7"
)
print(canceled_run)
Response
{
"object": "eval.run",
"id": "evalrun_67abd54d60ec8190832b46859da808f7",
"eval_id": "eval_67abd54d9b0081909a86353f6fb9317a",
"report_url": "https://platform.openai.com/evaluations/eval_67abd54d9b0081909a86353f6fb9317a?run_id=evalrun_67abd54d60ec8190832b46859da808f7",
"status": "canceled",
"model": "gpt-4o-mini",
"name": "gpt-4o-mini",
"created_at": 1743092069,
"result_counts": {
"total": 0,
"errored": 0,
"failed": 0,
"passed": 0
},
"per_model_usage": null,
"per_testing_criteria_results": null,
"data_source": {
"type": "completions",
"source": {
"type": "file_content",
"content": [
{
"item": {
"input": "Tech Company Launches Advanced Artificial Intelligence Platform",
"ground_truth": "Technology"
}
},
{
"item": {
"input": "Central Bank Increases Interest Rates Amid Inflation Concerns",
"ground_truth": "Markets"
}
},
{
"item": {
"input": "International Summit Addresses Climate Change Strategies",
"ground_truth": "World"
}
},
{
"item": {
"input": "Major Retailer Reports Record-Breaking Holiday Sales",
"ground_truth": "Business"
}
},
{
"item": {
"input": "National Team Qualifies for World Championship Finals",
"ground_truth": "Sports"
}
},
{
"item": {
"input": "Stock Markets Rally After Positive Economic Data Released",
"ground_truth": "Markets"
}
},
{
"item": {
"input": "Global Manufacturer Announces Merger with Competitor",
"ground_truth": "Business"
}
},
{
"item": {
"input": "Breakthrough in Renewable Energy Technology Unveiled",
"ground_truth": "Technology"
}
},
{
"item": {
"input": "World Leaders Sign Historic Climate Agreement",
"ground_truth": "World"
}
},
{
"item": {
"input": "Professional Athlete Sets New Record in Championship Event",
"ground_truth": "Sports"
}
},
{
"item": {
"input": "Financial Institutions Adapt to New Regulatory Requirements",
"ground_truth": "Business"
}
},
{
"item": {
"input": "Tech Conference Showcases Advances in Artificial Intelligence",
"ground_truth": "Technology"
}
},
{
"item": {
"input": "Global Markets Respond to Oil Price Fluctuations",
"ground_truth": "Markets"
}
},
{
"item": {
"input": "International Cooperation Strengthened Through New Treaty",
"ground_truth": "World"
}
},
{
"item": {
"input": "Sports League Announces Revised Schedule for Upcoming Season",
"ground_truth": "Sports"
}
}
]
},
"input_messages": {
"type": "template",
"template": [
{
"type": "message",
"role": "developer",
"content": {
"type": "input_text",
"text": "Categorize a given news headline into one of the following topics: Technology, Markets, World, Business, or Sports.\n\n# Steps\n\n1. Analyze the content of the news headline to understand its primary focus.\n2. Extract the subject matter, identifying any key indicators or keywords.\n3. Use the identified indicators to determine the most suitable category out of the five options: Technology, Markets, World, Business, or Sports.\n4. Ensure only one category is selected per headline.\n\n# Output Format\n\nRespond with the chosen category as a single word. For instance: \"Technology\", \"Markets\", \"World\", \"Business\", or \"Sports\".\n\n# Examples\n\n**Input**: \"Apple Unveils New iPhone Model, Featuring Advanced AI Features\" \n**Output**: \"Technology\"\n\n**Input**: \"Global Stocks Mixed as Investors Await Central Bank Decisions\" \n**Output**: \"Markets\"\n\n**Input**: \"War in Ukraine: Latest Updates on Negotiation Status\" \n**Output**: \"World\"\n\n**Input**: \"Microsoft in Talks to Acquire Gaming Company for $2 Billion\" \n**Output**: \"Business\"\n\n**Input**: \"Manchester United Secures Win in Premier League Football Match\" \n**Output**: \"Sports\" \n\n# Notes\n\n- If the headline appears to fit into more than one category, choose the most dominant theme.\n- Keywords or phrases such as \"stocks\", \"company acquisition\", \"match\", or technological brands can be good indicators for classification.\n"
}
},
{
"type": "message",
"role": "user",
"content": {
"type": "input_text",
"text": "{{item.input}}"
}
}
]
},
"model": "gpt-4o-mini",
"sampling_params": {
"seed": 42,
"temperature": 1.0,
"top_p": 1.0,
"max_completions_tokens": 2048
}
},
"error": null,
"metadata": {}
}
Delete eval run
evals.runs.delete(strrun_id, RunDeleteParams**kwargs) -> RunDeleteResponse
delete /evals/{eval_id}/runs/{run_id}
Delete an eval run.
Parameters
-
eval_id: str -
run_id: str
Returns
-
class RunDeleteResponse: …-
deleted: Optional[bool] -
object: Optional[str] -
run_id: Optional[str]
-
Example
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
run = client.evals.runs.delete(
run_id="run_id",
eval_id="eval_id",
)
print(run.run_id)
Response
{
"deleted": true,
"object": "eval.run.deleted",
"run_id": "evalrun_677469f564d48190807532a852da3afb"
}
Example
from openai import OpenAI
client = OpenAI()
deleted = client.evals.runs.delete(
"eval_123abc",
"evalrun_abc456"
)
print(deleted)
Response
{
"object": "eval.run.deleted",
"deleted": true,
"run_id": "evalrun_abc456"
}
Domain Types
Create Eval Completions Run Data Source
-
class CreateEvalCompletionsRunDataSource: …A CompletionsRunDataSource object describing a model sampling configuration.
-
source: SourceDetermines what populates the
itemnamespace in this run's data source.-
class SourceFileContent: …-
content: List[SourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class SourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
class SourceStoredCompletions: …A StoredCompletionsRunDataSource configuration describing a set of filters
-
type: Literal["stored_completions"]The type of source. Always
stored_completions."stored_completions"
-
created_after: Optional[int]An optional Unix timestamp to filter items created after this time.
-
created_before: Optional[int]An optional Unix timestamp to filter items created before this time.
-
limit: Optional[int]An optional maximum number of items to return.
-
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.
-
model: Optional[str]An optional model to filter by (e.g., 'gpt-4o').
-
-
-
type: Literal["completions"]The type of run data source. Always
completions."completions"
-
input_messages: Optional[InputMessages]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 theitemnamespace.-
class InputMessagesTemplate: …-
template: List[InputMessagesTemplateTemplate]A list of chat messages forming the prompt or context. May include variable references to the
itemnamespace, ie {{item.name}}.-
class EasyInputMessage: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: Union[str, ResponseInputMessageContentList]Text, image, or audio input to the model, used to generate a response. Can also contain previous assistant responses.
-
strA text input to the model.
-
List[ResponseInputContent]-
class ResponseInputText: …A text input to the model.
-
text: strThe text input to the model.
-
type: Literal["input_text"]The type of the input item. Always
input_text."input_text"
-
-
class ResponseInputImage: …An image input to the model. Learn about image inputs.
-
detail: Literal["low", "high", "auto", "original"]The detail level of the image to be sent to the model. One of
high,low,auto, ororiginal. Defaults toauto.-
"low" -
"high" -
"auto" -
"original"
-
-
type: Literal["input_image"]The type of the input item. Always
input_image."input_image"
-
file_id: Optional[str]The ID of the file to be sent to the model.
-
image_url: Optional[str]The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.
-
-
class ResponseInputFile: …A file input to the model.
-
type: Literal["input_file"]The type of the input item. Always
input_file."input_file"
-
detail: Optional[Literal["low", "high"]]The detail level of the file to be sent to the model. Use
lowfor the default rendering behavior, orhighto render the file at higher quality. Defaults tolow.-
"low" -
"high"
-
-
file_data: Optional[str]The content of the file to be sent to the model.
-
file_id: Optional[str]The ID of the file to be sent to the model.
-
file_url: Optional[str]The URL of the file to be sent to the model.
-
filename: Optional[str]The name of the file to be sent to the model.
-
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
phase: Optional[Literal["commentary", "final_answer"]]Labels an
assistantmessage as intermediate commentary (commentary) or the final answer (final_answer). For models likegpt-5.3-codexand beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages.-
"commentary" -
"final_answer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
class InputMessagesTemplateTemplateEvalItem: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: InputMessagesTemplateTemplateEvalItemContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class InputMessagesTemplateTemplateEvalItemContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class InputMessagesTemplateTemplateEvalItemContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
input_audio: InputAudio-
data: strBase64-encoded audio data.
-
format: Literal["mp3", "wav"]The format of the audio data. Currently supported formats are
mp3andwav.-
"mp3" -
"wav"
-
-
-
type: Literal["input_audio"]The type of the input item. Always
input_audio."input_audio"
-
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
-
type: Literal["template"]The type of input messages. Always
template."template"
-
-
class InputMessagesItemReference: …-
item_reference: strA reference to a variable in the
itemnamespace. Ie, "item.input_trajectory" -
type: Literal["item_reference"]The type of input messages. Always
item_reference."item_reference"
-
-
-
model: Optional[str]The name of the model to use for generating completions (e.g. "o3-mini").
-
sampling_params: Optional[SamplingParams]-
max_completion_tokens: Optional[int]The maximum number of tokens in the generated output.
-
reasoning_effort: Optional[ReasoningEffort]Constrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.-
gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1. -
All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. -
The
gpt-5-promodel defaults to (and only supports)highreasoning effort. -
xhighis supported for all models aftergpt-5.1-codex-max. -
"none" -
"minimal" -
"low" -
"medium" -
"high" -
"xhigh"
-
-
response_format: Optional[SamplingParamsResponseFormat]An object specifying the format that the model must output.
Setting to
{ "type": "json_schema", "json_schema": {...} }enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.Setting to
{ "type": "json_object" }enables the older JSON mode, which ensures the message the model generates is valid JSON. Usingjson_schemais preferred for models that support it.-
class ResponseFormatText: …Default response format. Used to generate text responses.
-
type: Literal["text"]The type of response format being defined. Always
text."text"
-
-
class ResponseFormatJSONSchema: …JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.
-
json_schema: JSONSchemaStructured Outputs configuration options, including a JSON Schema.
-
name: strThe name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
description: Optional[str]A description of what the response format is for, used by the model to determine how to respond in the format.
-
schema: Optional[Dict[str, object]]The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.
-
strict: Optional[bool]Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the
schemafield. Only a subset of JSON Schema is supported whenstrictistrue. To learn more, read the Structured Outputs guide.
-
-
type: Literal["json_schema"]The type of response format being defined. Always
json_schema."json_schema"
-
-
class ResponseFormatJSONObject: …JSON object response format. An older method of generating JSON responses. Using
json_schemais recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.-
type: Literal["json_object"]The type of response format being defined. Always
json_object."json_object"
-
-
-
seed: Optional[int]A seed value to initialize the randomness, during sampling.
-
temperature: Optional[float]A higher temperature increases randomness in the outputs.
-
tools: Optional[List[ChatCompletionFunctionTool]]A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
-
function: FunctionDefinition-
name: strThe name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
description: Optional[str]A description of what the function does, used by the model to choose when and how to call the function.
-
parameters: Optional[FunctionParameters]The parameters the functions accepts, described as a JSON Schema object. See the guide for examples, and the JSON Schema reference for documentation about the format.
Omitting
parametersdefines a function with an empty parameter list. -
strict: Optional[bool]Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the
parametersfield. Only a subset of JSON Schema is supported whenstrictistrue. Learn more about Structured Outputs in the function calling guide.
-
-
type: Literal["function"]The type of the tool. Currently, only
functionis supported."function"
-
-
top_p: Optional[float]An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
Create Eval JSONL Run Data Source
-
class CreateEvalJSONLRunDataSource: …A JsonlRunDataSource object with that specifies a JSONL file that matches the eval
-
source: SourceDetermines what populates the
itemnamespace in the data source.-
class SourceFileContent: …-
content: List[SourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class SourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
-
type: Literal["jsonl"]The type of data source. Always
jsonl."jsonl"
-
Eval API Error
-
class EvalAPIError: …An object representing an error response from the Eval API.
-
code: strThe error code.
-
message: strThe error message.
-
Run List Response
-
class RunListResponse: …A schema representing an evaluation run.
-
id: strUnique identifier for the evaluation run.
-
created_at: intUnix timestamp (in seconds) when the evaluation run was created.
-
data_source: DataSourceInformation about the run's data source.
-
class CreateEvalJSONLRunDataSource: …A JsonlRunDataSource object with that specifies a JSONL file that matches the eval
-
source: SourceDetermines what populates the
itemnamespace in the data source.-
class SourceFileContent: …-
content: List[SourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class SourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
-
type: Literal["jsonl"]The type of data source. Always
jsonl."jsonl"
-
-
class CreateEvalCompletionsRunDataSource: …A CompletionsRunDataSource object describing a model sampling configuration.
-
source: SourceDetermines what populates the
itemnamespace in this run's data source.-
class SourceFileContent: …-
content: List[SourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class SourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
class SourceStoredCompletions: …A StoredCompletionsRunDataSource configuration describing a set of filters
-
type: Literal["stored_completions"]The type of source. Always
stored_completions."stored_completions"
-
created_after: Optional[int]An optional Unix timestamp to filter items created after this time.
-
created_before: Optional[int]An optional Unix timestamp to filter items created before this time.
-
limit: Optional[int]An optional maximum number of items to return.
-
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.
-
model: Optional[str]An optional model to filter by (e.g., 'gpt-4o').
-
-
-
type: Literal["completions"]The type of run data source. Always
completions."completions"
-
input_messages: Optional[InputMessages]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 theitemnamespace.-
class InputMessagesTemplate: …-
template: List[InputMessagesTemplateTemplate]A list of chat messages forming the prompt or context. May include variable references to the
itemnamespace, ie {{item.name}}.-
class EasyInputMessage: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: Union[str, ResponseInputMessageContentList]Text, image, or audio input to the model, used to generate a response. Can also contain previous assistant responses.
-
strA text input to the model.
-
List[ResponseInputContent]-
class ResponseInputText: …A text input to the model.
-
text: strThe text input to the model.
-
type: Literal["input_text"]The type of the input item. Always
input_text."input_text"
-
-
class ResponseInputImage: …An image input to the model. Learn about image inputs.
-
detail: Literal["low", "high", "auto", "original"]The detail level of the image to be sent to the model. One of
high,low,auto, ororiginal. Defaults toauto.-
"low" -
"high" -
"auto" -
"original"
-
-
type: Literal["input_image"]The type of the input item. Always
input_image."input_image"
-
file_id: Optional[str]The ID of the file to be sent to the model.
-
image_url: Optional[str]The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.
-
-
class ResponseInputFile: …A file input to the model.
-
type: Literal["input_file"]The type of the input item. Always
input_file."input_file"
-
detail: Optional[Literal["low", "high"]]The detail level of the file to be sent to the model. Use
lowfor the default rendering behavior, orhighto render the file at higher quality. Defaults tolow.-
"low" -
"high"
-
-
file_data: Optional[str]The content of the file to be sent to the model.
-
file_id: Optional[str]The ID of the file to be sent to the model.
-
file_url: Optional[str]The URL of the file to be sent to the model.
-
filename: Optional[str]The name of the file to be sent to the model.
-
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
phase: Optional[Literal["commentary", "final_answer"]]Labels an
assistantmessage as intermediate commentary (commentary) or the final answer (final_answer). For models likegpt-5.3-codexand beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages.-
"commentary" -
"final_answer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
class InputMessagesTemplateTemplateEvalItem: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: InputMessagesTemplateTemplateEvalItemContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class InputMessagesTemplateTemplateEvalItemContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class InputMessagesTemplateTemplateEvalItemContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
input_audio: InputAudio-
data: strBase64-encoded audio data.
-
format: Literal["mp3", "wav"]The format of the audio data. Currently supported formats are
mp3andwav.-
"mp3" -
"wav"
-
-
-
type: Literal["input_audio"]The type of the input item. Always
input_audio."input_audio"
-
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
-
type: Literal["template"]The type of input messages. Always
template."template"
-
-
class InputMessagesItemReference: …-
item_reference: strA reference to a variable in the
itemnamespace. Ie, "item.input_trajectory" -
type: Literal["item_reference"]The type of input messages. Always
item_reference."item_reference"
-
-
-
model: Optional[str]The name of the model to use for generating completions (e.g. "o3-mini").
-
sampling_params: Optional[SamplingParams]-
max_completion_tokens: Optional[int]The maximum number of tokens in the generated output.
-
reasoning_effort: Optional[ReasoningEffort]Constrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.-
gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1. -
All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. -
The
gpt-5-promodel defaults to (and only supports)highreasoning effort. -
xhighis supported for all models aftergpt-5.1-codex-max. -
"none" -
"minimal" -
"low" -
"medium" -
"high" -
"xhigh"
-
-
response_format: Optional[SamplingParamsResponseFormat]An object specifying the format that the model must output.
Setting to
{ "type": "json_schema", "json_schema": {...} }enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.Setting to
{ "type": "json_object" }enables the older JSON mode, which ensures the message the model generates is valid JSON. Usingjson_schemais preferred for models that support it.-
class ResponseFormatText: …Default response format. Used to generate text responses.
-
type: Literal["text"]The type of response format being defined. Always
text."text"
-
-
class ResponseFormatJSONSchema: …JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.
-
json_schema: JSONSchemaStructured Outputs configuration options, including a JSON Schema.
-
name: strThe name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
description: Optional[str]A description of what the response format is for, used by the model to determine how to respond in the format.
-
schema: Optional[Dict[str, object]]The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.
-
strict: Optional[bool]Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the
schemafield. Only a subset of JSON Schema is supported whenstrictistrue. To learn more, read the Structured Outputs guide.
-
-
type: Literal["json_schema"]The type of response format being defined. Always
json_schema."json_schema"
-
-
class ResponseFormatJSONObject: …JSON object response format. An older method of generating JSON responses. Using
json_schemais recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.-
type: Literal["json_object"]The type of response format being defined. Always
json_object."json_object"
-
-
-
seed: Optional[int]A seed value to initialize the randomness, during sampling.
-
temperature: Optional[float]A higher temperature increases randomness in the outputs.
-
tools: Optional[List[ChatCompletionFunctionTool]]A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
-
function: FunctionDefinition-
name: strThe name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
description: Optional[str]A description of what the function does, used by the model to choose when and how to call the function.
-
parameters: Optional[FunctionParameters]The parameters the functions accepts, described as a JSON Schema object. See the guide for examples, and the JSON Schema reference for documentation about the format.
Omitting
parametersdefines a function with an empty parameter list. -
strict: Optional[bool]Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the
parametersfield. Only a subset of JSON Schema is supported whenstrictistrue. Learn more about Structured Outputs in the function calling guide.
-
-
type: Literal["function"]The type of the tool. Currently, only
functionis supported."function"
-
-
top_p: Optional[float]An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
class DataSourceResponses: …A ResponsesRunDataSource object describing a model sampling configuration.
-
source: DataSourceResponsesSourceDetermines what populates the
itemnamespace in this run's data source.-
class DataSourceResponsesSourceFileContent: …-
content: List[DataSourceResponsesSourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class DataSourceResponsesSourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
class DataSourceResponsesSourceResponses: …A EvalResponsesSource object describing a run data source configuration.
-
type: Literal["responses"]The type of run data source. Always
responses."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. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1.- All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. - The
gpt-5-promodel defaults to (and only supports)highreasoning effort. xhighis supported for all models aftergpt-5.1-codex-max.
-
temperature: Optional[float]Sampling temperature. This is a query parameter used to select responses.
-
tools: Optional[List[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[List[str]]List of user identifiers. This is a query parameter used to select responses.
-
-
-
type: Literal["responses"]The type of run data source. Always
responses."responses"
-
input_messages: Optional[DataSourceResponsesInputMessages]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 theitemnamespace.-
class DataSourceResponsesInputMessagesTemplate: …-
template: List[DataSourceResponsesInputMessagesTemplateTemplate]A list of chat messages forming the prompt or context. May include variable references to the
itemnamespace, ie {{item.name}}.-
class DataSourceResponsesInputMessagesTemplateTemplateChatMessage: …-
content: strThe content of the message.
-
role: strThe role of the message (e.g. "system", "assistant", "user").
-
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItem: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
-
type: Literal["template"]The type of input messages. Always
template."template"
-
-
class DataSourceResponsesInputMessagesItemReference: …-
item_reference: strA reference to a variable in the
itemnamespace. Ie, "item.name" -
type: Literal["item_reference"]The type of input messages. Always
item_reference."item_reference"
-
-
-
model: Optional[str]The name of the model to use for generating completions (e.g. "o3-mini").
-
sampling_params: Optional[DataSourceResponsesSamplingParams]-
max_completion_tokens: Optional[int]The maximum number of tokens in the generated output.
-
reasoning_effort: Optional[ReasoningEffort]Constrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1.- All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. - The
gpt-5-promodel defaults to (and only supports)highreasoning effort. xhighis supported for all models aftergpt-5.1-codex-max.
-
seed: Optional[int]A seed value to initialize the randomness, during sampling.
-
temperature: Optional[float]A higher temperature increases randomness in the outputs.
-
text: Optional[DataSourceResponsesSamplingParamsText]Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:
-
format: Optional[ResponseFormatTextConfig]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.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. Usingjson_schemais preferred for models that support it.-
class ResponseFormatText: …Default response format. Used to generate text responses.
-
class ResponseFormatTextJSONSchemaConfig: …JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.
-
name: strThe name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
schema: Dict[str, object]The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.
-
type: Literal["json_schema"]The type of response format being defined. Always
json_schema."json_schema"
-
description: Optional[str]A description of what the response format is for, used by the model to determine how to respond in the format.
-
strict: Optional[bool]Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the
schemafield. Only a subset of JSON Schema is supported whenstrictistrue. To learn more, read the Structured Outputs guide.
-
-
class ResponseFormatJSONObject: …JSON object response format. An older method of generating JSON responses. Using
json_schemais recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.
-
-
tools: Optional[List[Tool]]An array of tools the model may call while generating a response. You can specify which tool to use by setting the
tool_choiceparameter.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 or file search. Learn more about built-in tools.
-
Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code. Learn more about function calling.
-
class FunctionTool: …Defines a function in your own code the model can choose to call. Learn more about function calling.
-
name: strThe name of the function to call.
-
parameters: Optional[Dict[str, object]]A JSON schema object describing the parameters of the function.
-
strict: Optional[bool]Whether to enforce strict parameter validation. Default
true. -
type: Literal["function"]The type of the function tool. Always
function."function"
-
defer_loading: Optional[bool]Whether this function is deferred and loaded via tool search.
-
description: Optional[str]A description of the function. Used by the model to determine whether or not to call the function.
-
-
class FileSearchTool: …A tool that searches for relevant content from uploaded files. Learn more about the file search tool.
-
type: Literal["file_search"]The type of the file search tool. Always
file_search."file_search"
-
vector_store_ids: List[str]The IDs of the vector stores to search.
-
filters: Optional[Filters]A filter to apply.
-
class ComparisonFilter: …A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
key: strThe key to compare against the value.
-
type: Literal["eq", "ne", "gt", 5 more]Specifies the comparison operator:
eq,ne,gt,gte,lt,lte,in,nin.-
eq: equals -
ne: not equal -
gt: greater than -
gte: greater than or equal -
lt: less than -
lte: less than or equal -
in: in -
nin: not in -
"eq" -
"ne" -
"gt" -
"gte" -
"lt" -
"lte" -
"in" -
"nin"
-
-
value: Union[str, float, bool, List[Union[str, float]]]The value to compare against the attribute key; supports string, number, or boolean types.
-
str -
float -
bool -
List[Union[str, float]]-
str -
float
-
-
-
-
class CompoundFilter: …Combine multiple filters using
andoror.-
filters: List[Filter]Array of filters to combine. Items can be
ComparisonFilterorCompoundFilter.-
class ComparisonFilter: …A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
object
-
-
type: Literal["and", "or"]Type of operation:
andoror.-
"and" -
"or"
-
-
-
-
max_num_results: Optional[int]The maximum number of results to return. This number should be between 1 and 50 inclusive.
-
ranking_options: Optional[RankingOptions]Ranking options for search.
-
hybrid_search: Optional[RankingOptionsHybridSearch]Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.
-
embedding_weight: floatThe weight of the embedding in the reciprocal ranking fusion.
-
text_weight: floatThe weight of the text in the reciprocal ranking fusion.
-
-
ranker: Optional[Literal["auto", "default-2024-11-15"]]The ranker to use for the file search.
-
"auto" -
"default-2024-11-15"
-
-
score_threshold: Optional[float]The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.
-
-
-
class ComputerTool: …A tool that controls a virtual computer. Learn more about the computer tool.
-
type: Literal["computer"]The type of the computer tool. Always
computer."computer"
-
-
class ComputerUsePreviewTool: …A tool that controls a virtual computer. Learn more about the computer tool.
-
display_height: intThe height of the computer display.
-
display_width: intThe width of the computer display.
-
environment: Literal["windows", "mac", "linux", 2 more]The type of computer environment to control.
-
"windows" -
"mac" -
"linux" -
"ubuntu" -
"browser"
-
-
type: Literal["computer_use_preview"]The type of the computer use tool. Always
computer_use_preview."computer_use_preview"
-
-
class WebSearchTool: …Search the Internet for sources related to the prompt. Learn more about the web search tool.
-
type: Literal["web_search", "web_search_2025_08_26"]The type of the web search tool. One of
web_searchorweb_search_2025_08_26.-
"web_search" -
"web_search_2025_08_26"
-
-
filters: Optional[Filters]Filters for the search.
-
allowed_domains: Optional[List[str]]Allowed domains for the search. If not provided, all domains are allowed. Subdomains of the provided domains are allowed as well.
Example:
["pubmed.ncbi.nlm.nih.gov"]
-
-
search_context_size: Optional[Literal["low", "medium", "high"]]High level guidance for the amount of context window space to use for the search. One of
low,medium, orhigh.mediumis the default.-
"low" -
"medium" -
"high"
-
-
user_location: Optional[UserLocation]The approximate location of the user.
-
city: Optional[str]Free text input for the city of the user, e.g.
San Francisco. -
country: Optional[str]The two-letter ISO country code of the user, e.g.
US. -
region: Optional[str]Free text input for the region of the user, e.g.
California. -
timezone: Optional[str]The IANA timezone of the user, e.g.
America/Los_Angeles. -
type: Optional[Literal["approximate"]]The type of location approximation. Always
approximate."approximate"
-
-
-
class Mcp: …Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
-
server_label: strA label for this MCP server, used to identify it in tool calls.
-
type: Literal["mcp"]The type of the MCP tool. Always
mcp."mcp"
-
allowed_tools: Optional[McpAllowedTools]List of allowed tool names or a filter object.
-
List[str]A string array of allowed tool names
-
class McpAllowedToolsMcpToolFilter: …A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
-
authorization: Optional[str]An OAuth access token that can be used with a remote MCP server, either with a custom MCP server URL or a service connector. Your application must handle the OAuth authorization flow and provide the token here.
-
connector_id: Optional[Literal["connector_dropbox", "connector_gmail", "connector_googlecalendar", 5 more]]Identifier for service connectors, like those available in ChatGPT. One of
server_urlorconnector_idmust be provided. Learn more about service connectors here.Currently supported
connector_idvalues are:-
Dropbox:
connector_dropbox -
Gmail:
connector_gmail -
Google Calendar:
connector_googlecalendar -
Google Drive:
connector_googledrive -
Microsoft Teams:
connector_microsoftteams -
Outlook Calendar:
connector_outlookcalendar -
Outlook Email:
connector_outlookemail -
SharePoint:
connector_sharepoint -
"connector_dropbox" -
"connector_gmail" -
"connector_googlecalendar" -
"connector_googledrive" -
"connector_microsoftteams" -
"connector_outlookcalendar" -
"connector_outlookemail" -
"connector_sharepoint"
-
-
defer_loading: Optional[bool]Whether this MCP tool is deferred and discovered via tool search.
-
headers: Optional[Dict[str, str]]Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.
-
require_approval: Optional[McpRequireApproval]Specify which of the MCP server's tools require approval.
-
class McpRequireApprovalMcpToolApprovalFilter: …Specify which of the MCP server's tools require approval. Can be
always,never, or a filter object associated with tools that require approval.-
always: Optional[McpRequireApprovalMcpToolApprovalFilterAlways]A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
never: Optional[McpRequireApprovalMcpToolApprovalFilterNever]A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
-
Literal["always", "never"]Specify a single approval policy for all tools. One of
alwaysornever. When set toalways, all tools will require approval. When set tonever, all tools will not require approval.-
"always" -
"never"
-
-
-
server_description: Optional[str]Optional description of the MCP server, used to provide more context.
-
server_url: Optional[str]The URL for the MCP server. One of
server_urlorconnector_idmust be provided.
-
-
class CodeInterpreter: …A tool that runs Python code to help generate a response to a prompt.
-
container: CodeInterpreterContainerThe code interpreter container. Can be a container ID or an object that specifies uploaded file IDs to make available to your code, along with an optional
memory_limitsetting.-
strThe container ID.
-
class CodeInterpreterContainerCodeInterpreterToolAuto: …Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.
-
type: Literal["auto"]Always
auto."auto"
-
file_ids: Optional[List[str]]An optional list of uploaded files to make available to your code.
-
memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]The memory limit for the code interpreter container.
-
"1g" -
"4g" -
"16g" -
"64g"
-
-
network_policy: Optional[CodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicy]Network access policy for the container.
-
class ContainerNetworkPolicyDisabled: …-
type: Literal["disabled"]Disable outbound network access. Always
disabled."disabled"
-
-
class ContainerNetworkPolicyAllowlist: …-
allowed_domains: List[str]A list of allowed domains when type is
allowlist. -
type: Literal["allowlist"]Allow outbound network access only to specified domains. Always
allowlist."allowlist"
-
domain_secrets: Optional[List[ContainerNetworkPolicyDomainSecret]]Optional domain-scoped secrets for allowlisted domains.
-
domain: strThe domain associated with the secret.
-
name: strThe name of the secret to inject for the domain.
-
value: strThe secret value to inject for the domain.
-
-
-
-
-
-
type: Literal["code_interpreter"]The type of the code interpreter tool. Always
code_interpreter."code_interpreter"
-
-
class ImageGeneration: …A tool that generates images using the GPT image models.
-
type: Literal["image_generation"]The type of the image generation tool. Always
image_generation."image_generation"
-
action: Optional[Literal["generate", "edit", "auto"]]Whether to generate a new image or edit an existing image. Default:
auto.-
"generate" -
"edit" -
"auto"
-
-
background: Optional[Literal["transparent", "opaque", "auto"]]Allows to set transparency for the background of the generated image(s). This parameter is only supported for GPT image models that support transparent backgrounds. Must be one of
transparent,opaque, orauto(default value). Whenautois used, the model will automatically determine the best background for the image.gpt-image-2andgpt-image-2-2026-04-21do not support transparent backgrounds. Requests withbackgroundset totransparentwill return an error for these models; useopaqueorautoinstead.If
transparent, the output format needs to support transparency, so it should be set to eitherpng(default value) orwebp.-
"transparent" -
"opaque" -
"auto"
-
-
input_fidelity: Optional[Literal["high", "low"]]Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for
gpt-image-1andgpt-image-1.5and later models, unsupported forgpt-image-1-mini. Supportshighandlow. Defaults tolow.-
"high" -
"low"
-
-
input_image_mask: Optional[ImageGenerationInputImageMask]Optional mask for inpainting. Contains
image_url(string, optional) andfile_id(string, optional).-
file_id: Optional[str]File ID for the mask image.
-
image_url: Optional[str]Base64-encoded mask image.
-
-
model: Optional[Union[str, Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-2", 3 more], null]]The image generation model to use. Default:
gpt-image-1.-
str -
Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-2", 3 more]The image generation model to use. Default:
gpt-image-1.-
"gpt-image-1" -
"gpt-image-1-mini" -
"gpt-image-2" -
"gpt-image-2-2026-04-21" -
"gpt-image-1.5" -
"chatgpt-image-latest"
-
-
-
moderation: Optional[Literal["auto", "low"]]Moderation level for the generated image. Default:
auto.-
"auto" -
"low"
-
-
output_compression: Optional[int]Compression level for the output image. Default: 100.
-
output_format: Optional[Literal["png", "webp", "jpeg"]]The output format of the generated image. One of
png,webp, orjpeg. Default:png.-
"png" -
"webp" -
"jpeg"
-
-
partial_images: Optional[int]Number of partial images to generate in streaming mode, from 0 (default value) to 3.
-
quality: Optional[Literal["low", "medium", "high", "auto"]]The quality of the generated image. One of
low,medium,high, orauto. Default:auto.-
"low" -
"medium" -
"high" -
"auto"
-
-
size: Optional[Union[str, Literal["1024x1024", "1024x1536", "1536x1024", "auto"], null]]The size of the generated images. For
gpt-image-2andgpt-image-2-2026-04-21, arbitrary resolutions are supported asWIDTHxHEIGHTstrings, for example1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above2560x1440are experimental, and the maximum supported resolution is3840x2160. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes1024x1024,1536x1024, and1024x1536are supported by the GPT image models;autois supported for models that allow automatic sizing. Fordall-e-2, use one of256x256,512x512, or1024x1024. Fordall-e-3, use one of1024x1024,1792x1024, or1024x1792.-
str -
Literal["1024x1024", "1024x1536", "1536x1024", "auto"]The size of the generated images. For
gpt-image-2andgpt-image-2-2026-04-21, arbitrary resolutions are supported asWIDTHxHEIGHTstrings, for example1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above2560x1440are experimental, and the maximum supported resolution is3840x2160. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes1024x1024,1536x1024, and1024x1536are supported by the GPT image models;autois supported for models that allow automatic sizing. Fordall-e-2, use one of256x256,512x512, or1024x1024. Fordall-e-3, use one of1024x1024,1792x1024, or1024x1792.-
"1024x1024" -
"1024x1536" -
"1536x1024" -
"auto"
-
-
-
-
class LocalShell: …A tool that allows the model to execute shell commands in a local environment.
-
type: Literal["local_shell"]The type of the local shell tool. Always
local_shell."local_shell"
-
-
class FunctionShellTool: …A tool that allows the model to execute shell commands.
-
type: Literal["shell"]The type of the shell tool. Always
shell."shell"
-
environment: Optional[Environment]-
class ContainerAuto: …-
type: Literal["container_auto"]Automatically creates a container for this request
"container_auto"
-
file_ids: Optional[List[str]]An optional list of uploaded files to make available to your code.
-
memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]The memory limit for the container.
-
"1g" -
"4g" -
"16g" -
"64g"
-
-
network_policy: Optional[NetworkPolicy]Network access policy for the container.
-
class ContainerNetworkPolicyDisabled: … -
class ContainerNetworkPolicyAllowlist: …
-
-
skills: Optional[List[Skill]]An optional list of skills referenced by id or inline data.
-
class SkillReference: …-
skill_id: strThe ID of the referenced skill.
-
type: Literal["skill_reference"]References a skill created with the /v1/skills endpoint.
"skill_reference"
-
version: Optional[str]Optional skill version. Use a positive integer or 'latest'. Omit for default.
-
-
class InlineSkill: …-
description: strThe description of the skill.
-
name: strThe name of the skill.
-
source: InlineSkillSourceInline skill payload
-
data: strBase64-encoded skill zip bundle.
-
media_type: Literal["application/zip"]The media type of the inline skill payload. Must be
application/zip."application/zip"
-
type: Literal["base64"]The type of the inline skill source. Must be
base64."base64"
-
-
type: Literal["inline"]Defines an inline skill for this request.
"inline"
-
-
-
-
class LocalEnvironment: …-
type: Literal["local"]Use a local computer environment.
"local"
-
skills: Optional[List[LocalSkill]]An optional list of skills.
-
description: strThe description of the skill.
-
name: strThe name of the skill.
-
path: strThe path to the directory containing the skill.
-
-
-
class ContainerReference: …-
container_id: strThe ID of the referenced container.
-
type: Literal["container_reference"]References a container created with the /v1/containers endpoint
"container_reference"
-
-
-
-
class CustomTool: …A custom tool that processes input using a specified format. Learn more about custom tools
-
name: strThe name of the custom tool, used to identify it in tool calls.
-
type: Literal["custom"]The type of the custom tool. Always
custom."custom"
-
defer_loading: Optional[bool]Whether this tool should be deferred and discovered via tool search.
-
description: Optional[str]Optional description of the custom tool, used to provide more context.
-
format: Optional[CustomToolInputFormat]The input format for the custom tool. Default is unconstrained text.
-
class Text: …Unconstrained free-form text.
-
type: Literal["text"]Unconstrained text format. Always
text."text"
-
-
class Grammar: …A grammar defined by the user.
-
definition: strThe grammar definition.
-
syntax: Literal["lark", "regex"]The syntax of the grammar definition. One of
larkorregex.-
"lark" -
"regex"
-
-
type: Literal["grammar"]Grammar format. Always
grammar."grammar"
-
-
-
-
class NamespaceTool: …Groups function/custom tools under a shared namespace.
-
description: strA description of the namespace shown to the model.
-
name: strThe namespace name used in tool calls (for example,
crm). -
tools: List[Tool]The function/custom tools available inside this namespace.
-
class ToolFunction: …-
name: str -
type: Literal["function"]"function"
-
defer_loading: Optional[bool]Whether this function should be deferred and discovered via tool search.
-
description: Optional[str] -
parameters: Optional[object] -
strict: Optional[bool]
-
-
class CustomTool: …A custom tool that processes input using a specified format. Learn more about custom tools
-
-
type: Literal["namespace"]The type of the tool. Always
namespace."namespace"
-
-
class ToolSearchTool: …Hosted or BYOT tool search configuration for deferred tools.
-
type: Literal["tool_search"]The type of the tool. Always
tool_search."tool_search"
-
description: Optional[str]Description shown to the model for a client-executed tool search tool.
-
execution: Optional[Literal["server", "client"]]Whether tool search is executed by the server or by the client.
-
"server" -
"client"
-
-
parameters: Optional[object]Parameter schema for a client-executed tool search tool.
-
-
class WebSearchPreviewTool: …This tool searches the web for relevant results to use in a response. Learn more about the web search tool.
-
type: Literal["web_search_preview", "web_search_preview_2025_03_11"]The type of the web search tool. One of
web_search_previeworweb_search_preview_2025_03_11.-
"web_search_preview" -
"web_search_preview_2025_03_11"
-
-
search_content_types: Optional[List[Literal["text", "image"]]]-
"text" -
"image"
-
-
search_context_size: Optional[Literal["low", "medium", "high"]]High level guidance for the amount of context window space to use for the search. One of
low,medium, orhigh.mediumis the default.-
"low" -
"medium" -
"high"
-
-
user_location: Optional[UserLocation]The user's location.
-
type: Literal["approximate"]The type of location approximation. Always
approximate."approximate"
-
city: Optional[str]Free text input for the city of the user, e.g.
San Francisco. -
country: Optional[str]The two-letter ISO country code of the user, e.g.
US. -
region: Optional[str]Free text input for the region of the user, e.g.
California. -
timezone: Optional[str]The IANA timezone of the user, e.g.
America/Los_Angeles.
-
-
-
class ApplyPatchTool: …Allows the assistant to create, delete, or update files using unified diffs.
-
type: Literal["apply_patch"]The type of the tool. Always
apply_patch."apply_patch"
-
-
-
top_p: Optional[float]An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
-
error: EvalAPIErrorAn object representing an error response from the Eval API.
-
code: strThe error code.
-
message: strThe error message.
-
-
eval_id: strThe identifier of the associated evaluation.
-
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.
-
model: strThe model that is evaluated, if applicable.
-
name: strThe name of the evaluation run.
-
object: Literal["eval.run"]The type of the object. Always "eval.run".
"eval.run"
-
per_model_usage: List[PerModelUsage]Usage statistics for each model during the evaluation run.
-
cached_tokens: intThe number of tokens retrieved from cache.
-
completion_tokens: intThe number of completion tokens generated.
-
invocation_count: intThe number of invocations.
-
model_name: strThe name of the model.
-
prompt_tokens: intThe number of prompt tokens used.
-
total_tokens: intThe total number of tokens used.
-
-
per_testing_criteria_results: List[PerTestingCriteriaResult]Results per testing criteria applied during the evaluation run.
-
failed: intNumber of tests failed for this criteria.
-
passed: intNumber of tests passed for this criteria.
-
testing_criteria: strA description of the testing criteria.
-
-
report_url: strThe URL to the rendered evaluation run report on the UI dashboard.
-
result_counts: ResultCountsCounters summarizing the outcomes of the evaluation run.
-
errored: intNumber of output items that resulted in an error.
-
failed: intNumber of output items that failed to pass the evaluation.
-
passed: intNumber of output items that passed the evaluation.
-
total: intTotal number of executed output items.
-
-
status: strThe status of the evaluation run.
-
Run Create Response
-
class RunCreateResponse: …A schema representing an evaluation run.
-
id: strUnique identifier for the evaluation run.
-
created_at: intUnix timestamp (in seconds) when the evaluation run was created.
-
data_source: DataSourceInformation about the run's data source.
-
class CreateEvalJSONLRunDataSource: …A JsonlRunDataSource object with that specifies a JSONL file that matches the eval
-
source: SourceDetermines what populates the
itemnamespace in the data source.-
class SourceFileContent: …-
content: List[SourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class SourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
-
type: Literal["jsonl"]The type of data source. Always
jsonl."jsonl"
-
-
class CreateEvalCompletionsRunDataSource: …A CompletionsRunDataSource object describing a model sampling configuration.
-
source: SourceDetermines what populates the
itemnamespace in this run's data source.-
class SourceFileContent: …-
content: List[SourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class SourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
class SourceStoredCompletions: …A StoredCompletionsRunDataSource configuration describing a set of filters
-
type: Literal["stored_completions"]The type of source. Always
stored_completions."stored_completions"
-
created_after: Optional[int]An optional Unix timestamp to filter items created after this time.
-
created_before: Optional[int]An optional Unix timestamp to filter items created before this time.
-
limit: Optional[int]An optional maximum number of items to return.
-
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.
-
model: Optional[str]An optional model to filter by (e.g., 'gpt-4o').
-
-
-
type: Literal["completions"]The type of run data source. Always
completions."completions"
-
input_messages: Optional[InputMessages]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 theitemnamespace.-
class InputMessagesTemplate: …-
template: List[InputMessagesTemplateTemplate]A list of chat messages forming the prompt or context. May include variable references to the
itemnamespace, ie {{item.name}}.-
class EasyInputMessage: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: Union[str, ResponseInputMessageContentList]Text, image, or audio input to the model, used to generate a response. Can also contain previous assistant responses.
-
strA text input to the model.
-
List[ResponseInputContent]-
class ResponseInputText: …A text input to the model.
-
text: strThe text input to the model.
-
type: Literal["input_text"]The type of the input item. Always
input_text."input_text"
-
-
class ResponseInputImage: …An image input to the model. Learn about image inputs.
-
detail: Literal["low", "high", "auto", "original"]The detail level of the image to be sent to the model. One of
high,low,auto, ororiginal. Defaults toauto.-
"low" -
"high" -
"auto" -
"original"
-
-
type: Literal["input_image"]The type of the input item. Always
input_image."input_image"
-
file_id: Optional[str]The ID of the file to be sent to the model.
-
image_url: Optional[str]The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.
-
-
class ResponseInputFile: …A file input to the model.
-
type: Literal["input_file"]The type of the input item. Always
input_file."input_file"
-
detail: Optional[Literal["low", "high"]]The detail level of the file to be sent to the model. Use
lowfor the default rendering behavior, orhighto render the file at higher quality. Defaults tolow.-
"low" -
"high"
-
-
file_data: Optional[str]The content of the file to be sent to the model.
-
file_id: Optional[str]The ID of the file to be sent to the model.
-
file_url: Optional[str]The URL of the file to be sent to the model.
-
filename: Optional[str]The name of the file to be sent to the model.
-
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
phase: Optional[Literal["commentary", "final_answer"]]Labels an
assistantmessage as intermediate commentary (commentary) or the final answer (final_answer). For models likegpt-5.3-codexand beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages.-
"commentary" -
"final_answer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
class InputMessagesTemplateTemplateEvalItem: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: InputMessagesTemplateTemplateEvalItemContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class InputMessagesTemplateTemplateEvalItemContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class InputMessagesTemplateTemplateEvalItemContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
input_audio: InputAudio-
data: strBase64-encoded audio data.
-
format: Literal["mp3", "wav"]The format of the audio data. Currently supported formats are
mp3andwav.-
"mp3" -
"wav"
-
-
-
type: Literal["input_audio"]The type of the input item. Always
input_audio."input_audio"
-
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
-
type: Literal["template"]The type of input messages. Always
template."template"
-
-
class InputMessagesItemReference: …-
item_reference: strA reference to a variable in the
itemnamespace. Ie, "item.input_trajectory" -
type: Literal["item_reference"]The type of input messages. Always
item_reference."item_reference"
-
-
-
model: Optional[str]The name of the model to use for generating completions (e.g. "o3-mini").
-
sampling_params: Optional[SamplingParams]-
max_completion_tokens: Optional[int]The maximum number of tokens in the generated output.
-
reasoning_effort: Optional[ReasoningEffort]Constrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.-
gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1. -
All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. -
The
gpt-5-promodel defaults to (and only supports)highreasoning effort. -
xhighis supported for all models aftergpt-5.1-codex-max. -
"none" -
"minimal" -
"low" -
"medium" -
"high" -
"xhigh"
-
-
response_format: Optional[SamplingParamsResponseFormat]An object specifying the format that the model must output.
Setting to
{ "type": "json_schema", "json_schema": {...} }enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.Setting to
{ "type": "json_object" }enables the older JSON mode, which ensures the message the model generates is valid JSON. Usingjson_schemais preferred for models that support it.-
class ResponseFormatText: …Default response format. Used to generate text responses.
-
type: Literal["text"]The type of response format being defined. Always
text."text"
-
-
class ResponseFormatJSONSchema: …JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.
-
json_schema: JSONSchemaStructured Outputs configuration options, including a JSON Schema.
-
name: strThe name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
description: Optional[str]A description of what the response format is for, used by the model to determine how to respond in the format.
-
schema: Optional[Dict[str, object]]The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.
-
strict: Optional[bool]Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the
schemafield. Only a subset of JSON Schema is supported whenstrictistrue. To learn more, read the Structured Outputs guide.
-
-
type: Literal["json_schema"]The type of response format being defined. Always
json_schema."json_schema"
-
-
class ResponseFormatJSONObject: …JSON object response format. An older method of generating JSON responses. Using
json_schemais recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.-
type: Literal["json_object"]The type of response format being defined. Always
json_object."json_object"
-
-
-
seed: Optional[int]A seed value to initialize the randomness, during sampling.
-
temperature: Optional[float]A higher temperature increases randomness in the outputs.
-
tools: Optional[List[ChatCompletionFunctionTool]]A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
-
function: FunctionDefinition-
name: strThe name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
description: Optional[str]A description of what the function does, used by the model to choose when and how to call the function.
-
parameters: Optional[FunctionParameters]The parameters the functions accepts, described as a JSON Schema object. See the guide for examples, and the JSON Schema reference for documentation about the format.
Omitting
parametersdefines a function with an empty parameter list. -
strict: Optional[bool]Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the
parametersfield. Only a subset of JSON Schema is supported whenstrictistrue. Learn more about Structured Outputs in the function calling guide.
-
-
type: Literal["function"]The type of the tool. Currently, only
functionis supported."function"
-
-
top_p: Optional[float]An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
class DataSourceResponses: …A ResponsesRunDataSource object describing a model sampling configuration.
-
source: DataSourceResponsesSourceDetermines what populates the
itemnamespace in this run's data source.-
class DataSourceResponsesSourceFileContent: …-
content: List[DataSourceResponsesSourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class DataSourceResponsesSourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
class DataSourceResponsesSourceResponses: …A EvalResponsesSource object describing a run data source configuration.
-
type: Literal["responses"]The type of run data source. Always
responses."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. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1.- All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. - The
gpt-5-promodel defaults to (and only supports)highreasoning effort. xhighis supported for all models aftergpt-5.1-codex-max.
-
temperature: Optional[float]Sampling temperature. This is a query parameter used to select responses.
-
tools: Optional[List[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[List[str]]List of user identifiers. This is a query parameter used to select responses.
-
-
-
type: Literal["responses"]The type of run data source. Always
responses."responses"
-
input_messages: Optional[DataSourceResponsesInputMessages]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 theitemnamespace.-
class DataSourceResponsesInputMessagesTemplate: …-
template: List[DataSourceResponsesInputMessagesTemplateTemplate]A list of chat messages forming the prompt or context. May include variable references to the
itemnamespace, ie {{item.name}}.-
class DataSourceResponsesInputMessagesTemplateTemplateChatMessage: …-
content: strThe content of the message.
-
role: strThe role of the message (e.g. "system", "assistant", "user").
-
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItem: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
-
type: Literal["template"]The type of input messages. Always
template."template"
-
-
class DataSourceResponsesInputMessagesItemReference: …-
item_reference: strA reference to a variable in the
itemnamespace. Ie, "item.name" -
type: Literal["item_reference"]The type of input messages. Always
item_reference."item_reference"
-
-
-
model: Optional[str]The name of the model to use for generating completions (e.g. "o3-mini").
-
sampling_params: Optional[DataSourceResponsesSamplingParams]-
max_completion_tokens: Optional[int]The maximum number of tokens in the generated output.
-
reasoning_effort: Optional[ReasoningEffort]Constrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1.- All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. - The
gpt-5-promodel defaults to (and only supports)highreasoning effort. xhighis supported for all models aftergpt-5.1-codex-max.
-
seed: Optional[int]A seed value to initialize the randomness, during sampling.
-
temperature: Optional[float]A higher temperature increases randomness in the outputs.
-
text: Optional[DataSourceResponsesSamplingParamsText]Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:
-
format: Optional[ResponseFormatTextConfig]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.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. Usingjson_schemais preferred for models that support it.-
class ResponseFormatText: …Default response format. Used to generate text responses.
-
class ResponseFormatTextJSONSchemaConfig: …JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.
-
name: strThe name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
schema: Dict[str, object]The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.
-
type: Literal["json_schema"]The type of response format being defined. Always
json_schema."json_schema"
-
description: Optional[str]A description of what the response format is for, used by the model to determine how to respond in the format.
-
strict: Optional[bool]Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the
schemafield. Only a subset of JSON Schema is supported whenstrictistrue. To learn more, read the Structured Outputs guide.
-
-
class ResponseFormatJSONObject: …JSON object response format. An older method of generating JSON responses. Using
json_schemais recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.
-
-
tools: Optional[List[Tool]]An array of tools the model may call while generating a response. You can specify which tool to use by setting the
tool_choiceparameter.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 or file search. Learn more about built-in tools.
-
Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code. Learn more about function calling.
-
class FunctionTool: …Defines a function in your own code the model can choose to call. Learn more about function calling.
-
name: strThe name of the function to call.
-
parameters: Optional[Dict[str, object]]A JSON schema object describing the parameters of the function.
-
strict: Optional[bool]Whether to enforce strict parameter validation. Default
true. -
type: Literal["function"]The type of the function tool. Always
function."function"
-
defer_loading: Optional[bool]Whether this function is deferred and loaded via tool search.
-
description: Optional[str]A description of the function. Used by the model to determine whether or not to call the function.
-
-
class FileSearchTool: …A tool that searches for relevant content from uploaded files. Learn more about the file search tool.
-
type: Literal["file_search"]The type of the file search tool. Always
file_search."file_search"
-
vector_store_ids: List[str]The IDs of the vector stores to search.
-
filters: Optional[Filters]A filter to apply.
-
class ComparisonFilter: …A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
key: strThe key to compare against the value.
-
type: Literal["eq", "ne", "gt", 5 more]Specifies the comparison operator:
eq,ne,gt,gte,lt,lte,in,nin.-
eq: equals -
ne: not equal -
gt: greater than -
gte: greater than or equal -
lt: less than -
lte: less than or equal -
in: in -
nin: not in -
"eq" -
"ne" -
"gt" -
"gte" -
"lt" -
"lte" -
"in" -
"nin"
-
-
value: Union[str, float, bool, List[Union[str, float]]]The value to compare against the attribute key; supports string, number, or boolean types.
-
str -
float -
bool -
List[Union[str, float]]-
str -
float
-
-
-
-
class CompoundFilter: …Combine multiple filters using
andoror.-
filters: List[Filter]Array of filters to combine. Items can be
ComparisonFilterorCompoundFilter.-
class ComparisonFilter: …A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
object
-
-
type: Literal["and", "or"]Type of operation:
andoror.-
"and" -
"or"
-
-
-
-
max_num_results: Optional[int]The maximum number of results to return. This number should be between 1 and 50 inclusive.
-
ranking_options: Optional[RankingOptions]Ranking options for search.
-
hybrid_search: Optional[RankingOptionsHybridSearch]Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.
-
embedding_weight: floatThe weight of the embedding in the reciprocal ranking fusion.
-
text_weight: floatThe weight of the text in the reciprocal ranking fusion.
-
-
ranker: Optional[Literal["auto", "default-2024-11-15"]]The ranker to use for the file search.
-
"auto" -
"default-2024-11-15"
-
-
score_threshold: Optional[float]The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.
-
-
-
class ComputerTool: …A tool that controls a virtual computer. Learn more about the computer tool.
-
type: Literal["computer"]The type of the computer tool. Always
computer."computer"
-
-
class ComputerUsePreviewTool: …A tool that controls a virtual computer. Learn more about the computer tool.
-
display_height: intThe height of the computer display.
-
display_width: intThe width of the computer display.
-
environment: Literal["windows", "mac", "linux", 2 more]The type of computer environment to control.
-
"windows" -
"mac" -
"linux" -
"ubuntu" -
"browser"
-
-
type: Literal["computer_use_preview"]The type of the computer use tool. Always
computer_use_preview."computer_use_preview"
-
-
class WebSearchTool: …Search the Internet for sources related to the prompt. Learn more about the web search tool.
-
type: Literal["web_search", "web_search_2025_08_26"]The type of the web search tool. One of
web_searchorweb_search_2025_08_26.-
"web_search" -
"web_search_2025_08_26"
-
-
filters: Optional[Filters]Filters for the search.
-
allowed_domains: Optional[List[str]]Allowed domains for the search. If not provided, all domains are allowed. Subdomains of the provided domains are allowed as well.
Example:
["pubmed.ncbi.nlm.nih.gov"]
-
-
search_context_size: Optional[Literal["low", "medium", "high"]]High level guidance for the amount of context window space to use for the search. One of
low,medium, orhigh.mediumis the default.-
"low" -
"medium" -
"high"
-
-
user_location: Optional[UserLocation]The approximate location of the user.
-
city: Optional[str]Free text input for the city of the user, e.g.
San Francisco. -
country: Optional[str]The two-letter ISO country code of the user, e.g.
US. -
region: Optional[str]Free text input for the region of the user, e.g.
California. -
timezone: Optional[str]The IANA timezone of the user, e.g.
America/Los_Angeles. -
type: Optional[Literal["approximate"]]The type of location approximation. Always
approximate."approximate"
-
-
-
class Mcp: …Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
-
server_label: strA label for this MCP server, used to identify it in tool calls.
-
type: Literal["mcp"]The type of the MCP tool. Always
mcp."mcp"
-
allowed_tools: Optional[McpAllowedTools]List of allowed tool names or a filter object.
-
List[str]A string array of allowed tool names
-
class McpAllowedToolsMcpToolFilter: …A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
-
authorization: Optional[str]An OAuth access token that can be used with a remote MCP server, either with a custom MCP server URL or a service connector. Your application must handle the OAuth authorization flow and provide the token here.
-
connector_id: Optional[Literal["connector_dropbox", "connector_gmail", "connector_googlecalendar", 5 more]]Identifier for service connectors, like those available in ChatGPT. One of
server_urlorconnector_idmust be provided. Learn more about service connectors here.Currently supported
connector_idvalues are:-
Dropbox:
connector_dropbox -
Gmail:
connector_gmail -
Google Calendar:
connector_googlecalendar -
Google Drive:
connector_googledrive -
Microsoft Teams:
connector_microsoftteams -
Outlook Calendar:
connector_outlookcalendar -
Outlook Email:
connector_outlookemail -
SharePoint:
connector_sharepoint -
"connector_dropbox" -
"connector_gmail" -
"connector_googlecalendar" -
"connector_googledrive" -
"connector_microsoftteams" -
"connector_outlookcalendar" -
"connector_outlookemail" -
"connector_sharepoint"
-
-
defer_loading: Optional[bool]Whether this MCP tool is deferred and discovered via tool search.
-
headers: Optional[Dict[str, str]]Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.
-
require_approval: Optional[McpRequireApproval]Specify which of the MCP server's tools require approval.
-
class McpRequireApprovalMcpToolApprovalFilter: …Specify which of the MCP server's tools require approval. Can be
always,never, or a filter object associated with tools that require approval.-
always: Optional[McpRequireApprovalMcpToolApprovalFilterAlways]A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
never: Optional[McpRequireApprovalMcpToolApprovalFilterNever]A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
-
Literal["always", "never"]Specify a single approval policy for all tools. One of
alwaysornever. When set toalways, all tools will require approval. When set tonever, all tools will not require approval.-
"always" -
"never"
-
-
-
server_description: Optional[str]Optional description of the MCP server, used to provide more context.
-
server_url: Optional[str]The URL for the MCP server. One of
server_urlorconnector_idmust be provided.
-
-
class CodeInterpreter: …A tool that runs Python code to help generate a response to a prompt.
-
container: CodeInterpreterContainerThe code interpreter container. Can be a container ID or an object that specifies uploaded file IDs to make available to your code, along with an optional
memory_limitsetting.-
strThe container ID.
-
class CodeInterpreterContainerCodeInterpreterToolAuto: …Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.
-
type: Literal["auto"]Always
auto."auto"
-
file_ids: Optional[List[str]]An optional list of uploaded files to make available to your code.
-
memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]The memory limit for the code interpreter container.
-
"1g" -
"4g" -
"16g" -
"64g"
-
-
network_policy: Optional[CodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicy]Network access policy for the container.
-
class ContainerNetworkPolicyDisabled: …-
type: Literal["disabled"]Disable outbound network access. Always
disabled."disabled"
-
-
class ContainerNetworkPolicyAllowlist: …-
allowed_domains: List[str]A list of allowed domains when type is
allowlist. -
type: Literal["allowlist"]Allow outbound network access only to specified domains. Always
allowlist."allowlist"
-
domain_secrets: Optional[List[ContainerNetworkPolicyDomainSecret]]Optional domain-scoped secrets for allowlisted domains.
-
domain: strThe domain associated with the secret.
-
name: strThe name of the secret to inject for the domain.
-
value: strThe secret value to inject for the domain.
-
-
-
-
-
-
type: Literal["code_interpreter"]The type of the code interpreter tool. Always
code_interpreter."code_interpreter"
-
-
class ImageGeneration: …A tool that generates images using the GPT image models.
-
type: Literal["image_generation"]The type of the image generation tool. Always
image_generation."image_generation"
-
action: Optional[Literal["generate", "edit", "auto"]]Whether to generate a new image or edit an existing image. Default:
auto.-
"generate" -
"edit" -
"auto"
-
-
background: Optional[Literal["transparent", "opaque", "auto"]]Allows to set transparency for the background of the generated image(s). This parameter is only supported for GPT image models that support transparent backgrounds. Must be one of
transparent,opaque, orauto(default value). Whenautois used, the model will automatically determine the best background for the image.gpt-image-2andgpt-image-2-2026-04-21do not support transparent backgrounds. Requests withbackgroundset totransparentwill return an error for these models; useopaqueorautoinstead.If
transparent, the output format needs to support transparency, so it should be set to eitherpng(default value) orwebp.-
"transparent" -
"opaque" -
"auto"
-
-
input_fidelity: Optional[Literal["high", "low"]]Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for
gpt-image-1andgpt-image-1.5and later models, unsupported forgpt-image-1-mini. Supportshighandlow. Defaults tolow.-
"high" -
"low"
-
-
input_image_mask: Optional[ImageGenerationInputImageMask]Optional mask for inpainting. Contains
image_url(string, optional) andfile_id(string, optional).-
file_id: Optional[str]File ID for the mask image.
-
image_url: Optional[str]Base64-encoded mask image.
-
-
model: Optional[Union[str, Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-2", 3 more], null]]The image generation model to use. Default:
gpt-image-1.-
str -
Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-2", 3 more]The image generation model to use. Default:
gpt-image-1.-
"gpt-image-1" -
"gpt-image-1-mini" -
"gpt-image-2" -
"gpt-image-2-2026-04-21" -
"gpt-image-1.5" -
"chatgpt-image-latest"
-
-
-
moderation: Optional[Literal["auto", "low"]]Moderation level for the generated image. Default:
auto.-
"auto" -
"low"
-
-
output_compression: Optional[int]Compression level for the output image. Default: 100.
-
output_format: Optional[Literal["png", "webp", "jpeg"]]The output format of the generated image. One of
png,webp, orjpeg. Default:png.-
"png" -
"webp" -
"jpeg"
-
-
partial_images: Optional[int]Number of partial images to generate in streaming mode, from 0 (default value) to 3.
-
quality: Optional[Literal["low", "medium", "high", "auto"]]The quality of the generated image. One of
low,medium,high, orauto. Default:auto.-
"low" -
"medium" -
"high" -
"auto"
-
-
size: Optional[Union[str, Literal["1024x1024", "1024x1536", "1536x1024", "auto"], null]]The size of the generated images. For
gpt-image-2andgpt-image-2-2026-04-21, arbitrary resolutions are supported asWIDTHxHEIGHTstrings, for example1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above2560x1440are experimental, and the maximum supported resolution is3840x2160. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes1024x1024,1536x1024, and1024x1536are supported by the GPT image models;autois supported for models that allow automatic sizing. Fordall-e-2, use one of256x256,512x512, or1024x1024. Fordall-e-3, use one of1024x1024,1792x1024, or1024x1792.-
str -
Literal["1024x1024", "1024x1536", "1536x1024", "auto"]The size of the generated images. For
gpt-image-2andgpt-image-2-2026-04-21, arbitrary resolutions are supported asWIDTHxHEIGHTstrings, for example1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above2560x1440are experimental, and the maximum supported resolution is3840x2160. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes1024x1024,1536x1024, and1024x1536are supported by the GPT image models;autois supported for models that allow automatic sizing. Fordall-e-2, use one of256x256,512x512, or1024x1024. Fordall-e-3, use one of1024x1024,1792x1024, or1024x1792.-
"1024x1024" -
"1024x1536" -
"1536x1024" -
"auto"
-
-
-
-
class LocalShell: …A tool that allows the model to execute shell commands in a local environment.
-
type: Literal["local_shell"]The type of the local shell tool. Always
local_shell."local_shell"
-
-
class FunctionShellTool: …A tool that allows the model to execute shell commands.
-
type: Literal["shell"]The type of the shell tool. Always
shell."shell"
-
environment: Optional[Environment]-
class ContainerAuto: …-
type: Literal["container_auto"]Automatically creates a container for this request
"container_auto"
-
file_ids: Optional[List[str]]An optional list of uploaded files to make available to your code.
-
memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]The memory limit for the container.
-
"1g" -
"4g" -
"16g" -
"64g"
-
-
network_policy: Optional[NetworkPolicy]Network access policy for the container.
-
class ContainerNetworkPolicyDisabled: … -
class ContainerNetworkPolicyAllowlist: …
-
-
skills: Optional[List[Skill]]An optional list of skills referenced by id or inline data.
-
class SkillReference: …-
skill_id: strThe ID of the referenced skill.
-
type: Literal["skill_reference"]References a skill created with the /v1/skills endpoint.
"skill_reference"
-
version: Optional[str]Optional skill version. Use a positive integer or 'latest'. Omit for default.
-
-
class InlineSkill: …-
description: strThe description of the skill.
-
name: strThe name of the skill.
-
source: InlineSkillSourceInline skill payload
-
data: strBase64-encoded skill zip bundle.
-
media_type: Literal["application/zip"]The media type of the inline skill payload. Must be
application/zip."application/zip"
-
type: Literal["base64"]The type of the inline skill source. Must be
base64."base64"
-
-
type: Literal["inline"]Defines an inline skill for this request.
"inline"
-
-
-
-
class LocalEnvironment: …-
type: Literal["local"]Use a local computer environment.
"local"
-
skills: Optional[List[LocalSkill]]An optional list of skills.
-
description: strThe description of the skill.
-
name: strThe name of the skill.
-
path: strThe path to the directory containing the skill.
-
-
-
class ContainerReference: …-
container_id: strThe ID of the referenced container.
-
type: Literal["container_reference"]References a container created with the /v1/containers endpoint
"container_reference"
-
-
-
-
class CustomTool: …A custom tool that processes input using a specified format. Learn more about custom tools
-
name: strThe name of the custom tool, used to identify it in tool calls.
-
type: Literal["custom"]The type of the custom tool. Always
custom."custom"
-
defer_loading: Optional[bool]Whether this tool should be deferred and discovered via tool search.
-
description: Optional[str]Optional description of the custom tool, used to provide more context.
-
format: Optional[CustomToolInputFormat]The input format for the custom tool. Default is unconstrained text.
-
class Text: …Unconstrained free-form text.
-
type: Literal["text"]Unconstrained text format. Always
text."text"
-
-
class Grammar: …A grammar defined by the user.
-
definition: strThe grammar definition.
-
syntax: Literal["lark", "regex"]The syntax of the grammar definition. One of
larkorregex.-
"lark" -
"regex"
-
-
type: Literal["grammar"]Grammar format. Always
grammar."grammar"
-
-
-
-
class NamespaceTool: …Groups function/custom tools under a shared namespace.
-
description: strA description of the namespace shown to the model.
-
name: strThe namespace name used in tool calls (for example,
crm). -
tools: List[Tool]The function/custom tools available inside this namespace.
-
class ToolFunction: …-
name: str -
type: Literal["function"]"function"
-
defer_loading: Optional[bool]Whether this function should be deferred and discovered via tool search.
-
description: Optional[str] -
parameters: Optional[object] -
strict: Optional[bool]
-
-
class CustomTool: …A custom tool that processes input using a specified format. Learn more about custom tools
-
-
type: Literal["namespace"]The type of the tool. Always
namespace."namespace"
-
-
class ToolSearchTool: …Hosted or BYOT tool search configuration for deferred tools.
-
type: Literal["tool_search"]The type of the tool. Always
tool_search."tool_search"
-
description: Optional[str]Description shown to the model for a client-executed tool search tool.
-
execution: Optional[Literal["server", "client"]]Whether tool search is executed by the server or by the client.
-
"server" -
"client"
-
-
parameters: Optional[object]Parameter schema for a client-executed tool search tool.
-
-
class WebSearchPreviewTool: …This tool searches the web for relevant results to use in a response. Learn more about the web search tool.
-
type: Literal["web_search_preview", "web_search_preview_2025_03_11"]The type of the web search tool. One of
web_search_previeworweb_search_preview_2025_03_11.-
"web_search_preview" -
"web_search_preview_2025_03_11"
-
-
search_content_types: Optional[List[Literal["text", "image"]]]-
"text" -
"image"
-
-
search_context_size: Optional[Literal["low", "medium", "high"]]High level guidance for the amount of context window space to use for the search. One of
low,medium, orhigh.mediumis the default.-
"low" -
"medium" -
"high"
-
-
user_location: Optional[UserLocation]The user's location.
-
type: Literal["approximate"]The type of location approximation. Always
approximate."approximate"
-
city: Optional[str]Free text input for the city of the user, e.g.
San Francisco. -
country: Optional[str]The two-letter ISO country code of the user, e.g.
US. -
region: Optional[str]Free text input for the region of the user, e.g.
California. -
timezone: Optional[str]The IANA timezone of the user, e.g.
America/Los_Angeles.
-
-
-
class ApplyPatchTool: …Allows the assistant to create, delete, or update files using unified diffs.
-
type: Literal["apply_patch"]The type of the tool. Always
apply_patch."apply_patch"
-
-
-
top_p: Optional[float]An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
-
error: EvalAPIErrorAn object representing an error response from the Eval API.
-
code: strThe error code.
-
message: strThe error message.
-
-
eval_id: strThe identifier of the associated evaluation.
-
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.
-
model: strThe model that is evaluated, if applicable.
-
name: strThe name of the evaluation run.
-
object: Literal["eval.run"]The type of the object. Always "eval.run".
"eval.run"
-
per_model_usage: List[PerModelUsage]Usage statistics for each model during the evaluation run.
-
cached_tokens: intThe number of tokens retrieved from cache.
-
completion_tokens: intThe number of completion tokens generated.
-
invocation_count: intThe number of invocations.
-
model_name: strThe name of the model.
-
prompt_tokens: intThe number of prompt tokens used.
-
total_tokens: intThe total number of tokens used.
-
-
per_testing_criteria_results: List[PerTestingCriteriaResult]Results per testing criteria applied during the evaluation run.
-
failed: intNumber of tests failed for this criteria.
-
passed: intNumber of tests passed for this criteria.
-
testing_criteria: strA description of the testing criteria.
-
-
report_url: strThe URL to the rendered evaluation run report on the UI dashboard.
-
result_counts: ResultCountsCounters summarizing the outcomes of the evaluation run.
-
errored: intNumber of output items that resulted in an error.
-
failed: intNumber of output items that failed to pass the evaluation.
-
passed: intNumber of output items that passed the evaluation.
-
total: intTotal number of executed output items.
-
-
status: strThe status of the evaluation run.
-
Run Retrieve Response
-
class RunRetrieveResponse: …A schema representing an evaluation run.
-
id: strUnique identifier for the evaluation run.
-
created_at: intUnix timestamp (in seconds) when the evaluation run was created.
-
data_source: DataSourceInformation about the run's data source.
-
class CreateEvalJSONLRunDataSource: …A JsonlRunDataSource object with that specifies a JSONL file that matches the eval
-
source: SourceDetermines what populates the
itemnamespace in the data source.-
class SourceFileContent: …-
content: List[SourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class SourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
-
type: Literal["jsonl"]The type of data source. Always
jsonl."jsonl"
-
-
class CreateEvalCompletionsRunDataSource: …A CompletionsRunDataSource object describing a model sampling configuration.
-
source: SourceDetermines what populates the
itemnamespace in this run's data source.-
class SourceFileContent: …-
content: List[SourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class SourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
class SourceStoredCompletions: …A StoredCompletionsRunDataSource configuration describing a set of filters
-
type: Literal["stored_completions"]The type of source. Always
stored_completions."stored_completions"
-
created_after: Optional[int]An optional Unix timestamp to filter items created after this time.
-
created_before: Optional[int]An optional Unix timestamp to filter items created before this time.
-
limit: Optional[int]An optional maximum number of items to return.
-
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.
-
model: Optional[str]An optional model to filter by (e.g., 'gpt-4o').
-
-
-
type: Literal["completions"]The type of run data source. Always
completions."completions"
-
input_messages: Optional[InputMessages]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 theitemnamespace.-
class InputMessagesTemplate: …-
template: List[InputMessagesTemplateTemplate]A list of chat messages forming the prompt or context. May include variable references to the
itemnamespace, ie {{item.name}}.-
class EasyInputMessage: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: Union[str, ResponseInputMessageContentList]Text, image, or audio input to the model, used to generate a response. Can also contain previous assistant responses.
-
strA text input to the model.
-
List[ResponseInputContent]-
class ResponseInputText: …A text input to the model.
-
text: strThe text input to the model.
-
type: Literal["input_text"]The type of the input item. Always
input_text."input_text"
-
-
class ResponseInputImage: …An image input to the model. Learn about image inputs.
-
detail: Literal["low", "high", "auto", "original"]The detail level of the image to be sent to the model. One of
high,low,auto, ororiginal. Defaults toauto.-
"low" -
"high" -
"auto" -
"original"
-
-
type: Literal["input_image"]The type of the input item. Always
input_image."input_image"
-
file_id: Optional[str]The ID of the file to be sent to the model.
-
image_url: Optional[str]The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.
-
-
class ResponseInputFile: …A file input to the model.
-
type: Literal["input_file"]The type of the input item. Always
input_file."input_file"
-
detail: Optional[Literal["low", "high"]]The detail level of the file to be sent to the model. Use
lowfor the default rendering behavior, orhighto render the file at higher quality. Defaults tolow.-
"low" -
"high"
-
-
file_data: Optional[str]The content of the file to be sent to the model.
-
file_id: Optional[str]The ID of the file to be sent to the model.
-
file_url: Optional[str]The URL of the file to be sent to the model.
-
filename: Optional[str]The name of the file to be sent to the model.
-
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
phase: Optional[Literal["commentary", "final_answer"]]Labels an
assistantmessage as intermediate commentary (commentary) or the final answer (final_answer). For models likegpt-5.3-codexand beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages.-
"commentary" -
"final_answer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
class InputMessagesTemplateTemplateEvalItem: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: InputMessagesTemplateTemplateEvalItemContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class InputMessagesTemplateTemplateEvalItemContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class InputMessagesTemplateTemplateEvalItemContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
input_audio: InputAudio-
data: strBase64-encoded audio data.
-
format: Literal["mp3", "wav"]The format of the audio data. Currently supported formats are
mp3andwav.-
"mp3" -
"wav"
-
-
-
type: Literal["input_audio"]The type of the input item. Always
input_audio."input_audio"
-
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
-
type: Literal["template"]The type of input messages. Always
template."template"
-
-
class InputMessagesItemReference: …-
item_reference: strA reference to a variable in the
itemnamespace. Ie, "item.input_trajectory" -
type: Literal["item_reference"]The type of input messages. Always
item_reference."item_reference"
-
-
-
model: Optional[str]The name of the model to use for generating completions (e.g. "o3-mini").
-
sampling_params: Optional[SamplingParams]-
max_completion_tokens: Optional[int]The maximum number of tokens in the generated output.
-
reasoning_effort: Optional[ReasoningEffort]Constrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.-
gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1. -
All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. -
The
gpt-5-promodel defaults to (and only supports)highreasoning effort. -
xhighis supported for all models aftergpt-5.1-codex-max. -
"none" -
"minimal" -
"low" -
"medium" -
"high" -
"xhigh"
-
-
response_format: Optional[SamplingParamsResponseFormat]An object specifying the format that the model must output.
Setting to
{ "type": "json_schema", "json_schema": {...} }enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.Setting to
{ "type": "json_object" }enables the older JSON mode, which ensures the message the model generates is valid JSON. Usingjson_schemais preferred for models that support it.-
class ResponseFormatText: …Default response format. Used to generate text responses.
-
type: Literal["text"]The type of response format being defined. Always
text."text"
-
-
class ResponseFormatJSONSchema: …JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.
-
json_schema: JSONSchemaStructured Outputs configuration options, including a JSON Schema.
-
name: strThe name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
description: Optional[str]A description of what the response format is for, used by the model to determine how to respond in the format.
-
schema: Optional[Dict[str, object]]The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.
-
strict: Optional[bool]Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the
schemafield. Only a subset of JSON Schema is supported whenstrictistrue. To learn more, read the Structured Outputs guide.
-
-
type: Literal["json_schema"]The type of response format being defined. Always
json_schema."json_schema"
-
-
class ResponseFormatJSONObject: …JSON object response format. An older method of generating JSON responses. Using
json_schemais recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.-
type: Literal["json_object"]The type of response format being defined. Always
json_object."json_object"
-
-
-
seed: Optional[int]A seed value to initialize the randomness, during sampling.
-
temperature: Optional[float]A higher temperature increases randomness in the outputs.
-
tools: Optional[List[ChatCompletionFunctionTool]]A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
-
function: FunctionDefinition-
name: strThe name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
description: Optional[str]A description of what the function does, used by the model to choose when and how to call the function.
-
parameters: Optional[FunctionParameters]The parameters the functions accepts, described as a JSON Schema object. See the guide for examples, and the JSON Schema reference for documentation about the format.
Omitting
parametersdefines a function with an empty parameter list. -
strict: Optional[bool]Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the
parametersfield. Only a subset of JSON Schema is supported whenstrictistrue. Learn more about Structured Outputs in the function calling guide.
-
-
type: Literal["function"]The type of the tool. Currently, only
functionis supported."function"
-
-
top_p: Optional[float]An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
class DataSourceResponses: …A ResponsesRunDataSource object describing a model sampling configuration.
-
source: DataSourceResponsesSourceDetermines what populates the
itemnamespace in this run's data source.-
class DataSourceResponsesSourceFileContent: …-
content: List[DataSourceResponsesSourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class DataSourceResponsesSourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
class DataSourceResponsesSourceResponses: …A EvalResponsesSource object describing a run data source configuration.
-
type: Literal["responses"]The type of run data source. Always
responses."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. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1.- All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. - The
gpt-5-promodel defaults to (and only supports)highreasoning effort. xhighis supported for all models aftergpt-5.1-codex-max.
-
temperature: Optional[float]Sampling temperature. This is a query parameter used to select responses.
-
tools: Optional[List[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[List[str]]List of user identifiers. This is a query parameter used to select responses.
-
-
-
type: Literal["responses"]The type of run data source. Always
responses."responses"
-
input_messages: Optional[DataSourceResponsesInputMessages]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 theitemnamespace.-
class DataSourceResponsesInputMessagesTemplate: …-
template: List[DataSourceResponsesInputMessagesTemplateTemplate]A list of chat messages forming the prompt or context. May include variable references to the
itemnamespace, ie {{item.name}}.-
class DataSourceResponsesInputMessagesTemplateTemplateChatMessage: …-
content: strThe content of the message.
-
role: strThe role of the message (e.g. "system", "assistant", "user").
-
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItem: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
-
type: Literal["template"]The type of input messages. Always
template."template"
-
-
class DataSourceResponsesInputMessagesItemReference: …-
item_reference: strA reference to a variable in the
itemnamespace. Ie, "item.name" -
type: Literal["item_reference"]The type of input messages. Always
item_reference."item_reference"
-
-
-
model: Optional[str]The name of the model to use for generating completions (e.g. "o3-mini").
-
sampling_params: Optional[DataSourceResponsesSamplingParams]-
max_completion_tokens: Optional[int]The maximum number of tokens in the generated output.
-
reasoning_effort: Optional[ReasoningEffort]Constrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1.- All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. - The
gpt-5-promodel defaults to (and only supports)highreasoning effort. xhighis supported for all models aftergpt-5.1-codex-max.
-
seed: Optional[int]A seed value to initialize the randomness, during sampling.
-
temperature: Optional[float]A higher temperature increases randomness in the outputs.
-
text: Optional[DataSourceResponsesSamplingParamsText]Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:
-
format: Optional[ResponseFormatTextConfig]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.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. Usingjson_schemais preferred for models that support it.-
class ResponseFormatText: …Default response format. Used to generate text responses.
-
class ResponseFormatTextJSONSchemaConfig: …JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.
-
name: strThe name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
schema: Dict[str, object]The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.
-
type: Literal["json_schema"]The type of response format being defined. Always
json_schema."json_schema"
-
description: Optional[str]A description of what the response format is for, used by the model to determine how to respond in the format.
-
strict: Optional[bool]Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the
schemafield. Only a subset of JSON Schema is supported whenstrictistrue. To learn more, read the Structured Outputs guide.
-
-
class ResponseFormatJSONObject: …JSON object response format. An older method of generating JSON responses. Using
json_schemais recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.
-
-
tools: Optional[List[Tool]]An array of tools the model may call while generating a response. You can specify which tool to use by setting the
tool_choiceparameter.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 or file search. Learn more about built-in tools.
-
Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code. Learn more about function calling.
-
class FunctionTool: …Defines a function in your own code the model can choose to call. Learn more about function calling.
-
name: strThe name of the function to call.
-
parameters: Optional[Dict[str, object]]A JSON schema object describing the parameters of the function.
-
strict: Optional[bool]Whether to enforce strict parameter validation. Default
true. -
type: Literal["function"]The type of the function tool. Always
function."function"
-
defer_loading: Optional[bool]Whether this function is deferred and loaded via tool search.
-
description: Optional[str]A description of the function. Used by the model to determine whether or not to call the function.
-
-
class FileSearchTool: …A tool that searches for relevant content from uploaded files. Learn more about the file search tool.
-
type: Literal["file_search"]The type of the file search tool. Always
file_search."file_search"
-
vector_store_ids: List[str]The IDs of the vector stores to search.
-
filters: Optional[Filters]A filter to apply.
-
class ComparisonFilter: …A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
key: strThe key to compare against the value.
-
type: Literal["eq", "ne", "gt", 5 more]Specifies the comparison operator:
eq,ne,gt,gte,lt,lte,in,nin.-
eq: equals -
ne: not equal -
gt: greater than -
gte: greater than or equal -
lt: less than -
lte: less than or equal -
in: in -
nin: not in -
"eq" -
"ne" -
"gt" -
"gte" -
"lt" -
"lte" -
"in" -
"nin"
-
-
value: Union[str, float, bool, List[Union[str, float]]]The value to compare against the attribute key; supports string, number, or boolean types.
-
str -
float -
bool -
List[Union[str, float]]-
str -
float
-
-
-
-
class CompoundFilter: …Combine multiple filters using
andoror.-
filters: List[Filter]Array of filters to combine. Items can be
ComparisonFilterorCompoundFilter.-
class ComparisonFilter: …A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
object
-
-
type: Literal["and", "or"]Type of operation:
andoror.-
"and" -
"or"
-
-
-
-
max_num_results: Optional[int]The maximum number of results to return. This number should be between 1 and 50 inclusive.
-
ranking_options: Optional[RankingOptions]Ranking options for search.
-
hybrid_search: Optional[RankingOptionsHybridSearch]Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.
-
embedding_weight: floatThe weight of the embedding in the reciprocal ranking fusion.
-
text_weight: floatThe weight of the text in the reciprocal ranking fusion.
-
-
ranker: Optional[Literal["auto", "default-2024-11-15"]]The ranker to use for the file search.
-
"auto" -
"default-2024-11-15"
-
-
score_threshold: Optional[float]The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.
-
-
-
class ComputerTool: …A tool that controls a virtual computer. Learn more about the computer tool.
-
type: Literal["computer"]The type of the computer tool. Always
computer."computer"
-
-
class ComputerUsePreviewTool: …A tool that controls a virtual computer. Learn more about the computer tool.
-
display_height: intThe height of the computer display.
-
display_width: intThe width of the computer display.
-
environment: Literal["windows", "mac", "linux", 2 more]The type of computer environment to control.
-
"windows" -
"mac" -
"linux" -
"ubuntu" -
"browser"
-
-
type: Literal["computer_use_preview"]The type of the computer use tool. Always
computer_use_preview."computer_use_preview"
-
-
class WebSearchTool: …Search the Internet for sources related to the prompt. Learn more about the web search tool.
-
type: Literal["web_search", "web_search_2025_08_26"]The type of the web search tool. One of
web_searchorweb_search_2025_08_26.-
"web_search" -
"web_search_2025_08_26"
-
-
filters: Optional[Filters]Filters for the search.
-
allowed_domains: Optional[List[str]]Allowed domains for the search. If not provided, all domains are allowed. Subdomains of the provided domains are allowed as well.
Example:
["pubmed.ncbi.nlm.nih.gov"]
-
-
search_context_size: Optional[Literal["low", "medium", "high"]]High level guidance for the amount of context window space to use for the search. One of
low,medium, orhigh.mediumis the default.-
"low" -
"medium" -
"high"
-
-
user_location: Optional[UserLocation]The approximate location of the user.
-
city: Optional[str]Free text input for the city of the user, e.g.
San Francisco. -
country: Optional[str]The two-letter ISO country code of the user, e.g.
US. -
region: Optional[str]Free text input for the region of the user, e.g.
California. -
timezone: Optional[str]The IANA timezone of the user, e.g.
America/Los_Angeles. -
type: Optional[Literal["approximate"]]The type of location approximation. Always
approximate."approximate"
-
-
-
class Mcp: …Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
-
server_label: strA label for this MCP server, used to identify it in tool calls.
-
type: Literal["mcp"]The type of the MCP tool. Always
mcp."mcp"
-
allowed_tools: Optional[McpAllowedTools]List of allowed tool names or a filter object.
-
List[str]A string array of allowed tool names
-
class McpAllowedToolsMcpToolFilter: …A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
-
authorization: Optional[str]An OAuth access token that can be used with a remote MCP server, either with a custom MCP server URL or a service connector. Your application must handle the OAuth authorization flow and provide the token here.
-
connector_id: Optional[Literal["connector_dropbox", "connector_gmail", "connector_googlecalendar", 5 more]]Identifier for service connectors, like those available in ChatGPT. One of
server_urlorconnector_idmust be provided. Learn more about service connectors here.Currently supported
connector_idvalues are:-
Dropbox:
connector_dropbox -
Gmail:
connector_gmail -
Google Calendar:
connector_googlecalendar -
Google Drive:
connector_googledrive -
Microsoft Teams:
connector_microsoftteams -
Outlook Calendar:
connector_outlookcalendar -
Outlook Email:
connector_outlookemail -
SharePoint:
connector_sharepoint -
"connector_dropbox" -
"connector_gmail" -
"connector_googlecalendar" -
"connector_googledrive" -
"connector_microsoftteams" -
"connector_outlookcalendar" -
"connector_outlookemail" -
"connector_sharepoint"
-
-
defer_loading: Optional[bool]Whether this MCP tool is deferred and discovered via tool search.
-
headers: Optional[Dict[str, str]]Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.
-
require_approval: Optional[McpRequireApproval]Specify which of the MCP server's tools require approval.
-
class McpRequireApprovalMcpToolApprovalFilter: …Specify which of the MCP server's tools require approval. Can be
always,never, or a filter object associated with tools that require approval.-
always: Optional[McpRequireApprovalMcpToolApprovalFilterAlways]A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
never: Optional[McpRequireApprovalMcpToolApprovalFilterNever]A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
-
Literal["always", "never"]Specify a single approval policy for all tools. One of
alwaysornever. When set toalways, all tools will require approval. When set tonever, all tools will not require approval.-
"always" -
"never"
-
-
-
server_description: Optional[str]Optional description of the MCP server, used to provide more context.
-
server_url: Optional[str]The URL for the MCP server. One of
server_urlorconnector_idmust be provided.
-
-
class CodeInterpreter: …A tool that runs Python code to help generate a response to a prompt.
-
container: CodeInterpreterContainerThe code interpreter container. Can be a container ID or an object that specifies uploaded file IDs to make available to your code, along with an optional
memory_limitsetting.-
strThe container ID.
-
class CodeInterpreterContainerCodeInterpreterToolAuto: …Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.
-
type: Literal["auto"]Always
auto."auto"
-
file_ids: Optional[List[str]]An optional list of uploaded files to make available to your code.
-
memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]The memory limit for the code interpreter container.
-
"1g" -
"4g" -
"16g" -
"64g"
-
-
network_policy: Optional[CodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicy]Network access policy for the container.
-
class ContainerNetworkPolicyDisabled: …-
type: Literal["disabled"]Disable outbound network access. Always
disabled."disabled"
-
-
class ContainerNetworkPolicyAllowlist: …-
allowed_domains: List[str]A list of allowed domains when type is
allowlist. -
type: Literal["allowlist"]Allow outbound network access only to specified domains. Always
allowlist."allowlist"
-
domain_secrets: Optional[List[ContainerNetworkPolicyDomainSecret]]Optional domain-scoped secrets for allowlisted domains.
-
domain: strThe domain associated with the secret.
-
name: strThe name of the secret to inject for the domain.
-
value: strThe secret value to inject for the domain.
-
-
-
-
-
-
type: Literal["code_interpreter"]The type of the code interpreter tool. Always
code_interpreter."code_interpreter"
-
-
class ImageGeneration: …A tool that generates images using the GPT image models.
-
type: Literal["image_generation"]The type of the image generation tool. Always
image_generation."image_generation"
-
action: Optional[Literal["generate", "edit", "auto"]]Whether to generate a new image or edit an existing image. Default:
auto.-
"generate" -
"edit" -
"auto"
-
-
background: Optional[Literal["transparent", "opaque", "auto"]]Allows to set transparency for the background of the generated image(s). This parameter is only supported for GPT image models that support transparent backgrounds. Must be one of
transparent,opaque, orauto(default value). Whenautois used, the model will automatically determine the best background for the image.gpt-image-2andgpt-image-2-2026-04-21do not support transparent backgrounds. Requests withbackgroundset totransparentwill return an error for these models; useopaqueorautoinstead.If
transparent, the output format needs to support transparency, so it should be set to eitherpng(default value) orwebp.-
"transparent" -
"opaque" -
"auto"
-
-
input_fidelity: Optional[Literal["high", "low"]]Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for
gpt-image-1andgpt-image-1.5and later models, unsupported forgpt-image-1-mini. Supportshighandlow. Defaults tolow.-
"high" -
"low"
-
-
input_image_mask: Optional[ImageGenerationInputImageMask]Optional mask for inpainting. Contains
image_url(string, optional) andfile_id(string, optional).-
file_id: Optional[str]File ID for the mask image.
-
image_url: Optional[str]Base64-encoded mask image.
-
-
model: Optional[Union[str, Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-2", 3 more], null]]The image generation model to use. Default:
gpt-image-1.-
str -
Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-2", 3 more]The image generation model to use. Default:
gpt-image-1.-
"gpt-image-1" -
"gpt-image-1-mini" -
"gpt-image-2" -
"gpt-image-2-2026-04-21" -
"gpt-image-1.5" -
"chatgpt-image-latest"
-
-
-
moderation: Optional[Literal["auto", "low"]]Moderation level for the generated image. Default:
auto.-
"auto" -
"low"
-
-
output_compression: Optional[int]Compression level for the output image. Default: 100.
-
output_format: Optional[Literal["png", "webp", "jpeg"]]The output format of the generated image. One of
png,webp, orjpeg. Default:png.-
"png" -
"webp" -
"jpeg"
-
-
partial_images: Optional[int]Number of partial images to generate in streaming mode, from 0 (default value) to 3.
-
quality: Optional[Literal["low", "medium", "high", "auto"]]The quality of the generated image. One of
low,medium,high, orauto. Default:auto.-
"low" -
"medium" -
"high" -
"auto"
-
-
size: Optional[Union[str, Literal["1024x1024", "1024x1536", "1536x1024", "auto"], null]]The size of the generated images. For
gpt-image-2andgpt-image-2-2026-04-21, arbitrary resolutions are supported asWIDTHxHEIGHTstrings, for example1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above2560x1440are experimental, and the maximum supported resolution is3840x2160. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes1024x1024,1536x1024, and1024x1536are supported by the GPT image models;autois supported for models that allow automatic sizing. Fordall-e-2, use one of256x256,512x512, or1024x1024. Fordall-e-3, use one of1024x1024,1792x1024, or1024x1792.-
str -
Literal["1024x1024", "1024x1536", "1536x1024", "auto"]The size of the generated images. For
gpt-image-2andgpt-image-2-2026-04-21, arbitrary resolutions are supported asWIDTHxHEIGHTstrings, for example1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above2560x1440are experimental, and the maximum supported resolution is3840x2160. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes1024x1024,1536x1024, and1024x1536are supported by the GPT image models;autois supported for models that allow automatic sizing. Fordall-e-2, use one of256x256,512x512, or1024x1024. Fordall-e-3, use one of1024x1024,1792x1024, or1024x1792.-
"1024x1024" -
"1024x1536" -
"1536x1024" -
"auto"
-
-
-
-
class LocalShell: …A tool that allows the model to execute shell commands in a local environment.
-
type: Literal["local_shell"]The type of the local shell tool. Always
local_shell."local_shell"
-
-
class FunctionShellTool: …A tool that allows the model to execute shell commands.
-
type: Literal["shell"]The type of the shell tool. Always
shell."shell"
-
environment: Optional[Environment]-
class ContainerAuto: …-
type: Literal["container_auto"]Automatically creates a container for this request
"container_auto"
-
file_ids: Optional[List[str]]An optional list of uploaded files to make available to your code.
-
memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]The memory limit for the container.
-
"1g" -
"4g" -
"16g" -
"64g"
-
-
network_policy: Optional[NetworkPolicy]Network access policy for the container.
-
class ContainerNetworkPolicyDisabled: … -
class ContainerNetworkPolicyAllowlist: …
-
-
skills: Optional[List[Skill]]An optional list of skills referenced by id or inline data.
-
class SkillReference: …-
skill_id: strThe ID of the referenced skill.
-
type: Literal["skill_reference"]References a skill created with the /v1/skills endpoint.
"skill_reference"
-
version: Optional[str]Optional skill version. Use a positive integer or 'latest'. Omit for default.
-
-
class InlineSkill: …-
description: strThe description of the skill.
-
name: strThe name of the skill.
-
source: InlineSkillSourceInline skill payload
-
data: strBase64-encoded skill zip bundle.
-
media_type: Literal["application/zip"]The media type of the inline skill payload. Must be
application/zip."application/zip"
-
type: Literal["base64"]The type of the inline skill source. Must be
base64."base64"
-
-
type: Literal["inline"]Defines an inline skill for this request.
"inline"
-
-
-
-
class LocalEnvironment: …-
type: Literal["local"]Use a local computer environment.
"local"
-
skills: Optional[List[LocalSkill]]An optional list of skills.
-
description: strThe description of the skill.
-
name: strThe name of the skill.
-
path: strThe path to the directory containing the skill.
-
-
-
class ContainerReference: …-
container_id: strThe ID of the referenced container.
-
type: Literal["container_reference"]References a container created with the /v1/containers endpoint
"container_reference"
-
-
-
-
class CustomTool: …A custom tool that processes input using a specified format. Learn more about custom tools
-
name: strThe name of the custom tool, used to identify it in tool calls.
-
type: Literal["custom"]The type of the custom tool. Always
custom."custom"
-
defer_loading: Optional[bool]Whether this tool should be deferred and discovered via tool search.
-
description: Optional[str]Optional description of the custom tool, used to provide more context.
-
format: Optional[CustomToolInputFormat]The input format for the custom tool. Default is unconstrained text.
-
class Text: …Unconstrained free-form text.
-
type: Literal["text"]Unconstrained text format. Always
text."text"
-
-
class Grammar: …A grammar defined by the user.
-
definition: strThe grammar definition.
-
syntax: Literal["lark", "regex"]The syntax of the grammar definition. One of
larkorregex.-
"lark" -
"regex"
-
-
type: Literal["grammar"]Grammar format. Always
grammar."grammar"
-
-
-
-
class NamespaceTool: …Groups function/custom tools under a shared namespace.
-
description: strA description of the namespace shown to the model.
-
name: strThe namespace name used in tool calls (for example,
crm). -
tools: List[Tool]The function/custom tools available inside this namespace.
-
class ToolFunction: …-
name: str -
type: Literal["function"]"function"
-
defer_loading: Optional[bool]Whether this function should be deferred and discovered via tool search.
-
description: Optional[str] -
parameters: Optional[object] -
strict: Optional[bool]
-
-
class CustomTool: …A custom tool that processes input using a specified format. Learn more about custom tools
-
-
type: Literal["namespace"]The type of the tool. Always
namespace."namespace"
-
-
class ToolSearchTool: …Hosted or BYOT tool search configuration for deferred tools.
-
type: Literal["tool_search"]The type of the tool. Always
tool_search."tool_search"
-
description: Optional[str]Description shown to the model for a client-executed tool search tool.
-
execution: Optional[Literal["server", "client"]]Whether tool search is executed by the server or by the client.
-
"server" -
"client"
-
-
parameters: Optional[object]Parameter schema for a client-executed tool search tool.
-
-
class WebSearchPreviewTool: …This tool searches the web for relevant results to use in a response. Learn more about the web search tool.
-
type: Literal["web_search_preview", "web_search_preview_2025_03_11"]The type of the web search tool. One of
web_search_previeworweb_search_preview_2025_03_11.-
"web_search_preview" -
"web_search_preview_2025_03_11"
-
-
search_content_types: Optional[List[Literal["text", "image"]]]-
"text" -
"image"
-
-
search_context_size: Optional[Literal["low", "medium", "high"]]High level guidance for the amount of context window space to use for the search. One of
low,medium, orhigh.mediumis the default.-
"low" -
"medium" -
"high"
-
-
user_location: Optional[UserLocation]The user's location.
-
type: Literal["approximate"]The type of location approximation. Always
approximate."approximate"
-
city: Optional[str]Free text input for the city of the user, e.g.
San Francisco. -
country: Optional[str]The two-letter ISO country code of the user, e.g.
US. -
region: Optional[str]Free text input for the region of the user, e.g.
California. -
timezone: Optional[str]The IANA timezone of the user, e.g.
America/Los_Angeles.
-
-
-
class ApplyPatchTool: …Allows the assistant to create, delete, or update files using unified diffs.
-
type: Literal["apply_patch"]The type of the tool. Always
apply_patch."apply_patch"
-
-
-
top_p: Optional[float]An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
-
error: EvalAPIErrorAn object representing an error response from the Eval API.
-
code: strThe error code.
-
message: strThe error message.
-
-
eval_id: strThe identifier of the associated evaluation.
-
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.
-
model: strThe model that is evaluated, if applicable.
-
name: strThe name of the evaluation run.
-
object: Literal["eval.run"]The type of the object. Always "eval.run".
"eval.run"
-
per_model_usage: List[PerModelUsage]Usage statistics for each model during the evaluation run.
-
cached_tokens: intThe number of tokens retrieved from cache.
-
completion_tokens: intThe number of completion tokens generated.
-
invocation_count: intThe number of invocations.
-
model_name: strThe name of the model.
-
prompt_tokens: intThe number of prompt tokens used.
-
total_tokens: intThe total number of tokens used.
-
-
per_testing_criteria_results: List[PerTestingCriteriaResult]Results per testing criteria applied during the evaluation run.
-
failed: intNumber of tests failed for this criteria.
-
passed: intNumber of tests passed for this criteria.
-
testing_criteria: strA description of the testing criteria.
-
-
report_url: strThe URL to the rendered evaluation run report on the UI dashboard.
-
result_counts: ResultCountsCounters summarizing the outcomes of the evaluation run.
-
errored: intNumber of output items that resulted in an error.
-
failed: intNumber of output items that failed to pass the evaluation.
-
passed: intNumber of output items that passed the evaluation.
-
total: intTotal number of executed output items.
-
-
status: strThe status of the evaluation run.
-
Run Cancel Response
-
class RunCancelResponse: …A schema representing an evaluation run.
-
id: strUnique identifier for the evaluation run.
-
created_at: intUnix timestamp (in seconds) when the evaluation run was created.
-
data_source: DataSourceInformation about the run's data source.
-
class CreateEvalJSONLRunDataSource: …A JsonlRunDataSource object with that specifies a JSONL file that matches the eval
-
source: SourceDetermines what populates the
itemnamespace in the data source.-
class SourceFileContent: …-
content: List[SourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class SourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
-
type: Literal["jsonl"]The type of data source. Always
jsonl."jsonl"
-
-
class CreateEvalCompletionsRunDataSource: …A CompletionsRunDataSource object describing a model sampling configuration.
-
source: SourceDetermines what populates the
itemnamespace in this run's data source.-
class SourceFileContent: …-
content: List[SourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class SourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
class SourceStoredCompletions: …A StoredCompletionsRunDataSource configuration describing a set of filters
-
type: Literal["stored_completions"]The type of source. Always
stored_completions."stored_completions"
-
created_after: Optional[int]An optional Unix timestamp to filter items created after this time.
-
created_before: Optional[int]An optional Unix timestamp to filter items created before this time.
-
limit: Optional[int]An optional maximum number of items to return.
-
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.
-
model: Optional[str]An optional model to filter by (e.g., 'gpt-4o').
-
-
-
type: Literal["completions"]The type of run data source. Always
completions."completions"
-
input_messages: Optional[InputMessages]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 theitemnamespace.-
class InputMessagesTemplate: …-
template: List[InputMessagesTemplateTemplate]A list of chat messages forming the prompt or context. May include variable references to the
itemnamespace, ie {{item.name}}.-
class EasyInputMessage: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: Union[str, ResponseInputMessageContentList]Text, image, or audio input to the model, used to generate a response. Can also contain previous assistant responses.
-
strA text input to the model.
-
List[ResponseInputContent]-
class ResponseInputText: …A text input to the model.
-
text: strThe text input to the model.
-
type: Literal["input_text"]The type of the input item. Always
input_text."input_text"
-
-
class ResponseInputImage: …An image input to the model. Learn about image inputs.
-
detail: Literal["low", "high", "auto", "original"]The detail level of the image to be sent to the model. One of
high,low,auto, ororiginal. Defaults toauto.-
"low" -
"high" -
"auto" -
"original"
-
-
type: Literal["input_image"]The type of the input item. Always
input_image."input_image"
-
file_id: Optional[str]The ID of the file to be sent to the model.
-
image_url: Optional[str]The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.
-
-
class ResponseInputFile: …A file input to the model.
-
type: Literal["input_file"]The type of the input item. Always
input_file."input_file"
-
detail: Optional[Literal["low", "high"]]The detail level of the file to be sent to the model. Use
lowfor the default rendering behavior, orhighto render the file at higher quality. Defaults tolow.-
"low" -
"high"
-
-
file_data: Optional[str]The content of the file to be sent to the model.
-
file_id: Optional[str]The ID of the file to be sent to the model.
-
file_url: Optional[str]The URL of the file to be sent to the model.
-
filename: Optional[str]The name of the file to be sent to the model.
-
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
phase: Optional[Literal["commentary", "final_answer"]]Labels an
assistantmessage as intermediate commentary (commentary) or the final answer (final_answer). For models likegpt-5.3-codexand beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages.-
"commentary" -
"final_answer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
class InputMessagesTemplateTemplateEvalItem: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: InputMessagesTemplateTemplateEvalItemContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class InputMessagesTemplateTemplateEvalItemContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class InputMessagesTemplateTemplateEvalItemContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
input_audio: InputAudio-
data: strBase64-encoded audio data.
-
format: Literal["mp3", "wav"]The format of the audio data. Currently supported formats are
mp3andwav.-
"mp3" -
"wav"
-
-
-
type: Literal["input_audio"]The type of the input item. Always
input_audio."input_audio"
-
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
-
type: Literal["template"]The type of input messages. Always
template."template"
-
-
class InputMessagesItemReference: …-
item_reference: strA reference to a variable in the
itemnamespace. Ie, "item.input_trajectory" -
type: Literal["item_reference"]The type of input messages. Always
item_reference."item_reference"
-
-
-
model: Optional[str]The name of the model to use for generating completions (e.g. "o3-mini").
-
sampling_params: Optional[SamplingParams]-
max_completion_tokens: Optional[int]The maximum number of tokens in the generated output.
-
reasoning_effort: Optional[ReasoningEffort]Constrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.-
gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1. -
All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. -
The
gpt-5-promodel defaults to (and only supports)highreasoning effort. -
xhighis supported for all models aftergpt-5.1-codex-max. -
"none" -
"minimal" -
"low" -
"medium" -
"high" -
"xhigh"
-
-
response_format: Optional[SamplingParamsResponseFormat]An object specifying the format that the model must output.
Setting to
{ "type": "json_schema", "json_schema": {...} }enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.Setting to
{ "type": "json_object" }enables the older JSON mode, which ensures the message the model generates is valid JSON. Usingjson_schemais preferred for models that support it.-
class ResponseFormatText: …Default response format. Used to generate text responses.
-
type: Literal["text"]The type of response format being defined. Always
text."text"
-
-
class ResponseFormatJSONSchema: …JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.
-
json_schema: JSONSchemaStructured Outputs configuration options, including a JSON Schema.
-
name: strThe name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
description: Optional[str]A description of what the response format is for, used by the model to determine how to respond in the format.
-
schema: Optional[Dict[str, object]]The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.
-
strict: Optional[bool]Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the
schemafield. Only a subset of JSON Schema is supported whenstrictistrue. To learn more, read the Structured Outputs guide.
-
-
type: Literal["json_schema"]The type of response format being defined. Always
json_schema."json_schema"
-
-
class ResponseFormatJSONObject: …JSON object response format. An older method of generating JSON responses. Using
json_schemais recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.-
type: Literal["json_object"]The type of response format being defined. Always
json_object."json_object"
-
-
-
seed: Optional[int]A seed value to initialize the randomness, during sampling.
-
temperature: Optional[float]A higher temperature increases randomness in the outputs.
-
tools: Optional[List[ChatCompletionFunctionTool]]A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
-
function: FunctionDefinition-
name: strThe name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
description: Optional[str]A description of what the function does, used by the model to choose when and how to call the function.
-
parameters: Optional[FunctionParameters]The parameters the functions accepts, described as a JSON Schema object. See the guide for examples, and the JSON Schema reference for documentation about the format.
Omitting
parametersdefines a function with an empty parameter list. -
strict: Optional[bool]Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the
parametersfield. Only a subset of JSON Schema is supported whenstrictistrue. Learn more about Structured Outputs in the function calling guide.
-
-
type: Literal["function"]The type of the tool. Currently, only
functionis supported."function"
-
-
top_p: Optional[float]An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
class DataSourceResponses: …A ResponsesRunDataSource object describing a model sampling configuration.
-
source: DataSourceResponsesSourceDetermines what populates the
itemnamespace in this run's data source.-
class DataSourceResponsesSourceFileContent: …-
content: List[DataSourceResponsesSourceFileContentContent]The content of the jsonl file.
-
item: Dict[str, object] -
sample: Optional[Dict[str, object]]
-
-
type: Literal["file_content"]The type of jsonl source. Always
file_content."file_content"
-
-
class DataSourceResponsesSourceFileID: …-
id: strThe identifier of the file.
-
type: Literal["file_id"]The type of jsonl source. Always
file_id."file_id"
-
-
class DataSourceResponsesSourceResponses: …A EvalResponsesSource object describing a run data source configuration.
-
type: Literal["responses"]The type of run data source. Always
responses."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. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1.- All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. - The
gpt-5-promodel defaults to (and only supports)highreasoning effort. xhighis supported for all models aftergpt-5.1-codex-max.
-
temperature: Optional[float]Sampling temperature. This is a query parameter used to select responses.
-
tools: Optional[List[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[List[str]]List of user identifiers. This is a query parameter used to select responses.
-
-
-
type: Literal["responses"]The type of run data source. Always
responses."responses"
-
input_messages: Optional[DataSourceResponsesInputMessages]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 theitemnamespace.-
class DataSourceResponsesInputMessagesTemplate: …-
template: List[DataSourceResponsesInputMessagesTemplateTemplate]A list of chat messages forming the prompt or context. May include variable references to the
itemnamespace, ie {{item.name}}.-
class DataSourceResponsesInputMessagesTemplateTemplateChatMessage: …-
content: strThe content of the message.
-
role: strThe role of the message (e.g. "system", "assistant", "user").
-
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItem: …A message input to the model with a role indicating instruction following hierarchy. Instructions given with the
developerorsystemrole take precedence over instructions given with theuserrole. Messages with theassistantrole are presumed to have been generated by the model in previous interactions.-
content: DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputs 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.
-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentOutputText: …A text output from the model.
-
text: strThe text output from the model.
-
type: Literal["output_text"]The type of the output text. Always
output_text."output_text"
-
-
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputImage: …An image input block used within EvalItem content arrays.
-
image_url: strThe URL of the image input.
-
type: Literal["input_image"]The type of the image input. Always
input_image."input_image"
-
detail: Optional[str]The detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio: …An audio input to the model.
-
List[GraderInputItem]-
strA text input to the model.
-
class ResponseInputText: …A text input to the model.
-
class GraderInputItemOutputText: …A text output from the model.
-
class GraderInputItemInputImage: …An image input block used within EvalItem content arrays.
-
class ResponseInputAudio: …An audio input to the model.
-
-
-
role: Literal["user", "assistant", "system", "developer"]The role of the message input. One of
user,assistant,system, ordeveloper.-
"user" -
"assistant" -
"system" -
"developer"
-
-
type: Optional[Literal["message"]]The type of the message input. Always
message."message"
-
-
-
type: Literal["template"]The type of input messages. Always
template."template"
-
-
class DataSourceResponsesInputMessagesItemReference: …-
item_reference: strA reference to a variable in the
itemnamespace. Ie, "item.name" -
type: Literal["item_reference"]The type of input messages. Always
item_reference."item_reference"
-
-
-
model: Optional[str]The name of the model to use for generating completions (e.g. "o3-mini").
-
sampling_params: Optional[DataSourceResponsesSamplingParams]-
max_completion_tokens: Optional[int]The maximum number of tokens in the generated output.
-
reasoning_effort: Optional[ReasoningEffort]Constrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high, andxhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.gpt-5.1defaults tonone, which does not perform reasoning. The supported reasoning values forgpt-5.1arenone,low,medium, andhigh. Tool calls are supported for all reasoning values in gpt-5.1.- All models before
gpt-5.1default tomediumreasoning effort, and do not supportnone. - The
gpt-5-promodel defaults to (and only supports)highreasoning effort. xhighis supported for all models aftergpt-5.1-codex-max.
-
seed: Optional[int]A seed value to initialize the randomness, during sampling.
-
temperature: Optional[float]A higher temperature increases randomness in the outputs.
-
text: Optional[DataSourceResponsesSamplingParamsText]Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:
-
format: Optional[ResponseFormatTextConfig]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.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. Usingjson_schemais preferred for models that support it.-
class ResponseFormatText: …Default response format. Used to generate text responses.
-
class ResponseFormatTextJSONSchemaConfig: …JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.
-
name: strThe name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
-
schema: Dict[str, object]The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.
-
type: Literal["json_schema"]The type of response format being defined. Always
json_schema."json_schema"
-
description: Optional[str]A description of what the response format is for, used by the model to determine how to respond in the format.
-
strict: Optional[bool]Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the
schemafield. Only a subset of JSON Schema is supported whenstrictistrue. To learn more, read the Structured Outputs guide.
-
-
class ResponseFormatJSONObject: …JSON object response format. An older method of generating JSON responses. Using
json_schemais recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.
-
-
tools: Optional[List[Tool]]An array of tools the model may call while generating a response. You can specify which tool to use by setting the
tool_choiceparameter.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 or file search. Learn more about built-in tools.
-
Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code. Learn more about function calling.
-
class FunctionTool: …Defines a function in your own code the model can choose to call. Learn more about function calling.
-
name: strThe name of the function to call.
-
parameters: Optional[Dict[str, object]]A JSON schema object describing the parameters of the function.
-
strict: Optional[bool]Whether to enforce strict parameter validation. Default
true. -
type: Literal["function"]The type of the function tool. Always
function."function"
-
defer_loading: Optional[bool]Whether this function is deferred and loaded via tool search.
-
description: Optional[str]A description of the function. Used by the model to determine whether or not to call the function.
-
-
class FileSearchTool: …A tool that searches for relevant content from uploaded files. Learn more about the file search tool.
-
type: Literal["file_search"]The type of the file search tool. Always
file_search."file_search"
-
vector_store_ids: List[str]The IDs of the vector stores to search.
-
filters: Optional[Filters]A filter to apply.
-
class ComparisonFilter: …A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
key: strThe key to compare against the value.
-
type: Literal["eq", "ne", "gt", 5 more]Specifies the comparison operator:
eq,ne,gt,gte,lt,lte,in,nin.-
eq: equals -
ne: not equal -
gt: greater than -
gte: greater than or equal -
lt: less than -
lte: less than or equal -
in: in -
nin: not in -
"eq" -
"ne" -
"gt" -
"gte" -
"lt" -
"lte" -
"in" -
"nin"
-
-
value: Union[str, float, bool, List[Union[str, float]]]The value to compare against the attribute key; supports string, number, or boolean types.
-
str -
float -
bool -
List[Union[str, float]]-
str -
float
-
-
-
-
class CompoundFilter: …Combine multiple filters using
andoror.-
filters: List[Filter]Array of filters to combine. Items can be
ComparisonFilterorCompoundFilter.-
class ComparisonFilter: …A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
object
-
-
type: Literal["and", "or"]Type of operation:
andoror.-
"and" -
"or"
-
-
-
-
max_num_results: Optional[int]The maximum number of results to return. This number should be between 1 and 50 inclusive.
-
ranking_options: Optional[RankingOptions]Ranking options for search.
-
hybrid_search: Optional[RankingOptionsHybridSearch]Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.
-
embedding_weight: floatThe weight of the embedding in the reciprocal ranking fusion.
-
text_weight: floatThe weight of the text in the reciprocal ranking fusion.
-
-
ranker: Optional[Literal["auto", "default-2024-11-15"]]The ranker to use for the file search.
-
"auto" -
"default-2024-11-15"
-
-
score_threshold: Optional[float]The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.
-
-
-
class ComputerTool: …A tool that controls a virtual computer. Learn more about the computer tool.
-
type: Literal["computer"]The type of the computer tool. Always
computer."computer"
-
-
class ComputerUsePreviewTool: …A tool that controls a virtual computer. Learn more about the computer tool.
-
display_height: intThe height of the computer display.
-
display_width: intThe width of the computer display.
-
environment: Literal["windows", "mac", "linux", 2 more]The type of computer environment to control.
-
"windows" -
"mac" -
"linux" -
"ubuntu" -
"browser"
-
-
type: Literal["computer_use_preview"]The type of the computer use tool. Always
computer_use_preview."computer_use_preview"
-
-
class WebSearchTool: …Search the Internet for sources related to the prompt. Learn more about the web search tool.
-
type: Literal["web_search", "web_search_2025_08_26"]The type of the web search tool. One of
web_searchorweb_search_2025_08_26.-
"web_search" -
"web_search_2025_08_26"
-
-
filters: Optional[Filters]Filters for the search.
-
allowed_domains: Optional[List[str]]Allowed domains for the search. If not provided, all domains are allowed. Subdomains of the provided domains are allowed as well.
Example:
["pubmed.ncbi.nlm.nih.gov"]
-
-
search_context_size: Optional[Literal["low", "medium", "high"]]High level guidance for the amount of context window space to use for the search. One of
low,medium, orhigh.mediumis the default.-
"low" -
"medium" -
"high"
-
-
user_location: Optional[UserLocation]The approximate location of the user.
-
city: Optional[str]Free text input for the city of the user, e.g.
San Francisco. -
country: Optional[str]The two-letter ISO country code of the user, e.g.
US. -
region: Optional[str]Free text input for the region of the user, e.g.
California. -
timezone: Optional[str]The IANA timezone of the user, e.g.
America/Los_Angeles. -
type: Optional[Literal["approximate"]]The type of location approximation. Always
approximate."approximate"
-
-
-
class Mcp: …Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
-
server_label: strA label for this MCP server, used to identify it in tool calls.
-
type: Literal["mcp"]The type of the MCP tool. Always
mcp."mcp"
-
allowed_tools: Optional[McpAllowedTools]List of allowed tool names or a filter object.
-
List[str]A string array of allowed tool names
-
class McpAllowedToolsMcpToolFilter: …A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
-
authorization: Optional[str]An OAuth access token that can be used with a remote MCP server, either with a custom MCP server URL or a service connector. Your application must handle the OAuth authorization flow and provide the token here.
-
connector_id: Optional[Literal["connector_dropbox", "connector_gmail", "connector_googlecalendar", 5 more]]Identifier for service connectors, like those available in ChatGPT. One of
server_urlorconnector_idmust be provided. Learn more about service connectors here.Currently supported
connector_idvalues are:-
Dropbox:
connector_dropbox -
Gmail:
connector_gmail -
Google Calendar:
connector_googlecalendar -
Google Drive:
connector_googledrive -
Microsoft Teams:
connector_microsoftteams -
Outlook Calendar:
connector_outlookcalendar -
Outlook Email:
connector_outlookemail -
SharePoint:
connector_sharepoint -
"connector_dropbox" -
"connector_gmail" -
"connector_googlecalendar" -
"connector_googledrive" -
"connector_microsoftteams" -
"connector_outlookcalendar" -
"connector_outlookemail" -
"connector_sharepoint"
-
-
defer_loading: Optional[bool]Whether this MCP tool is deferred and discovered via tool search.
-
headers: Optional[Dict[str, str]]Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.
-
require_approval: Optional[McpRequireApproval]Specify which of the MCP server's tools require approval.
-
class McpRequireApprovalMcpToolApprovalFilter: …Specify which of the MCP server's tools require approval. Can be
always,never, or a filter object associated with tools that require approval.-
always: Optional[McpRequireApprovalMcpToolApprovalFilterAlways]A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
never: Optional[McpRequireApprovalMcpToolApprovalFilterNever]A filter object to specify which tools are allowed.
-
read_only: Optional[bool]Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with
readOnlyHint, it will match this filter. -
tool_names: Optional[List[str]]List of allowed tool names.
-
-
-
Literal["always", "never"]Specify a single approval policy for all tools. One of
alwaysornever. When set toalways, all tools will require approval. When set tonever, all tools will not require approval.-
"always" -
"never"
-
-
-
server_description: Optional[str]Optional description of the MCP server, used to provide more context.
-
server_url: Optional[str]The URL for the MCP server. One of
server_urlorconnector_idmust be provided.
-
-
class CodeInterpreter: …A tool that runs Python code to help generate a response to a prompt.
-
container: CodeInterpreterContainerThe code interpreter container. Can be a container ID or an object that specifies uploaded file IDs to make available to your code, along with an optional
memory_limitsetting.-
strThe container ID.
-
class CodeInterpreterContainerCodeInterpreterToolAuto: …Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.
-
type: Literal["auto"]Always
auto."auto"
-
file_ids: Optional[List[str]]An optional list of uploaded files to make available to your code.
-
memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]The memory limit for the code interpreter container.
-
"1g" -
"4g" -
"16g" -
"64g"
-
-
network_policy: Optional[CodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicy]Network access policy for the container.
-
class ContainerNetworkPolicyDisabled: …-
type: Literal["disabled"]Disable outbound network access. Always
disabled."disabled"
-
-
class ContainerNetworkPolicyAllowlist: …-
allowed_domains: List[str]A list of allowed domains when type is
allowlist. -
type: Literal["allowlist"]Allow outbound network access only to specified domains. Always
allowlist."allowlist"
-
domain_secrets: Optional[List[ContainerNetworkPolicyDomainSecret]]Optional domain-scoped secrets for allowlisted domains.
-
domain: strThe domain associated with the secret.
-
name: strThe name of the secret to inject for the domain.
-
value: strThe secret value to inject for the domain.
-
-
-
-
-
-
type: Literal["code_interpreter"]The type of the code interpreter tool. Always
code_interpreter."code_interpreter"
-
-
class ImageGeneration: …A tool that generates images using the GPT image models.
-
type: Literal["image_generation"]The type of the image generation tool. Always
image_generation."image_generation"
-
action: Optional[Literal["generate", "edit", "auto"]]Whether to generate a new image or edit an existing image. Default:
auto.-
"generate" -
"edit" -
"auto"
-
-
background: Optional[Literal["transparent", "opaque", "auto"]]Allows to set transparency for the background of the generated image(s). This parameter is only supported for GPT image models that support transparent backgrounds. Must be one of
transparent,opaque, orauto(default value). Whenautois used, the model will automatically determine the best background for the image.gpt-image-2andgpt-image-2-2026-04-21do not support transparent backgrounds. Requests withbackgroundset totransparentwill return an error for these models; useopaqueorautoinstead.If
transparent, the output format needs to support transparency, so it should be set to eitherpng(default value) orwebp.-
"transparent" -
"opaque" -
"auto"
-
-
input_fidelity: Optional[Literal["high", "low"]]Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for
gpt-image-1andgpt-image-1.5and later models, unsupported forgpt-image-1-mini. Supportshighandlow. Defaults tolow.-
"high" -
"low"
-
-
input_image_mask: Optional[ImageGenerationInputImageMask]Optional mask for inpainting. Contains
image_url(string, optional) andfile_id(string, optional).-
file_id: Optional[str]File ID for the mask image.
-
image_url: Optional[str]Base64-encoded mask image.
-
-
model: Optional[Union[str, Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-2", 3 more], null]]The image generation model to use. Default:
gpt-image-1.-
str -
Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-2", 3 more]The image generation model to use. Default:
gpt-image-1.-
"gpt-image-1" -
"gpt-image-1-mini" -
"gpt-image-2" -
"gpt-image-2-2026-04-21" -
"gpt-image-1.5" -
"chatgpt-image-latest"
-
-
-
moderation: Optional[Literal["auto", "low"]]Moderation level for the generated image. Default:
auto.-
"auto" -
"low"
-
-
output_compression: Optional[int]Compression level for the output image. Default: 100.
-
output_format: Optional[Literal["png", "webp", "jpeg"]]The output format of the generated image. One of
png,webp, orjpeg. Default:png.-
"png" -
"webp" -
"jpeg"
-
-
partial_images: Optional[int]Number of partial images to generate in streaming mode, from 0 (default value) to 3.
-
quality: Optional[Literal["low", "medium", "high", "auto"]]The quality of the generated image. One of
low,medium,high, orauto. Default:auto.-
"low" -
"medium" -
"high" -
"auto"
-
-
size: Optional[Union[str, Literal["1024x1024", "1024x1536", "1536x1024", "auto"], null]]The size of the generated images. For
gpt-image-2andgpt-image-2-2026-04-21, arbitrary resolutions are supported asWIDTHxHEIGHTstrings, for example1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above2560x1440are experimental, and the maximum supported resolution is3840x2160. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes1024x1024,1536x1024, and1024x1536are supported by the GPT image models;autois supported for models that allow automatic sizing. Fordall-e-2, use one of256x256,512x512, or1024x1024. Fordall-e-3, use one of1024x1024,1792x1024, or1024x1792.-
str -
Literal["1024x1024", "1024x1536", "1536x1024", "auto"]The size of the generated images. For
gpt-image-2andgpt-image-2-2026-04-21, arbitrary resolutions are supported asWIDTHxHEIGHTstrings, for example1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above2560x1440are experimental, and the maximum supported resolution is3840x2160. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes1024x1024,1536x1024, and1024x1536are supported by the GPT image models;autois supported for models that allow automatic sizing. Fordall-e-2, use one of256x256,512x512, or1024x1024. Fordall-e-3, use one of1024x1024,1792x1024, or1024x1792.-
"1024x1024" -
"1024x1536" -
"1536x1024" -
"auto"
-
-
-
-
class LocalShell: …A tool that allows the model to execute shell commands in a local environment.
-
type: Literal["local_shell"]The type of the local shell tool. Always
local_shell."local_shell"
-
-
class FunctionShellTool: …A tool that allows the model to execute shell commands.
-
type: Literal["shell"]The type of the shell tool. Always
shell."shell"
-
environment: Optional[Environment]-
class ContainerAuto: …-
type: Literal["container_auto"]Automatically creates a container for this request
"container_auto"
-
file_ids: Optional[List[str]]An optional list of uploaded files to make available to your code.
-
memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]The memory limit for the container.
-
"1g" -
"4g" -
"16g" -
"64g"
-
-
network_policy: Optional[NetworkPolicy]Network access policy for the container.
-
class ContainerNetworkPolicyDisabled: … -
class ContainerNetworkPolicyAllowlist: …
-
-
skills: Optional[List[Skill]]An optional list of skills referenced by id or inline data.
-
class SkillReference: …-
skill_id: strThe ID of the referenced skill.
-
type: Literal["skill_reference"]References a skill created with the /v1/skills endpoint.
"skill_reference"
-
version: Optional[str]Optional skill version. Use a positive integer or 'latest'. Omit for default.
-
-
class InlineSkill: …-
description: strThe description of the skill.
-
name: strThe name of the skill.
-
source: InlineSkillSourceInline skill payload
-
data: strBase64-encoded skill zip bundle.
-
media_type: Literal["application/zip"]The media type of the inline skill payload. Must be
application/zip."application/zip"
-
type: Literal["base64"]The type of the inline skill source. Must be
base64."base64"
-
-
type: Literal["inline"]Defines an inline skill for this request.
"inline"
-
-
-
-
class LocalEnvironment: …-
type: Literal["local"]Use a local computer environment.
"local"
-
skills: Optional[List[LocalSkill]]An optional list of skills.
-
description: strThe description of the skill.
-
name: strThe name of the skill.
-
path: strThe path to the directory containing the skill.
-
-
-
class ContainerReference: …-
container_id: strThe ID of the referenced container.
-
type: Literal["container_reference"]References a container created with the /v1/containers endpoint
"container_reference"
-
-
-
-
class CustomTool: …A custom tool that processes input using a specified format. Learn more about custom tools
-
name: strThe name of the custom tool, used to identify it in tool calls.
-
type: Literal["custom"]The type of the custom tool. Always
custom."custom"
-
defer_loading: Optional[bool]Whether this tool should be deferred and discovered via tool search.
-
description: Optional[str]Optional description of the custom tool, used to provide more context.
-
format: Optional[CustomToolInputFormat]The input format for the custom tool. Default is unconstrained text.
-
class Text: …Unconstrained free-form text.
-
type: Literal["text"]Unconstrained text format. Always
text."text"
-
-
class Grammar: …A grammar defined by the user.
-
definition: strThe grammar definition.
-
syntax: Literal["lark", "regex"]The syntax of the grammar definition. One of
larkorregex.-
"lark" -
"regex"
-
-
type: Literal["grammar"]Grammar format. Always
grammar."grammar"
-
-
-
-
class NamespaceTool: …Groups function/custom tools under a shared namespace.
-
description: strA description of the namespace shown to the model.
-
name: strThe namespace name used in tool calls (for example,
crm). -
tools: List[Tool]The function/custom tools available inside this namespace.
-
class ToolFunction: …-
name: str -
type: Literal["function"]"function"
-
defer_loading: Optional[bool]Whether this function should be deferred and discovered via tool search.
-
description: Optional[str] -
parameters: Optional[object] -
strict: Optional[bool]
-
-
class CustomTool: …A custom tool that processes input using a specified format. Learn more about custom tools
-
-
type: Literal["namespace"]The type of the tool. Always
namespace."namespace"
-
-
class ToolSearchTool: …Hosted or BYOT tool search configuration for deferred tools.
-
type: Literal["tool_search"]The type of the tool. Always
tool_search."tool_search"
-
description: Optional[str]Description shown to the model for a client-executed tool search tool.
-
execution: Optional[Literal["server", "client"]]Whether tool search is executed by the server or by the client.
-
"server" -
"client"
-
-
parameters: Optional[object]Parameter schema for a client-executed tool search tool.
-
-
class WebSearchPreviewTool: …This tool searches the web for relevant results to use in a response. Learn more about the web search tool.
-
type: Literal["web_search_preview", "web_search_preview_2025_03_11"]The type of the web search tool. One of
web_search_previeworweb_search_preview_2025_03_11.-
"web_search_preview" -
"web_search_preview_2025_03_11"
-
-
search_content_types: Optional[List[Literal["text", "image"]]]-
"text" -
"image"
-
-
search_context_size: Optional[Literal["low", "medium", "high"]]High level guidance for the amount of context window space to use for the search. One of
low,medium, orhigh.mediumis the default.-
"low" -
"medium" -
"high"
-
-
user_location: Optional[UserLocation]The user's location.
-
type: Literal["approximate"]The type of location approximation. Always
approximate."approximate"
-
city: Optional[str]Free text input for the city of the user, e.g.
San Francisco. -
country: Optional[str]The two-letter ISO country code of the user, e.g.
US. -
region: Optional[str]Free text input for the region of the user, e.g.
California. -
timezone: Optional[str]The IANA timezone of the user, e.g.
America/Los_Angeles.
-
-
-
class ApplyPatchTool: …Allows the assistant to create, delete, or update files using unified diffs.
-
type: Literal["apply_patch"]The type of the tool. Always
apply_patch."apply_patch"
-
-
-
top_p: Optional[float]An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
-
error: EvalAPIErrorAn object representing an error response from the Eval API.
-
code: strThe error code.
-
message: strThe error message.
-
-
eval_id: strThe identifier of the associated evaluation.
-
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.
-
model: strThe model that is evaluated, if applicable.
-
name: strThe name of the evaluation run.
-
object: Literal["eval.run"]The type of the object. Always "eval.run".
"eval.run"
-
per_model_usage: List[PerModelUsage]Usage statistics for each model during the evaluation run.
-
cached_tokens: intThe number of tokens retrieved from cache.
-
completion_tokens: intThe number of completion tokens generated.
-
invocation_count: intThe number of invocations.
-
model_name: strThe name of the model.
-
prompt_tokens: intThe number of prompt tokens used.
-
total_tokens: intThe total number of tokens used.
-
-
per_testing_criteria_results: List[PerTestingCriteriaResult]Results per testing criteria applied during the evaluation run.
-
failed: intNumber of tests failed for this criteria.
-
passed: intNumber of tests passed for this criteria.
-
testing_criteria: strA description of the testing criteria.
-
-
report_url: strThe URL to the rendered evaluation run report on the UI dashboard.
-
result_counts: ResultCountsCounters summarizing the outcomes of the evaluation run.
-
errored: intNumber of output items that resulted in an error.
-
failed: intNumber of output items that failed to pass the evaluation.
-
passed: intNumber of output items that passed the evaluation.
-
total: intTotal number of executed output items.
-
-
status: strThe status of the evaluation run.
-
Run Delete Response
-
class RunDeleteResponse: …-
deleted: Optional[bool] -
object: Optional[str] -
run_id: Optional[str]
-
Output Items
Get eval run output items
evals.runs.output_items.list(strrun_id, OutputItemListParams**kwargs) -> SyncCursorPage[OutputItemListResponse]
get /evals/{eval_id}/runs/{run_id}/output_items
Get a list of output items for an evaluation run.
Parameters
-
eval_id: str -
run_id: str -
after: Optional[str]Identifier for the last output item from the previous pagination request.
-
limit: Optional[int]Number of output items to retrieve.
-
order: Optional[Literal["asc", "desc"]]Sort order for output items by timestamp. Use
ascfor ascending order ordescfor descending order. Defaults toasc.-
"asc" -
"desc"
-
-
status: Optional[Literal["fail", "pass"]]Filter output items by status. Use
failedto filter by failed output items orpassto filter by passed output items.-
"fail" -
"pass"
-
Returns
-
class OutputItemListResponse: …A schema representing an evaluation run output item.
-
id: strUnique identifier for the evaluation run output item.
-
created_at: intUnix timestamp (in seconds) when the evaluation run was created.
-
datasource_item: Dict[str, object]Details of the input data source item.
-
datasource_item_id: intThe identifier for the data source item.
-
eval_id: strThe identifier of the evaluation group.
-
object: Literal["eval.run.output_item"]The type of the object. Always "eval.run.output_item".
"eval.run.output_item"
-
results: List[Result]A list of grader results for this output item.
-
name: strThe name of the grader.
-
passed: boolWhether the grader considered the output a pass.
-
score: floatThe numeric score produced by the grader.
-
sample: Optional[Dict[str, object]]Optional sample or intermediate data produced by the grader.
-
type: Optional[str]The grader type (for example, "string-check-grader").
-
-
run_id: strThe identifier of the evaluation run associated with this output item.
-
sample: SampleA sample containing the input and output of the evaluation run.
-
error: EvalAPIErrorAn object representing an error response from the Eval API.
-
code: strThe error code.
-
message: strThe error message.
-
-
finish_reason: strThe reason why the sample generation was finished.
-
input: List[SampleInput]An array of input messages.
-
content: strThe content of the message.
-
role: strThe role of the message sender (e.g., system, user, developer).
-
-
max_completion_tokens: intThe maximum number of tokens allowed for completion.
-
model: strThe model used for generating the sample.
-
output: List[SampleOutput]An array of output messages.
-
content: Optional[str]The content of the message.
-
role: Optional[str]The role of the message (e.g. "system", "assistant", "user").
-
-
seed: intThe seed used for generating the sample.
-
temperature: floatThe sampling temperature used.
-
top_p: floatThe top_p value used for sampling.
-
usage: SampleUsageToken usage details for the sample.
-
cached_tokens: intThe number of tokens retrieved from cache.
-
completion_tokens: intThe number of completion tokens generated.
-
prompt_tokens: intThe number of prompt tokens used.
-
total_tokens: intThe total number of tokens used.
-
-
-
status: strThe status of the evaluation run.
-
Example
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
page = client.evals.runs.output_items.list(
run_id="run_id",
eval_id="eval_id",
)
page = page.data[0]
print(page.id)
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"datasource_item": {
"foo": "bar"
},
"datasource_item_id": 0,
"eval_id": "eval_id",
"object": "eval.run.output_item",
"results": [
{
"name": "name",
"passed": true,
"score": 0,
"sample": {
"foo": "bar"
},
"type": "type"
}
],
"run_id": "run_id",
"sample": {
"error": {
"code": "code",
"message": "message"
},
"finish_reason": "finish_reason",
"input": [
{
"content": "content",
"role": "role"
}
],
"max_completion_tokens": 0,
"model": "model",
"output": [
{
"content": "content",
"role": "role"
}
],
"seed": 0,
"temperature": 0,
"top_p": 0,
"usage": {
"cached_tokens": 0,
"completion_tokens": 0,
"prompt_tokens": 0,
"total_tokens": 0
}
},
"status": "status"
}
],
"first_id": "first_id",
"has_more": true,
"last_id": "last_id",
"object": "list"
}
Example
from openai import OpenAI
client = OpenAI()
output_items = client.evals.runs.output_items.list(
"egroup_67abd54d9b0081909a86353f6fb9317a",
"erun_67abd54d60ec8190832b46859da808f7"
)
print(output_items)
Response
{
"object": "list",
"data": [
{
"object": "eval.run.output_item",
"id": "outputitem_67e5796c28e081909917bf79f6e6214d",
"created_at": 1743092076,
"run_id": "evalrun_67abd54d60ec8190832b46859da808f7",
"eval_id": "eval_67abd54d9b0081909a86353f6fb9317a",
"status": "pass",
"datasource_item_id": 5,
"datasource_item": {
"input": "Stock Markets Rally After Positive Economic Data Released",
"ground_truth": "Markets"
},
"results": [
{
"name": "String check-a2486074-d803-4445-b431-ad2262e85d47",
"sample": null,
"passed": true,
"score": 1.0
}
],
"sample": {
"input": [
{
"role": "developer",
"content": "Categorize a given news headline into one of the following topics: Technology, Markets, World, Business, or Sports.\n\n# Steps\n\n1. Analyze the content of the news headline to understand its primary focus.\n2. Extract the subject matter, identifying any key indicators or keywords.\n3. Use the identified indicators to determine the most suitable category out of the five options: Technology, Markets, World, Business, or Sports.\n4. Ensure only one category is selected per headline.\n\n# Output Format\n\nRespond with the chosen category as a single word. For instance: \"Technology\", \"Markets\", \"World\", \"Business\", or \"Sports\".\n\n# Examples\n\n**Input**: \"Apple Unveils New iPhone Model, Featuring Advanced AI Features\" \n**Output**: \"Technology\"\n\n**Input**: \"Global Stocks Mixed as Investors Await Central Bank Decisions\" \n**Output**: \"Markets\"\n\n**Input**: \"War in Ukraine: Latest Updates on Negotiation Status\" \n**Output**: \"World\"\n\n**Input**: \"Microsoft in Talks to Acquire Gaming Company for $2 Billion\" \n**Output**: \"Business\"\n\n**Input**: \"Manchester United Secures Win in Premier League Football Match\" \n**Output**: \"Sports\" \n\n# Notes\n\n- If the headline appears to fit into more than one category, choose the most dominant theme.\n- Keywords or phrases such as \"stocks\", \"company acquisition\", \"match\", or technological brands can be good indicators for classification.\n",
"tool_call_id": null,
"tool_calls": null,
"function_call": null
},
{
"role": "user",
"content": "Stock Markets Rally After Positive Economic Data Released",
"tool_call_id": null,
"tool_calls": null,
"function_call": null
}
],
"output": [
{
"role": "assistant",
"content": "Markets",
"tool_call_id": null,
"tool_calls": null,
"function_call": null
}
],
"finish_reason": "stop",
"model": "gpt-4o-mini-2024-07-18",
"usage": {
"total_tokens": 325,
"completion_tokens": 2,
"prompt_tokens": 323,
"cached_tokens": 0
},
"error": null,
"temperature": 1.0,
"max_completion_tokens": 2048,
"top_p": 1.0,
"seed": 42
}
}
],
"first_id": "outputitem_67e5796c28e081909917bf79f6e6214d",
"last_id": "outputitem_67e5796c28e081909917bf79f6e6214d",
"has_more": true
}
Get an output item of an eval run
evals.runs.output_items.retrieve(stroutput_item_id, OutputItemRetrieveParams**kwargs) -> OutputItemRetrieveResponse
get /evals/{eval_id}/runs/{run_id}/output_items/{output_item_id}
Get an evaluation run output item by ID.
Parameters
-
eval_id: str -
run_id: str -
output_item_id: str
Returns
-
class OutputItemRetrieveResponse: …A schema representing an evaluation run output item.
-
id: strUnique identifier for the evaluation run output item.
-
created_at: intUnix timestamp (in seconds) when the evaluation run was created.
-
datasource_item: Dict[str, object]Details of the input data source item.
-
datasource_item_id: intThe identifier for the data source item.
-
eval_id: strThe identifier of the evaluation group.
-
object: Literal["eval.run.output_item"]The type of the object. Always "eval.run.output_item".
"eval.run.output_item"
-
results: List[Result]A list of grader results for this output item.
-
name: strThe name of the grader.
-
passed: boolWhether the grader considered the output a pass.
-
score: floatThe numeric score produced by the grader.
-
sample: Optional[Dict[str, object]]Optional sample or intermediate data produced by the grader.
-
type: Optional[str]The grader type (for example, "string-check-grader").
-
-
run_id: strThe identifier of the evaluation run associated with this output item.
-
sample: SampleA sample containing the input and output of the evaluation run.
-
error: EvalAPIErrorAn object representing an error response from the Eval API.
-
code: strThe error code.
-
message: strThe error message.
-
-
finish_reason: strThe reason why the sample generation was finished.
-
input: List[SampleInput]An array of input messages.
-
content: strThe content of the message.
-
role: strThe role of the message sender (e.g., system, user, developer).
-
-
max_completion_tokens: intThe maximum number of tokens allowed for completion.
-
model: strThe model used for generating the sample.
-
output: List[SampleOutput]An array of output messages.
-
content: Optional[str]The content of the message.
-
role: Optional[str]The role of the message (e.g. "system", "assistant", "user").
-
-
seed: intThe seed used for generating the sample.
-
temperature: floatThe sampling temperature used.
-
top_p: floatThe top_p value used for sampling.
-
usage: SampleUsageToken usage details for the sample.
-
cached_tokens: intThe number of tokens retrieved from cache.
-
completion_tokens: intThe number of completion tokens generated.
-
prompt_tokens: intThe number of prompt tokens used.
-
total_tokens: intThe total number of tokens used.
-
-
-
status: strThe status of the evaluation run.
-
Example
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
output_item = client.evals.runs.output_items.retrieve(
output_item_id="output_item_id",
eval_id="eval_id",
run_id="run_id",
)
print(output_item.id)
Response
{
"id": "id",
"created_at": 0,
"datasource_item": {
"foo": "bar"
},
"datasource_item_id": 0,
"eval_id": "eval_id",
"object": "eval.run.output_item",
"results": [
{
"name": "name",
"passed": true,
"score": 0,
"sample": {
"foo": "bar"
},
"type": "type"
}
],
"run_id": "run_id",
"sample": {
"error": {
"code": "code",
"message": "message"
},
"finish_reason": "finish_reason",
"input": [
{
"content": "content",
"role": "role"
}
],
"max_completion_tokens": 0,
"model": "model",
"output": [
{
"content": "content",
"role": "role"
}
],
"seed": 0,
"temperature": 0,
"top_p": 0,
"usage": {
"cached_tokens": 0,
"completion_tokens": 0,
"prompt_tokens": 0,
"total_tokens": 0
}
},
"status": "status"
}
Example
from openai import OpenAI
client = OpenAI()
output_item = client.evals.runs.output_items.retrieve(
"eval_67abd54d9b0081909a86353f6fb9317a",
"evalrun_67abd54d60ec8190832b46859da808f7",
"outputitem_67abd55eb6548190bb580745d5644a33"
)
print(output_item)
Response
{
"object": "eval.run.output_item",
"id": "outputitem_67e5796c28e081909917bf79f6e6214d",
"created_at": 1743092076,
"run_id": "evalrun_67abd54d60ec8190832b46859da808f7",
"eval_id": "eval_67abd54d9b0081909a86353f6fb9317a",
"status": "pass",
"datasource_item_id": 5,
"datasource_item": {
"input": "Stock Markets Rally After Positive Economic Data Released",
"ground_truth": "Markets"
},
"results": [
{
"name": "String check-a2486074-d803-4445-b431-ad2262e85d47",
"sample": null,
"passed": true,
"score": 1.0
}
],
"sample": {
"input": [
{
"role": "developer",
"content": "Categorize a given news headline into one of the following topics: Technology, Markets, World, Business, or Sports.\n\n# Steps\n\n1. Analyze the content of the news headline to understand its primary focus.\n2. Extract the subject matter, identifying any key indicators or keywords.\n3. Use the identified indicators to determine the most suitable category out of the five options: Technology, Markets, World, Business, or Sports.\n4. Ensure only one category is selected per headline.\n\n# Output Format\n\nRespond with the chosen category as a single word. For instance: \"Technology\", \"Markets\", \"World\", \"Business\", or \"Sports\".\n\n# Examples\n\n**Input**: \"Apple Unveils New iPhone Model, Featuring Advanced AI Features\" \n**Output**: \"Technology\"\n\n**Input**: \"Global Stocks Mixed as Investors Await Central Bank Decisions\" \n**Output**: \"Markets\"\n\n**Input**: \"War in Ukraine: Latest Updates on Negotiation Status\" \n**Output**: \"World\"\n\n**Input**: \"Microsoft in Talks to Acquire Gaming Company for $2 Billion\" \n**Output**: \"Business\"\n\n**Input**: \"Manchester United Secures Win in Premier League Football Match\" \n**Output**: \"Sports\" \n\n# Notes\n\n- If the headline appears to fit into more than one category, choose the most dominant theme.\n- Keywords or phrases such as \"stocks\", \"company acquisition\", \"match\", or technological brands can be good indicators for classification.\n",
"tool_call_id": null,
"tool_calls": null,
"function_call": null
},
{
"role": "user",
"content": "Stock Markets Rally After Positive Economic Data Released",
"tool_call_id": null,
"tool_calls": null,
"function_call": null
}
],
"output": [
{
"role": "assistant",
"content": "Markets",
"tool_call_id": null,
"tool_calls": null,
"function_call": null
}
],
"finish_reason": "stop",
"model": "gpt-4o-mini-2024-07-18",
"usage": {
"total_tokens": 325,
"completion_tokens": 2,
"prompt_tokens": 323,
"cached_tokens": 0
},
"error": null,
"temperature": 1.0,
"max_completion_tokens": 2048,
"top_p": 1.0,
"seed": 42
}
}
Domain Types
Output Item List Response
-
class OutputItemListResponse: …A schema representing an evaluation run output item.
-
id: strUnique identifier for the evaluation run output item.
-
created_at: intUnix timestamp (in seconds) when the evaluation run was created.
-
datasource_item: Dict[str, object]Details of the input data source item.
-
datasource_item_id: intThe identifier for the data source item.
-
eval_id: strThe identifier of the evaluation group.
-
object: Literal["eval.run.output_item"]The type of the object. Always "eval.run.output_item".
"eval.run.output_item"
-
results: List[Result]A list of grader results for this output item.
-
name: strThe name of the grader.
-
passed: boolWhether the grader considered the output a pass.
-
score: floatThe numeric score produced by the grader.
-
sample: Optional[Dict[str, object]]Optional sample or intermediate data produced by the grader.
-
type: Optional[str]The grader type (for example, "string-check-grader").
-
-
run_id: strThe identifier of the evaluation run associated with this output item.
-
sample: SampleA sample containing the input and output of the evaluation run.
-
error: EvalAPIErrorAn object representing an error response from the Eval API.
-
code: strThe error code.
-
message: strThe error message.
-
-
finish_reason: strThe reason why the sample generation was finished.
-
input: List[SampleInput]An array of input messages.
-
content: strThe content of the message.
-
role: strThe role of the message sender (e.g., system, user, developer).
-
-
max_completion_tokens: intThe maximum number of tokens allowed for completion.
-
model: strThe model used for generating the sample.
-
output: List[SampleOutput]An array of output messages.
-
content: Optional[str]The content of the message.
-
role: Optional[str]The role of the message (e.g. "system", "assistant", "user").
-
-
seed: intThe seed used for generating the sample.
-
temperature: floatThe sampling temperature used.
-
top_p: floatThe top_p value used for sampling.
-
usage: SampleUsageToken usage details for the sample.
-
cached_tokens: intThe number of tokens retrieved from cache.
-
completion_tokens: intThe number of completion tokens generated.
-
prompt_tokens: intThe number of prompt tokens used.
-
total_tokens: intThe total number of tokens used.
-
-
-
status: strThe status of the evaluation run.
-
Output Item Retrieve Response
-
class OutputItemRetrieveResponse: …A schema representing an evaluation run output item.
-
id: strUnique identifier for the evaluation run output item.
-
created_at: intUnix timestamp (in seconds) when the evaluation run was created.
-
datasource_item: Dict[str, object]Details of the input data source item.
-
datasource_item_id: intThe identifier for the data source item.
-
eval_id: strThe identifier of the evaluation group.
-
object: Literal["eval.run.output_item"]The type of the object. Always "eval.run.output_item".
"eval.run.output_item"
-
results: List[Result]A list of grader results for this output item.
-
name: strThe name of the grader.
-
passed: boolWhether the grader considered the output a pass.
-
score: floatThe numeric score produced by the grader.
-
sample: Optional[Dict[str, object]]Optional sample or intermediate data produced by the grader.
-
type: Optional[str]The grader type (for example, "string-check-grader").
-
-
run_id: strThe identifier of the evaluation run associated with this output item.
-
sample: SampleA sample containing the input and output of the evaluation run.
-
error: EvalAPIErrorAn object representing an error response from the Eval API.
-
code: strThe error code.
-
message: strThe error message.
-
-
finish_reason: strThe reason why the sample generation was finished.
-
input: List[SampleInput]An array of input messages.
-
content: strThe content of the message.
-
role: strThe role of the message sender (e.g., system, user, developer).
-
-
max_completion_tokens: intThe maximum number of tokens allowed for completion.
-
model: strThe model used for generating the sample.
-
output: List[SampleOutput]An array of output messages.
-
content: Optional[str]The content of the message.
-
role: Optional[str]The role of the message (e.g. "system", "assistant", "user").
-
-
seed: intThe seed used for generating the sample.
-
temperature: floatThe sampling temperature used.
-
top_p: floatThe top_p value used for sampling.
-
usage: SampleUsageToken usage details for the sample.
-
cached_tokens: intThe number of tokens retrieved from cache.
-
completion_tokens: intThe number of completion tokens generated.
-
prompt_tokens: intThe number of prompt tokens used.
-
total_tokens: intThe total number of tokens used.
-
-
-
status: strThe status of the evaluation run.
-