OpenAI Graders 评分器类型参考
本页汇总评测使用的评分器输入、评分器配置和嵌套字段。创建、运行和查询评测的接口见 Evals 接口参考。
评分器模型
类型定义
评分器输入(Grader Inputs)
GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more
输入项列表。每项可为输入文本、输出文本、图像输入或音频输入对象。
TextInput = string
给模型的文本输入。
ResponseInputText object { text, type, prompt_cache_breakpoint }
给模型的文本输入。
text: string
发送给模型的文本内容。
type: "input_text" (default: "input_text")
输入项类型,固定为 input_text。
"input_text"
prompt_cache_breakpoint: optional object { mode, ttl }
标记可复用提示词前缀的确切结尾。省略 ttl 时,断点沿用请求的 prompt_cache_options.ttl。边界保持在原位置,无需按词元块取整。
mode: "explicit" (default: "explicit")
断点模式,固定为 explicit。
"explicit"
ttl: optional "30m" or "12h"
此缓存断点的最短保留期限。默认沿用请求的 TTL。
"30m"
"12h"
OutputText object { text, type }
模型的文本输出。
text: string
模型输出的文本内容。
type: "output_text"
文本输出类型,固定为 output_text。
"output_text"
InputImage object { image_url, type, detail }
EvalItem 内容数组中的图像输入块。
image_url: string
输入图像的 URL。
format: uri
type: "input_image"
图像输入类型,固定为 input_image。
"input_image"
detail: optional string
发送给模型的图像细节级别,可取 high、low 或 auto,默认为 auto。
ResponseInputAudio object { input_audio, type }
给模型的音频输入。
input_audio: object { data, format }
data: string
以 Base64 编码的音频数据。
format: "mp3" or "wav"
音频数据格式,目前支持 mp3 和 wav。
"mp3"
"wav"
type: "input_audio"
输入项类型,固定为 input_audio。
"input_audio"
标签模型评分器(Label Model Grader)
LabelModelGrader object { input, labels, model, 3 more }
LabelModelGrader 使用模型为评测中的每一项分配标签。
input: array of object { content, role, type }
content: string or ResponseInputText or OutputText { text, type } or 3 more
模型输入,可包含模板字符串。支持文本、输出文本、图像输入和音频输入,可传单项或数组。
TextInput = string
给模型的文本输入。
ResponseInputText object { text, type, prompt_cache_breakpoint }
给模型的文本输入。
text: string
发送给模型的文本内容。
type: "input_text" (default: "input_text")
输入项类型,固定为 input_text。
"input_text"
prompt_cache_breakpoint: optional object { mode, ttl }
标记可复用提示词前缀的确切结尾。省略 ttl 时,断点沿用请求的 prompt_cache_options.ttl。边界保持在原位置,无需按词元块取整。
mode: "explicit" (default: "explicit")
断点模式,固定为 explicit。
"explicit"
ttl: optional "30m" or "12h"
此缓存断点的最短保留期限。默认沿用请求的 TTL。
"30m"
"12h"
OutputText object { text, type }
模型的文本输出。
text: string
模型输出的文本内容。
type: "output_text"
文本输出类型,固定为 output_text。
"output_text"
InputImage object { image_url, type, detail }
EvalItem 内容数组中的图像输入块。
image_url: string
输入图像的 URL。
format: uri
type: "input_image"
图像输入类型,固定为 input_image。
"input_image"
detail: optional string
发送给模型的图像细节级别,可取 high、low 或 auto,默认为 auto。
ResponseInputAudio object { input_audio, type }
给模型的音频输入。
input_audio: object { data, format }
data: string
以 Base64 编码的音频数据。
format: "mp3" or "wav"
音频数据格式,目前支持 mp3 和 wav。
"mp3"
"wav"
type: "input_audio"
输入项类型,固定为 input_audio。
"input_audio"
GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more
输入项列表。每项可为输入文本、输出文本、图像输入或音频输入对象。
TextInput = string
给模型的文本输入。
ResponseInputText object { text, type, prompt_cache_breakpoint }
给模型的文本输入。
OutputText object { text, type }
模型的文本输出。
text: string
模型输出的文本内容。
type: "output_text"
文本输出类型,固定为 output_text。
"output_text"
InputImage object { image_url, type, detail }
EvalItem 内容数组中的图像输入块。
image_url: string
输入图像的 URL。
format: uri
type: "input_image"
图像输入类型,固定为 input_image。
"input_image"
detail: optional string
发送给模型的图像细节级别,可取 high、low 或 auto,默认为 auto。
ResponseInputAudio object { input_audio, type }
给模型的音频输入。
role: "user" or "assistant" or "system" or "developer"
输入消息的角色,可取 user、assistant、system 或 developer。
"user"
"assistant"
"system"
"developer"
type: optional "message"
输入消息类型,固定为 message。
"message"
labels: array of string
可分配给各评测项的标签。
model: string
用于评测的模型,必须支持结构化输出。
name: string
评分器名称。
passing_labels: array of string
代表评测通过的标签,必须是全部标签的子集。
type: "label_model"
对象类型,固定为 label_model。
"label_model"
组合评分器(Multi Grader)
MultiGrader object { calculate_output, graders, name, type }
MultiGrader 合并多个评分器的结果,输出一个分数。
calculate_output: string
根据各评分器结果计算总分的公式。
graders: map[StringCheckGrader or TextSimilarityGrader or PythonGrader or 2 more]
StringCheckGrader object { input, name, operation, 2 more }
StringCheckGrader 按指定操作比较输入字符串与参考字符串。
input: string
输入文本,可包含模板字符串。
name: string
评分器名称。
operation: "eq" or "ne" or "like" or "ilike"
字符串比较操作,可取 eq、ne、like 或 ilike。
"eq"
"ne"
"like"
"ilike"
reference: string
参考文本,可包含模板字符串。
type: "string_check"
对象类型,固定为 string_check。
"string_check"
TextSimilarityGrader object { evaluation_metric, input, name, 2 more }
TextSimilarityGrader 按相似度指标对文本评分。
evaluation_metric: "cosine" or "fuzzy_match" or "bleu" or 8 more
评测指标,可取 cosine、fuzzy_match、bleu、gleu、meteor、rouge_1、rouge_2、rouge_3、rouge_4、rouge_5 或 rouge_l。
"cosine"
"fuzzy_match"
"bleu"
"gleu"
"meteor"
"rouge_1"
"rouge_2"
"rouge_3"
"rouge_4"
"rouge_5"
"rouge_l"
input: string
待评分的文本。
name: string
评分器名称。
reference: string
用于比较的参考文本。
type: "text_similarity" (default: "text_similarity")
评分器类型。
"text_similarity"
PythonGrader object { name, source, type, image_tag }
PythonGrader 运行 Python 脚本处理输入。
name: string
评分器名称。
source: string
Python 脚本的源代码。
type: "python"
对象类型,固定为 python。
"python"
image_tag: optional string
运行 Python 脚本时使用的镜像标签。
ScoreModelGrader object { input, model, name, 3 more }
ScoreModelGrader 使用模型为输入打分。
input: array of object { content, role, type }
待评分的输入消息。支持文本、输出文本、图像输入和音频输入内容块,可包含模板字符串。
content: string or ResponseInputText or OutputText { text, type } or 3 more
模型输入,可包含模板字符串。支持文本、输出文本、图像输入和音频输入,可传单项或数组。
TextInput = string
给模型的文本输入。
ResponseInputText object { text, type, prompt_cache_breakpoint }
给模型的文本输入。
text: string
发送给模型的文本内容。
type: "input_text" (default: "input_text")
输入项类型,固定为 input_text。
"input_text"
prompt_cache_breakpoint: optional object { mode, ttl }
标记可复用提示词前缀的确切结尾。省略 ttl 时,断点沿用请求的 prompt_cache_options.ttl。边界保持在原位置,无需按词元块取整。
mode: "explicit" (default: "explicit")
断点模式,固定为 explicit。
"explicit"
ttl: optional "30m" or "12h"
此缓存断点的最短保留期限。默认沿用请求的 TTL。
"30m"
"12h"
OutputText object { text, type }
模型的文本输出。
text: string
模型输出的文本内容。
type: "output_text"
文本输出类型,固定为 output_text。
"output_text"
InputImage object { image_url, type, detail }
EvalItem 内容数组中的图像输入块。
image_url: string
输入图像的 URL。
format: uri
type: "input_image"
图像输入类型,固定为 input_image。
"input_image"
detail: optional string
发送给模型的图像细节级别,可取 high、low 或 auto,默认为 auto。
ResponseInputAudio object { input_audio, type }
给模型的音频输入。
input_audio: object { data, format }
data: string
以 Base64 编码的音频数据。
format: "mp3" or "wav"
音频数据格式,目前支持 mp3 和 wav。
"mp3"
"wav"
type: "input_audio"
输入项类型,固定为 input_audio。
"input_audio"
GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more
输入项列表。每项可为输入文本、输出文本、图像输入或音频输入对象。
TextInput = string
给模型的文本输入。
ResponseInputText object { text, type, prompt_cache_breakpoint }
给模型的文本输入。
OutputText object { text, type }
模型的文本输出。
text: string
模型输出的文本内容。
type: "output_text"
文本输出类型,固定为 output_text。
"output_text"
InputImage object { image_url, type, detail }
EvalItem 内容数组中的图像输入块。
image_url: string
输入图像的 URL。
format: uri
type: "input_image"
图像输入类型,固定为 input_image。
"input_image"
detail: optional string
发送给模型的图像细节级别,可取 high、low 或 auto,默认为 auto。
ResponseInputAudio object { input_audio, type }
给模型的音频输入。
role: "user" or "assistant" or "system" or "developer"
输入消息的角色,可取 user、assistant、system 或 developer。
"user"
"assistant"
"system"
"developer"
type: optional "message"
输入消息类型,固定为 message。
"message"
model: string
用于评测的模型。
name: string
评分器名称。
type: "score_model"
对象类型,固定为 score_model。
"score_model"
range: optional array of number
分数范围必须提供两个数值,默认为 [0, 1]。
sampling_params: optional object { max_completions_tokens, reasoning_effort, seed, 2 more }
模型的采样参数。
max_completions_tokens: optional integer or null
评分模型生成响应时允许输出的最大词元数。
minimum: 1
reasoning_effort: optional ReasoningEffort or null (default: "medium")
用于限制推理模型的推理力度。目前支持 none、minimal、low、medium、high、xhigh 和 max。降低力度可缩短响应时间并减少推理词元用量。各模型的支持范围见推理模型指南。
"none"
"minimal"
"low"
"medium"
"high"
"xhigh"
"max"
seed: optional integer or null
采样时初始化随机过程所用的种子。
temperature: optional number or null
较高的温度会增加输出的随机性。
top_p: optional number or null (default: 1)
核采样可替代温度调节。取值 1.0 时涵盖所有词元。
LabelModelGrader object { input, labels, model, 3 more }
LabelModelGrader 使用模型为评测中的每一项分配标签。
input: array of object { content, role, type }
content: string or ResponseInputText or OutputText { text, type } or 3 more
模型输入,可包含模板字符串。支持文本、输出文本、图像输入和音频输入,可传单项或数组。
TextInput = string
给模型的文本输入。
ResponseInputText object { text, type, prompt_cache_breakpoint }
给模型的文本输入。
OutputText object { text, type }
模型的文本输出。
text: string
模型输出的文本内容。
type: "output_text"
文本输出类型,固定为 output_text。
"output_text"
InputImage object { image_url, type, detail }
EvalItem 内容数组中的图像输入块。
image_url: string
输入图像的 URL。
format: uri
type: "input_image"
图像输入类型,固定为 input_image。
"input_image"
detail: optional string
发送给模型的图像细节级别,可取 high、low 或 auto,默认为 auto。
ResponseInputAudio object { input_audio, type }
给模型的音频输入。
GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more
输入项列表。每项可为输入文本、输出文本、图像输入或音频输入对象。
role: "user" or "assistant" or "system" or "developer"
输入消息的角色,可取 user、assistant、system 或 developer。
"user"
"assistant"
"system"
"developer"
type: optional "message"
输入消息类型,固定为 message。
"message"
labels: array of string
可分配给各评测项的标签。
model: string
用于评测的模型,必须支持结构化输出。
name: string
评分器名称。
passing_labels: array of string
代表评测通过的标签,必须是全部标签的子集。
type: "label_model"
对象类型,固定为 label_model。
"label_model"
name: string
评分器名称。
type: "multi" (default: "multi")
对象类型,固定为 multi。
"multi"
Python 评分器(Python Grader)
PythonGrader object { name, source, type, image_tag }
PythonGrader 运行 Python 脚本处理输入。
name: string
评分器名称。
source: string
Python 脚本的源代码。
type: "python"
对象类型,固定为 python。
"python"
image_tag: optional string
运行 Python 脚本时使用的镜像标签。
分数模型评分器(Score Model Grader)
ScoreModelGrader object { input, model, name, 3 more }
ScoreModelGrader 使用模型为输入打分。
input: array of object { content, role, type }
待评分的输入消息。支持文本、输出文本、图像输入和音频输入内容块,可包含模板字符串。
content: string or ResponseInputText or OutputText { text, type } or 3 more
模型输入,可包含模板字符串。支持文本、输出文本、图像输入和音频输入,可传单项或数组。
TextInput = string
给模型的文本输入。
ResponseInputText object { text, type, prompt_cache_breakpoint }
给模型的文本输入。
text: string
发送给模型的文本内容。
type: "input_text" (default: "input_text")
输入项类型,固定为 input_text。
"input_text"
prompt_cache_breakpoint: optional object { mode, ttl }
标记可复用提示词前缀的确切结尾。省略 ttl 时,断点沿用请求的 prompt_cache_options.ttl。边界保持在原位置,无需按词元块取整。
mode: "explicit" (default: "explicit")
断点模式,固定为 explicit。
"explicit"
ttl: optional "30m" or "12h"
此缓存断点的最短保留期限。默认沿用请求的 TTL。
"30m"
"12h"
OutputText object { text, type }
模型的文本输出。
text: string
模型输出的文本内容。
type: "output_text"
文本输出类型,固定为 output_text。
"output_text"
InputImage object { image_url, type, detail }
EvalItem 内容数组中的图像输入块。
image_url: string
输入图像的 URL。
format: uri
type: "input_image"
图像输入类型,固定为 input_image。
"input_image"
detail: optional string
发送给模型的图像细节级别,可取 high、low 或 auto,默认为 auto。
ResponseInputAudio object { input_audio, type }
给模型的音频输入。
input_audio: object { data, format }
data: string
以 Base64 编码的音频数据。
format: "mp3" or "wav"
音频数据格式,目前支持 mp3 和 wav。
"mp3"
"wav"
type: "input_audio"
输入项类型,固定为 input_audio。
"input_audio"
GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more
输入项列表。每项可为输入文本、输出文本、图像输入或音频输入对象。
TextInput = string
给模型的文本输入。
ResponseInputText object { text, type, prompt_cache_breakpoint }
给模型的文本输入。
OutputText object { text, type }
模型的文本输出。
text: string
模型输出的文本内容。
type: "output_text"
文本输出类型,固定为 output_text。
"output_text"
InputImage object { image_url, type, detail }
EvalItem 内容数组中的图像输入块。
image_url: string
输入图像的 URL。
format: uri
type: "input_image"
图像输入类型,固定为 input_image。
"input_image"
detail: optional string
发送给模型的图像细节级别,可取 high、low 或 auto,默认为 auto。
ResponseInputAudio object { input_audio, type }
给模型的音频输入。
role: "user" or "assistant" or "system" or "developer"
输入消息的角色,可取 user、assistant、system 或 developer。
"user"
"assistant"
"system"
"developer"
type: optional "message"
输入消息类型,固定为 message。
"message"
model: string
用于评测的模型。
name: string
评分器名称。
type: "score_model"
对象类型,固定为 score_model。
"score_model"
range: optional array of number
分数范围必须提供两个数值,默认为 [0, 1]。
sampling_params: optional object { max_completions_tokens, reasoning_effort, seed, 2 more }
模型的采样参数。
max_completions_tokens: optional integer or null
评分模型生成响应时允许输出的最大词元数。
minimum: 1
reasoning_effort: optional ReasoningEffort or null (default: "medium")
用于限制推理模型的推理力度。目前支持 none、minimal、low、medium、high、xhigh 和 max。降低力度可缩短响应时间并减少推理词元用量。各模型的支持范围见推理模型指南。
"none"
"minimal"
"low"
"medium"
"high"
"xhigh"
"max"
seed: optional integer or null
采样时初始化随机过程所用的种子。
temperature: optional number or null
较高的温度会增加输出的随机性。
top_p: optional number or null (default: 1)
核采样可替代温度调节。取值 1.0 时涵盖所有词元。
字符串检查评分器(String Check Grader)
StringCheckGrader object { input, name, operation, 2 more }
StringCheckGrader 按指定操作比较输入字符串与参考字符串。
input: string
输入文本,可包含模板字符串。
name: string
评分器名称。
operation: "eq" or "ne" or "like" or "ilike"
字符串比较操作,可取 eq、ne、like 或 ilike。
"eq"
"ne"
"like"
"ilike"
reference: string
参考文本,可包含模板字符串。
type: "string_check"
对象类型,固定为 string_check。
"string_check"
文本相似度评分器(Text Similarity Grader)
TextSimilarityGrader object { evaluation_metric, input, name, 2 more }
TextSimilarityGrader 按相似度指标对文本评分。
evaluation_metric: "cosine" or "fuzzy_match" or "bleu" or 8 more
评测指标,可取 cosine、fuzzy_match、bleu、gleu、meteor、rouge_1、rouge_2、rouge_3、rouge_4、rouge_5 或 rouge_l。
"cosine"
"fuzzy_match"
"bleu"
"gleu"
"meteor"
"rouge_1"
"rouge_2"
"rouge_3"
"rouge_4"
"rouge_5"
"rouge_l"
input: string
待评分的文本。
name: string
评分器名称。
reference: string
用于比较的参考文本。
type: "text_similarity" (default: "text_similarity")
评分器类型。
"text_similarity"

TRAE-AI编程


更多建议: