Skip to main content

ContextStrategy

Trait ContextStrategy 

Source
pub trait ContextStrategy: Send + Sync {
    // Required method
    fn build(&self, state: &State, history: &[Message]) -> Vec<Message>;

    // Provided methods
    fn folds(&self, _history: &[Message]) -> Vec<(usize, usize)> { ... }
    fn fold_budget(&self, _history: &[Message]) -> Option<usize> { ... }
}

Required Methods§

Source

fn build(&self, state: &State, history: &[Message]) -> Vec<Message>

Build the messages for the next call from the run so far.

Provided Methods§

Source

fn folds(&self, _history: &[Message]) -> Vec<(usize, usize)>

The folds this strategy makes over history, as (a, b) ranges of history[1..]. Strategies that never fold return none.

Source

fn fold_budget(&self, _history: &[Message]) -> Option<usize>

The fold budget in force after history, in approximate tokens, for strategies that fold.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§