Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Validate grader

fine_tuning.alpha.graders.validate(GraderValidateParams**kwargs) -> GraderValidateResponse
POST/fine_tuning/alpha/graders/validate

Validate a grader.

ParametersExpand Collapse
grader: Grader

The grader used for the fine-tuning job.

One of the following:
class StringCheckGrader: …

A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.

class TextSimilarityGrader: …

A TextSimilarityGrader object which grades text based on similarity metrics.

class PythonGrader: …

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

class ScoreModelGrader: …

A ScoreModelGrader object that uses a model to assign a score to the input.

class MultiGrader: …

A MultiGrader object combines the output of multiple graders to produce a single score.

ReturnsExpand Collapse
class GraderValidateResponse: …
grader: Optional[Grader]

The grader used for the fine-tuning job.

Validate grader

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
response = client.fine_tuning.alpha.graders.validate(
    grader={
        "input": "input",
        "name": "name",
        "operation": "eq",
        "reference": "reference",
        "type": "string_check",
    },
)
print(response.grader)
{
  "grader": {
    "type": "string_check",
    "name": "Example string check grader",
    "input": "{{sample.output_text}}",
    "reference": "{{item.label}}",
    "operation": "eq"
  }
}
Returns Examples
{
  "grader": {
    "type": "string_check",
    "name": "Example string check grader",
    "input": "{{sample.output_text}}",
    "reference": "{{item.label}}",
    "operation": "eq"
  }
}