generate_answer

Function generate_answer 

Source
pub async fn generate_answer(
    question: &str,
    results: &[FileGroupedResult],
    total_count: usize,
    gathered_context: Option<&str>,
    codebase_context: Option<&str>,
    provider: &dyn LlmProvider,
) -> Result<String>
Expand description

Generate a conversational answer based on search results

Takes the user’s original question and search results, then calls the LLM to synthesize a natural language answer that references specific files and line numbers from the results.

§Arguments

  • question - The original user question
  • results - Search results grouped by file
  • total_count - Total number of matches found
  • gathered_context - Optional context gathered from tools (documentation, codebase structure)
  • codebase_context - Optional codebase metadata (always available, language distribution, directories)
  • provider - LLM provider to use for answer generation

§Returns

A conversational answer string that summarizes the findings