Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Confident ai Deepeval EvaluationDataset Save As

From Leeroopedia
Revision as of 12:18, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Confident_ai_Deepeval_EvaluationDataset_Save_As.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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",
)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment