pub trait ContextPolicy: Send + Sync {
// Required method
fn select(
&self,
history: &[Message],
system_prompt: &str,
tools: &[ToolSpec],
) -> Result<ContextSelection, ContextError>;
}Expand description
Decides which history messages go into each model request.
Required Methods§
Sourcefn select(
&self,
history: &[Message],
system_prompt: &str,
tools: &[ToolSpec],
) -> Result<ContextSelection, ContextError>
fn select( &self, history: &[Message], system_prompt: &str, tools: &[ToolSpec], ) -> Result<ContextSelection, ContextError>
Choose the messages for a request with this system prompt and these tools. The newest message is the user’s current input and must be kept.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".