Skip to main content

detect_search_intent_with_timeout

Function detect_search_intent_with_timeout 

Source
pub fn detect_search_intent_with_timeout(
    provider: Option<Arc<dyn LlmProviderTrait>>,
    prompt: &str,
    config: &SearchIntentConfig,
) -> SearchIntent
Expand description

Detects search intent with LLM classification and timeout.

Uses LLM classification with a configurable timeout. Falls back to keyword detection if LLM times out or fails.

§Arguments

  • provider - Optional LLM provider. If None, uses keyword-only detection.
  • prompt - The user prompt to analyze.
  • config - Configuration for intent detection.

§Returns

A SearchIntent from either LLM or keyword detection.

§Panics

This function does not panic under normal operation.