The SDK’s tuning implementation is experimental, and may change in future versions.
Method
TuningJob object. This method initiates a fine-tuning process for a specified base model using the provided training dataset.
string
required
The name of the model to tune. For Vertex AI, this can also be a pre-tuned model resource name starting with
projects/.TuningDataset
required
The training dataset to use for tuning. Can be one of:
gcs_uri: GCS bucket path (Vertex AI only)vertex_dataset_resource: Vertex AI Dataset resource (Vertex AI only)examples: Inline training examples (Gemini API only)
CreateTuningJobConfig
Configuration options for the tuning job:
Response
string
The resource name of the tuning job
JobState
Current state of the tuning job. One of:
JOB_STATE_QUEUED: Job is queuedJOB_STATE_PENDING: Job is pendingJOB_STATE_RUNNING: Job is runningJOB_STATE_SUCCEEDED: Job completed successfullyJOB_STATE_FAILED: Job failedJOB_STATE_CANCELLED: Job was cancelled
string
Timestamp when the job was created
string
Timestamp when the job started running
string
Timestamp when the job completed
string
The base model being tuned
TunedModel
Information about the resulting tuned model
Usage
Basic Example
Polling for Completion
With Inline Examples (Gemini API)
See Also
- tunings.get - Retrieve tuning job status
- tunings.list - List all tuning jobs
- tunings.cancel - Cancel a running tuning job