Skip to main content

classify_retrieval_strategy

Function classify_retrieval_strategy 

Source
pub async fn classify_retrieval_strategy(
    provider: &AnyProvider,
    query: &str,
) -> String
Expand description

Classify a query’s intent to select the best graph retrieval strategy.

Returns one of: "astar", "watercircles", "beam_search", or "synapse". On any LLM error or unrecognised response, returns "synapse" as a safe fallback. This function never propagates errors.

§Examples

let provider = AnyProvider::Mock(MockProvider::default());
let strategy = classify_retrieval_strategy(&provider, "who is Alice?").await;
assert!(["astar", "watercircles", "beam_search", "synapse"].contains(&strategy.as_str()));