Implementation:Confident ai Deepeval EvaluationDataset Save As
| Sources | Domains | Last Updated |
|---|---|---|
| DeepEval | Synthetic_Data, LLM_Evaluation, Data_Management | 2026-02-14 09:00 GMT |
Overview
The save_as method on the EvaluationDataset class persists evaluation data to disk in a specified file format, enabling sharing, versioning, and reproducibility.
Description
save_as serializes the contents of an EvaluationDataset (its goldens and optionally its test cases) to a file in one of three supported formats: JSON, CSV, or JSONL. The method accepts a target directory, an optional file name, and the desired format. It returns the full path to the saved file, enabling programmatic downstream access.
Usage
Call this method after populating an EvaluationDataset with goldens (either generated synthetically or loaded from another source) to save the data for sharing, archival, or further processing.
Code Reference
Source Location: Repository: confident-ai/deepeval, File: deepeval/dataset/dataset.py (L958-1298)
Signature:
def save_as(
self,
file_type: Literal["json", "csv", "jsonl"],
directory: str,
file_name: Optional[str] = None,
include_test_cases: bool = False,
) -> str:
...
Import:
from deepeval.dataset import EvaluationDataset
I/O Contract
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| file_type | Literal["json", "csv", "jsonl"] | Yes | Output file format |
| directory | str | Yes | Target directory path for the saved file |
| file_name | Optional[str] | No | Custom file name (without extension); defaults to auto-generated name |
| include_test_cases | bool | No | Whether to include test cases in addition to goldens (default: False) |
Outputs:
- str -- absolute path to the saved file on disk
Usage Examples
from deepeval.dataset import EvaluationDataset
dataset = EvaluationDataset(goldens=goldens)
saved_path = dataset.save_as(
file_type="json",
directory="./output",
file_name="eval_data",
)