GEPA.DataLoader behaviour (GEPA v0.3.0)

Copy Markdown View Source

Protocol-style data access abstraction.

The official Python implementation normalizes in-memory lists into a DataLoader. The Elixir port keeps the same seam while allowing custom loader structs to provide stable IDs and ordered fetches.

Summary

Functions

Normalize raw lists into GEPA.DataLoader.List; pass loader structs through.

Types

data_id()

@type data_id() :: term()

data_inst()

@type data_inst() :: term()

t()

@type t() :: term()

Callbacks

all_ids(t)

@callback all_ids(t()) :: [data_id()]

fetch(t, list)

@callback fetch(t(), [data_id()]) :: [data_inst()]

size(t)

@callback size(t()) :: non_neg_integer()

Functions

all_ids(items)

@spec all_ids(t()) :: [data_id()]

ensure(loader)

@spec ensure([data_inst()] | t() | nil) :: t() | nil

Normalize raw lists into GEPA.DataLoader.List; pass loader structs through.

fetch(items, ids)

@spec fetch(t(), [data_id()]) :: [data_inst()]

size(items)

@spec size(t()) :: non_neg_integer()