Retriever
TheRetriever class is the entry point for loading your conversation data into Fair Forge. Every evaluation requires a custom retriever that implements load_dataset(). Fair Forge supports three iteration strategies that control how data is consumed — from loading everything upfront to yielding individual QA pairs on demand.
Iteration Modes
Choose the mode that fits your dataset size and processing requirements:
The default mode is
FULL_DATASET. To use streaming, override the iteration_level property.
Interface
The return type of
load_dataset() must be consistent with iteration_level. Returning an Iterator with the default FULL_DATASET level will raise a ValueError at runtime.Full Dataset Mode
The simplest and most common mode. Load all sessions into a list and return it.Loading from JSON
Loading from a Database
Loading from an API
Loading from CSV
Multi-Assistant Retriever (BestOf)
BestOf expects oneDataset per assistant, all answering the same questions. The retriever loads them — BestOf handles the tournament logic automatically.
qa_id values so BestOf can pair their responses:
Best Practices
Use explicit constructor parameters instead of kwargs.get()
Use explicit constructor parameters instead of kwargs.get()
Declare parameters explicitly for clarity and IDE support:
Handle missing fields with Pydantic defaults
Handle missing fields with Pydantic defaults
Use Fields with defaults (
model_validate to leverage Pydantic’s validation and defaults:language="english") are filled in automatically.Use streaming for large datasets
Use streaming for large datasets
If your dataset has thousands of sessions or QA pairs, prefer streaming
to avoid loading everything into memory. See the Streaming page.
Next Steps
Streaming Retrievers
Handle large datasets with stream_sessions and stream_batches
Dataset & Batch
Understand the data structures used by all retrievers