Fine Tuning
Methods
Domain Types
Dpo Hyperparameters
-
type DpoHyperparametersResp struct{…}The hyperparameters used for the DPO fine-tuning job.
-
BatchSize DpoHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
Beta DpoHyperparametersBetaUnionRespThe beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
LearningRateMultiplier DpoHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs DpoHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
Dpo Method
-
type DpoMethod struct{…}Configuration for the DPO fine-tuning method.
-
Hyperparameters DpoHyperparametersRespThe hyperparameters used for the DPO fine-tuning job.
-
BatchSize DpoHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
Beta DpoHyperparametersBetaUnionRespThe beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
LearningRateMultiplier DpoHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs DpoHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
Reinforcement Hyperparameters
-
type ReinforcementHyperparametersResp struct{…}The hyperparameters used for the reinforcement fine-tuning job.
-
BatchSize ReinforcementHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
ComputeMultiplier ReinforcementHyperparametersComputeMultiplierUnionRespMultiplier on amount of compute used for exploring search space during training.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
EvalInterval ReinforcementHyperparametersEvalIntervalUnionRespThe number of training steps between evaluation runs.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
EvalSamples ReinforcementHyperparametersEvalSamplesUnionRespNumber of evaluation samples to generate per training step.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier ReinforcementHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs ReinforcementHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
ReasoningEffort ReinforcementHyperparametersReasoningEffortLevel of reasoning effort.
-
const ReinforcementHyperparametersReasoningEffortDefault ReinforcementHyperparametersReasoningEffort = "default" -
const ReinforcementHyperparametersReasoningEffortLow ReinforcementHyperparametersReasoningEffort = "low" -
const ReinforcementHyperparametersReasoningEffortMedium ReinforcementHyperparametersReasoningEffort = "medium" -
const ReinforcementHyperparametersReasoningEffortHigh ReinforcementHyperparametersReasoningEffort = "high"
-
-
Reinforcement Method
-
type ReinforcementMethod struct{…}Configuration for the reinforcement fine-tuning method.
-
Grader ReinforcementMethodGraderUnionThe 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"
-
-
-
Hyperparameters ReinforcementHyperparametersRespThe hyperparameters used for the reinforcement fine-tuning job.
-
BatchSize ReinforcementHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
ComputeMultiplier ReinforcementHyperparametersComputeMultiplierUnionRespMultiplier on amount of compute used for exploring search space during training.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
EvalInterval ReinforcementHyperparametersEvalIntervalUnionRespThe number of training steps between evaluation runs.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
EvalSamples ReinforcementHyperparametersEvalSamplesUnionRespNumber of evaluation samples to generate per training step.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier ReinforcementHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs ReinforcementHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
ReasoningEffort ReinforcementHyperparametersReasoningEffortLevel of reasoning effort.
-
const ReinforcementHyperparametersReasoningEffortDefault ReinforcementHyperparametersReasoningEffort = "default" -
const ReinforcementHyperparametersReasoningEffortLow ReinforcementHyperparametersReasoningEffort = "low" -
const ReinforcementHyperparametersReasoningEffortMedium ReinforcementHyperparametersReasoningEffort = "medium" -
const ReinforcementHyperparametersReasoningEffortHigh ReinforcementHyperparametersReasoningEffort = "high"
-
-
-
Supervised Hyperparameters
-
type SupervisedHyperparametersResp struct{…}The hyperparameters used for the fine-tuning job.
-
BatchSize SupervisedHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier SupervisedHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs SupervisedHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
Supervised Method
-
type SupervisedMethod struct{…}Configuration for the supervised fine-tuning method.
-
Hyperparameters SupervisedHyperparametersRespThe hyperparameters used for the fine-tuning job.
-
BatchSize SupervisedHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier SupervisedHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs SupervisedHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
Jobs
Create fine-tuning job
client.FineTuning.Jobs.New(ctx, body) (*FineTuningJob, error)
post /fine_tuning/jobs
Creates a fine-tuning job which begins the process of creating a new model from a given dataset.
Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.
Parameters
-
body FineTuningJobNewParams-
Model param.Field[FineTuningJobNewParamsModel]The name of the model to fine-tune. You can select one of the supported models.
-
string -
type FineTuningJobNewParamsModel stringThe name of the model to fine-tune. You can select one of the supported models.
-
const FineTuningJobNewParamsModelBabbage002 FineTuningJobNewParamsModel = "babbage-002" -
const FineTuningJobNewParamsModelDavinci002 FineTuningJobNewParamsModel = "davinci-002" -
const FineTuningJobNewParamsModelGPT3_5Turbo FineTuningJobNewParamsModel = "gpt-3.5-turbo" -
const FineTuningJobNewParamsModelGPT4oMini FineTuningJobNewParamsModel = "gpt-4o-mini"
-
-
-
TrainingFile param.Field[string]The ID of an uploaded file that contains training data.
See upload file for how to upload a file.
Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose
fine-tune.The contents of the file should differ depending on if the model uses the chat, completions format, or if the fine-tuning method uses the preference format.
See the fine-tuning guide for more details.
-
Hyperparameters param.Field[FineTuningJobNewParamsHyperparameters]The hyperparameters used for the fine-tuning job. This value is now deprecated in favor of
method, and should be passed in under themethodparameter.-
BatchSize FineTuningJobNewParamsHyperparametersBatchSizeUnionNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier FineTuningJobNewParamsHyperparametersLearningRateMultiplierUnionScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs FineTuningJobNewParamsHyperparametersNEpochsUnionThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
Integrations param.Field[[]FineTuningJobNewParamsIntegration]A list of integrations to enable for your fine-tuning job.
-
Type WandbThe type of integration to enable. Currently, only "wandb" (Weights and Biases) is supported.
const WandbWandb Wandb = "wandb"
-
Wandb FineTuningJobNewParamsIntegrationWandbThe settings for your integration with Weights and Biases. This payload specifies the project that metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags to your run, and set a default entity (team, username, etc) to be associated with your run.
-
Project stringThe name of the project that the new run will be created under.
-
Entity stringThe entity to use for the run. This allows you to set the team or username of the WandB user that you would like associated with the run. If not set, the default entity for the registered WandB API key is used.
-
Name stringA display name to set for the run. If not set, we will use the Job ID as the name.
-
Tags []stringA list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some default tags are generated by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}".
-
-
-
Metadata param.Field[Metadata]Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
-
Method param.Field[FineTuningJobNewParamsMethod]The method used for fine-tuning.
-
Type stringThe type of method. Is either
supervised,dpo, orreinforcement.-
const FineTuningJobNewParamsMethodTypeSupervised FineTuningJobNewParamsMethodType = "supervised" -
const FineTuningJobNewParamsMethodTypeDpo FineTuningJobNewParamsMethodType = "dpo" -
const FineTuningJobNewParamsMethodTypeReinforcement FineTuningJobNewParamsMethodType = "reinforcement"
-
-
Dpo DpoMethodConfiguration for the DPO fine-tuning method.
-
Hyperparameters DpoHyperparametersRespThe hyperparameters used for the DPO fine-tuning job.
-
BatchSize DpoHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
Beta DpoHyperparametersBetaUnionRespThe beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
LearningRateMultiplier DpoHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs DpoHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
-
Reinforcement ReinforcementMethodConfiguration for the reinforcement fine-tuning method.
-
Grader ReinforcementMethodGraderUnionThe 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"
-
-
-
Hyperparameters ReinforcementHyperparametersRespThe hyperparameters used for the reinforcement fine-tuning job.
-
BatchSize ReinforcementHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
ComputeMultiplier ReinforcementHyperparametersComputeMultiplierUnionRespMultiplier on amount of compute used for exploring search space during training.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
EvalInterval ReinforcementHyperparametersEvalIntervalUnionRespThe number of training steps between evaluation runs.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
EvalSamples ReinforcementHyperparametersEvalSamplesUnionRespNumber of evaluation samples to generate per training step.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier ReinforcementHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs ReinforcementHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
ReasoningEffort ReinforcementHyperparametersReasoningEffortLevel of reasoning effort.
-
const ReinforcementHyperparametersReasoningEffortDefault ReinforcementHyperparametersReasoningEffort = "default" -
const ReinforcementHyperparametersReasoningEffortLow ReinforcementHyperparametersReasoningEffort = "low" -
const ReinforcementHyperparametersReasoningEffortMedium ReinforcementHyperparametersReasoningEffort = "medium" -
const ReinforcementHyperparametersReasoningEffortHigh ReinforcementHyperparametersReasoningEffort = "high"
-
-
-
-
Supervised SupervisedMethodConfiguration for the supervised fine-tuning method.
-
Hyperparameters SupervisedHyperparametersRespThe hyperparameters used for the fine-tuning job.
-
BatchSize SupervisedHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier SupervisedHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs SupervisedHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
-
-
Seed param.Field[int64]The seed controls the reproducibility of the job. Passing in the same seed and job parameters should produce the same results, but may differ in rare cases. If a seed is not specified, one will be generated for you.
-
Suffix param.Field[string]A string of up to 64 characters that will be added to your fine-tuned model name.
For example, a
suffixof "custom-model-name" would produce a model name likeft:gpt-4o-mini:openai:custom-model-name:7p4lURel. -
ValidationFile param.Field[string]The ID of an uploaded file that contains validation data.
If you provide this file, the data is used to generate validation metrics periodically during fine-tuning. These metrics can be viewed in the fine-tuning results file. The same data should not be present in both train and validation files.
Your dataset must be formatted as a JSONL file. You must upload your file with the purpose
fine-tune.See the fine-tuning guide for more details.
-
Returns
-
type FineTuningJob struct{…}The
fine_tuning.jobobject represents a fine-tuning job that has been created through the API.-
ID stringThe object identifier, which can be referenced in the API endpoints.
-
CreatedAt int64The Unix timestamp (in seconds) for when the fine-tuning job was created.
-
Error FineTuningJobErrorFor fine-tuning jobs that have
failed, this will contain more information on the cause of the failure.-
Code stringA machine-readable error code.
-
Message stringA human-readable error message.
-
Param stringThe parameter that was invalid, usually
training_fileorvalidation_file. This field will be null if the failure was not parameter-specific.
-
-
FineTunedModel stringThe name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running.
-
FinishedAt int64The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running.
-
Hyperparameters FineTuningJobHyperparametersThe hyperparameters used for the fine-tuning job. This value will only be returned when running
supervisedjobs.-
BatchSize FineTuningJobHyperparametersBatchSizeUnionNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier FineTuningJobHyperparametersLearningRateMultiplierUnionScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs FineTuningJobHyperparametersNEpochsUnionThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
Model stringThe base model that is being fine-tuned.
-
Object FineTuningJobThe object type, which is always "fine_tuning.job".
const FineTuningJobFineTuningJob FineTuningJob = "fine_tuning.job"
-
OrganizationID stringThe organization that owns the fine-tuning job.
-
ResultFiles []stringThe compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the Files API.
-
Seed int64The seed used for the fine-tuning job.
-
Status FineTuningJobStatusThe current status of the fine-tuning job, which can be either
validating_files,queued,running,succeeded,failed, orcancelled.-
const FineTuningJobStatusValidatingFiles FineTuningJobStatus = "validating_files" -
const FineTuningJobStatusQueued FineTuningJobStatus = "queued" -
const FineTuningJobStatusRunning FineTuningJobStatus = "running" -
const FineTuningJobStatusSucceeded FineTuningJobStatus = "succeeded" -
const FineTuningJobStatusFailed FineTuningJobStatus = "failed" -
const FineTuningJobStatusCancelled FineTuningJobStatus = "cancelled"
-
-
TrainedTokens int64The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running.
-
TrainingFile stringThe file ID used for training. You can retrieve the training data with the Files API.
-
ValidationFile stringThe file ID used for validation. You can retrieve the validation results with the Files API.
-
EstimatedFinish int64The Unix timestamp (in seconds) for when the fine-tuning job is estimated to finish. The value will be null if the fine-tuning job is not running.
-
Integrations []FineTuningJobWandbIntegrationObjectA list of integrations to enable for this fine-tuning job.
-
Type WandbThe type of the integration being enabled for the fine-tuning job
const WandbWandb Wandb = "wandb"
-
Wandb FineTuningJobWandbIntegrationThe settings for your integration with Weights and Biases. This payload specifies the project that metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags to your run, and set a default entity (team, username, etc) to be associated with your run.
-
Project stringThe name of the project that the new run will be created under.
-
Entity stringThe entity to use for the run. This allows you to set the team or username of the WandB user that you would like associated with the run. If not set, the default entity for the registered WandB API key is used.
-
Name stringA display name to set for the run. If not set, we will use the Job ID as the name.
-
Tags []stringA list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some default tags are generated by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}".
-
-
-
Metadata MetadataSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
-
Method FineTuningJobMethodThe method used for fine-tuning.
-
Type stringThe type of method. Is either
supervised,dpo, orreinforcement.-
const FineTuningJobMethodTypeSupervised FineTuningJobMethodType = "supervised" -
const FineTuningJobMethodTypeDpo FineTuningJobMethodType = "dpo" -
const FineTuningJobMethodTypeReinforcement FineTuningJobMethodType = "reinforcement"
-
-
Dpo DpoMethodConfiguration for the DPO fine-tuning method.
-
Hyperparameters DpoHyperparametersRespThe hyperparameters used for the DPO fine-tuning job.
-
BatchSize DpoHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
Beta DpoHyperparametersBetaUnionRespThe beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
LearningRateMultiplier DpoHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs DpoHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
-
Reinforcement ReinforcementMethodConfiguration for the reinforcement fine-tuning method.
-
Grader ReinforcementMethodGraderUnionThe 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"
-
-
-
Hyperparameters ReinforcementHyperparametersRespThe hyperparameters used for the reinforcement fine-tuning job.
-
BatchSize ReinforcementHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
ComputeMultiplier ReinforcementHyperparametersComputeMultiplierUnionRespMultiplier on amount of compute used for exploring search space during training.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
EvalInterval ReinforcementHyperparametersEvalIntervalUnionRespThe number of training steps between evaluation runs.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
EvalSamples ReinforcementHyperparametersEvalSamplesUnionRespNumber of evaluation samples to generate per training step.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier ReinforcementHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs ReinforcementHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
ReasoningEffort ReinforcementHyperparametersReasoningEffortLevel of reasoning effort.
-
const ReinforcementHyperparametersReasoningEffortDefault ReinforcementHyperparametersReasoningEffort = "default" -
const ReinforcementHyperparametersReasoningEffortLow ReinforcementHyperparametersReasoningEffort = "low" -
const ReinforcementHyperparametersReasoningEffortMedium ReinforcementHyperparametersReasoningEffort = "medium" -
const ReinforcementHyperparametersReasoningEffortHigh ReinforcementHyperparametersReasoningEffort = "high"
-
-
-
-
Supervised SupervisedMethodConfiguration for the supervised fine-tuning method.
-
Hyperparameters SupervisedHyperparametersRespThe hyperparameters used for the fine-tuning job.
-
BatchSize SupervisedHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier SupervisedHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs SupervisedHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
-
-
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"),
)
fineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{
Model: openai.FineTuningJobNewParamsModelGPT4oMini,
TrainingFile: "file-abc123",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", fineTuningJob.ID)
}
Response
{
"id": "id",
"created_at": 0,
"error": {
"code": "code",
"message": "message",
"param": "param"
},
"fine_tuned_model": "fine_tuned_model",
"finished_at": 0,
"hyperparameters": {
"batch_size": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto"
},
"model": "model",
"object": "fine_tuning.job",
"organization_id": "organization_id",
"result_files": [
"file-abc123"
],
"seed": 0,
"status": "validating_files",
"trained_tokens": 0,
"training_file": "training_file",
"validation_file": "validation_file",
"estimated_finish": 0,
"integrations": [
{
"type": "wandb",
"wandb": {
"project": "my-wandb-project",
"entity": "entity",
"name": "name",
"tags": [
"custom-tag"
]
}
}
],
"metadata": {
"foo": "string"
},
"method": {
"type": "supervised",
"dpo": {
"hyperparameters": {
"batch_size": "auto",
"beta": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto"
}
},
"reinforcement": {
"grader": {
"input": "input",
"name": "name",
"operation": "eq",
"reference": "reference",
"type": "string_check"
},
"hyperparameters": {
"batch_size": "auto",
"compute_multiplier": "auto",
"eval_interval": "auto",
"eval_samples": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto",
"reasoning_effort": "default"
}
},
"supervised": {
"hyperparameters": {
"batch_size": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto"
}
}
}
}
List fine-tuning jobs
client.FineTuning.Jobs.List(ctx, query) (*CursorPage[FineTuningJob], error)
get /fine_tuning/jobs
List your organization's fine-tuning jobs
Parameters
-
query FineTuningJobListParams-
After param.Field[string]Identifier for the last job from the previous pagination request.
-
Limit param.Field[int64]Number of fine-tuning jobs to retrieve.
-
Metadata param.Field[map[string, string]]Optional metadata filter. To filter, use the syntax
metadata[k]=v. Alternatively, setmetadata=nullto indicate no metadata.
-
Returns
-
type FineTuningJob struct{…}The
fine_tuning.jobobject represents a fine-tuning job that has been created through the API.-
ID stringThe object identifier, which can be referenced in the API endpoints.
-
CreatedAt int64The Unix timestamp (in seconds) for when the fine-tuning job was created.
-
Error FineTuningJobErrorFor fine-tuning jobs that have
failed, this will contain more information on the cause of the failure.-
Code stringA machine-readable error code.
-
Message stringA human-readable error message.
-
Param stringThe parameter that was invalid, usually
training_fileorvalidation_file. This field will be null if the failure was not parameter-specific.
-
-
FineTunedModel stringThe name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running.
-
FinishedAt int64The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running.
-
Hyperparameters FineTuningJobHyperparametersThe hyperparameters used for the fine-tuning job. This value will only be returned when running
supervisedjobs.-
BatchSize FineTuningJobHyperparametersBatchSizeUnionNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier FineTuningJobHyperparametersLearningRateMultiplierUnionScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs FineTuningJobHyperparametersNEpochsUnionThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
Model stringThe base model that is being fine-tuned.
-
Object FineTuningJobThe object type, which is always "fine_tuning.job".
const FineTuningJobFineTuningJob FineTuningJob = "fine_tuning.job"
-
OrganizationID stringThe organization that owns the fine-tuning job.
-
ResultFiles []stringThe compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the Files API.
-
Seed int64The seed used for the fine-tuning job.
-
Status FineTuningJobStatusThe current status of the fine-tuning job, which can be either
validating_files,queued,running,succeeded,failed, orcancelled.-
const FineTuningJobStatusValidatingFiles FineTuningJobStatus = "validating_files" -
const FineTuningJobStatusQueued FineTuningJobStatus = "queued" -
const FineTuningJobStatusRunning FineTuningJobStatus = "running" -
const FineTuningJobStatusSucceeded FineTuningJobStatus = "succeeded" -
const FineTuningJobStatusFailed FineTuningJobStatus = "failed" -
const FineTuningJobStatusCancelled FineTuningJobStatus = "cancelled"
-
-
TrainedTokens int64The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running.
-
TrainingFile stringThe file ID used for training. You can retrieve the training data with the Files API.
-
ValidationFile stringThe file ID used for validation. You can retrieve the validation results with the Files API.
-
EstimatedFinish int64The Unix timestamp (in seconds) for when the fine-tuning job is estimated to finish. The value will be null if the fine-tuning job is not running.
-
Integrations []FineTuningJobWandbIntegrationObjectA list of integrations to enable for this fine-tuning job.
-
Type WandbThe type of the integration being enabled for the fine-tuning job
const WandbWandb Wandb = "wandb"
-
Wandb FineTuningJobWandbIntegrationThe settings for your integration with Weights and Biases. This payload specifies the project that metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags to your run, and set a default entity (team, username, etc) to be associated with your run.
-
Project stringThe name of the project that the new run will be created under.
-
Entity stringThe entity to use for the run. This allows you to set the team or username of the WandB user that you would like associated with the run. If not set, the default entity for the registered WandB API key is used.
-
Name stringA display name to set for the run. If not set, we will use the Job ID as the name.
-
Tags []stringA list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some default tags are generated by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}".
-
-
-
Metadata MetadataSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
-
Method FineTuningJobMethodThe method used for fine-tuning.
-
Type stringThe type of method. Is either
supervised,dpo, orreinforcement.-
const FineTuningJobMethodTypeSupervised FineTuningJobMethodType = "supervised" -
const FineTuningJobMethodTypeDpo FineTuningJobMethodType = "dpo" -
const FineTuningJobMethodTypeReinforcement FineTuningJobMethodType = "reinforcement"
-
-
Dpo DpoMethodConfiguration for the DPO fine-tuning method.
-
Hyperparameters DpoHyperparametersRespThe hyperparameters used for the DPO fine-tuning job.
-
BatchSize DpoHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
Beta DpoHyperparametersBetaUnionRespThe beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
LearningRateMultiplier DpoHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs DpoHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
-
Reinforcement ReinforcementMethodConfiguration for the reinforcement fine-tuning method.
-
Grader ReinforcementMethodGraderUnionThe 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"
-
-
-
Hyperparameters ReinforcementHyperparametersRespThe hyperparameters used for the reinforcement fine-tuning job.
-
BatchSize ReinforcementHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
ComputeMultiplier ReinforcementHyperparametersComputeMultiplierUnionRespMultiplier on amount of compute used for exploring search space during training.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
EvalInterval ReinforcementHyperparametersEvalIntervalUnionRespThe number of training steps between evaluation runs.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
EvalSamples ReinforcementHyperparametersEvalSamplesUnionRespNumber of evaluation samples to generate per training step.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier ReinforcementHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs ReinforcementHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
ReasoningEffort ReinforcementHyperparametersReasoningEffortLevel of reasoning effort.
-
const ReinforcementHyperparametersReasoningEffortDefault ReinforcementHyperparametersReasoningEffort = "default" -
const ReinforcementHyperparametersReasoningEffortLow ReinforcementHyperparametersReasoningEffort = "low" -
const ReinforcementHyperparametersReasoningEffortMedium ReinforcementHyperparametersReasoningEffort = "medium" -
const ReinforcementHyperparametersReasoningEffortHigh ReinforcementHyperparametersReasoningEffort = "high"
-
-
-
-
Supervised SupervisedMethodConfiguration for the supervised fine-tuning method.
-
Hyperparameters SupervisedHyperparametersRespThe hyperparameters used for the fine-tuning job.
-
BatchSize SupervisedHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier SupervisedHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs SupervisedHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
-
-
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"),
)
page, err := client.FineTuning.Jobs.List(context.TODO(), openai.FineTuningJobListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"error": {
"code": "code",
"message": "message",
"param": "param"
},
"fine_tuned_model": "fine_tuned_model",
"finished_at": 0,
"hyperparameters": {
"batch_size": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto"
},
"model": "model",
"object": "fine_tuning.job",
"organization_id": "organization_id",
"result_files": [
"file-abc123"
],
"seed": 0,
"status": "validating_files",
"trained_tokens": 0,
"training_file": "training_file",
"validation_file": "validation_file",
"estimated_finish": 0,
"integrations": [
{
"type": "wandb",
"wandb": {
"project": "my-wandb-project",
"entity": "entity",
"name": "name",
"tags": [
"custom-tag"
]
}
}
],
"metadata": {
"foo": "string"
},
"method": {
"type": "supervised",
"dpo": {
"hyperparameters": {
"batch_size": "auto",
"beta": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto"
}
},
"reinforcement": {
"grader": {
"input": "input",
"name": "name",
"operation": "eq",
"reference": "reference",
"type": "string_check"
},
"hyperparameters": {
"batch_size": "auto",
"compute_multiplier": "auto",
"eval_interval": "auto",
"eval_samples": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto",
"reasoning_effort": "default"
}
},
"supervised": {
"hyperparameters": {
"batch_size": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto"
}
}
}
}
],
"has_more": true,
"object": "list"
}
Retrieve fine-tuning job
client.FineTuning.Jobs.Get(ctx, fineTuningJobID) (*FineTuningJob, error)
get /fine_tuning/jobs/{fine_tuning_job_id}
Get info about a fine-tuning job.
Parameters
fineTuningJobID string
Returns
-
type FineTuningJob struct{…}The
fine_tuning.jobobject represents a fine-tuning job that has been created through the API.-
ID stringThe object identifier, which can be referenced in the API endpoints.
-
CreatedAt int64The Unix timestamp (in seconds) for when the fine-tuning job was created.
-
Error FineTuningJobErrorFor fine-tuning jobs that have
failed, this will contain more information on the cause of the failure.-
Code stringA machine-readable error code.
-
Message stringA human-readable error message.
-
Param stringThe parameter that was invalid, usually
training_fileorvalidation_file. This field will be null if the failure was not parameter-specific.
-
-
FineTunedModel stringThe name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running.
-
FinishedAt int64The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running.
-
Hyperparameters FineTuningJobHyperparametersThe hyperparameters used for the fine-tuning job. This value will only be returned when running
supervisedjobs.-
BatchSize FineTuningJobHyperparametersBatchSizeUnionNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier FineTuningJobHyperparametersLearningRateMultiplierUnionScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs FineTuningJobHyperparametersNEpochsUnionThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
Model stringThe base model that is being fine-tuned.
-
Object FineTuningJobThe object type, which is always "fine_tuning.job".
const FineTuningJobFineTuningJob FineTuningJob = "fine_tuning.job"
-
OrganizationID stringThe organization that owns the fine-tuning job.
-
ResultFiles []stringThe compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the Files API.
-
Seed int64The seed used for the fine-tuning job.
-
Status FineTuningJobStatusThe current status of the fine-tuning job, which can be either
validating_files,queued,running,succeeded,failed, orcancelled.-
const FineTuningJobStatusValidatingFiles FineTuningJobStatus = "validating_files" -
const FineTuningJobStatusQueued FineTuningJobStatus = "queued" -
const FineTuningJobStatusRunning FineTuningJobStatus = "running" -
const FineTuningJobStatusSucceeded FineTuningJobStatus = "succeeded" -
const FineTuningJobStatusFailed FineTuningJobStatus = "failed" -
const FineTuningJobStatusCancelled FineTuningJobStatus = "cancelled"
-
-
TrainedTokens int64The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running.
-
TrainingFile stringThe file ID used for training. You can retrieve the training data with the Files API.
-
ValidationFile stringThe file ID used for validation. You can retrieve the validation results with the Files API.
-
EstimatedFinish int64The Unix timestamp (in seconds) for when the fine-tuning job is estimated to finish. The value will be null if the fine-tuning job is not running.
-
Integrations []FineTuningJobWandbIntegrationObjectA list of integrations to enable for this fine-tuning job.
-
Type WandbThe type of the integration being enabled for the fine-tuning job
const WandbWandb Wandb = "wandb"
-
Wandb FineTuningJobWandbIntegrationThe settings for your integration with Weights and Biases. This payload specifies the project that metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags to your run, and set a default entity (team, username, etc) to be associated with your run.
-
Project stringThe name of the project that the new run will be created under.
-
Entity stringThe entity to use for the run. This allows you to set the team or username of the WandB user that you would like associated with the run. If not set, the default entity for the registered WandB API key is used.
-
Name stringA display name to set for the run. If not set, we will use the Job ID as the name.
-
Tags []stringA list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some default tags are generated by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}".
-
-
-
Metadata MetadataSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
-
Method FineTuningJobMethodThe method used for fine-tuning.
-
Type stringThe type of method. Is either
supervised,dpo, orreinforcement.-
const FineTuningJobMethodTypeSupervised FineTuningJobMethodType = "supervised" -
const FineTuningJobMethodTypeDpo FineTuningJobMethodType = "dpo" -
const FineTuningJobMethodTypeReinforcement FineTuningJobMethodType = "reinforcement"
-
-
Dpo DpoMethodConfiguration for the DPO fine-tuning method.
-
Hyperparameters DpoHyperparametersRespThe hyperparameters used for the DPO fine-tuning job.
-
BatchSize DpoHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
Beta DpoHyperparametersBetaUnionRespThe beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
LearningRateMultiplier DpoHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs DpoHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
-
Reinforcement ReinforcementMethodConfiguration for the reinforcement fine-tuning method.
-
Grader ReinforcementMethodGraderUnionThe 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"
-
-
-
Hyperparameters ReinforcementHyperparametersRespThe hyperparameters used for the reinforcement fine-tuning job.
-
BatchSize ReinforcementHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
ComputeMultiplier ReinforcementHyperparametersComputeMultiplierUnionRespMultiplier on amount of compute used for exploring search space during training.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
EvalInterval ReinforcementHyperparametersEvalIntervalUnionRespThe number of training steps between evaluation runs.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
EvalSamples ReinforcementHyperparametersEvalSamplesUnionRespNumber of evaluation samples to generate per training step.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier ReinforcementHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs ReinforcementHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
ReasoningEffort ReinforcementHyperparametersReasoningEffortLevel of reasoning effort.
-
const ReinforcementHyperparametersReasoningEffortDefault ReinforcementHyperparametersReasoningEffort = "default" -
const ReinforcementHyperparametersReasoningEffortLow ReinforcementHyperparametersReasoningEffort = "low" -
const ReinforcementHyperparametersReasoningEffortMedium ReinforcementHyperparametersReasoningEffort = "medium" -
const ReinforcementHyperparametersReasoningEffortHigh ReinforcementHyperparametersReasoningEffort = "high"
-
-
-
-
Supervised SupervisedMethodConfiguration for the supervised fine-tuning method.
-
Hyperparameters SupervisedHyperparametersRespThe hyperparameters used for the fine-tuning job.
-
BatchSize SupervisedHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier SupervisedHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs SupervisedHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
-
-
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"),
)
fineTuningJob, err := client.FineTuning.Jobs.Get(context.TODO(), "ft-AF1WoRqd3aJAHsqc9NY7iL8F")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", fineTuningJob.ID)
}
Response
{
"id": "id",
"created_at": 0,
"error": {
"code": "code",
"message": "message",
"param": "param"
},
"fine_tuned_model": "fine_tuned_model",
"finished_at": 0,
"hyperparameters": {
"batch_size": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto"
},
"model": "model",
"object": "fine_tuning.job",
"organization_id": "organization_id",
"result_files": [
"file-abc123"
],
"seed": 0,
"status": "validating_files",
"trained_tokens": 0,
"training_file": "training_file",
"validation_file": "validation_file",
"estimated_finish": 0,
"integrations": [
{
"type": "wandb",
"wandb": {
"project": "my-wandb-project",
"entity": "entity",
"name": "name",
"tags": [
"custom-tag"
]
}
}
],
"metadata": {
"foo": "string"
},
"method": {
"type": "supervised",
"dpo": {
"hyperparameters": {
"batch_size": "auto",
"beta": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto"
}
},
"reinforcement": {
"grader": {
"input": "input",
"name": "name",
"operation": "eq",
"reference": "reference",
"type": "string_check"
},
"hyperparameters": {
"batch_size": "auto",
"compute_multiplier": "auto",
"eval_interval": "auto",
"eval_samples": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto",
"reasoning_effort": "default"
}
},
"supervised": {
"hyperparameters": {
"batch_size": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto"
}
}
}
}
List fine-tuning events
client.FineTuning.Jobs.ListEvents(ctx, fineTuningJobID, query) (*CursorPage[FineTuningJobEvent], error)
get /fine_tuning/jobs/{fine_tuning_job_id}/events
Get status updates for a fine-tuning job.
Parameters
-
fineTuningJobID string -
query FineTuningJobListEventsParams-
After param.Field[string]Identifier for the last event from the previous pagination request.
-
Limit param.Field[int64]Number of events to retrieve.
-
Returns
-
type FineTuningJobEvent struct{…}Fine-tuning job event object
-
ID stringThe object identifier.
-
CreatedAt int64The Unix timestamp (in seconds) for when the fine-tuning job was created.
-
Level FineTuningJobEventLevelThe log level of the event.
-
const FineTuningJobEventLevelInfo FineTuningJobEventLevel = "info" -
const FineTuningJobEventLevelWarn FineTuningJobEventLevel = "warn" -
const FineTuningJobEventLevelError FineTuningJobEventLevel = "error"
-
-
Message stringThe message of the event.
-
Object FineTuningJobEventThe object type, which is always "fine_tuning.job.event".
const FineTuningJobEventFineTuningJobEvent FineTuningJobEvent = "fine_tuning.job.event"
-
Data anyThe data associated with the event.
-
Type FineTuningJobEventTypeThe type of event.
-
const FineTuningJobEventTypeMessage FineTuningJobEventType = "message" -
const FineTuningJobEventTypeMetrics FineTuningJobEventType = "metrics"
-
-
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"),
)
page, err := client.FineTuning.Jobs.ListEvents(
context.TODO(),
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
openai.FineTuningJobListEventsParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"level": "info",
"message": "message",
"object": "fine_tuning.job.event",
"data": {},
"type": "message"
}
],
"has_more": true,
"object": "list"
}
Cancel fine-tuning
client.FineTuning.Jobs.Cancel(ctx, fineTuningJobID) (*FineTuningJob, error)
post /fine_tuning/jobs/{fine_tuning_job_id}/cancel
Immediately cancel a fine-tune job.
Parameters
fineTuningJobID string
Returns
-
type FineTuningJob struct{…}The
fine_tuning.jobobject represents a fine-tuning job that has been created through the API.-
ID stringThe object identifier, which can be referenced in the API endpoints.
-
CreatedAt int64The Unix timestamp (in seconds) for when the fine-tuning job was created.
-
Error FineTuningJobErrorFor fine-tuning jobs that have
failed, this will contain more information on the cause of the failure.-
Code stringA machine-readable error code.
-
Message stringA human-readable error message.
-
Param stringThe parameter that was invalid, usually
training_fileorvalidation_file. This field will be null if the failure was not parameter-specific.
-
-
FineTunedModel stringThe name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running.
-
FinishedAt int64The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running.
-
Hyperparameters FineTuningJobHyperparametersThe hyperparameters used for the fine-tuning job. This value will only be returned when running
supervisedjobs.-
BatchSize FineTuningJobHyperparametersBatchSizeUnionNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier FineTuningJobHyperparametersLearningRateMultiplierUnionScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs FineTuningJobHyperparametersNEpochsUnionThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
Model stringThe base model that is being fine-tuned.
-
Object FineTuningJobThe object type, which is always "fine_tuning.job".
const FineTuningJobFineTuningJob FineTuningJob = "fine_tuning.job"
-
OrganizationID stringThe organization that owns the fine-tuning job.
-
ResultFiles []stringThe compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the Files API.
-
Seed int64The seed used for the fine-tuning job.
-
Status FineTuningJobStatusThe current status of the fine-tuning job, which can be either
validating_files,queued,running,succeeded,failed, orcancelled.-
const FineTuningJobStatusValidatingFiles FineTuningJobStatus = "validating_files" -
const FineTuningJobStatusQueued FineTuningJobStatus = "queued" -
const FineTuningJobStatusRunning FineTuningJobStatus = "running" -
const FineTuningJobStatusSucceeded FineTuningJobStatus = "succeeded" -
const FineTuningJobStatusFailed FineTuningJobStatus = "failed" -
const FineTuningJobStatusCancelled FineTuningJobStatus = "cancelled"
-
-
TrainedTokens int64The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running.
-
TrainingFile stringThe file ID used for training. You can retrieve the training data with the Files API.
-
ValidationFile stringThe file ID used for validation. You can retrieve the validation results with the Files API.
-
EstimatedFinish int64The Unix timestamp (in seconds) for when the fine-tuning job is estimated to finish. The value will be null if the fine-tuning job is not running.
-
Integrations []FineTuningJobWandbIntegrationObjectA list of integrations to enable for this fine-tuning job.
-
Type WandbThe type of the integration being enabled for the fine-tuning job
const WandbWandb Wandb = "wandb"
-
Wandb FineTuningJobWandbIntegrationThe settings for your integration with Weights and Biases. This payload specifies the project that metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags to your run, and set a default entity (team, username, etc) to be associated with your run.
-
Project stringThe name of the project that the new run will be created under.
-
Entity stringThe entity to use for the run. This allows you to set the team or username of the WandB user that you would like associated with the run. If not set, the default entity for the registered WandB API key is used.
-
Name stringA display name to set for the run. If not set, we will use the Job ID as the name.
-
Tags []stringA list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some default tags are generated by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}".
-
-
-
Metadata MetadataSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
-
Method FineTuningJobMethodThe method used for fine-tuning.
-
Type stringThe type of method. Is either
supervised,dpo, orreinforcement.-
const FineTuningJobMethodTypeSupervised FineTuningJobMethodType = "supervised" -
const FineTuningJobMethodTypeDpo FineTuningJobMethodType = "dpo" -
const FineTuningJobMethodTypeReinforcement FineTuningJobMethodType = "reinforcement"
-
-
Dpo DpoMethodConfiguration for the DPO fine-tuning method.
-
Hyperparameters DpoHyperparametersRespThe hyperparameters used for the DPO fine-tuning job.
-
BatchSize DpoHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
Beta DpoHyperparametersBetaUnionRespThe beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
LearningRateMultiplier DpoHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs DpoHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
-
Reinforcement ReinforcementMethodConfiguration for the reinforcement fine-tuning method.
-
Grader ReinforcementMethodGraderUnionThe 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"
-
-
-
Hyperparameters ReinforcementHyperparametersRespThe hyperparameters used for the reinforcement fine-tuning job.
-
BatchSize ReinforcementHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
ComputeMultiplier ReinforcementHyperparametersComputeMultiplierUnionRespMultiplier on amount of compute used for exploring search space during training.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
EvalInterval ReinforcementHyperparametersEvalIntervalUnionRespThe number of training steps between evaluation runs.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
EvalSamples ReinforcementHyperparametersEvalSamplesUnionRespNumber of evaluation samples to generate per training step.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier ReinforcementHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs ReinforcementHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
ReasoningEffort ReinforcementHyperparametersReasoningEffortLevel of reasoning effort.
-
const ReinforcementHyperparametersReasoningEffortDefault ReinforcementHyperparametersReasoningEffort = "default" -
const ReinforcementHyperparametersReasoningEffortLow ReinforcementHyperparametersReasoningEffort = "low" -
const ReinforcementHyperparametersReasoningEffortMedium ReinforcementHyperparametersReasoningEffort = "medium" -
const ReinforcementHyperparametersReasoningEffortHigh ReinforcementHyperparametersReasoningEffort = "high"
-
-
-
-
Supervised SupervisedMethodConfiguration for the supervised fine-tuning method.
-
Hyperparameters SupervisedHyperparametersRespThe hyperparameters used for the fine-tuning job.
-
BatchSize SupervisedHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier SupervisedHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs SupervisedHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
-
-
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"),
)
fineTuningJob, err := client.FineTuning.Jobs.Cancel(context.TODO(), "ft-AF1WoRqd3aJAHsqc9NY7iL8F")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", fineTuningJob.ID)
}
Response
{
"id": "id",
"created_at": 0,
"error": {
"code": "code",
"message": "message",
"param": "param"
},
"fine_tuned_model": "fine_tuned_model",
"finished_at": 0,
"hyperparameters": {
"batch_size": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto"
},
"model": "model",
"object": "fine_tuning.job",
"organization_id": "organization_id",
"result_files": [
"file-abc123"
],
"seed": 0,
"status": "validating_files",
"trained_tokens": 0,
"training_file": "training_file",
"validation_file": "validation_file",
"estimated_finish": 0,
"integrations": [
{
"type": "wandb",
"wandb": {
"project": "my-wandb-project",
"entity": "entity",
"name": "name",
"tags": [
"custom-tag"
]
}
}
],
"metadata": {
"foo": "string"
},
"method": {
"type": "supervised",
"dpo": {
"hyperparameters": {
"batch_size": "auto",
"beta": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto"
}
},
"reinforcement": {
"grader": {
"input": "input",
"name": "name",
"operation": "eq",
"reference": "reference",
"type": "string_check"
},
"hyperparameters": {
"batch_size": "auto",
"compute_multiplier": "auto",
"eval_interval": "auto",
"eval_samples": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto",
"reasoning_effort": "default"
}
},
"supervised": {
"hyperparameters": {
"batch_size": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto"
}
}
}
}
Pause fine-tuning
client.FineTuning.Jobs.Pause(ctx, fineTuningJobID) (*FineTuningJob, error)
post /fine_tuning/jobs/{fine_tuning_job_id}/pause
Pause a fine-tune job.
Parameters
fineTuningJobID string
Returns
-
type FineTuningJob struct{…}The
fine_tuning.jobobject represents a fine-tuning job that has been created through the API.-
ID stringThe object identifier, which can be referenced in the API endpoints.
-
CreatedAt int64The Unix timestamp (in seconds) for when the fine-tuning job was created.
-
Error FineTuningJobErrorFor fine-tuning jobs that have
failed, this will contain more information on the cause of the failure.-
Code stringA machine-readable error code.
-
Message stringA human-readable error message.
-
Param stringThe parameter that was invalid, usually
training_fileorvalidation_file. This field will be null if the failure was not parameter-specific.
-
-
FineTunedModel stringThe name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running.
-
FinishedAt int64The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running.
-
Hyperparameters FineTuningJobHyperparametersThe hyperparameters used for the fine-tuning job. This value will only be returned when running
supervisedjobs.-
BatchSize FineTuningJobHyperparametersBatchSizeUnionNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier FineTuningJobHyperparametersLearningRateMultiplierUnionScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs FineTuningJobHyperparametersNEpochsUnionThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
Model stringThe base model that is being fine-tuned.
-
Object FineTuningJobThe object type, which is always "fine_tuning.job".
const FineTuningJobFineTuningJob FineTuningJob = "fine_tuning.job"
-
OrganizationID stringThe organization that owns the fine-tuning job.
-
ResultFiles []stringThe compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the Files API.
-
Seed int64The seed used for the fine-tuning job.
-
Status FineTuningJobStatusThe current status of the fine-tuning job, which can be either
validating_files,queued,running,succeeded,failed, orcancelled.-
const FineTuningJobStatusValidatingFiles FineTuningJobStatus = "validating_files" -
const FineTuningJobStatusQueued FineTuningJobStatus = "queued" -
const FineTuningJobStatusRunning FineTuningJobStatus = "running" -
const FineTuningJobStatusSucceeded FineTuningJobStatus = "succeeded" -
const FineTuningJobStatusFailed FineTuningJobStatus = "failed" -
const FineTuningJobStatusCancelled FineTuningJobStatus = "cancelled"
-
-
TrainedTokens int64The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running.
-
TrainingFile stringThe file ID used for training. You can retrieve the training data with the Files API.
-
ValidationFile stringThe file ID used for validation. You can retrieve the validation results with the Files API.
-
EstimatedFinish int64The Unix timestamp (in seconds) for when the fine-tuning job is estimated to finish. The value will be null if the fine-tuning job is not running.
-
Integrations []FineTuningJobWandbIntegrationObjectA list of integrations to enable for this fine-tuning job.
-
Type WandbThe type of the integration being enabled for the fine-tuning job
const WandbWandb Wandb = "wandb"
-
Wandb FineTuningJobWandbIntegrationThe settings for your integration with Weights and Biases. This payload specifies the project that metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags to your run, and set a default entity (team, username, etc) to be associated with your run.
-
Project stringThe name of the project that the new run will be created under.
-
Entity stringThe entity to use for the run. This allows you to set the team or username of the WandB user that you would like associated with the run. If not set, the default entity for the registered WandB API key is used.
-
Name stringA display name to set for the run. If not set, we will use the Job ID as the name.
-
Tags []stringA list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some default tags are generated by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}".
-
-
-
Metadata MetadataSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
-
Method FineTuningJobMethodThe method used for fine-tuning.
-
Type stringThe type of method. Is either
supervised,dpo, orreinforcement.-
const FineTuningJobMethodTypeSupervised FineTuningJobMethodType = "supervised" -
const FineTuningJobMethodTypeDpo FineTuningJobMethodType = "dpo" -
const FineTuningJobMethodTypeReinforcement FineTuningJobMethodType = "reinforcement"
-
-
Dpo DpoMethodConfiguration for the DPO fine-tuning method.
-
Hyperparameters DpoHyperparametersRespThe hyperparameters used for the DPO fine-tuning job.
-
BatchSize DpoHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
Beta DpoHyperparametersBetaUnionRespThe beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
LearningRateMultiplier DpoHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs DpoHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
-
Reinforcement ReinforcementMethodConfiguration for the reinforcement fine-tuning method.
-
Grader ReinforcementMethodGraderUnionThe 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"
-
-
-
Hyperparameters ReinforcementHyperparametersRespThe hyperparameters used for the reinforcement fine-tuning job.
-
BatchSize ReinforcementHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
ComputeMultiplier ReinforcementHyperparametersComputeMultiplierUnionRespMultiplier on amount of compute used for exploring search space during training.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
EvalInterval ReinforcementHyperparametersEvalIntervalUnionRespThe number of training steps between evaluation runs.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
EvalSamples ReinforcementHyperparametersEvalSamplesUnionRespNumber of evaluation samples to generate per training step.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier ReinforcementHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs ReinforcementHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
ReasoningEffort ReinforcementHyperparametersReasoningEffortLevel of reasoning effort.
-
const ReinforcementHyperparametersReasoningEffortDefault ReinforcementHyperparametersReasoningEffort = "default" -
const ReinforcementHyperparametersReasoningEffortLow ReinforcementHyperparametersReasoningEffort = "low" -
const ReinforcementHyperparametersReasoningEffortMedium ReinforcementHyperparametersReasoningEffort = "medium" -
const ReinforcementHyperparametersReasoningEffortHigh ReinforcementHyperparametersReasoningEffort = "high"
-
-
-
-
Supervised SupervisedMethodConfiguration for the supervised fine-tuning method.
-
Hyperparameters SupervisedHyperparametersRespThe hyperparameters used for the fine-tuning job.
-
BatchSize SupervisedHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier SupervisedHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs SupervisedHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
-
-
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"),
)
fineTuningJob, err := client.FineTuning.Jobs.Pause(context.TODO(), "ft-AF1WoRqd3aJAHsqc9NY7iL8F")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", fineTuningJob.ID)
}
Response
{
"id": "id",
"created_at": 0,
"error": {
"code": "code",
"message": "message",
"param": "param"
},
"fine_tuned_model": "fine_tuned_model",
"finished_at": 0,
"hyperparameters": {
"batch_size": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto"
},
"model": "model",
"object": "fine_tuning.job",
"organization_id": "organization_id",
"result_files": [
"file-abc123"
],
"seed": 0,
"status": "validating_files",
"trained_tokens": 0,
"training_file": "training_file",
"validation_file": "validation_file",
"estimated_finish": 0,
"integrations": [
{
"type": "wandb",
"wandb": {
"project": "my-wandb-project",
"entity": "entity",
"name": "name",
"tags": [
"custom-tag"
]
}
}
],
"metadata": {
"foo": "string"
},
"method": {
"type": "supervised",
"dpo": {
"hyperparameters": {
"batch_size": "auto",
"beta": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto"
}
},
"reinforcement": {
"grader": {
"input": "input",
"name": "name",
"operation": "eq",
"reference": "reference",
"type": "string_check"
},
"hyperparameters": {
"batch_size": "auto",
"compute_multiplier": "auto",
"eval_interval": "auto",
"eval_samples": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto",
"reasoning_effort": "default"
}
},
"supervised": {
"hyperparameters": {
"batch_size": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto"
}
}
}
}
Resume fine-tuning
client.FineTuning.Jobs.Resume(ctx, fineTuningJobID) (*FineTuningJob, error)
post /fine_tuning/jobs/{fine_tuning_job_id}/resume
Resume a fine-tune job.
Parameters
fineTuningJobID string
Returns
-
type FineTuningJob struct{…}The
fine_tuning.jobobject represents a fine-tuning job that has been created through the API.-
ID stringThe object identifier, which can be referenced in the API endpoints.
-
CreatedAt int64The Unix timestamp (in seconds) for when the fine-tuning job was created.
-
Error FineTuningJobErrorFor fine-tuning jobs that have
failed, this will contain more information on the cause of the failure.-
Code stringA machine-readable error code.
-
Message stringA human-readable error message.
-
Param stringThe parameter that was invalid, usually
training_fileorvalidation_file. This field will be null if the failure was not parameter-specific.
-
-
FineTunedModel stringThe name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running.
-
FinishedAt int64The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running.
-
Hyperparameters FineTuningJobHyperparametersThe hyperparameters used for the fine-tuning job. This value will only be returned when running
supervisedjobs.-
BatchSize FineTuningJobHyperparametersBatchSizeUnionNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier FineTuningJobHyperparametersLearningRateMultiplierUnionScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs FineTuningJobHyperparametersNEpochsUnionThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
Model stringThe base model that is being fine-tuned.
-
Object FineTuningJobThe object type, which is always "fine_tuning.job".
const FineTuningJobFineTuningJob FineTuningJob = "fine_tuning.job"
-
OrganizationID stringThe organization that owns the fine-tuning job.
-
ResultFiles []stringThe compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the Files API.
-
Seed int64The seed used for the fine-tuning job.
-
Status FineTuningJobStatusThe current status of the fine-tuning job, which can be either
validating_files,queued,running,succeeded,failed, orcancelled.-
const FineTuningJobStatusValidatingFiles FineTuningJobStatus = "validating_files" -
const FineTuningJobStatusQueued FineTuningJobStatus = "queued" -
const FineTuningJobStatusRunning FineTuningJobStatus = "running" -
const FineTuningJobStatusSucceeded FineTuningJobStatus = "succeeded" -
const FineTuningJobStatusFailed FineTuningJobStatus = "failed" -
const FineTuningJobStatusCancelled FineTuningJobStatus = "cancelled"
-
-
TrainedTokens int64The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running.
-
TrainingFile stringThe file ID used for training. You can retrieve the training data with the Files API.
-
ValidationFile stringThe file ID used for validation. You can retrieve the validation results with the Files API.
-
EstimatedFinish int64The Unix timestamp (in seconds) for when the fine-tuning job is estimated to finish. The value will be null if the fine-tuning job is not running.
-
Integrations []FineTuningJobWandbIntegrationObjectA list of integrations to enable for this fine-tuning job.
-
Type WandbThe type of the integration being enabled for the fine-tuning job
const WandbWandb Wandb = "wandb"
-
Wandb FineTuningJobWandbIntegrationThe settings for your integration with Weights and Biases. This payload specifies the project that metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags to your run, and set a default entity (team, username, etc) to be associated with your run.
-
Project stringThe name of the project that the new run will be created under.
-
Entity stringThe entity to use for the run. This allows you to set the team or username of the WandB user that you would like associated with the run. If not set, the default entity for the registered WandB API key is used.
-
Name stringA display name to set for the run. If not set, we will use the Job ID as the name.
-
Tags []stringA list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some default tags are generated by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}".
-
-
-
Metadata MetadataSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
-
Method FineTuningJobMethodThe method used for fine-tuning.
-
Type stringThe type of method. Is either
supervised,dpo, orreinforcement.-
const FineTuningJobMethodTypeSupervised FineTuningJobMethodType = "supervised" -
const FineTuningJobMethodTypeDpo FineTuningJobMethodType = "dpo" -
const FineTuningJobMethodTypeReinforcement FineTuningJobMethodType = "reinforcement"
-
-
Dpo DpoMethodConfiguration for the DPO fine-tuning method.
-
Hyperparameters DpoHyperparametersRespThe hyperparameters used for the DPO fine-tuning job.
-
BatchSize DpoHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
Beta DpoHyperparametersBetaUnionRespThe beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
LearningRateMultiplier DpoHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs DpoHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
-
Reinforcement ReinforcementMethodConfiguration for the reinforcement fine-tuning method.
-
Grader ReinforcementMethodGraderUnionThe 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"
-
-
-
Hyperparameters ReinforcementHyperparametersRespThe hyperparameters used for the reinforcement fine-tuning job.
-
BatchSize ReinforcementHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
ComputeMultiplier ReinforcementHyperparametersComputeMultiplierUnionRespMultiplier on amount of compute used for exploring search space during training.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
EvalInterval ReinforcementHyperparametersEvalIntervalUnionRespThe number of training steps between evaluation runs.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
EvalSamples ReinforcementHyperparametersEvalSamplesUnionRespNumber of evaluation samples to generate per training step.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier ReinforcementHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs ReinforcementHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
ReasoningEffort ReinforcementHyperparametersReasoningEffortLevel of reasoning effort.
-
const ReinforcementHyperparametersReasoningEffortDefault ReinforcementHyperparametersReasoningEffort = "default" -
const ReinforcementHyperparametersReasoningEffortLow ReinforcementHyperparametersReasoningEffort = "low" -
const ReinforcementHyperparametersReasoningEffortMedium ReinforcementHyperparametersReasoningEffort = "medium" -
const ReinforcementHyperparametersReasoningEffortHigh ReinforcementHyperparametersReasoningEffort = "high"
-
-
-
-
Supervised SupervisedMethodConfiguration for the supervised fine-tuning method.
-
Hyperparameters SupervisedHyperparametersRespThe hyperparameters used for the fine-tuning job.
-
BatchSize SupervisedHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier SupervisedHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs SupervisedHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
-
-
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"),
)
fineTuningJob, err := client.FineTuning.Jobs.Resume(context.TODO(), "ft-AF1WoRqd3aJAHsqc9NY7iL8F")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", fineTuningJob.ID)
}
Response
{
"id": "id",
"created_at": 0,
"error": {
"code": "code",
"message": "message",
"param": "param"
},
"fine_tuned_model": "fine_tuned_model",
"finished_at": 0,
"hyperparameters": {
"batch_size": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto"
},
"model": "model",
"object": "fine_tuning.job",
"organization_id": "organization_id",
"result_files": [
"file-abc123"
],
"seed": 0,
"status": "validating_files",
"trained_tokens": 0,
"training_file": "training_file",
"validation_file": "validation_file",
"estimated_finish": 0,
"integrations": [
{
"type": "wandb",
"wandb": {
"project": "my-wandb-project",
"entity": "entity",
"name": "name",
"tags": [
"custom-tag"
]
}
}
],
"metadata": {
"foo": "string"
},
"method": {
"type": "supervised",
"dpo": {
"hyperparameters": {
"batch_size": "auto",
"beta": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto"
}
},
"reinforcement": {
"grader": {
"input": "input",
"name": "name",
"operation": "eq",
"reference": "reference",
"type": "string_check"
},
"hyperparameters": {
"batch_size": "auto",
"compute_multiplier": "auto",
"eval_interval": "auto",
"eval_samples": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto",
"reasoning_effort": "default"
}
},
"supervised": {
"hyperparameters": {
"batch_size": "auto",
"learning_rate_multiplier": "auto",
"n_epochs": "auto"
}
}
}
}
Domain Types
Fine Tuning Job
-
type FineTuningJob struct{…}The
fine_tuning.jobobject represents a fine-tuning job that has been created through the API.-
ID stringThe object identifier, which can be referenced in the API endpoints.
-
CreatedAt int64The Unix timestamp (in seconds) for when the fine-tuning job was created.
-
Error FineTuningJobErrorFor fine-tuning jobs that have
failed, this will contain more information on the cause of the failure.-
Code stringA machine-readable error code.
-
Message stringA human-readable error message.
-
Param stringThe parameter that was invalid, usually
training_fileorvalidation_file. This field will be null if the failure was not parameter-specific.
-
-
FineTunedModel stringThe name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running.
-
FinishedAt int64The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running.
-
Hyperparameters FineTuningJobHyperparametersThe hyperparameters used for the fine-tuning job. This value will only be returned when running
supervisedjobs.-
BatchSize FineTuningJobHyperparametersBatchSizeUnionNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier FineTuningJobHyperparametersLearningRateMultiplierUnionScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs FineTuningJobHyperparametersNEpochsUnionThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
Model stringThe base model that is being fine-tuned.
-
Object FineTuningJobThe object type, which is always "fine_tuning.job".
const FineTuningJobFineTuningJob FineTuningJob = "fine_tuning.job"
-
OrganizationID stringThe organization that owns the fine-tuning job.
-
ResultFiles []stringThe compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the Files API.
-
Seed int64The seed used for the fine-tuning job.
-
Status FineTuningJobStatusThe current status of the fine-tuning job, which can be either
validating_files,queued,running,succeeded,failed, orcancelled.-
const FineTuningJobStatusValidatingFiles FineTuningJobStatus = "validating_files" -
const FineTuningJobStatusQueued FineTuningJobStatus = "queued" -
const FineTuningJobStatusRunning FineTuningJobStatus = "running" -
const FineTuningJobStatusSucceeded FineTuningJobStatus = "succeeded" -
const FineTuningJobStatusFailed FineTuningJobStatus = "failed" -
const FineTuningJobStatusCancelled FineTuningJobStatus = "cancelled"
-
-
TrainedTokens int64The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running.
-
TrainingFile stringThe file ID used for training. You can retrieve the training data with the Files API.
-
ValidationFile stringThe file ID used for validation. You can retrieve the validation results with the Files API.
-
EstimatedFinish int64The Unix timestamp (in seconds) for when the fine-tuning job is estimated to finish. The value will be null if the fine-tuning job is not running.
-
Integrations []FineTuningJobWandbIntegrationObjectA list of integrations to enable for this fine-tuning job.
-
Type WandbThe type of the integration being enabled for the fine-tuning job
const WandbWandb Wandb = "wandb"
-
Wandb FineTuningJobWandbIntegrationThe settings for your integration with Weights and Biases. This payload specifies the project that metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags to your run, and set a default entity (team, username, etc) to be associated with your run.
-
Project stringThe name of the project that the new run will be created under.
-
Entity stringThe entity to use for the run. This allows you to set the team or username of the WandB user that you would like associated with the run. If not set, the default entity for the registered WandB API key is used.
-
Name stringA display name to set for the run. If not set, we will use the Job ID as the name.
-
Tags []stringA list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some default tags are generated by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}".
-
-
-
Metadata MetadataSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
-
Method FineTuningJobMethodThe method used for fine-tuning.
-
Type stringThe type of method. Is either
supervised,dpo, orreinforcement.-
const FineTuningJobMethodTypeSupervised FineTuningJobMethodType = "supervised" -
const FineTuningJobMethodTypeDpo FineTuningJobMethodType = "dpo" -
const FineTuningJobMethodTypeReinforcement FineTuningJobMethodType = "reinforcement"
-
-
Dpo DpoMethodConfiguration for the DPO fine-tuning method.
-
Hyperparameters DpoHyperparametersRespThe hyperparameters used for the DPO fine-tuning job.
-
BatchSize DpoHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
Beta DpoHyperparametersBetaUnionRespThe beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
LearningRateMultiplier DpoHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs DpoHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
-
Reinforcement ReinforcementMethodConfiguration for the reinforcement fine-tuning method.
-
Grader ReinforcementMethodGraderUnionThe 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"
-
-
-
Hyperparameters ReinforcementHyperparametersRespThe hyperparameters used for the reinforcement fine-tuning job.
-
BatchSize ReinforcementHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
ComputeMultiplier ReinforcementHyperparametersComputeMultiplierUnionRespMultiplier on amount of compute used for exploring search space during training.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
EvalInterval ReinforcementHyperparametersEvalIntervalUnionRespThe number of training steps between evaluation runs.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
EvalSamples ReinforcementHyperparametersEvalSamplesUnionRespNumber of evaluation samples to generate per training step.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier ReinforcementHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs ReinforcementHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
ReasoningEffort ReinforcementHyperparametersReasoningEffortLevel of reasoning effort.
-
const ReinforcementHyperparametersReasoningEffortDefault ReinforcementHyperparametersReasoningEffort = "default" -
const ReinforcementHyperparametersReasoningEffortLow ReinforcementHyperparametersReasoningEffort = "low" -
const ReinforcementHyperparametersReasoningEffortMedium ReinforcementHyperparametersReasoningEffort = "medium" -
const ReinforcementHyperparametersReasoningEffortHigh ReinforcementHyperparametersReasoningEffort = "high"
-
-
-
-
Supervised SupervisedMethodConfiguration for the supervised fine-tuning method.
-
Hyperparameters SupervisedHyperparametersRespThe hyperparameters used for the fine-tuning job.
-
BatchSize SupervisedHyperparametersBatchSizeUnionRespNumber of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
LearningRateMultiplier SupervisedHyperparametersLearningRateMultiplierUnionRespScaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
-
type Auto stringconst AutoAuto Auto = "auto"
-
float64
-
-
NEpochs SupervisedHyperparametersNEpochsUnionRespThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
-
type Auto stringconst AutoAuto Auto = "auto"
-
int64
-
-
-
-
-
Fine Tuning Job Event
-
type FineTuningJobEvent struct{…}Fine-tuning job event object
-
ID stringThe object identifier.
-
CreatedAt int64The Unix timestamp (in seconds) for when the fine-tuning job was created.
-
Level FineTuningJobEventLevelThe log level of the event.
-
const FineTuningJobEventLevelInfo FineTuningJobEventLevel = "info" -
const FineTuningJobEventLevelWarn FineTuningJobEventLevel = "warn" -
const FineTuningJobEventLevelError FineTuningJobEventLevel = "error"
-
-
Message stringThe message of the event.
-
Object FineTuningJobEventThe object type, which is always "fine_tuning.job.event".
const FineTuningJobEventFineTuningJobEvent FineTuningJobEvent = "fine_tuning.job.event"
-
Data anyThe data associated with the event.
-
Type FineTuningJobEventTypeThe type of event.
-
const FineTuningJobEventTypeMessage FineTuningJobEventType = "message" -
const FineTuningJobEventTypeMetrics FineTuningJobEventType = "metrics"
-
-
Fine Tuning Job Wandb Integration
-
type FineTuningJobWandbIntegration struct{…}The settings for your integration with Weights and Biases. This payload specifies the project that metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags to your run, and set a default entity (team, username, etc) to be associated with your run.
-
Project stringThe name of the project that the new run will be created under.
-
Entity stringThe entity to use for the run. This allows you to set the team or username of the WandB user that you would like associated with the run. If not set, the default entity for the registered WandB API key is used.
-
Name stringA display name to set for the run. If not set, we will use the Job ID as the name.
-
Tags []stringA list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some default tags are generated by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}".
-
Fine Tuning Job Wandb Integration Object
-
type FineTuningJobWandbIntegrationObject struct{…}-
Type WandbThe type of the integration being enabled for the fine-tuning job
const WandbWandb Wandb = "wandb"
-
Wandb FineTuningJobWandbIntegrationThe settings for your integration with Weights and Biases. This payload specifies the project that metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags to your run, and set a default entity (team, username, etc) to be associated with your run.
-
Project stringThe name of the project that the new run will be created under.
-
Entity stringThe entity to use for the run. This allows you to set the team or username of the WandB user that you would like associated with the run. If not set, the default entity for the registered WandB API key is used.
-
Name stringA display name to set for the run. If not set, we will use the Job ID as the name.
-
Tags []stringA list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some default tags are generated by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}".
-
-
Checkpoints
List fine-tuning checkpoints
client.FineTuning.Jobs.Checkpoints.List(ctx, fineTuningJobID, query) (*CursorPage[FineTuningJobCheckpoint], error)
get /fine_tuning/jobs/{fine_tuning_job_id}/checkpoints
List checkpoints for a fine-tuning job.
Parameters
-
fineTuningJobID string -
query FineTuningJobCheckpointListParams-
After param.Field[string]Identifier for the last checkpoint ID from the previous pagination request.
-
Limit param.Field[int64]Number of checkpoints to retrieve.
-
Returns
-
type FineTuningJobCheckpoint struct{…}The
fine_tuning.job.checkpointobject represents a model checkpoint for a fine-tuning job that is ready to use.-
ID stringThe checkpoint identifier, which can be referenced in the API endpoints.
-
CreatedAt int64The Unix timestamp (in seconds) for when the checkpoint was created.
-
FineTunedModelCheckpoint stringThe name of the fine-tuned checkpoint model that is created.
-
FineTuningJobID stringThe name of the fine-tuning job that this checkpoint was created from.
-
Metrics FineTuningJobCheckpointMetricsMetrics at the step number during the fine-tuning job.
-
FullValidLoss float64 -
FullValidMeanTokenAccuracy float64 -
Step float64 -
TrainLoss float64 -
TrainMeanTokenAccuracy float64 -
ValidLoss float64 -
ValidMeanTokenAccuracy float64
-
-
Object FineTuningJobCheckpointThe object type, which is always "fine_tuning.job.checkpoint".
const FineTuningJobCheckpointFineTuningJobCheckpoint FineTuningJobCheckpoint = "fine_tuning.job.checkpoint"
-
StepNumber int64The step number that the checkpoint was created at.
-
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"),
)
page, err := client.FineTuning.Jobs.Checkpoints.List(
context.TODO(),
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
openai.FineTuningJobCheckpointListParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"fine_tuned_model_checkpoint": "fine_tuned_model_checkpoint",
"fine_tuning_job_id": "fine_tuning_job_id",
"metrics": {
"full_valid_loss": 0,
"full_valid_mean_token_accuracy": 0,
"step": 0,
"train_loss": 0,
"train_mean_token_accuracy": 0,
"valid_loss": 0,
"valid_mean_token_accuracy": 0
},
"object": "fine_tuning.job.checkpoint",
"step_number": 0
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Domain Types
Fine Tuning Job Checkpoint
-
type FineTuningJobCheckpoint struct{…}The
fine_tuning.job.checkpointobject represents a model checkpoint for a fine-tuning job that is ready to use.-
ID stringThe checkpoint identifier, which can be referenced in the API endpoints.
-
CreatedAt int64The Unix timestamp (in seconds) for when the checkpoint was created.
-
FineTunedModelCheckpoint stringThe name of the fine-tuned checkpoint model that is created.
-
FineTuningJobID stringThe name of the fine-tuning job that this checkpoint was created from.
-
Metrics FineTuningJobCheckpointMetricsMetrics at the step number during the fine-tuning job.
-
FullValidLoss float64 -
FullValidMeanTokenAccuracy float64 -
Step float64 -
TrainLoss float64 -
TrainMeanTokenAccuracy float64 -
ValidLoss float64 -
ValidMeanTokenAccuracy float64
-
-
Object FineTuningJobCheckpointThe object type, which is always "fine_tuning.job.checkpoint".
const FineTuningJobCheckpointFineTuningJobCheckpoint FineTuningJobCheckpoint = "fine_tuning.job.checkpoint"
-
StepNumber int64The step number that the checkpoint was created at.
-
Checkpoints
Permissions
List checkpoint permissions
client.FineTuning.Checkpoints.Permissions.Get(ctx, fineTunedModelCheckpoint, query) (*FineTuningCheckpointPermissionGetResponse, error)
get /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions
NOTE: This endpoint requires an admin API key.
Organization owners can use this endpoint to view all permissions for a fine-tuned model checkpoint.
Parameters
-
fineTunedModelCheckpoint string -
query FineTuningCheckpointPermissionGetParams-
After param.Field[string]Identifier for the last permission ID from the previous pagination request.
-
Limit param.Field[int64]Number of permissions to retrieve.
-
Order param.Field[FineTuningCheckpointPermissionGetParamsOrder]The order in which to retrieve permissions.
-
const FineTuningCheckpointPermissionGetParamsOrderAscending FineTuningCheckpointPermissionGetParamsOrder = "ascending" -
const FineTuningCheckpointPermissionGetParamsOrderDescending FineTuningCheckpointPermissionGetParamsOrder = "descending"
-
-
ProjectID param.Field[string]The ID of the project to get permissions for.
-
Returns
-
type FineTuningCheckpointPermissionGetResponse struct{…}-
Data []FineTuningCheckpointPermissionGetResponseData-
ID stringThe permission identifier, which can be referenced in the API endpoints.
-
CreatedAt int64The Unix timestamp (in seconds) for when the permission was created.
-
Object CheckpointPermissionThe object type, which is always "checkpoint.permission".
const CheckpointPermissionCheckpointPermission CheckpointPermission = "checkpoint.permission"
-
ProjectID stringThe project identifier that the permission is for.
-
-
HasMore bool -
Object Listconst ListList List = "list"
-
FirstID string -
LastID string
-
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"),
)
permission, err := client.FineTuning.Checkpoints.Permissions.Get(
context.TODO(),
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
openai.FineTuningCheckpointPermissionGetParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", permission.FirstID)
}
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"object": "checkpoint.permission",
"project_id": "project_id"
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
List checkpoint permissions
client.FineTuning.Checkpoints.Permissions.List(ctx, fineTunedModelCheckpoint, query) (*ConversationCursorPage[FineTuningCheckpointPermissionListResponse], error)
get /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions
NOTE: This endpoint requires an admin API key.
Organization owners can use this endpoint to view all permissions for a fine-tuned model checkpoint.
Parameters
-
fineTunedModelCheckpoint string -
query FineTuningCheckpointPermissionListParams-
After param.Field[string]Identifier for the last permission ID from the previous pagination request.
-
Limit param.Field[int64]Number of permissions to retrieve.
-
Order param.Field[FineTuningCheckpointPermissionListParamsOrder]The order in which to retrieve permissions.
-
const FineTuningCheckpointPermissionListParamsOrderAscending FineTuningCheckpointPermissionListParamsOrder = "ascending" -
const FineTuningCheckpointPermissionListParamsOrderDescending FineTuningCheckpointPermissionListParamsOrder = "descending"
-
-
ProjectID param.Field[string]The ID of the project to get permissions for.
-
Returns
-
type FineTuningCheckpointPermissionListResponse struct{…}The
checkpoint.permissionobject represents a permission for a fine-tuned model checkpoint.-
ID stringThe permission identifier, which can be referenced in the API endpoints.
-
CreatedAt int64The Unix timestamp (in seconds) for when the permission was created.
-
Object CheckpointPermissionThe object type, which is always "checkpoint.permission".
const CheckpointPermissionCheckpointPermission CheckpointPermission = "checkpoint.permission"
-
ProjectID stringThe project identifier that the permission is for.
-
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"),
)
page, err := client.FineTuning.Checkpoints.Permissions.List(
context.TODO(),
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
openai.FineTuningCheckpointPermissionListParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"object": "checkpoint.permission",
"project_id": "project_id"
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Create checkpoint permissions
client.FineTuning.Checkpoints.Permissions.New(ctx, fineTunedModelCheckpoint, body) (*Page[FineTuningCheckpointPermissionNewResponse], error)
post /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions
NOTE: Calling this endpoint requires an admin API key.
This enables organization owners to share fine-tuned models with other projects in their organization.
Parameters
-
fineTunedModelCheckpoint string -
body FineTuningCheckpointPermissionNewParams-
ProjectIDs param.Field[[]string]The project identifiers to grant access to.
-
Returns
-
type FineTuningCheckpointPermissionNewResponse struct{…}The
checkpoint.permissionobject represents a permission for a fine-tuned model checkpoint.-
ID stringThe permission identifier, which can be referenced in the API endpoints.
-
CreatedAt int64The Unix timestamp (in seconds) for when the permission was created.
-
Object CheckpointPermissionThe object type, which is always "checkpoint.permission".
const CheckpointPermissionCheckpointPermission CheckpointPermission = "checkpoint.permission"
-
ProjectID stringThe project identifier that the permission is for.
-
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"),
)
page, err := client.FineTuning.Checkpoints.Permissions.New(
context.TODO(),
"ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd",
openai.FineTuningCheckpointPermissionNewParams{
ProjectIDs: []string{"string"},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"object": "checkpoint.permission",
"project_id": "project_id"
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Delete checkpoint permission
client.FineTuning.Checkpoints.Permissions.Delete(ctx, fineTunedModelCheckpoint, permissionID) (*FineTuningCheckpointPermissionDeleteResponse, error)
delete /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions/{permission_id}
NOTE: This endpoint requires an admin API key.
Organization owners can use this endpoint to delete a permission for a fine-tuned model checkpoint.
Parameters
-
fineTunedModelCheckpoint string -
permissionID string
Returns
-
type FineTuningCheckpointPermissionDeleteResponse struct{…}-
ID stringThe ID of the fine-tuned model checkpoint permission that was deleted.
-
Deleted boolWhether the fine-tuned model checkpoint permission was successfully deleted.
-
Object CheckpointPermissionThe object type, which is always "checkpoint.permission".
const CheckpointPermissionCheckpointPermission CheckpointPermission = "checkpoint.permission"
-
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"),
)
permission, err := client.FineTuning.Checkpoints.Permissions.Delete(
context.TODO(),
"ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd",
"cp_zc4Q7MP6XxulcVzj4MZdwsAB",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", permission.ID)
}
Response
{
"id": "id",
"deleted": true,
"object": "checkpoint.permission"
}
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"
}
}