Class LocalFileEvalStore

java.lang.Object
com.google.genkit.ai.evaluation.LocalFileEvalStore
All Implemented Interfaces:
EvalStore

public class LocalFileEvalStore extends Object implements EvalStore
File-based implementation of EvalStore.

Stores evaluation runs in the .genkit/evals directory with:

  • index.json - metadata for all eval runs
  • {evalRunId}.json - actual eval run data
  • Constructor Details

    • LocalFileEvalStore

      public LocalFileEvalStore()
      Creates a new LocalFileEvalStore using the default location.
    • LocalFileEvalStore

      public LocalFileEvalStore(Path storeRoot)
      Creates a new LocalFileEvalStore with a custom root path.
      Parameters:
      storeRoot - the root directory for storing eval runs
  • Method Details

    • getInstance

      public static LocalFileEvalStore getInstance()
      Gets the singleton instance of the eval store.
      Returns:
      the eval store instance
    • save

      public void save(EvalRun evalRun) throws Exception
      Description copied from interface: EvalStore
      Saves an evaluation run.
      Specified by:
      save in interface EvalStore
      Parameters:
      evalRun - the evaluation run to save
      Throws:
      Exception - if save fails
    • load

      public EvalRun load(String evalRunId) throws Exception
      Description copied from interface: EvalStore
      Loads an evaluation run by ID.
      Specified by:
      load in interface EvalStore
      Parameters:
      evalRunId - the evaluation run ID
      Returns:
      the evaluation run, or null if not found
      Throws:
      Exception - if load fails
    • list

      public List<EvalRunKey> list() throws Exception
      Description copied from interface: EvalStore
      Lists all evaluation run keys.
      Specified by:
      list in interface EvalStore
      Returns:
      list of evaluation run keys
      Throws:
      Exception - if listing fails
    • list

      public List<EvalRunKey> list(String actionRef, String datasetId) throws Exception
      Description copied from interface: EvalStore
      Lists evaluation run keys with optional filtering.
      Specified by:
      list in interface EvalStore
      Parameters:
      actionRef - filter by action reference
      datasetId - filter by dataset ID
      Returns:
      filtered list of evaluation run keys
      Throws:
      Exception - if listing fails
    • delete

      public void delete(String evalRunId) throws Exception
      Description copied from interface: EvalStore
      Deletes an evaluation run.
      Specified by:
      delete in interface EvalStore
      Parameters:
      evalRunId - the evaluation run ID to delete
      Throws:
      Exception - if deletion fails