Alpha
Graders
Run grader
GraderRunResponse fineTuning().alpha().graders().run(GraderRunParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /fine_tuning/alpha/graders/run
Run grader
Parameters
-
GraderRunParams params-
Grader graderThe grader used for the fine-tuning job.
-
class StringCheckGrader:A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
String inputThe input text. This may include template strings.
-
String nameThe name of the grader.
-
Operation operationThe string check operation to perform. One of
eq,ne,like, orilike.-
EQ("eq") -
NE("ne") -
LIKE("like") -
ILIKE("ilike")
-
-
String referenceThe reference text. This may include template strings.
-
JsonValue; type "string_check"constantThe object type, which is always
string_check.STRING_CHECK("string_check")
-
-
class TextSimilarityGrader:A TextSimilarityGrader object which grades text based on similarity metrics.
-
EvaluationMetric evaluationMetricThe evaluation metric to use. One of
cosine,fuzzy_match,bleu,gleu,meteor,rouge_1,rouge_2,rouge_3,rouge_4,rouge_5, orrouge_l.-
COSINE("cosine") -
FUZZY_MATCH("fuzzy_match") -
BLEU("bleu") -
GLEU("gleu") -
METEOR("meteor") -
ROUGE_1("rouge_1") -
ROUGE_2("rouge_2") -
ROUGE_3("rouge_3") -
ROUGE_4("rouge_4") -
ROUGE_5("rouge_5") -
ROUGE_L("rouge_l")
-
-
String inputThe text being graded.
-
String nameThe name of the grader.
-
String referenceThe text being graded against.
-
JsonValue; type "text_similarity"constantThe type of grader.
TEXT_SIMILARITY("text_similarity")
-
-
class PythonGrader:A PythonGrader object that runs a python script on the input.
-
String nameThe name of the grader.
-
String sourceThe source code of the python script.
-
JsonValue; type "python"constantThe object type, which is always
python.PYTHON("python")
-
Optional<String> imageTagThe image tag to use for the python script.
-
-
class ScoreModelGrader:A ScoreModelGrader object that uses a model to assign a score to the input.
-
List<Input> inputThe input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.
-
Content contentInputs 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 -
class ResponseInputText:A text input to the model.
-
String textThe text input to the model.
-
JsonValue; type "input_text"constantThe type of the input item. Always
input_text.INPUT_TEXT("input_text")
-
Optional<PromptCacheBreakpoint> promptCacheBreakpointMarks 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.-
JsonValue; mode "explicit"constantThe breakpoint mode. Always
explicit.EXPLICIT("explicit")
-
-
-
class OutputText:A text output from the model.
-
String textThe text output from the model.
-
JsonValue; type "output_text"constantThe type of the output text. Always
output_text.OUTPUT_TEXT("output_text")
-
-
class InputImage:An image input block used within EvalItem content arrays.
-
String imageUrlThe URL of the image input.
-
JsonValue; type "input_image"constantThe type of the image input. Always
input_image.INPUT_IMAGE("input_image")
-
Optional<String> detailThe detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio:An audio input to the model.
-
InputAudio inputAudio-
String dataBase64-encoded audio data.
-
Format formatThe format of the audio data. Currently supported formats are
mp3andwav.-
MP3("mp3") -
WAV("wav")
-
-
-
JsonValue; type "input_audio"constantThe type of the input item. Always
input_audio.INPUT_AUDIO("input_audio")
-
-
List<EvalContentItem>-
String -
class ResponseInputText:A text input to the model.
-
OutputText-
String textThe text output from the model.
-
JsonValue; type "output_text"constantThe type of the output text. Always
output_text.OUTPUT_TEXT("output_text")
-
-
InputImage-
String imageUrlThe URL of the image input.
-
JsonValue; type "input_image"constantThe type of the image input. Always
input_image.INPUT_IMAGE("input_image")
-
Optional<String> detailThe detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio:An audio input to the model.
-
-
-
Role roleThe role of the message input. One of
user,assistant,system, ordeveloper.-
USER("user") -
ASSISTANT("assistant") -
SYSTEM("system") -
DEVELOPER("developer")
-
-
Optional<Type> typeThe type of the message input. Always
message.MESSAGE("message")
-
-
String modelThe model to use for the evaluation.
-
String nameThe name of the grader.
-
JsonValue; type "score_model"constantThe object type, which is always
score_model.SCORE_MODEL("score_model")
-
Optional<List<Double>> rangeThe range of the score. Defaults to
[0, 1]. -
Optional<SamplingParams> samplingParamsThe sampling parameters for the model.
-
Optional<Long> maxCompletionsTokensThe maximum number of tokens the grader model may generate in its response.
-
Optional<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.-
NONE("none") -
MINIMAL("minimal") -
LOW("low") -
MEDIUM("medium") -
HIGH("high") -
XHIGH("xhigh") -
MAX("max")
-
-
Optional<Long> seedA seed value to initialize the randomness, during sampling.
-
Optional<Double> temperatureA higher temperature increases randomness in the outputs.
-
Optional<Double> topPAn alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
class MultiGrader:A MultiGrader object combines the output of multiple graders to produce a single score.
-
String calculateOutputA formula to calculate the output based on grader results.
-
Graders gradersA StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
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 LabelModelGrader:A LabelModelGrader object which uses a model to assign labels to each item in the evaluation.
-
List<Input> input-
Content contentInputs 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 -
class ResponseInputText:A text input to the model.
-
class OutputText:A text output from the model.
-
String textThe text output from the model.
-
JsonValue; type "output_text"constantThe type of the output text. Always
output_text.OUTPUT_TEXT("output_text")
-
-
class InputImage:An image input block used within EvalItem content arrays.
-
String imageUrlThe URL of the image input.
-
JsonValue; type "input_image"constantThe type of the image input. Always
input_image.INPUT_IMAGE("input_image")
-
Optional<String> detailThe detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio:An audio input to the model.
-
List<EvalContentItem>-
String -
class ResponseInputText:A text input to the model.
-
OutputText -
InputImage -
class ResponseInputAudio:An audio input to the model.
-
-
-
Role roleThe role of the message input. One of
user,assistant,system, ordeveloper.-
USER("user") -
ASSISTANT("assistant") -
SYSTEM("system") -
DEVELOPER("developer")
-
-
Optional<Type> typeThe type of the message input. Always
message.MESSAGE("message")
-
-
List<String> labelsThe labels to assign to each item in the evaluation.
-
String modelThe model to use for the evaluation. Must support structured outputs.
-
String nameThe name of the grader.
-
List<String> passingLabelsThe labels that indicate a passing result. Must be a subset of labels.
-
JsonValue; type "label_model"constantThe object type, which is always
label_model.LABEL_MODEL("label_model")
-
-
-
String nameThe name of the grader.
-
JsonValue; type "multi"constantThe object type, which is always
multi.MULTI("multi")
-
-
-
String modelSampleThe 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. -
Optional<JsonValue> itemThe dataset item provided to the grader. This will be used to populate the
itemnamespace. See the guide for more details.
-
Returns
-
class GraderRunResponse:-
Metadata metadata-
Errors errors-
boolean formulaParseError -
boolean invalidVariableError -
boolean modelGraderParseError -
boolean modelGraderRefusalError -
boolean modelGraderServerError -
Optional<String> modelGraderServerErrorDetails -
boolean otherError -
boolean pythonGraderRuntimeError -
Optional<String> pythonGraderRuntimeErrorDetails -
boolean pythonGraderServerError -
Optional<String> pythonGraderServerErrorType -
boolean sampleParseError -
boolean truncatedObservationError -
boolean unresponsiveRewardError
-
-
double executionTime -
String name -
Optional<String> sampledModelName -
Scores scores -
Optional<Long> tokenUsage -
String type
-
-
ModelGraderTokenUsagePerModel modelGraderTokenUsagePerModel -
double reward -
SubRewards subRewards
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.finetuning.alpha.graders.GraderRunParams;
import com.openai.models.finetuning.alpha.graders.GraderRunResponse;
import com.openai.models.graders.gradermodels.StringCheckGrader;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
GraderRunParams params = GraderRunParams.builder()
.grader(StringCheckGrader.builder()
.input("input")
.name("name")
.operation(StringCheckGrader.Operation.EQ)
.reference("reference")
.build())
.modelSample("model_sample")
.build();
GraderRunResponse response = client.fineTuning().alpha().graders().run(params);
}
}
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
GraderValidateResponse fineTuning().alpha().graders().validate(GraderValidateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /fine_tuning/alpha/graders/validate
Validate grader
Parameters
-
GraderValidateParams params-
Grader graderThe grader used for the fine-tuning job.
-
class StringCheckGrader:A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
String inputThe input text. This may include template strings.
-
String nameThe name of the grader.
-
Operation operationThe string check operation to perform. One of
eq,ne,like, orilike.-
EQ("eq") -
NE("ne") -
LIKE("like") -
ILIKE("ilike")
-
-
String referenceThe reference text. This may include template strings.
-
JsonValue; type "string_check"constantThe object type, which is always
string_check.STRING_CHECK("string_check")
-
-
class TextSimilarityGrader:A TextSimilarityGrader object which grades text based on similarity metrics.
-
EvaluationMetric evaluationMetricThe evaluation metric to use. One of
cosine,fuzzy_match,bleu,gleu,meteor,rouge_1,rouge_2,rouge_3,rouge_4,rouge_5, orrouge_l.-
COSINE("cosine") -
FUZZY_MATCH("fuzzy_match") -
BLEU("bleu") -
GLEU("gleu") -
METEOR("meteor") -
ROUGE_1("rouge_1") -
ROUGE_2("rouge_2") -
ROUGE_3("rouge_3") -
ROUGE_4("rouge_4") -
ROUGE_5("rouge_5") -
ROUGE_L("rouge_l")
-
-
String inputThe text being graded.
-
String nameThe name of the grader.
-
String referenceThe text being graded against.
-
JsonValue; type "text_similarity"constantThe type of grader.
TEXT_SIMILARITY("text_similarity")
-
-
class PythonGrader:A PythonGrader object that runs a python script on the input.
-
String nameThe name of the grader.
-
String sourceThe source code of the python script.
-
JsonValue; type "python"constantThe object type, which is always
python.PYTHON("python")
-
Optional<String> imageTagThe image tag to use for the python script.
-
-
class ScoreModelGrader:A ScoreModelGrader object that uses a model to assign a score to the input.
-
List<Input> inputThe input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.
-
Content contentInputs 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 -
class ResponseInputText:A text input to the model.
-
String textThe text input to the model.
-
JsonValue; type "input_text"constantThe type of the input item. Always
input_text.INPUT_TEXT("input_text")
-
Optional<PromptCacheBreakpoint> promptCacheBreakpointMarks 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.-
JsonValue; mode "explicit"constantThe breakpoint mode. Always
explicit.EXPLICIT("explicit")
-
-
-
class OutputText:A text output from the model.
-
String textThe text output from the model.
-
JsonValue; type "output_text"constantThe type of the output text. Always
output_text.OUTPUT_TEXT("output_text")
-
-
class InputImage:An image input block used within EvalItem content arrays.
-
String imageUrlThe URL of the image input.
-
JsonValue; type "input_image"constantThe type of the image input. Always
input_image.INPUT_IMAGE("input_image")
-
Optional<String> detailThe detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio:An audio input to the model.
-
InputAudio inputAudio-
String dataBase64-encoded audio data.
-
Format formatThe format of the audio data. Currently supported formats are
mp3andwav.-
MP3("mp3") -
WAV("wav")
-
-
-
JsonValue; type "input_audio"constantThe type of the input item. Always
input_audio.INPUT_AUDIO("input_audio")
-
-
List<EvalContentItem>-
String -
class ResponseInputText:A text input to the model.
-
OutputText-
String textThe text output from the model.
-
JsonValue; type "output_text"constantThe type of the output text. Always
output_text.OUTPUT_TEXT("output_text")
-
-
InputImage-
String imageUrlThe URL of the image input.
-
JsonValue; type "input_image"constantThe type of the image input. Always
input_image.INPUT_IMAGE("input_image")
-
Optional<String> detailThe detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio:An audio input to the model.
-
-
-
Role roleThe role of the message input. One of
user,assistant,system, ordeveloper.-
USER("user") -
ASSISTANT("assistant") -
SYSTEM("system") -
DEVELOPER("developer")
-
-
Optional<Type> typeThe type of the message input. Always
message.MESSAGE("message")
-
-
String modelThe model to use for the evaluation.
-
String nameThe name of the grader.
-
JsonValue; type "score_model"constantThe object type, which is always
score_model.SCORE_MODEL("score_model")
-
Optional<List<Double>> rangeThe range of the score. Defaults to
[0, 1]. -
Optional<SamplingParams> samplingParamsThe sampling parameters for the model.
-
Optional<Long> maxCompletionsTokensThe maximum number of tokens the grader model may generate in its response.
-
Optional<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.-
NONE("none") -
MINIMAL("minimal") -
LOW("low") -
MEDIUM("medium") -
HIGH("high") -
XHIGH("xhigh") -
MAX("max")
-
-
Optional<Long> seedA seed value to initialize the randomness, during sampling.
-
Optional<Double> temperatureA higher temperature increases randomness in the outputs.
-
Optional<Double> topPAn alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
class MultiGrader:A MultiGrader object combines the output of multiple graders to produce a single score.
-
String calculateOutputA formula to calculate the output based on grader results.
-
Graders gradersA StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
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 LabelModelGrader:A LabelModelGrader object which uses a model to assign labels to each item in the evaluation.
-
List<Input> input-
Content contentInputs 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 -
class ResponseInputText:A text input to the model.
-
class OutputText:A text output from the model.
-
String textThe text output from the model.
-
JsonValue; type "output_text"constantThe type of the output text. Always
output_text.OUTPUT_TEXT("output_text")
-
-
class InputImage:An image input block used within EvalItem content arrays.
-
String imageUrlThe URL of the image input.
-
JsonValue; type "input_image"constantThe type of the image input. Always
input_image.INPUT_IMAGE("input_image")
-
Optional<String> detailThe detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio:An audio input to the model.
-
List<EvalContentItem>-
String -
class ResponseInputText:A text input to the model.
-
OutputText -
InputImage -
class ResponseInputAudio:An audio input to the model.
-
-
-
Role roleThe role of the message input. One of
user,assistant,system, ordeveloper.-
USER("user") -
ASSISTANT("assistant") -
SYSTEM("system") -
DEVELOPER("developer")
-
-
Optional<Type> typeThe type of the message input. Always
message.MESSAGE("message")
-
-
List<String> labelsThe labels to assign to each item in the evaluation.
-
String modelThe model to use for the evaluation. Must support structured outputs.
-
String nameThe name of the grader.
-
List<String> passingLabelsThe labels that indicate a passing result. Must be a subset of labels.
-
JsonValue; type "label_model"constantThe object type, which is always
label_model.LABEL_MODEL("label_model")
-
-
-
String nameThe name of the grader.
-
JsonValue; type "multi"constantThe object type, which is always
multi.MULTI("multi")
-
-
-
Returns
-
class GraderValidateResponse:-
Optional<Grader> graderThe grader used for the fine-tuning job.
-
class StringCheckGrader:A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
String inputThe input text. This may include template strings.
-
String nameThe name of the grader.
-
Operation operationThe string check operation to perform. One of
eq,ne,like, orilike.-
EQ("eq") -
NE("ne") -
LIKE("like") -
ILIKE("ilike")
-
-
String referenceThe reference text. This may include template strings.
-
JsonValue; type "string_check"constantThe object type, which is always
string_check.STRING_CHECK("string_check")
-
-
class TextSimilarityGrader:A TextSimilarityGrader object which grades text based on similarity metrics.
-
EvaluationMetric evaluationMetricThe evaluation metric to use. One of
cosine,fuzzy_match,bleu,gleu,meteor,rouge_1,rouge_2,rouge_3,rouge_4,rouge_5, orrouge_l.-
COSINE("cosine") -
FUZZY_MATCH("fuzzy_match") -
BLEU("bleu") -
GLEU("gleu") -
METEOR("meteor") -
ROUGE_1("rouge_1") -
ROUGE_2("rouge_2") -
ROUGE_3("rouge_3") -
ROUGE_4("rouge_4") -
ROUGE_5("rouge_5") -
ROUGE_L("rouge_l")
-
-
String inputThe text being graded.
-
String nameThe name of the grader.
-
String referenceThe text being graded against.
-
JsonValue; type "text_similarity"constantThe type of grader.
TEXT_SIMILARITY("text_similarity")
-
-
class PythonGrader:A PythonGrader object that runs a python script on the input.
-
String nameThe name of the grader.
-
String sourceThe source code of the python script.
-
JsonValue; type "python"constantThe object type, which is always
python.PYTHON("python")
-
Optional<String> imageTagThe image tag to use for the python script.
-
-
class ScoreModelGrader:A ScoreModelGrader object that uses a model to assign a score to the input.
-
List<Input> inputThe input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.
-
Content contentInputs 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 -
class ResponseInputText:A text input to the model.
-
String textThe text input to the model.
-
JsonValue; type "input_text"constantThe type of the input item. Always
input_text.INPUT_TEXT("input_text")
-
Optional<PromptCacheBreakpoint> promptCacheBreakpointMarks 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.-
JsonValue; mode "explicit"constantThe breakpoint mode. Always
explicit.EXPLICIT("explicit")
-
-
-
class OutputText:A text output from the model.
-
String textThe text output from the model.
-
JsonValue; type "output_text"constantThe type of the output text. Always
output_text.OUTPUT_TEXT("output_text")
-
-
class InputImage:An image input block used within EvalItem content arrays.
-
String imageUrlThe URL of the image input.
-
JsonValue; type "input_image"constantThe type of the image input. Always
input_image.INPUT_IMAGE("input_image")
-
Optional<String> detailThe detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio:An audio input to the model.
-
InputAudio inputAudio-
String dataBase64-encoded audio data.
-
Format formatThe format of the audio data. Currently supported formats are
mp3andwav.-
MP3("mp3") -
WAV("wav")
-
-
-
JsonValue; type "input_audio"constantThe type of the input item. Always
input_audio.INPUT_AUDIO("input_audio")
-
-
List<EvalContentItem>-
String -
class ResponseInputText:A text input to the model.
-
OutputText-
String textThe text output from the model.
-
JsonValue; type "output_text"constantThe type of the output text. Always
output_text.OUTPUT_TEXT("output_text")
-
-
InputImage-
String imageUrlThe URL of the image input.
-
JsonValue; type "input_image"constantThe type of the image input. Always
input_image.INPUT_IMAGE("input_image")
-
Optional<String> detailThe detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio:An audio input to the model.
-
-
-
Role roleThe role of the message input. One of
user,assistant,system, ordeveloper.-
USER("user") -
ASSISTANT("assistant") -
SYSTEM("system") -
DEVELOPER("developer")
-
-
Optional<Type> typeThe type of the message input. Always
message.MESSAGE("message")
-
-
String modelThe model to use for the evaluation.
-
String nameThe name of the grader.
-
JsonValue; type "score_model"constantThe object type, which is always
score_model.SCORE_MODEL("score_model")
-
Optional<List<Double>> rangeThe range of the score. Defaults to
[0, 1]. -
Optional<SamplingParams> samplingParamsThe sampling parameters for the model.
-
Optional<Long> maxCompletionsTokensThe maximum number of tokens the grader model may generate in its response.
-
Optional<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.-
NONE("none") -
MINIMAL("minimal") -
LOW("low") -
MEDIUM("medium") -
HIGH("high") -
XHIGH("xhigh") -
MAX("max")
-
-
Optional<Long> seedA seed value to initialize the randomness, during sampling.
-
Optional<Double> temperatureA higher temperature increases randomness in the outputs.
-
Optional<Double> topPAn alternative to temperature for nucleus sampling; 1.0 includes all tokens.
-
-
-
class MultiGrader:A MultiGrader object combines the output of multiple graders to produce a single score.
-
String calculateOutputA formula to calculate the output based on grader results.
-
Graders gradersA StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
-
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 LabelModelGrader:A LabelModelGrader object which uses a model to assign labels to each item in the evaluation.
-
List<Input> input-
Content contentInputs 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 -
class ResponseInputText:A text input to the model.
-
class OutputText:A text output from the model.
-
String textThe text output from the model.
-
JsonValue; type "output_text"constantThe type of the output text. Always
output_text.OUTPUT_TEXT("output_text")
-
-
class InputImage:An image input block used within EvalItem content arrays.
-
String imageUrlThe URL of the image input.
-
JsonValue; type "input_image"constantThe type of the image input. Always
input_image.INPUT_IMAGE("input_image")
-
Optional<String> detailThe detail level of the image to be sent to the model. One of
high,low, orauto. Defaults toauto.
-
-
class ResponseInputAudio:An audio input to the model.
-
List<EvalContentItem>-
String -
class ResponseInputText:A text input to the model.
-
OutputText -
InputImage -
class ResponseInputAudio:An audio input to the model.
-
-
-
Role roleThe role of the message input. One of
user,assistant,system, ordeveloper.-
USER("user") -
ASSISTANT("assistant") -
SYSTEM("system") -
DEVELOPER("developer")
-
-
Optional<Type> typeThe type of the message input. Always
message.MESSAGE("message")
-
-
List<String> labelsThe labels to assign to each item in the evaluation.
-
String modelThe model to use for the evaluation. Must support structured outputs.
-
String nameThe name of the grader.
-
List<String> passingLabelsThe labels that indicate a passing result. Must be a subset of labels.
-
JsonValue; type "label_model"constantThe object type, which is always
label_model.LABEL_MODEL("label_model")
-
-
-
String nameThe name of the grader.
-
JsonValue; type "multi"constantThe object type, which is always
multi.MULTI("multi")
-
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.finetuning.alpha.graders.GraderValidateParams;
import com.openai.models.finetuning.alpha.graders.GraderValidateResponse;
import com.openai.models.graders.gradermodels.StringCheckGrader;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
GraderValidateParams params = GraderValidateParams.builder()
.grader(StringCheckGrader.builder()
.input("input")
.name("name")
.operation(StringCheckGrader.Operation.EQ)
.reference("reference")
.build())
.build();
GraderValidateResponse response = client.fineTuning().alpha().graders().validate(params);
}
}
Response
{
"grader": {
"input": "input",
"name": "name",
"operation": "eq",
"reference": "reference",
"type": "string_check"
}
}