Generate an execution plan from a prompt using LLM
(llm: &Arc<dyn LlmClient>, prompt: &str)
| 94 | impl LlmPlanner { |
| 95 | /// Generate an execution plan from a prompt using LLM |
| 96 | pub async fn create_plan(llm: &Arc<dyn LlmClient>, prompt: &str) -> Result<ExecutionPlan> { |
| 97 | let system = crate::prompts::LLM_PLAN_SYSTEM; |
| 98 | |
| 99 | let messages = vec![Message::user(prompt)]; |
| 100 | let response = llm |
| 101 | .complete(&messages, Some(system), &[]) |
| 102 | .await |
| 103 | .context("LLM call failed during plan creation")?; |
| 104 | |
| 105 | let text = response.text(); |
| 106 | Self::parse_plan_response(&text) |
| 107 | } |
| 108 | |
| 109 | /// Extract a goal with success criteria from a prompt using LLM |
| 110 | pub async fn extract_goal(llm: &Arc<dyn LlmClient>, prompt: &str) -> Result<AgentGoal> { |