Skip to content
SupportLogin

Select columns to adapt

Map dataset columns to prompt, completion, context, image, or chat roles before running Adaptive Data.

A dataset is made of rows and named columns. Adaptive Data needs to know which column contains the instruction, which contains the answer, and which columns provide supporting material. In the Python SDK, you define these roles with column_mapping on datasets.run.

Column mapping is the foundation for later steps such as recipes and brand controls, evaluation, and export.

Every run needs at least one of these anchors:

  • Prompt — the question, instruction, or task to complete.
  • Completion — the expected response or answer.

You only need one. If the other is missing, Adaptive Data can generate it.

The examples below assume you have installed and configured the Python SDK and uploaded a dataset to obtain dataset_id.

If the dataset contains prompts but no completions, map only the prompt column. Adaptive Data generates a completion for each row.

For example, a CSV with an instruction column might contain real tasks such as “Explain why leaves appear green” and “Convert 15 miles to kilometres”:

run = client.datasets.run(
dataset_id,
column_mapping={"prompt": "instruction"},
)

If the dataset contains high-quality answers but no prompts, map only the completion column. Adaptive Data synthesizes an appropriate prompt for each answer.

For example, a CSV with a response column might contain reference answers such as “Leaves appear green because chlorophyll reflects green wavelengths of light”:

run = client.datasets.run(
dataset_id,
column_mapping={"completion": "response"},
)

Most instruction datasets already contain both roles:

run = client.datasets.run(
dataset_id,
column_mapping={
"prompt": "instruction",
"completion": "response",
},
)

Context columns hold per-row background information, reference data, or metadata that the model needs to answer the prompt. Unlike prompt and completion, context is a list, so you can map multiple columns.

This example maps a document question-answering dataset with a title and passage for each question:

run = client.datasets.run(
dataset_id,
column_mapping={
"prompt": "question",
"completion": "answer",
"context": ["document_title", "document_body"],
},
)

Common patterns include:

  • Retrieval-augmented generation (RAG) — map the query as prompt, retrieved passages as context, and the reference answer as completion.
  • Per-row metadata — provide an audience, tone, locale, or product line alongside each prompt.
  • Universal prompt with context — apply one instruction to every row while context columns provide the row-specific material.

For one instruction shared by every row, use a universal prompt. For visual context, see Map an image column.

If every row should use the same instruction and the dataset does not have a prompt column, define a universal prompt. Context or image columns then supply the per-row content on which that instruction operates.

In the Python SDK, set universal_prompt directly in column_mapping. This example classifies reviews while using the existing sentiment column as the expected completion:

run = client.datasets.run(
dataset_id,
column_mapping={
"universal_prompt": (
"Classify the sentiment of this review as positive, neutral, "
"or negative. Respond with one word."
),
"context": ["review"],
"completion": "sentiment",
},
)

You can configure the same mapping in the web app:

On the columns step, locate the Prompt column card and select I don’t have prompt.

The columns step of the wizard with the Prompt column card and its "I don't have prompt" checkbox highlighted, alongside the Context column and Completion column cards.

The prompt card displays two choices:

  • Let adaption create prompt generates a prompt for each completion.
  • Write universal prompt applies one instruction to every row.

Select Write universal prompt, then enter the instruction in Enter prompt for all entries….

The expanded prompt card highlighting the "Write universal prompt" link and a textarea with placeholder "Enter prompt for all entries..." underneath, with the "Let adaption create prompt" toggle visible above.

Write a complete, self-contained instruction that identifies the task and expected output. For example:

Classify the sentiment of this review as positive, neutral, or negative. Respond with one word.

The same universal_prompt value is available through the datasets.run API and Python SDK, so app and programmatic runs can use the same mapping.

Images use the dedicated image mapping rather than the context list. The following mapping uses the public MathVision dataset: question contains the prompt, decoded_image contains the figure, and answer contains the expected answer.

run = client.datasets.run(
dataset_id,
column_mapping={
"prompt": "question",
"completion": "answer",
"image": "decoded_image",
},
)

Mapping the MathVision columns in the column selection step of the adaptation wizard: question as the prompt, decoded_image as image context, and answer as the completion.

Use image columns for visual question answering, captioning, classification, OCR, and other multimodal tasks.

Supported representations depend on the dataset source.

  • bytes — raw image bytes
  • hf_struct — a Hugging Face Image() feature
  • list — an array of image bytes
  • url — an absolute http(s) URL
  • path — a relative path, such as an imagefolder entry
  • Image folders without a manifest, such as train/<class>/*.png
  • A CSV or Parquet manifest with an image column
  • A tabular file with a bytes or URL column

For directly uploaded CSV, Parquet, JSON, JSONL, XLSX, and similar files:

  • bytes, hf_struct, or list
  • url — an absolute http(s) URL

A chat column contains a multi-turn conversation in the same shape used by OpenAI-style chat APIs. Each cell is a JSON array of turns:

[
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "How do I reset my password?" },
{
"role": "assistant",
"content": "Open Settings, select Account, then select Reset password."
}
]

Map the column containing those arrays:

run = client.datasets.run(
dataset_id,
column_mapping={"chat": "messages"},
)

When you map chat, Adaptive Data derives the prompt and completion from the conversation. Use chat for existing multi-turn data; use prompt and completion for single instruction-and-answer pairs.

Cells mapped as prompt or completion can contain either:

  • Plain text — a string in each cell.
  • Chat-turn arrays — a JSON array of {"role": "...", "content": "..."} objects.

For example, a structured completion can preserve an exchange within one cell:

[
{ "role": "user", "content": "Summarize this email." },
{
"role": "assistant",
"content": "The customer accepted the revised delivery date."
}
]

Adaptive Data parses valid arrays into chat turns and treats other values as plain text. For a full multi-turn conversation stored in one column, prefer the purpose-built chat mapping.

See ColumnMapping on the datasets.run reference for the current schema.