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 for Azure OpenAI
)
# Create a fine-tuning job
fine_tune_job = portkey.fine_tuning.jobs.create(
model="gpt-35-turbo", # Base model to fine-tune
training_file="file_id", # ID of the uploaded training file
validation_file="file_id", # Optional: ID of the uploaded validation file
suffix="finetune_name", # Custom suffix for the fine-tuned model name
hyperparameters={
"n_epochs": 1
}
)
print(fine_tune_job)