SpyBara
Go Premium

go/resources/fine_tuning/subresources/alpha/index.md 2026-07-10 23:02 UTC to 2026-07-12 06:58 UTC

2 added, 2 removed.

2026
Fri 31 21:03 Thu 30 23:58 Wed 29 15:02 Sat 25 05:59 Thu 23 18:00 Wed 22 20:02 Mon 20 20:00 Fri 17 17:00 Thu 16 20:57 Wed 15 02:58 Tue 14 06:58 Mon 13 15:59 Sun 12 06:58 Fri 10 23:02 Thu 9 20:58 Tue 7 08:02

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 string

          The input text. This may include template strings.

        • Name string

          The name of the grader.

        • Operation StringCheckGraderOperation

          The string check operation to perform. One of eq, ne, like, or ilike.

          • const StringCheckGraderOperationEq StringCheckGraderOperation = "eq"

          • const StringCheckGraderOperationNe StringCheckGraderOperation = "ne"

          • const StringCheckGraderOperationLike StringCheckGraderOperation = "like"

          • const StringCheckGraderOperationIlike StringCheckGraderOperation = "ilike"

        • Reference string

          The reference text. This may include template strings.

        • Type StringCheck

          The 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 TextSimilarityGraderEvaluationMetric

          The evaluation metric to use. One of cosine, fuzzy_match, bleu, gleu, meteor, rouge_1, rouge_2, rouge_3, rouge_4, rouge_5, or rouge_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 string

          The text being graded.

        • Name string

          The name of the grader.

        • Reference string

          The text being graded against.

        • Type TextSimilarity

          The type of grader.

          • const TextSimilarityTextSimilarity TextSimilarity = "text_similarity"
      • type PythonGrader struct{…}

        A PythonGrader object that runs a python script on the input.

        • Name string

          The name of the grader.

        • Source string

          The source code of the python script.

        • Type Python

          The object type, which is always python.

          • const PythonPython Python = "python"
        • ImageTag string

          The 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 []ScoreModelGraderInput

          The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.

          • Content ScoreModelGraderInputContentUnion

            Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.

            • string

            • type ResponseInputText struct{…}

              A text input to the model.

              • Text string

                The text input to the model.

              • Type InputText

                The type of the input item. Always input_text.

                • const InputTextInputText InputText = "input_text"
              • PromptCacheBreakpoint ResponseInputTextPromptCacheBreakpoint

                Marks 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 Explicit

                  The breakpoint mode. Always explicit.

                  • const ExplicitExplicit Explicit = "explicit"
            • type ScoreModelGraderInputContentOutputText struct{…}

              A text output from the model.

              • Text string

                The text output from the model.

              • Type OutputText

                The 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 string

                The URL of the image input.

              • Type InputImage

                The type of the image input. Always input_image.

                • const InputImageInputImage InputImage = "input_image"
              • Detail string

                The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

            • type ResponseInputAudio struct{…}

              An audio input to the model.

              • InputAudio ResponseInputAudioInputAudio

                • Data string

                  Base64-encoded audio data.

                • Format string

                  The format of the audio data. Currently supported formats are mp3 and wav.

                  • const ResponseInputAudioInputAudioFormatMP3 ResponseInputAudioInputAudioFormat = "mp3"

                  • const ResponseInputAudioInputAudioFormatWAV ResponseInputAudioInputAudioFormat = "wav"

              • Type InputAudio

                The type of the input item. Always input_audio.

                • const InputAudioInputAudio InputAudio = "input_audio"
            • type GraderInputs []GraderInputUnion

              A 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 string

                  The text output from the model.

                • Type OutputText

                  The 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 string

                  The URL of the image input.

                • Type InputImage

                  The type of the image input. Always input_image.

                  • const InputImageInputImage InputImage = "input_image"
                • Detail string

                  The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

              • type ResponseInputAudio struct{…}

                An audio input to the model.

          • Role string

            The role of the message input. One of user, assistant, system, or developer.

            • const ScoreModelGraderInputRoleUser ScoreModelGraderInputRole = "user"

            • const ScoreModelGraderInputRoleAssistant ScoreModelGraderInputRole = "assistant"

            • const ScoreModelGraderInputRoleSystem ScoreModelGraderInputRole = "system"

            • const ScoreModelGraderInputRoleDeveloper ScoreModelGraderInputRole = "developer"

          • Type string

            The type of the message input. Always message.

            • const ScoreModelGraderInputTypeMessage ScoreModelGraderInputType = "message"
        • Model string

          The model to use for the evaluation.

        • Name string

          The name of the grader.

        • Type ScoreModel

          The object type, which is always score_model.

          • const ScoreModelScoreModel ScoreModel = "score_model"
        • Range []float64

          The range of the score. Defaults to [0, 1].

        • SamplingParams ScoreModelGraderSamplingParams

          The sampling parameters for the model.

          • MaxCompletionsTokens int64

            The maximum number of tokens the grader model may generate in its response.

          • ReasoningEffort ReasoningEffort

            Constrains effort on reasoning for reasoning models. Currently supported values are none, minimal, low, medium, high, xhigh, and max. 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 int64

            A seed value to initialize the randomness, during sampling.

          • Temperature float64

            A higher temperature increases randomness in the outputs.

          • TopP float64

            An 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 string

          A formula to calculate the output based on grader results.

        • Graders MultiGraderGradersUnion

          A 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 LabelModelGraderInputContentUnion

                Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.

                • string

                • type ResponseInputText struct{…}

                  A text input to the model.

                • type LabelModelGraderInputContentOutputText struct{…}

                  A text output from the model.

                  • Text string

                    The text output from the model.

                  • Type OutputText

                    The 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 string

                    The URL of the image input.

                  • Type InputImage

                    The type of the image input. Always input_image.

                    • const InputImageInputImage InputImage = "input_image"
                  • Detail string

                    The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

                • type ResponseInputAudio struct{…}

                  An audio input to the model.

                • type GraderInputs []GraderInputUnion

                  A list of inputs, each of which may be either an input text, output text, input image, or input audio object.

              • Role string

                The role of the message input. One of user, assistant, system, or developer.

                • const LabelModelGraderInputRoleUser LabelModelGraderInputRole = "user"

                • const LabelModelGraderInputRoleAssistant LabelModelGraderInputRole = "assistant"

                • const LabelModelGraderInputRoleSystem LabelModelGraderInputRole = "system"

                • const LabelModelGraderInputRoleDeveloper LabelModelGraderInputRole = "developer"

              • Type string

                The type of the message input. Always message.

                • const LabelModelGraderInputTypeMessage LabelModelGraderInputType = "message"
            • Labels []string

              The labels to assign to each item in the evaluation.

            • Model string

              The model to use for the evaluation. Must support structured outputs.

            • Name string

              The name of the grader.

            • PassingLabels []string

              The labels that indicate a passing result. Must be a subset of labels.

            • Type LabelModel

              The object type, which is always label_model.

              • const LabelModelLabelModel LabelModel = "label_model"
        • Name string

          The name of the grader.

        • Type Multi

          The 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 sample namespace. See the guide for more details. The output_json variable 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 item namespace. 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 string

          The input text. This may include template strings.

        • Name string

          The name of the grader.

        • Operation StringCheckGraderOperation

          The string check operation to perform. One of eq, ne, like, or ilike.

          • const StringCheckGraderOperationEq StringCheckGraderOperation = "eq"

          • const StringCheckGraderOperationNe StringCheckGraderOperation = "ne"

          • const StringCheckGraderOperationLike StringCheckGraderOperation = "like"

          • const StringCheckGraderOperationIlike StringCheckGraderOperation = "ilike"

        • Reference string

          The reference text. This may include template strings.

        • Type StringCheck

          The 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 TextSimilarityGraderEvaluationMetric

          The evaluation metric to use. One of cosine, fuzzy_match, bleu, gleu, meteor, rouge_1, rouge_2, rouge_3, rouge_4, rouge_5, or rouge_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 string

          The text being graded.

        • Name string

          The name of the grader.

        • Reference string

          The text being graded against.

        • Type TextSimilarity

          The type of grader.

          • const TextSimilarityTextSimilarity TextSimilarity = "text_similarity"
      • type PythonGrader struct{…}

        A PythonGrader object that runs a python script on the input.

        • Name string

          The name of the grader.

        • Source string

          The source code of the python script.

        • Type Python

          The object type, which is always python.

          • const PythonPython Python = "python"
        • ImageTag string

          The 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 []ScoreModelGraderInput

          The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.

          • Content ScoreModelGraderInputContentUnion

            Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.

            • string

            • type ResponseInputText struct{…}

              A text input to the model.

              • Text string

                The text input to the model.

              • Type InputText

                The type of the input item. Always input_text.

                • const InputTextInputText InputText = "input_text"
              • PromptCacheBreakpoint ResponseInputTextPromptCacheBreakpoint

                Marks 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 Explicit

                  The breakpoint mode. Always explicit.

                  • const ExplicitExplicit Explicit = "explicit"
            • type ScoreModelGraderInputContentOutputText struct{…}

              A text output from the model.

              • Text string

                The text output from the model.

              • Type OutputText

                The 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 string

                The URL of the image input.

              • Type InputImage

                The type of the image input. Always input_image.

                • const InputImageInputImage InputImage = "input_image"
              • Detail string

                The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

            • type ResponseInputAudio struct{…}

              An audio input to the model.

              • InputAudio ResponseInputAudioInputAudio

                • Data string

                  Base64-encoded audio data.

                • Format string

                  The format of the audio data. Currently supported formats are mp3 and wav.

                  • const ResponseInputAudioInputAudioFormatMP3 ResponseInputAudioInputAudioFormat = "mp3"

                  • const ResponseInputAudioInputAudioFormatWAV ResponseInputAudioInputAudioFormat = "wav"

              • Type InputAudio

                The type of the input item. Always input_audio.

                • const InputAudioInputAudio InputAudio = "input_audio"
            • type GraderInputs []GraderInputUnion

              A 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 string

                  The text output from the model.

                • Type OutputText

                  The 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 string

                  The URL of the image input.

                • Type InputImage

                  The type of the image input. Always input_image.

                  • const InputImageInputImage InputImage = "input_image"
                • Detail string

                  The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

              • type ResponseInputAudio struct{…}

                An audio input to the model.

          • Role string

            The role of the message input. One of user, assistant, system, or developer.

            • const ScoreModelGraderInputRoleUser ScoreModelGraderInputRole = "user"

            • const ScoreModelGraderInputRoleAssistant ScoreModelGraderInputRole = "assistant"

            • const ScoreModelGraderInputRoleSystem ScoreModelGraderInputRole = "system"

            • const ScoreModelGraderInputRoleDeveloper ScoreModelGraderInputRole = "developer"

          • Type string

            The type of the message input. Always message.

            • const ScoreModelGraderInputTypeMessage ScoreModelGraderInputType = "message"
        • Model string

          The model to use for the evaluation.

        • Name string

          The name of the grader.

        • Type ScoreModel

          The object type, which is always score_model.

          • const ScoreModelScoreModel ScoreModel = "score_model"
        • Range []float64

          The range of the score. Defaults to [0, 1].

        • SamplingParams ScoreModelGraderSamplingParams

          The sampling parameters for the model.

          • MaxCompletionsTokens int64

            The maximum number of tokens the grader model may generate in its response.

          • ReasoningEffort ReasoningEffort

            Constrains effort on reasoning for reasoning models. Currently supported values are none, minimal, low, medium, high, xhigh, and max. 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 int64

            A seed value to initialize the randomness, during sampling.

          • Temperature float64

            A higher temperature increases randomness in the outputs.

          • TopP float64

            An 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 string

          A formula to calculate the output based on grader results.

        • Graders MultiGraderGradersUnion

          A 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 LabelModelGraderInputContentUnion

                Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.

                • string

                • type ResponseInputText struct{…}

                  A text input to the model.

                • type LabelModelGraderInputContentOutputText struct{…}

                  A text output from the model.

                  • Text string

                    The text output from the model.

                  • Type OutputText

                    The 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 string

                    The URL of the image input.

                  • Type InputImage

                    The type of the image input. Always input_image.

                    • const InputImageInputImage InputImage = "input_image"
                  • Detail string

                    The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

                • type ResponseInputAudio struct{…}

                  An audio input to the model.

                • type GraderInputs []GraderInputUnion

                  A list of inputs, each of which may be either an input text, output text, input image, or input audio object.

              • Role string

                The role of the message input. One of user, assistant, system, or developer.

                • const LabelModelGraderInputRoleUser LabelModelGraderInputRole = "user"

                • const LabelModelGraderInputRoleAssistant LabelModelGraderInputRole = "assistant"

                • const LabelModelGraderInputRoleSystem LabelModelGraderInputRole = "system"

                • const LabelModelGraderInputRoleDeveloper LabelModelGraderInputRole = "developer"

              • Type string

                The type of the message input. Always message.

                • const LabelModelGraderInputTypeMessage LabelModelGraderInputType = "message"
            • Labels []string

              The labels to assign to each item in the evaluation.

            • Model string

              The model to use for the evaluation. Must support structured outputs.

            • Name string

              The name of the grader.

            • PassingLabels []string

              The labels that indicate a passing result. Must be a subset of labels.

            • Type LabelModel

              The object type, which is always label_model.

              • const LabelModelLabelModel LabelModel = "label_model"
        • Name string

          The name of the grader.

        • Type Multi

          The object type, which is always multi.

          • const MultiMulti Multi = "multi"

