from portkey_ai import Portkey
# Initialize the Portkey client
portkey = Portkey(
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
virtual_key="VIRTUAL_KEY" # Add your provider's virtual key
)
fine_tune_job = portkey.fine_tuning.jobs.create(
training_file="file_id", # encoded s3 file URI of the training data.
model="model_id", # ex: modelId from bedrock for fine-tuning
hyperparameters={
"n_epochs": 1
},
role_arn="role_arn", # service role arn for bedrock job to assume when running.
job_name="job_name", # name for the job, optional will created random if not provided.
validation_file="file_id", # optional, must be encoded s3 file URI.
suffix="finetuned_model_name",
model_type="text" # optional, chat or text.
)
print(fine_tune_job)