Random Sampling
Randomly sample results for testing, analysis, or reducing result set size
Why do anything?
Large result sets need sampling for analysis or display. Random sampling provides representative subsets.
Why now?
Testing and analytics workflows need sampling capabilities.
Why this feature?
Random sampling with configurable sample size and optional seed for reproducibility.
How It Works
Sampling provides random document selection from result sets.
1
Pool Formation
Collect candidate documents
2
Random Selection
Randomly select sample_size documents
3
Stratification
Optional stratified sampling by field
Why This Approach
Random sampling ensures representative subsets. Seed enables reproducibility.
Where This Is Used
Integration
retriever = client.retrievers.create(stages=[{"type": "sample", "sample_size": 100}])