Skip to main content

ExampleSelector

Trait ExampleSelector 

Source
pub trait ExampleSelector<E>: Send + Sync
where E: Send + Sync + 'static,
{ // Required method fn select(&self, input: &str, examples: &[E]) -> Result<Vec<E>>; }
Expand description

Strategy for choosing which examples to include in a few-shot prompt.

Implementations receive an input value (typed) and the full pool of available examples, and return the examples to use, in render order.

Required Methods§

Source

fn select(&self, input: &str, examples: &[E]) -> Result<Vec<E>>

Select examples from examples to include for input. Returns owned clones (or constructs new examples) so the caller doesn’t have to manage lifetimes against the pool.

Implementors§

Source§

impl<E> ExampleSelector<E> for LengthBasedExampleSelector<E>
where E: Clone + Send + Sync + 'static,

Source§

impl<E> ExampleSelector<E> for StaticExampleSelector
where E: Clone + Send + Sync + 'static,