mod built_in;
mod plan_re_act;
pub use built_in::BuiltInPlanner;
pub use plan_re_act::PlanReActPlanner;
use async_trait::async_trait;
use crate::llm::LlmRequest;
#[derive(Debug, thiserror::Error)]
pub enum PlannerError {
#[error("Planning instruction error: {0}")]
Instruction(String),
#[error("Planning response error: {0}")]
Response(String),
}
#[async_trait]
pub trait Planner: Send + Sync {
fn build_planning_instruction(
&self,
request: &LlmRequest,
) -> Result<Option<String>, PlannerError>;
fn process_planning_response(
&self,
response_text: &str,
) -> Result<Option<String>, PlannerError>;
}
#[cfg(test)]
mod tests {
use super::*;
fn _assert_object_safe(_: &dyn Planner) {}
#[test]
fn planner_error_display() {
let err = PlannerError::Instruction("test".into());
assert!(err.to_string().contains("test"));
}
}