use crate::guardrail::Guardrail;
use std::sync::Arc;
const DEFAULT_MAX_RESPONSE_BYTES: usize = 4 * 1024 * 1024;
#[derive(Clone)]
pub struct RunOptions {
pub max_steps: u32,
pub max_history_tokens: usize,
pub max_response_bytes: usize,
pub guardrails: Vec<Arc<dyn Guardrail>>,
}
impl std::fmt::Debug for RunOptions {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("RunOptions")
.field("max_steps", &self.max_steps)
.field("max_history_tokens", &self.max_history_tokens)
.field("max_response_bytes", &self.max_response_bytes)
.field("guardrails", &self.guardrails.len())
.finish()
}
}
impl Default for RunOptions {
fn default() -> Self {
Self {
max_steps: 16,
max_history_tokens: 8_000,
max_response_bytes: DEFAULT_MAX_RESPONSE_BYTES,
guardrails: Vec::new(),
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn default_max_response_bytes_is_four_mebibytes() {
assert_eq!(RunOptions::default().max_response_bytes, 4 * 1024 * 1024);
}
}