pub struct Planner { /* private fields */ }Expand description
Planner: calls the LLM to generate a step list
Implementations§
Source§impl Planner
impl Planner
Sourcepub fn new(
llm: Arc<dyn BaseChatModel<Error = ProviderError> + Send + Sync>,
) -> Self
pub fn new( llm: Arc<dyn BaseChatModel<Error = ProviderError> + Send + Sync>, ) -> Self
Creates a new planner.
Sourcepub async fn plan(&self, objective: &str) -> Result<Plan, AgentError>
pub async fn plan(&self, objective: &str) -> Result<Plan, AgentError>
Generates an execution plan
Sourcepub async fn replan(
&self,
objective: &str,
failed_step: &str,
reason: &str,
completed: &str,
) -> Result<Plan, AgentError>
pub async fn replan( &self, objective: &str, failed_step: &str, reason: &str, completed: &str, ) -> Result<Plan, AgentError>
Replans (when a step fails).
0.22.0 C4 fix: completed carries the already-finished steps and
their results; the prompt injects them and explicitly asks for a plan
of the remaining work, so a replan no longer re-executes everything
(duplicate tool calls / duplicate cost) and the caller can splice the
completed steps back into the returned plan.
Auto Trait Implementations§
impl !RefUnwindSafe for Planner
impl !UnwindSafe for Planner
impl Freeze for Planner
impl Send for Planner
impl Sync for Planner
impl Unpin for Planner
impl UnsafeUnpin for Planner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more