Extend trajectories with a next user turn (or estimate cost)
For each row’s conversation, generates the user’s next message: a single question or request that can only be answered correctly by remembering details from earlier in the conversation, written in the conversation’s language. No completion is generated for it. Each request creates a new dataset for the result, returned as dataset_id; the dataset in the path is left unchanged. Poll GET /datasets/{dataset_id}/status and download from GET /datasets/{dataset_id}/download with the new id. If the dataset has been adapted (POST /datasets/{dataset_id}/adapt finished), the extension builds on its adapted download: column_mapping names columns of that download, so column_mapping.completion can be enhanced_completion, and the result keeps the adapted columns next to extended_prompt. Only prompt + completion applies there, since adapt splits a chat column into original_prompt and original_completion. Otherwise the extension reads the uploaded file, with one of two mappings. column_mapping.chat: a column of {"role", "content"} turns (or a JSON string of that list), ending on the assistant’s reply. Or column_mapping.prompt with column_mapping.completion: the conversation up to the user’s last turn (a turn list, or a plain string), plus the final reply as plain text. Each row of the result carries the conversation (split as for /adapt) plus an extended_prompt column. context, universal_prompt and image mappings are not currently supported. Credits and status polling behave as for /adapt; an idempotency_key replays the extension it first created, returning its dataset_id and run_id with zero estimates, since the replay starts and charges nothing (as for /translate). Set estimate=true to validate and get a cost quote without starting a run.
Extend trajectories with a next user turn (or estimate cost)
import os
from adaption import Adaption
client = Adaption(
api_key=os.environ.get("ADAPTION_API_KEY"), # This is the default and can be omitted
)
response = client.datasets.extend_trajectories(
dataset_id="dataset_id",
)
print(response.run_id){
"run_id": "dataset-550e8400-e29b-41d4-a716-446655440000-1712234567890",
"estimatedMinutes": 0,
"estimatedCreditsConsumed": 0,
"estimate": true,
"multimodalPricingApplied": true,
"creditMultiplier": 0,
"dataset_id": "7d1f3c2a-9b4e-4f60-8a1d-2e5c6b7a8f90"
}Returns Examples
{
"run_id": "dataset-550e8400-e29b-41d4-a716-446655440000-1712234567890",
"estimatedMinutes": 0,
"estimatedCreditsConsumed": 0,
"estimate": true,
"multimodalPricingApplied": true,
"creditMultiplier": 0,
"dataset_id": "7d1f3c2a-9b4e-4f60-8a1d-2e5c6b7a8f90"
}