(
&self,
messages: &[Message],
system: Option<&str>,
_tools: &[ToolDefinition],
)
| 299 | #[async_trait::async_trait] |
| 300 | impl LlmClient for MockLlmClient { |
| 301 | async fn complete( |
| 302 | &self, |
| 303 | messages: &[Message], |
| 304 | system: Option<&str>, |
| 305 | _tools: &[ToolDefinition], |
| 306 | ) -> Result<LlmResponse> { |
| 307 | if system == Some(crate::prompts::PRE_ANALYSIS_SYSTEM) { |
| 308 | let prompt = messages |
| 309 | .last() |
| 310 | .and_then(|m| { |
| 311 | m.content.iter().find_map(|block| { |
| 312 | if let ContentBlock::Text { text } = block { |
| 313 | Some(text.as_str()) |
| 314 | } else { |
| 315 | None |
| 316 | } |
| 317 | }) |
| 318 | }) |
| 319 | .unwrap_or(""); |
| 320 | let response = serde_json::json!({ |
| 321 | "intent": "GeneralPurpose", |
| 322 | "requires_planning": false, |
| 323 | "goal": { |
| 324 | "description": prompt, |
| 325 | "success_criteria": [] |
| 326 | }, |
| 327 | "execution_plan": { |
| 328 | "complexity": "Simple", |
| 329 | "steps": [ |
| 330 | { |
| 331 | "id": "step-1", |
| 332 | "description": prompt, |
| 333 | "tool": null, |
| 334 | "dependencies": [], |
| 335 | "success_criteria": "Complete the request" |
| 336 | } |
| 337 | ], |
| 338 | "required_tools": [] |
| 339 | }, |
| 340 | "optimized_input": prompt |
| 341 | }); |
| 342 | return Ok(MockLlmClient::text_response(&response.to_string())); |
| 343 | } |
| 344 | self.call_count.fetch_add(1, Ordering::SeqCst); |
| 345 | let mut responses = self.responses.lock().unwrap(); |
| 346 | if responses.is_empty() { |
| 347 | anyhow::bail!("No more mock responses available"); |
| 348 | } |
| 349 | Ok(responses.remove(0)) |
| 350 | } |
| 351 | |
| 352 | async fn complete_streaming( |
| 353 | &self, |
nothing calls this directly
no test coverage detected