Stage Category: REDUCE (Samples documents)Transformation: N documents → S sampled documents (where S ≤ N)
When to Use
When NOT to Use
Parameters
Sampling Strategies
Configuration Examples
How Sampling Works
Random Sampling
Selects documents with uniform probability:Stratified Sampling
Ensures representation from each group:Reservoir Sampling
Memory-efficient uniform sampling for very large or streaming result sets:Output Schema
Performance
Common Pipeline Patterns
Search + Sample for Testing
Balanced Category Sample
Sample Before LLM Processing
Cluster + Sample Representatives
Multi-Source Balanced Sample
Stratified Sampling Details
Minimum Per Stratum
count.
Proportional Allocation
Reproducibility
Useseed for reproducible results:
Error Handling
Sample vs Other Reduction Stages
Call sample from the API
Add the stage to a retriever’sstages array as {"stage_name": "<your label>", "stage_type": "reduce", "config": {"stage_id": "sample", "parameters": {...}}}. The parameters are the ones on this page.
- Create Retriever (
POST /v1/retrievers) saves a retriever that runs the stage. - Execute Ad-hoc Retriever (
POST /v1/retrievers/execute) runs stages without saving a retriever. - List Available Retriever Stages (
GET /v1/retrievers/stages) returns every stage’s parameter schema.

