Alpha
Graders
Run grader
client.FineTuning.Alpha.Graders.Run(ctx, body) (*FineTuningAlphaGraderRunResponse, error)
post /fine_tuning/alpha/graders/run
Run a grader.
Parameters
-
body FineTuningAlphaGraderRunParams-
Grader param.Field[FineTuningAlphaGraderRunParamsGraderUnion]The grader used for the fine-tuning job.
-
type StringCheckGrader struct{…}A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
Input stringThe input text. This may include template strings.
-
Name stringThe name of the grader.
-
Operation StringCheckGraderOperationThe string check operation to perform. One of
eq,ne,like, orilike.-
const StringCheckGraderOperationEq StringCheckGraderOperation = "eq" -
const StringCheckGraderOperationNe StringCheckGraderOperation = "ne" -
const StringCheckGraderOperationLike StringCheckGraderOperation = "like" -
const StringCheckGraderOperationIlike StringCheckGraderOperation = "ilike"
-
-
Reference stringThe reference text. This may include template strings.
-
Type StringCheckThe object type, which is always
string_check.const StringCheckStringCheck StringCheck = "string_check"
-
-
type TextSimilarityGrader struct{…}A TextSimilarityGrader object which grades text based on similarity metrics.
-
EvaluationMetric TextSimilarityGraderEvaluationMetricThe evaluation metric to use. One of
cosine,fuzzy_match,bleu,gleu,meteor,rouge_1,rouge_2,rouge_3,rouge_4,rouge_5, orrouge_l.-
const TextSimilarityGraderEvaluationMetricCosine TextSimilarityGraderEvaluationMetric = "cosine" -
const TextSimilarityGraderEvaluationMetricFuzzyMatch TextSimilarityGraderEvaluationMetric = "fuzzy_match" -
const TextSimilarityGraderEvaluationMetricBleu TextSimilarityGraderEvaluationMetric = "bleu" -
const TextSimilarityGraderEvaluationMetricGleu TextSimilarityGraderEvaluationMetric = "gleu" -
const TextSimilarityGraderEvaluationMetricMeteor TextSimilarityGraderEvaluationMetric = "meteor" -
const TextSimilarityGraderEvaluationMetricRouge1 TextSimilarityGraderEvaluationMetric = "rouge_1" -
const TextSimilarityGraderEvaluationMetricRouge2 TextSimilarityGraderEvaluationMetric = "rouge_2" -
const TextSimilarityGraderEvaluationMetricRouge3 TextSimilarityGraderEvaluationMetric = "rouge_3" -
const TextSimilarityGraderEvaluationMetricRouge4 TextSimilarityGraderEvaluationMetric = "rouge_4" -
const TextSimilarityGraderEvaluationMetricRouge5 TextSimilarityGraderEvaluationMetric = "rouge_5" -
const TextSimilarityGraderEvaluationMetricRougeL TextSimilarityGraderEvaluationMetric = "rouge_l"
-
-
Input stringThe text being graded.
-
Name stringThe name of the grader.
-
Reference stringThe text being graded against.
-
Type TextSimilarityThe type of grader.
const TextSimilarityTextSimilarity TextSimilarity = "text_similarity"
-
-
type PythonGrader struct{…}A PythonGrader object that runs a python script on the input.
-
Name stringThe name of the grader.
-
Source stringThe source code of the python script.
-
Type PythonThe object type, which is always
python.const PythonPython Python = "python"
-
ImageTag stringThe image tag to use for the python script.
-
-
type ScoreModelGrader struct{…}A ScoreModelGrader object that uses a model to assign a score to the input.
-
Input []ScoreModelGraderInputThe input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.
-
Content ScoreModelGraderInputContentUnionInputs 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.
-
string -
type ResponseInputText struct{…}A text input to the model.
-
Text stringThe text input to the model.
-
Type InputTextThe type of the input item. Always
input_text.const InputTextInputText InputText = "input_text"
-
PromptCacheBreakpoint ResponseInputTextPromptCacheBreakpointMarks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's
prompt_cache_options.ttl; the boundary is not rounded to a token block.-
Mode ExplicitThe breakpoint mode. Always
explicit.const ExplicitExplicit Explicit = "explicit"
-
-
-
type ScoreModelGraderInputContentOutputText struct{…}A text output from the model.
-
Text stringThe text output from the model.
-
Type OutputTextThe type of the output text. Always
output_text.const OutputTextOutputText OutputText = "output_text"
-
-
type ScoreModelGraderInputContentInputImage struct{…}An image input block used within EvalItem content arrays.
-
ImageURL stringThe URL of the image input.
-
Type InputImageThe type of the image input. Always
input_image.const InputImageInputImage InputImage = "input_image"
-
Detail stringThe detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
type ResponseInputAudio struct{…}An audio input to the model.
-
InputAudio ResponseInputAudioInputAudio-
Data stringBase64-encoded audio data.
-
Format stringThe format of the audio data. Currently supported formats are
mp3andwav.-
const ResponseInputAudioInputAudioFormatMP3 ResponseInputAudioInputAudioFormat = "mp3" -
const ResponseInputAudioInputAudioFormatWAV ResponseInputAudioInputAudioFormat = "wav"
-
-
-
Type InputAudioThe type of the input item. Always
input_audio.const InputAudioInputAudio InputAudio = "input_audio"
-
-
type GraderInputs []GraderInputUnionA list of inputs, each of which may be either an input text, output text, input image, or input audio object.
-
string -
type ResponseInputText struct{…}A text input to the model.
-
type GraderInputOutputText struct{…}A text output from the model.
-
Text stringThe text output from the model.
-
Type OutputTextThe type of the output text. Always
output_text.const OutputTextOutputText OutputText = "output_text"
-
-
type GraderInputInputImage struct{…}An image input block used within EvalItem content arrays.
-
ImageURL stringThe URL of the image input.
-
Type InputImageThe type of the image input. Always
input_image.const InputImageInputImage InputImage = "input_image"
-
Detail stringThe detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
type ResponseInputAudio struct{…}An audio input to the model.
-
-
-
Role stringThe role of the message input. One of
user,assistant,system, ordeveloper.-
const ScoreModelGraderInputRoleUser ScoreModelGraderInputRole = "user" -
const ScoreModelGraderInputRoleAssistant ScoreModelGraderInputRole = "assistant" -
const ScoreModelGraderInputRoleSystem ScoreModelGraderInputRole = "system" -
const ScoreModelGraderInputRoleDeveloper ScoreModelGraderInputRole = "developer"
-
-
Type stringThe type of the message input. Always
message.const ScoreModelGraderInputTypeMessage ScoreModelGraderInputType = "message"
-
-
Model stringThe model to use for the evaluation.
-
Name stringThe name of the grader.
-
Type ScoreModelThe object type, which is always
score_model.const ScoreModelScoreModel ScoreModel = "score_model"
-
Range []float64The range of the score. Defaults to
[0, 1]. -
SamplingParams ScoreModelGraderSamplingParamsThe sampling parameters for the model.
-
MaxCompletionsTokens int64The maximum number of tokens the grader model may generate in its response.
-
ReasoningEffort ReasoningEffortConstrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high,xhigh, andmax. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response. Not all reasoning models support every value. See the reasoning guide for model-specific support.-
const ReasoningEffortNone ReasoningEffort = "none" -
const ReasoningEffortMinimal ReasoningEffort = "minimal" -
const ReasoningEffortLow ReasoningEffort = "low" -
const ReasoningEffortMedium ReasoningEffort = "medium" -
const ReasoningEffortHigh ReasoningEffort = "high" -
const ReasoningEffortXhigh ReasoningEffort = "xhigh" -
const ReasoningEffortMax ReasoningEffort = "max"
-
-
Seed int64A seed value to initialize the randomness, during sampling.
-
Temperature float64A higher temperature increases randomness in the outputs.
-
TopP float64An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
type MultiGrader struct{…}A MultiGrader object combines the output of multiple graders to produce a single score.
-
CalculateOutput stringA formula to calculate the output based on grader results.
-
Graders MultiGraderGradersUnionA StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
type StringCheckGrader struct{…}A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
type TextSimilarityGrader struct{…}A TextSimilarityGrader object which grades text based on similarity metrics.
-
type PythonGrader struct{…}A PythonGrader object that runs a python script on the input.
-
type ScoreModelGrader struct{…}A ScoreModelGrader object that uses a model to assign a score to the input.
-
type LabelModelGrader struct{…}A LabelModelGrader object which uses a model to assign labels to each item in the evaluation.
-
Input []LabelModelGraderInput-
Content LabelModelGraderInputContentUnionInputs 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.
-
string -
type ResponseInputText struct{…}A text input to the model.
-
type LabelModelGraderInputContentOutputText struct{…}A text output from the model.
-
Text stringThe text output from the model.
-
Type OutputTextThe type of the output text. Always
output_text.const OutputTextOutputText OutputText = "output_text"
-
-
type LabelModelGraderInputContentInputImage struct{…}An image input block used within EvalItem content arrays.
-
ImageURL stringThe URL of the image input.
-
Type InputImageThe type of the image input. Always
input_image.const InputImageInputImage InputImage = "input_image"
-
Detail stringThe detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
type ResponseInputAudio struct{…}An audio input to the model.
-
type GraderInputs []GraderInputUnionA list of inputs, each of which may be either an input text, output text, input image, or input audio object.
-
-
Role stringThe role of the message input. One of
user,assistant,system, ordeveloper.-
const LabelModelGraderInputRoleUser LabelModelGraderInputRole = "user" -
const LabelModelGraderInputRoleAssistant LabelModelGraderInputRole = "assistant" -
const LabelModelGraderInputRoleSystem LabelModelGraderInputRole = "system" -
const LabelModelGraderInputRoleDeveloper LabelModelGraderInputRole = "developer"
-
-
Type stringThe type of the message input. Always
message.const LabelModelGraderInputTypeMessage LabelModelGraderInputType = "message"
-
-
Labels []stringThe labels to assign to each item in the evaluation.
-
Model stringThe model to use for the evaluation. Must support structured outputs.
-
Name stringThe name of the grader.
-
PassingLabels []stringThe labels that indicate a passing result. Must be a subset of labels.
-
Type LabelModelThe object type, which is always
label_model.const LabelModelLabelModel LabelModel = "label_model"
-
-
-
Name stringThe name of the grader.
-
Type MultiThe object type, which is always
multi.const MultiMulti Multi = "multi"
-
-
-
ModelSample param.Field[string]The model sample to be evaluated. This value will be used to populate the
samplenamespace. See the guide for more details. Theoutput_jsonvariable will be populated if the model sample is a valid JSON string. -
Item param.Field[any]The dataset item provided to the grader. This will be used to populate the
itemnamespace. See the guide for more details.
-
Returns
-
type FineTuningAlphaGraderRunResponse struct{…}-
Metadata FineTuningAlphaGraderRunResponseMetadata-
Errors FineTuningAlphaGraderRunResponseMetadataErrors-
FormulaParseError bool -
InvalidVariableError bool -
ModelGraderParseError bool -
ModelGraderRefusalError bool -
ModelGraderServerError bool -
ModelGraderServerErrorDetails string -
OtherError bool -
PythonGraderRuntimeError bool -
PythonGraderRuntimeErrorDetails string -
PythonGraderServerError bool -
PythonGraderServerErrorType string -
SampleParseError bool -
TruncatedObservationError bool -
UnresponsiveRewardError bool
-
-
ExecutionTime float64 -
Name string -
SampledModelName string -
Scores map[string, any] -
TokenUsage int64 -
Type string
-
-
ModelGraderTokenUsagePerModel map[string, any] -
Reward float64 -
SubRewards map[string, any]
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.FineTuning.Alpha.Graders.Run(context.TODO(), openai.FineTuningAlphaGraderRunParams{
Grader: openai.FineTuningAlphaGraderRunParamsGraderUnion{
OfStringCheck: &openai.StringCheckGraderParam{
Input: "input",
Name: "name",
Operation: openai.StringCheckGraderOperationEq,
Reference: "reference",
},
},
ModelSample: "model_sample",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Metadata)
}
Response
{
"metadata": {
"errors": {
"formula_parse_error": true,
"invalid_variable_error": true,
"model_grader_parse_error": true,
"model_grader_refusal_error": true,
"model_grader_server_error": true,
"model_grader_server_error_details": "model_grader_server_error_details",
"other_error": true,
"python_grader_runtime_error": true,
"python_grader_runtime_error_details": "python_grader_runtime_error_details",
"python_grader_server_error": true,
"python_grader_server_error_type": "python_grader_server_error_type",
"sample_parse_error": true,
"truncated_observation_error": true,
"unresponsive_reward_error": true
},
"execution_time": 0,
"name": "name",
"sampled_model_name": "sampled_model_name",
"scores": {
"foo": "bar"
},
"token_usage": 0,
"type": "type"
},
"model_grader_token_usage_per_model": {
"foo": "bar"
},
"reward": 0,
"sub_rewards": {
"foo": "bar"
}
}
Validate grader
client.FineTuning.Alpha.Graders.Validate(ctx, body) (*FineTuningAlphaGraderValidateResponse, error)
post /fine_tuning/alpha/graders/validate
Validate a grader.
Parameters
-
body FineTuningAlphaGraderValidateParams-
Grader param.Field[FineTuningAlphaGraderValidateParamsGraderUnion]The grader used for the fine-tuning job.
-
type StringCheckGrader struct{…}A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
Input stringThe input text. This may include template strings.
-
Name stringThe name of the grader.
-
Operation StringCheckGraderOperationThe string check operation to perform. One of
eq,ne,like, orilike.-
const StringCheckGraderOperationEq StringCheckGraderOperation = "eq" -
const StringCheckGraderOperationNe StringCheckGraderOperation = "ne" -
const StringCheckGraderOperationLike StringCheckGraderOperation = "like" -
const StringCheckGraderOperationIlike StringCheckGraderOperation = "ilike"
-
-
Reference stringThe reference text. This may include template strings.
-
Type StringCheckThe object type, which is always
string_check.const StringCheckStringCheck StringCheck = "string_check"
-
-
type TextSimilarityGrader struct{…}A TextSimilarityGrader object which grades text based on similarity metrics.
-
EvaluationMetric TextSimilarityGraderEvaluationMetricThe evaluation metric to use. One of
cosine,fuzzy_match,bleu,gleu,meteor,rouge_1,rouge_2,rouge_3,rouge_4,rouge_5, orrouge_l.-
const TextSimilarityGraderEvaluationMetricCosine TextSimilarityGraderEvaluationMetric = "cosine" -
const TextSimilarityGraderEvaluationMetricFuzzyMatch TextSimilarityGraderEvaluationMetric = "fuzzy_match" -
const TextSimilarityGraderEvaluationMetricBleu TextSimilarityGraderEvaluationMetric = "bleu" -
const TextSimilarityGraderEvaluationMetricGleu TextSimilarityGraderEvaluationMetric = "gleu" -
const TextSimilarityGraderEvaluationMetricMeteor TextSimilarityGraderEvaluationMetric = "meteor" -
const TextSimilarityGraderEvaluationMetricRouge1 TextSimilarityGraderEvaluationMetric = "rouge_1" -
const TextSimilarityGraderEvaluationMetricRouge2 TextSimilarityGraderEvaluationMetric = "rouge_2" -
const TextSimilarityGraderEvaluationMetricRouge3 TextSimilarityGraderEvaluationMetric = "rouge_3" -
const TextSimilarityGraderEvaluationMetricRouge4 TextSimilarityGraderEvaluationMetric = "rouge_4" -
const TextSimilarityGraderEvaluationMetricRouge5 TextSimilarityGraderEvaluationMetric = "rouge_5" -
const TextSimilarityGraderEvaluationMetricRougeL TextSimilarityGraderEvaluationMetric = "rouge_l"
-
-
Input stringThe text being graded.
-
Name stringThe name of the grader.
-
Reference stringThe text being graded against.
-
Type TextSimilarityThe type of grader.
const TextSimilarityTextSimilarity TextSimilarity = "text_similarity"
-
-
type PythonGrader struct{…}A PythonGrader object that runs a python script on the input.
-
Name stringThe name of the grader.
-
Source stringThe source code of the python script.
-
Type PythonThe object type, which is always
python.const PythonPython Python = "python"
-
ImageTag stringThe image tag to use for the python script.
-
-
type ScoreModelGrader struct{…}A ScoreModelGrader object that uses a model to assign a score to the input.
-
Input []ScoreModelGraderInputThe input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.
-
Content ScoreModelGraderInputContentUnionInputs 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.
-
string -
type ResponseInputText struct{…}A text input to the model.
-
Text stringThe text input to the model.
-
Type InputTextThe type of the input item. Always
input_text.const InputTextInputText InputText = "input_text"
-
PromptCacheBreakpoint ResponseInputTextPromptCacheBreakpointMarks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's
prompt_cache_options.ttl; the boundary is not rounded to a token block.-
Mode ExplicitThe breakpoint mode. Always
explicit.const ExplicitExplicit Explicit = "explicit"
-
-
-
type ScoreModelGraderInputContentOutputText struct{…}A text output from the model.
-
Text stringThe text output from the model.
-
Type OutputTextThe type of the output text. Always
output_text.const OutputTextOutputText OutputText = "output_text"
-
-
type ScoreModelGraderInputContentInputImage struct{…}An image input block used within EvalItem content arrays.
-
ImageURL stringThe URL of the image input.
-
Type InputImageThe type of the image input. Always
input_image.const InputImageInputImage InputImage = "input_image"
-
Detail stringThe detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
type ResponseInputAudio struct{…}An audio input to the model.
-
InputAudio ResponseInputAudioInputAudio-
Data stringBase64-encoded audio data.
-
Format stringThe format of the audio data. Currently supported formats are
mp3andwav.-
const ResponseInputAudioInputAudioFormatMP3 ResponseInputAudioInputAudioFormat = "mp3" -
const ResponseInputAudioInputAudioFormatWAV ResponseInputAudioInputAudioFormat = "wav"
-
-
-
Type InputAudioThe type of the input item. Always
input_audio.const InputAudioInputAudio InputAudio = "input_audio"
-
-
type GraderInputs []GraderInputUnionA list of inputs, each of which may be either an input text, output text, input image, or input audio object.
-
string -
type ResponseInputText struct{…}A text input to the model.
-
type GraderInputOutputText struct{…}A text output from the model.
-
Text stringThe text output from the model.
-
Type OutputTextThe type of the output text. Always
output_text.const OutputTextOutputText OutputText = "output_text"
-
-
type GraderInputInputImage struct{…}An image input block used within EvalItem content arrays.
-
ImageURL stringThe URL of the image input.
-
Type InputImageThe type of the image input. Always
input_image.const InputImageInputImage InputImage = "input_image"
-
Detail stringThe detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
type ResponseInputAudio struct{…}An audio input to the model.
-
-
-
Role stringThe role of the message input. One of
user,assistant,system, ordeveloper.-
const ScoreModelGraderInputRoleUser ScoreModelGraderInputRole = "user" -
const ScoreModelGraderInputRoleAssistant ScoreModelGraderInputRole = "assistant" -
const ScoreModelGraderInputRoleSystem ScoreModelGraderInputRole = "system" -
const ScoreModelGraderInputRoleDeveloper ScoreModelGraderInputRole = "developer"
-
-
Type stringThe type of the message input. Always
message.const ScoreModelGraderInputTypeMessage ScoreModelGraderInputType = "message"
-
-
Model stringThe model to use for the evaluation.
-
Name stringThe name of the grader.
-
Type ScoreModelThe object type, which is always
score_model.const ScoreModelScoreModel ScoreModel = "score_model"
-
Range []float64The range of the score. Defaults to
[0, 1]. -
SamplingParams ScoreModelGraderSamplingParamsThe sampling parameters for the model.
-
MaxCompletionsTokens int64The maximum number of tokens the grader model may generate in its response.
-
ReasoningEffort ReasoningEffortConstrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high,xhigh, andmax. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response. Not all reasoning models support every value. See the reasoning guide for model-specific support.-
const ReasoningEffortNone ReasoningEffort = "none" -
const ReasoningEffortMinimal ReasoningEffort = "minimal" -
const ReasoningEffortLow ReasoningEffort = "low" -
const ReasoningEffortMedium ReasoningEffort = "medium" -
const ReasoningEffortHigh ReasoningEffort = "high" -
const ReasoningEffortXhigh ReasoningEffort = "xhigh" -
const ReasoningEffortMax ReasoningEffort = "max"
-
-
Seed int64A seed value to initialize the randomness, during sampling.
-
Temperature float64A higher temperature increases randomness in the outputs.
-
TopP float64An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
type MultiGrader struct{…}A MultiGrader object combines the output of multiple graders to produce a single score.
-
CalculateOutput stringA formula to calculate the output based on grader results.
-
Graders MultiGraderGradersUnionA StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
type StringCheckGrader struct{…}A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
type TextSimilarityGrader struct{…}A TextSimilarityGrader object which grades text based on similarity metrics.
-
type PythonGrader struct{…}A PythonGrader object that runs a python script on the input.
-
type ScoreModelGrader struct{…}A ScoreModelGrader object that uses a model to assign a score to the input.
-
type LabelModelGrader struct{…}A LabelModelGrader object which uses a model to assign labels to each item in the evaluation.
-
Input []LabelModelGraderInput-
Content LabelModelGraderInputContentUnionInputs 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.
-
string -
type ResponseInputText struct{…}A text input to the model.
-
type LabelModelGraderInputContentOutputText struct{…}A text output from the model.
-
Text stringThe text output from the model.
-
Type OutputTextThe type of the output text. Always
output_text.const OutputTextOutputText OutputText = "output_text"
-
-
type LabelModelGraderInputContentInputImage struct{…}An image input block used within EvalItem content arrays.
-
ImageURL stringThe URL of the image input.
-
Type InputImageThe type of the image input. Always
input_image.const InputImageInputImage InputImage = "input_image"
-
Detail stringThe detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
type ResponseInputAudio struct{…}An audio input to the model.
-
type GraderInputs []GraderInputUnionA list of inputs, each of which may be either an input text, output text, input image, or input audio object.
-
-
Role stringThe role of the message input. One of
user,assistant,system, ordeveloper.-
const LabelModelGraderInputRoleUser LabelModelGraderInputRole = "user" -
const LabelModelGraderInputRoleAssistant LabelModelGraderInputRole = "assistant" -
const LabelModelGraderInputRoleSystem LabelModelGraderInputRole = "system" -
const LabelModelGraderInputRoleDeveloper LabelModelGraderInputRole = "developer"
-
-
Type stringThe type of the message input. Always
message.const LabelModelGraderInputTypeMessage LabelModelGraderInputType = "message"
-
-
Labels []stringThe labels to assign to each item in the evaluation.
-
Model stringThe model to use for the evaluation. Must support structured outputs.
-
Name stringThe name of the grader.
-
PassingLabels []stringThe labels that indicate a passing result. Must be a subset of labels.
-
Type LabelModelThe object type, which is always
label_model.const LabelModelLabelModel LabelModel = "label_model"
-
-
-
Name stringThe name of the grader.
-
Type MultiThe object type, which is always
multi.const MultiMulti Multi = "multi"
-
-
-
Returns
-
type FineTuningAlphaGraderValidateResponse struct{…}-
Grader FineTuningAlphaGraderValidateResponseGraderUnionThe grader used for the fine-tuning job.
-
type StringCheckGrader struct{…}A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
Input stringThe input text. This may include template strings.
-
Name stringThe name of the grader.
-
Operation StringCheckGraderOperationThe string check operation to perform. One of
eq,ne,like, orilike.-
const StringCheckGraderOperationEq StringCheckGraderOperation = "eq" -
const StringCheckGraderOperationNe StringCheckGraderOperation = "ne" -
const StringCheckGraderOperationLike StringCheckGraderOperation = "like" -
const StringCheckGraderOperationIlike StringCheckGraderOperation = "ilike"
-
-
Reference stringThe reference text. This may include template strings.
-
Type StringCheckThe object type, which is always
string_check.const StringCheckStringCheck StringCheck = "string_check"
-
-
type TextSimilarityGrader struct{…}A TextSimilarityGrader object which grades text based on similarity metrics.
-
EvaluationMetric TextSimilarityGraderEvaluationMetricThe evaluation metric to use. One of
cosine,fuzzy_match,bleu,gleu,meteor,rouge_1,rouge_2,rouge_3,rouge_4,rouge_5, orrouge_l.-
const TextSimilarityGraderEvaluationMetricCosine TextSimilarityGraderEvaluationMetric = "cosine" -
const TextSimilarityGraderEvaluationMetricFuzzyMatch TextSimilarityGraderEvaluationMetric = "fuzzy_match" -
const TextSimilarityGraderEvaluationMetricBleu TextSimilarityGraderEvaluationMetric = "bleu" -
const TextSimilarityGraderEvaluationMetricGleu TextSimilarityGraderEvaluationMetric = "gleu" -
const TextSimilarityGraderEvaluationMetricMeteor TextSimilarityGraderEvaluationMetric = "meteor" -
const TextSimilarityGraderEvaluationMetricRouge1 TextSimilarityGraderEvaluationMetric = "rouge_1" -
const TextSimilarityGraderEvaluationMetricRouge2 TextSimilarityGraderEvaluationMetric = "rouge_2" -
const TextSimilarityGraderEvaluationMetricRouge3 TextSimilarityGraderEvaluationMetric = "rouge_3" -
const TextSimilarityGraderEvaluationMetricRouge4 TextSimilarityGraderEvaluationMetric = "rouge_4" -
const TextSimilarityGraderEvaluationMetricRouge5 TextSimilarityGraderEvaluationMetric = "rouge_5" -
const TextSimilarityGraderEvaluationMetricRougeL TextSimilarityGraderEvaluationMetric = "rouge_l"
-
-
Input stringThe text being graded.
-
Name stringThe name of the grader.
-
Reference stringThe text being graded against.
-
Type TextSimilarityThe type of grader.
const TextSimilarityTextSimilarity TextSimilarity = "text_similarity"
-
-
type PythonGrader struct{…}A PythonGrader object that runs a python script on the input.
-
Name stringThe name of the grader.
-
Source stringThe source code of the python script.
-
Type PythonThe object type, which is always
python.const PythonPython Python = "python"
-
ImageTag stringThe image tag to use for the python script.
-
-
type ScoreModelGrader struct{…}A ScoreModelGrader object that uses a model to assign a score to the input.
-
Input []ScoreModelGraderInputThe input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.
-
Content ScoreModelGraderInputContentUnionInputs 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.
-
string -
type ResponseInputText struct{…}A text input to the model.
-
Text stringThe text input to the model.
-
Type InputTextThe type of the input item. Always
input_text.const InputTextInputText InputText = "input_text"
-
PromptCacheBreakpoint ResponseInputTextPromptCacheBreakpointMarks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's
prompt_cache_options.ttl; the boundary is not rounded to a token block.-
Mode ExplicitThe breakpoint mode. Always
explicit.const ExplicitExplicit Explicit = "explicit"
-
-
-
type ScoreModelGraderInputContentOutputText struct{…}A text output from the model.
-
Text stringThe text output from the model.
-
Type OutputTextThe type of the output text. Always
output_text.const OutputTextOutputText OutputText = "output_text"
-
-
type ScoreModelGraderInputContentInputImage struct{…}An image input block used within EvalItem content arrays.
-
ImageURL stringThe URL of the image input.
-
Type InputImageThe type of the image input. Always
input_image.const InputImageInputImage InputImage = "input_image"
-
Detail stringThe detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
type ResponseInputAudio struct{…}An audio input to the model.
-
InputAudio ResponseInputAudioInputAudio-
Data stringBase64-encoded audio data.
-
Format stringThe format of the audio data. Currently supported formats are
mp3andwav.-
const ResponseInputAudioInputAudioFormatMP3 ResponseInputAudioInputAudioFormat = "mp3" -
const ResponseInputAudioInputAudioFormatWAV ResponseInputAudioInputAudioFormat = "wav"
-
-
-
Type InputAudioThe type of the input item. Always
input_audio.const InputAudioInputAudio InputAudio = "input_audio"
-
-
type GraderInputs []GraderInputUnionA list of inputs, each of which may be either an input text, output text, input image, or input audio object.
-
string -
type ResponseInputText struct{…}A text input to the model.
-
type GraderInputOutputText struct{…}A text output from the model.
-
Text stringThe text output from the model.
-
Type OutputTextThe type of the output text. Always
output_text.const OutputTextOutputText OutputText = "output_text"
-
-
type GraderInputInputImage struct{…}An image input block used within EvalItem content arrays.
-
ImageURL stringThe URL of the image input.
-
Type InputImageThe type of the image input. Always
input_image.const InputImageInputImage InputImage = "input_image"
-
Detail stringThe detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
type ResponseInputAudio struct{…}An audio input to the model.
-
-
-
Role stringThe role of the message input. One of
user,assistant,system, ordeveloper.-
const ScoreModelGraderInputRoleUser ScoreModelGraderInputRole = "user" -
const ScoreModelGraderInputRoleAssistant ScoreModelGraderInputRole = "assistant" -
const ScoreModelGraderInputRoleSystem ScoreModelGraderInputRole = "system" -
const ScoreModelGraderInputRoleDeveloper ScoreModelGraderInputRole = "developer"
-
-
Type stringThe type of the message input. Always
message.const ScoreModelGraderInputTypeMessage ScoreModelGraderInputType = "message"
-
-
Model stringThe model to use for the evaluation.
-
Name stringThe name of the grader.
-
Type ScoreModelThe object type, which is always
score_model.const ScoreModelScoreModel ScoreModel = "score_model"
-
Range []float64The range of the score. Defaults to
[0, 1]. -
SamplingParams ScoreModelGraderSamplingParamsThe sampling parameters for the model.
-
MaxCompletionsTokens int64The maximum number of tokens the grader model may generate in its response.
-
ReasoningEffort ReasoningEffortConstrains effort on reasoning for reasoning models. Currently supported values are
none,minimal,low,medium,high,xhigh, andmax. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response. Not all reasoning models support every value. See the reasoning guide for model-specific support.-
const ReasoningEffortNone ReasoningEffort = "none" -
const ReasoningEffortMinimal ReasoningEffort = "minimal" -
const ReasoningEffortLow ReasoningEffort = "low" -
const ReasoningEffortMedium ReasoningEffort = "medium" -
const ReasoningEffortHigh ReasoningEffort = "high" -
const ReasoningEffortXhigh ReasoningEffort = "xhigh" -
const ReasoningEffortMax ReasoningEffort = "max"
-
-
Seed int64A seed value to initialize the randomness, during sampling.
-
Temperature float64A higher temperature increases randomness in the outputs.
-
TopP float64An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
type MultiGrader struct{…}A MultiGrader object combines the output of multiple graders to produce a single score.
-
CalculateOutput stringA formula to calculate the output based on grader results.
-
Graders MultiGraderGradersUnionA StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
type StringCheckGrader struct{…}A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
type TextSimilarityGrader struct{…}A TextSimilarityGrader object which grades text based on similarity metrics.
-
type PythonGrader struct{…}A PythonGrader object that runs a python script on the input.
-
type ScoreModelGrader struct{…}A ScoreModelGrader object that uses a model to assign a score to the input.
-
type LabelModelGrader struct{…}A LabelModelGrader object which uses a model to assign labels to each item in the evaluation.
-
Input []LabelModelGraderInput-
Content LabelModelGraderInputContentUnionInputs 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.
-
string -
type ResponseInputText struct{…}A text input to the model.
-
type LabelModelGraderInputContentOutputText struct{…}A text output from the model.
-
Text stringThe text output from the model.
-
Type OutputTextThe type of the output text. Always
output_text.const OutputTextOutputText OutputText = "output_text"
-
-
type LabelModelGraderInputContentInputImage struct{…}An image input block used within EvalItem content arrays.
-
ImageURL stringThe URL of the image input.
-
Type InputImageThe type of the image input. Always
input_image.const InputImageInputImage InputImage = "input_image"
-
Detail stringThe detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
type ResponseInputAudio struct{…}An audio input to the model.
-
type GraderInputs []GraderInputUnionA list of inputs, each of which may be either an input text, output text, input image, or input audio object.
-
-
Role stringThe role of the message input. One of
user,assistant,system, ordeveloper.-
const LabelModelGraderInputRoleUser LabelModelGraderInputRole = "user" -
const LabelModelGraderInputRoleAssistant LabelModelGraderInputRole = "assistant" -
const LabelModelGraderInputRoleSystem LabelModelGraderInputRole = "system" -
const LabelModelGraderInputRoleDeveloper LabelModelGraderInputRole = "developer"
-
-
Type stringThe type of the message input. Always
message.const LabelModelGraderInputTypeMessage LabelModelGraderInputType = "message"
-
-
Labels []stringThe labels to assign to each item in the evaluation.
-
Model stringThe model to use for the evaluation. Must support structured outputs.
-
Name stringThe name of the grader.
-
PassingLabels []stringThe labels that indicate a passing result. Must be a subset of labels.
-
Type LabelModelThe object type, which is always
label_model.const LabelModelLabelModel LabelModel = "label_model"
-
-
-
Name stringThe name of the grader.
-
Type MultiThe object type, which is always
multi.const MultiMulti Multi = "multi"
-
-
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.FineTuning.Alpha.Graders.Validate(context.TODO(), openai.FineTuningAlphaGraderValidateParams{
Grader: openai.FineTuningAlphaGraderValidateParamsGraderUnion{
OfStringCheckGrader: &openai.StringCheckGraderParam{
Input: "input",
Name: "name",
Operation: openai.StringCheckGraderOperationEq,
Reference: "reference",
},
},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Grader)
}
Response
{
"grader": {
"input": "input",
"name": "name",
"operation": "eq",
"reference": "reference",
"type": "string_check"
}
}