Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

Build an Evaluation DatasetBeta

Beta
This is coming — this page describes a feature that's still being rolled out and may not be available to you yet.

Keep the conversations that matter to you in a Dataset, so you can reuse them whenever you measure a change.

About This Task​

A Dataset holds conversations you want to compare pipeline versions on. It can include conversations from any pipeline in the workspace. To open the Datasets page, open a pipeline's Evaluation tab and choose Datasets from the Resources menu. The list shows the Datasets that have a test case recorded on that pipeline, and each Dataset lists only that pipeline's test cases.

For background, see Datasets. To reuse a Dataset from another workspace, export it there and import it here. For steps, see Import and Export a Dataset. If you have no recorded conversations, you can also build a Dataset from a CSV or XLSX table. See Add Test Cases from a Table.

Ways to Add Test Cases​

You can add test cases to a Dataset in these ways:

Add a Conversation from a Trace​

If a trace shows an answer you want to keep as a test case, add its conversation to a Dataset without leaving the trace.

  1. Open a pipeline, go to Analytics > Traces, and open the trace. For a platform Service, open the trace from the Service's Traces tab.
  2. Click Add to Dataset in the trace detail header.
  3. In Add to, choose Existing Dataset and select the Dataset, or choose New Dataset and type a name.
  4. Click Add. A notification confirms that the test case was added and links to the Dataset.

The test case is the whole conversation the trace belongs to. A trace from a standalone run, outside a chat, is its own conversation. The test case is filed under the trace's pipeline or, for a platform Service, under the Service's source pipeline. The button doesn't appear for an external Service or for a trace written under a previous source pipeline, because there's no pipeline to file the test case under.

Create an Empty Dataset​

  1. Open a pipeline's Evaluation tab, choose Datasets from the Resources menu, and click New Dataset.
  2. Type a name and click Save. The new Dataset opens with no test cases. Copy test cases from another Dataset to fill it.

Add Test Cases from a Table​

To measure your pipeline on questions you keep in a spreadsheet, add them to a Dataset as table-based test cases. Each row of a CSV or XLSX file becomes one test case, and each column is either a pipeline input or expected data that your evaluator reads. For background, see Table-Based Test Cases.

Prepare the File​

  • Use a CSV or XLSX file with a header row. Each following row is one test case.
  • Include a column for each pipeline input you want to send, for example query. If a pipeline input has another name, name the column after it.
  • Add a column for each value your evaluator needs to judge the answer, for example expected_answer. The built-in Answer correctness and Recall Metrics find their expected column by name or content. For how, see Expected Columns for Answer Correctness and Recall.
  • A Dataset holds at most 100 test cases, so keep the file within the room the Dataset has left. If the file has more rows, split it and add the parts to separate Datasets.

What Happens When You Replay a Row​

A replay of a row sends one request to the pipeline. The query value is sent as the query, and every other input goes to the pipeline input with the same name. If the test case has a setup script, the inputs it returns take precedence over the row's inputs. Your evaluator can read the row's inputs and expected data from session["test_case"].

For how to use them in a metric, see Write and Test an Evaluation Metric.

Optimization runs don't accept a Dataset that holds table-based test cases yet. To measure a Service on a Dataset, use one with recorded conversations only.

Copy Test Cases from Another Dataset​

Copy test cases to reuse them in another Dataset, including test cases recorded on other pipelines, without adding the conversations from search history again.

  1. Open the Dataset that should receive the test cases and click Copy test cases.
  2. In From Dataset, choose the source Dataset.
  3. In Test cases, select the test cases to copy.
  4. Click Copy. The button shows the number of selected test cases.

Each copy keeps the conversation, its pipeline, name, and scripts. The copy is independent of the original, so editing one leaves the other as it was.

Review and Edit Test Cases​

Open a Dataset to see its test cases. The table shows these columns:

  • Test case: The name. Click it to edit the test case.
  • Conversation: The ID of the conversation.
  • Pipeline: The pipeline the conversation was recorded on.
  • Scripts: Whether the test case has a Setup script, a Cleanup script, or none.
  • Actions: Conversation opens the conversation, Edit opens the test case editor, and Remove deletes the test case after you confirm. Conversation also works for test cases that came from an imported Dataset. For details, see View an Imported Conversation and Its Traces.

To edit a test case, click Edit. You can change its name. You can also write a setup script that runs before every replay, for example to give the replay environment variables or inputs. A cleanup script runs after every replay, even a failed one. A setup script defines one public function that takes no arguments and returns a dictionary with the optional keys env, inputs, and logs. A cleanup script defines one public function that takes the setup result (or None) and returns a dictionary with the optional key logs. Leave a script empty to skip that step. To reuse scripts, click Copy scripts from another test case. Nothing is saved until you click Save.

To remove several test cases at once, select them and click Remove selected. Removing a test case doesn't delete the conversation from search history, and Experiments that already ran it keep their results.

To rename a Dataset, click Rename. To delete it, click Delete and confirm. Deleting a Dataset deletes its test cases, but Experiments that already ran it keep their results.

The platform doesn't delete a Dataset that a check in a Service's deployment gate uses. The REST API answers with a 409 error that names the Service. Remove the check from the gate, or change it to use a different Dataset, and then delete the Dataset.

View an Imported Conversation and Its Traces​

When you import a Dataset from an archive, each conversation is stored with the Dataset under a new Session ID. Search history doesn't hold these conversations, because they never ran in your workspace. You can still read them, and open the trace of each turn, to check what a test case replays before you run an Experiment.

To view an imported conversation:

  1. Open the imported Dataset.
  2. In the row of the test case, click Conversation. The imported conversation drawer opens. It lists each turn with the question and the final answer.
  3. To see how the pipeline produced an answer, click Go to trace on a turn. The turn opens in the Session inspector, where you can step through its components, inputs, and outputs.

Imported conversations have these limits:

  • Archives don't contain retrieved documents, feedback, or logs, so imported turns show none. The drawer tells you this.
  • In the Session inspector, actions that apply only to a pipeline are hidden for imported conversations.
  • The Session inspector on a scoring run page can't load imported conversations yet.

In an Experiment, the recorded side of an imported test case opens the same imported conversation drawer. Conversations replayed by the Experiment are still read from search history.

What To Do Next​

Use your Dataset to compare pipeline versions. For details, see Run an Experiment.