Skip to main content

Overview

This page explains how to work with Datasets using the Basalt Python SDK. Datasets let you organize, retrieve, and extend structured test data (inputs, ideal outputs, metadata) to evaluate prompts, models, and full workflows.

Initialization

Create a single Basalt client and reuse it across your application or script.
When you are done (for example in a CLI script or worker), call:
to clean up resources.

Listing datasets

Retrieve all datasets accessible to your API key.

Basic listing (sync)

Async listing

Use the sync version in scripts and simple backends; prefer the async method list in async frameworks like FastAPI.

Getting datasets

Retrieve a specific dataset with all its rows and columns.

Inspecting columns

Dataset objects

The main objects you work with are:
  • Dataset
  • DatasetColumn
  • DatasetRow

Dataset

  • slug: Unique identifier for the dataset
  • name: Human-readable name
  • description: Description of what the dataset is for
  • num_rows: Number of rows
  • columns: List of DatasetColumn objects
  • rows: List of DatasetRow objects

DatasetColumn

  • name: Column name
  • type: Data type (e.g. "string", "number")
  • description: Column description

DatasetRow

  • name: Row identifier
  • values: Dict of column_name -> value. Values can be strings, numbers, or FileAttachment objects.
  • ideal_output: Optional expected output for evaluation
  • metadata: Optional dict with additional context

FileAttachment

  • source: Path to the file to upload
  • content_type: MIME type of the file
See the API Reference for method signatures and all available fields.