Skip to main content
Evaluate precomputed responses in JSONL or CSV data by defining a schema, mapping fields to evaluators, and starting a cloud evaluation run.

Prerequisites

The examples use the SDK client configured in Set up the SDK client.

Prepare input data

Most evaluation scenarios require input data. You can provide data in two ways:
If you don’t have a hand-curated dataset, you can bootstrap one. Use Generate a synthetic evaluation dataset when you’re prelaunch or have low traffic, or Convert agent traces into evaluation datasets to build a dataset from real production traffic.
Upload a JSONL or CSV file to create a versioned dataset in your Foundry project. Datasets support versioning and reuse across multiple evaluation runs. Use this approach for production testing and CI/CD workflows. Prepare a JSONL file with one JSON object per line containing the fields your evaluators need:
Or prepare a CSV file with column headers matching your evaluator fields:

Provide data inline

For quick experimentation with small test sets—or for scenarios that require inline data, such as agent response evaluation—provide data directly in the evaluation request by using file_content. For agent response evaluations, file_content is the only supported source type.
Pass source as the "source" field in your data source configuration when creating a run. The following scenario sections use file_id by default.

Source type support by scenario

Not all scenarios support both source types. The following matrix shows which source type each scenario supports.

Evaluate a JSONL dataset

Evaluate precomputed responses in a JSONL file by using the jsonl data source type. This scenario is useful when you already have model outputs and want to assess their quality.
Before you begin, complete client setup and Prepare input data.

Define the data schema and evaluators

Specify the schema that matches your JSONL fields, and select the evaluators (testing criteria) to run. Use the data_mapping parameter to connect fields from your input data to evaluator parameters by using {{item.field}} syntax. Always include data_mapping with the required input fields for each evaluator. Your field names must match those in your JSONL file. For example, if your data has "question" instead of "query", use "{{item.question}}" in the mapping. For the required parameters per evaluator, see built-in evaluators.

Create evaluation and run

Create the evaluation, and then start a run against your uploaded dataset. The run executes each evaluator on every row in the dataset.
For a complete runnable example, see sample_evaluations_builtin_with_dataset_id.py on GitHub. To poll for completion and interpret results, see Get cloud evaluation results.

Evaluate a CSV dataset

Evaluate precomputed responses in a CSV file by using the csv data source type. This scenario works the same way as dataset evaluation but accepts CSV files instead of JSONL. Use CSV when your data is already in spreadsheet or tabular format.
Before you begin, complete client setup and Prepare input data.

Prepare a CSV file

Create a CSV file with column headers that match the fields your evaluators need. Each row represents one test case.

Upload and run

Upload the CSV file as a dataset. Then, create an evaluation by using the csv data source type. The schema definition and evaluator configuration are the same as for JSONL evaluations. The only difference is the "type": "csv" in the data source.

Next steps