mellea.stdlib.sampling.types
Base types for sampling.
Classes
SamplingResult
Stores the results from a sampling operation. This includes successful and failed samplings.
Methods:
result
result_ctx
result_action
result_validations
SamplingStrategy
A SamplingStrategy class defines an abstract base class for implementing various sampling strategies.
This class provides a template for creating concrete sampling strategies that can be used to generate model outputs based on given instructions.
It allows setting custom validation and generation functions through properties.
Methods:
sample
action
: The action object to be sampled.context
: The context to be passed to the sampling strategy.backend
: The backend used for generating samples.requirements
: List of requirements to test against (merged with global requirements).validation_ctx
: Optional context to use for validation. If None, validation_ctx = ctx.format
: output format for structured outputs.model_options
: model options to pass to the backend during generation / validation.tool_calls
: True if tool calls should be used during this sampling strategy.
- A result object indicating the success or failure of the sampling process.