Upload a file

Please follow to the bedrock file upload guide for more details.

Create a fine-tuning job

curl \
--header 'Content-Type: application/json' \
--header 'x-portkey-api-key: <api_key>' \
--header 'x-portkey-virtual-key: <virtual_key>' \
--header 'x-portkey-aws-s3-bucket: <s3_bucket>' \
--data '{
  "model": "<model_id>",
  "model_type": "text", #chat or text
  "suffix": "<finetune_model_name>",
  "training_file": "<s3_path.jsonl>",
  "role_arn": "<role_arn>",
  "job_name": "<job_name>",
  "hyperparameters": {
    "n_epochs": 1
  }
}' \
'https://api.portkey.ai/v1/fine_tuning/jobs'

Notes:

  • Bedrock fine-tuning dataset format is a little bit different from OpenAI’s fine-tuning dataset format.
  • model_type field is required for the dataset transformation, currently gateway does the following dataset transformation:
    • chat -> text-to-text
    • chat -> chat.
  • model param should be the ModelID that is required for fine-tuning not for the inference. ModelID is different for inference and fine-tuning.

List of supported finetune models and their IDs are available at Bedrock documentation

List fine-tuning jobs

curl --header 'x-portkey-api-key: <api_key>' \
--header 'x-portkey-virtual-key: <virtual_key>' \
 'https://api.portkey.ai/v1/fine_tuning/jobs'

Get a fine-tuning job

curl --header 'x-portkey-api-key: <api_key>' \
--header 'x-portkey-virtual-key: <virtual_key>' \
 'https://api.portkey.ai/v1/fine_tuning/jobs/<job_id>'

Cancel a fine-tuning job

curl --header 'x-portkey-api-key: <api_key>' \
--header 'x-portkey-virtual-key: <virtual_key>' \
 'https://api.portkey.ai/v1/fine_tuning/jobs/<job_id>/cancel'

References

  • Fine-tune Support types for models: Link
  • Fine-tuning Documentation: Link