Call the LLM to generate an answer from context.
(&self, context: &str, query: &str)
| 293 | impl LlmProvider { |
| 294 | /// Call the LLM to generate an answer from context. |
| 295 | pub async fn answer(&self, context: &str, query: &str) -> Result<LlmResponse, AiError> { |
| 296 | match self.provider { |
| 297 | AiProvider::Anthropic => self.call_anthropic(context, query).await, |
| 298 | AiProvider::OpenAi => self.call_openai(context, query).await, |
| 299 | _ => Err(AiError::NoApiKey), |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | /// Synchronous answer (for non-async contexts). |
| 304 | pub fn answer_sync(&self, context: &str, query: &str) -> Result<LlmResponse, AiError> { |
no test coverage detected