Submit Training Job
Create a tuning job for the specified Agent
to specialize it to your specific domain or use case.
This API initiates an asynchronous tuning task. You can provide the required data through one of two ways:
-
Provide a
training_file
and an optionaltest_file
. If notest_file
is provided, a portion of thetraining_file
will be held out as the test set. For easy reusability, thetraining_file
is automatically saved as aTuning
Dataset
, and thetest_file
as anEvaluation
Dataset
. You can manage them via the/datasets/tune
and/datasets/evaluation
endpoints. -
Provide a
Tuning
Dataset
and an optionalEvaluation
Dataset
. You can create aTuning
Dataset
andEvaluation
Dataset
using the/datasets/tune
and/datasets/evaluation
endpoints respectively.
The API returns a tune job id
which can be used to check on the status of your tuning task through the GET /tune/jobs/{job_id}/metadata
endpoint.
After the tuning job is complete, the metadata associated with the tune job will include evaluation results and a model ID. You can then deploy the tuned model to the agent by editing its config with the tuned model ID and the “Edit Agent” API (i.e. the PUT /agents/{agent_id}
API). To deactivate the tuned model, you will need to edit the Agent’s config again and set the llm_model_id
field to “default”. For an end-to-end walkthrough, see the Tune & Evaluation Guide
.
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Path Parameters
ID of the Agent to list tuning jobs for
Body
Local path to the training data file.
The file should be in JSON array format, where each element of the array is a JSON object represents a single training example. The four required fields are guideline
, prompt
, reference
, and knowledge
.
-
knowledge
(list[str]
): Retrieved knowledge used to generate the reference answer.knowledge
is a list of retrieved text chunks. -
reference
(str
): The gold-standard answer to the prompt. -
guideline
(str
): Guidelines for model output. If you do not have special guidelines for the model's output, you can use theSystem Prompt
defined in your Agent configuration as theguideline
. -
prompt
(str
): Question for the model to respond to.
Example:
[
{
"guideline": "The answer should be accurate.",
"prompt": "What was last quarter's revenue?",
"reference": "According to recent reports, the Q3 revenue was $1.2 million, a 0.1 million increase from Q2.",
"knowledge": [
"Quarterly report: Q3 revenue was $1.2 million.",
"Quarterly report: Q2 revenue was $1.1 million.",
...
],
},
...
]
Optional. Local path to the test data file. The test file should follow the same format as the training data file.
Dataset
to use for training, created through the /datasets/tune
API. Either train_dataset_name
or training_file
must be provided, but not both.
Optional. Dataset
to use for testing model checkpoints, created through the /datasets/evaluate
API.
Optional. Comma-separated list of personas to use to generate synthetic data for training
Optional. Whether to generate synthetic data for training
Controls how quickly the model adapts to the training data. Must be greater than 0 and less than or equal to 0.1.
1 < x <= 0.1
Fraction of training steps used for learning rate warmup. Must be between 0 and 1 (exclusive).
0 <= x < 1
Controls the capacity of the LoRA adapters. Must be one of: 8, 16, 32, or 64.
8
, 16
, 32
, 64
Scaling factor that controls the magnitude of LoRA updates. Higher values lead to stronger adaptation effects. The effective learning strength is determined by the ratio of lora_alpha/lora_rank. Must be one of: 8, 16, 32, 64 or 128
8
, 16
, 32
, 64
, 128
LoRA dropout randomly disables connections during training to prevent overfitting and improve generalization when fine-tuning language models with Low-Rank Adaptation. Must be between 0 and 1 (exclusive).
0 <= x < 1
Number of complete passes through the training dataset.
1 <= x <= 4
Response
Response to POST /applications/{application_id}/tune request
ID of the created tune job
Was this page helpful?