Returns

  • type FineTuningAlphaGraderValidateResponse struct{…}

    • Grader FineTuningAlphaGraderValidateResponseGraderUnion

      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 string

          The input text. This may include template strings.

        • Name string

          The name of the grader.

        • Operation StringCheckGraderOperation

          The string check operation to perform. One of eq, ne, like, or ilike.

          • const StringCheckGraderOperationEq StringCheckGraderOperation = "eq"

          • const StringCheckGraderOperationNe StringCheckGraderOperation = "ne"

          • const StringCheckGraderOperationLike StringCheckGraderOperation = "like"

          • const StringCheckGraderOperationIlike StringCheckGraderOperation = "ilike"

        • Reference string

          The reference text. This may include template strings.

        • Type StringCheck

          The 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 TextSimilarityGraderEvaluationMetric

          The evaluation metric to use. One of cosine, fuzzy_match, bleu, gleu, meteor, rouge_1, rouge_2, rouge_3, rouge_4, rouge_5, or rouge_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 string

          The text being graded.

        • Name string

          The name of the grader.

        • Reference string

          The text being graded against.

        • Type TextSimilarity

          The type of grader.

          • const TextSimilarityTextSimilarity TextSimilarity = "text_similarity"
      • type PythonGrader struct{…}

        A PythonGrader object that runs a python script on the input.

        • Name string

          The name of the grader.

        • Source string

          The source code of the python script.

        • Type Python

          The object type, which is always python.

          • const PythonPython Python = "python"
        • ImageTag string

          The 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 []ScoreModelGraderInput

          The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.

          • Content ScoreModelGraderInputContentUnion

            Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.

            • string

            • type ResponseInputText struct{…}

              A text input to the model.

              • Text string

                The text input to the model.

              • Type InputText

                The type of the input item. Always input_text.

                • const InputTextInputText InputText = "input_text"
              • PromptCacheBreakpoint ResponseInputTextPromptCacheBreakpoint

                Marks 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 Explicit

                  The breakpoint mode. Always explicit.

                  • const ExplicitExplicit Explicit = "explicit"
            • type ScoreModelGraderInputContentOutputText struct{…}

              A text output from the model.

              • Text string

                The text output from the model.

              • Type OutputText

                The 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 string

                The URL of the image input.

              • Type InputImage

                The type of the image input. Always input_image.

                • const InputImageInputImage InputImage = "input_image"
              • Detail string

                The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

            • type ResponseInputAudio struct{…}

              An audio input to the model.

              • InputAudio ResponseInputAudioInputAudio

                • Data string

                  Base64-encoded audio data.

                • Format string

                  The format of the audio data. Currently supported formats are mp3 and wav.

                  • const ResponseInputAudioInputAudioFormatMP3 ResponseInputAudioInputAudioFormat = "mp3"

                  • const ResponseInputAudioInputAudioFormatWAV ResponseInputAudioInputAudioFormat = "wav"

              • Type InputAudio

                The type of the input item. Always input_audio.

                • const InputAudioInputAudio InputAudio = "input_audio"
            • type GraderInputs []GraderInputUnion

              A 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 string

                  The text output from the model.

                • Type OutputText

                  The 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 string

                  The URL of the image input.

                • Type InputImage

                  The type of the image input. Always input_image.

                  • const InputImageInputImage InputImage = "input_image"
                • Detail string

                  The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

              • type ResponseInputAudio struct{…}

                An audio input to the model.

          • Role string

            The role of the message input. One of user, assistant, system, or developer.

            • const ScoreModelGraderInputRoleUser ScoreModelGraderInputRole = "user"

            • const ScoreModelGraderInputRoleAssistant ScoreModelGraderInputRole = "assistant"

            • const ScoreModelGraderInputRoleSystem ScoreModelGraderInputRole = "system"

            • const ScoreModelGraderInputRoleDeveloper ScoreModelGraderInputRole = "developer"

          • Type string

            The type of the message input. Always message.

            • const ScoreModelGraderInputTypeMessage ScoreModelGraderInputType = "message"
        • Model string

          The model to use for the evaluation.

        • Name string

          The name of the grader.

        • Type ScoreModel

          The object type, which is always score_model.

          • const ScoreModelScoreModel ScoreModel = "score_model"
        • Range []float64

          The range of the score. Defaults to [0, 1].

        • SamplingParams ScoreModelGraderSamplingParams

          The sampling parameters for the model.

          • MaxCompletionsTokens int64

            The maximum number of tokens the grader model may generate in its response.

          • ReasoningEffort ReasoningEffort

            Constrains effort on reasoning for reasoning models. Currently supported values are none, minimal, low, medium, high, xhigh, and max. 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 int64

            A seed value to initialize the randomness, during sampling.

          • Temperature float64

            A higher temperature increases randomness in the outputs.

          • TopP float64

            An 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 string

          A formula to calculate the output based on grader results.

        • Graders MultiGraderGradersUnion

          A 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 LabelModelGraderInputContentUnion

                Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.

                • string

                • type ResponseInputText struct{…}

                  A text input to the model.

                • type LabelModelGraderInputContentOutputText struct{…}

                  A text output from the model.

                  • Text string

                    The text output from the model.

                  • Type OutputText

                    The 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 string

                    The URL of the image input.

                  • Type InputImage

                    The type of the image input. Always input_image.

                    • const InputImageInputImage InputImage = "input_image"
                  • Detail string

                    The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

                • type ResponseInputAudio struct{…}

                  An audio input to the model.

                • type GraderInputs []GraderInputUnion

                  A list of inputs, each of which may be either an input text, output text, input image, or input audio object.

              • Role string

                The role of the message input. One of user, assistant, system, or developer.

                • const LabelModelGraderInputRoleUser LabelModelGraderInputRole = "user"

                • const LabelModelGraderInputRoleAssistant LabelModelGraderInputRole = "assistant"

                • const LabelModelGraderInputRoleSystem LabelModelGraderInputRole = "system"

                • const LabelModelGraderInputRoleDeveloper LabelModelGraderInputRole = "developer"

              • Type string

                The type of the message input. Always message.

                • const LabelModelGraderInputTypeMessage LabelModelGraderInputType = "message"
            • Labels []string

              The labels to assign to each item in the evaluation.

            • Model string

              The model to use for the evaluation. Must support structured outputs.

            • Name string

              The name of the grader.

            • PassingLabels []string

              The labels that indicate a passing result. Must be a subset of labels.

            • Type LabelModel

              The object type, which is always label_model.

              • const LabelModelLabelModel LabelModel = "label_model"
        • Name string

          The name of the grader.

        • Type Multi

          The 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"
  }
}