Extract a goal with success criteria from a prompt using LLM
(llm: &Arc<dyn LlmClient>, prompt: &str)
| 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> { |
| 111 | let system = crate::prompts::LLM_GOAL_EXTRACT_SYSTEM; |
| 112 | |
| 113 | let messages = vec![Message::user(prompt)]; |
| 114 | let response = llm |
| 115 | .complete(&messages, Some(system), &[]) |
| 116 | .await |
| 117 | .context("LLM call failed during goal extraction")?; |
| 118 | |
| 119 | let text = response.text(); |
| 120 | Self::parse_goal_response(&text) |
| 121 | } |
| 122 | |
| 123 | /// Evaluate whether a goal has been achieved given current state |
| 124 | pub async fn check_achievement( |