Skip to main content

Module router

Module router 

Source
Expand description

§The SimiFlow Routing Pipeline

Developers should not have to manually write fallback logic. The pipeline allows defining thresholds to avoid expensive API calls.

§Execution Flow

  1. Tier 1 (Fast Pass): Run a fast algorithm like Levenshtein. If it is an obvious match (> 0.95) or mismatch (< 0.10), return immediately for zero cost.
  2. Tier 2 (Heavy Local Pass): If it falls in the ambiguous middle, fallback to a heavier algorithm like BM25.
  3. Tier 3 (API Hook): Provide an optional callback where the user can trigger their expensive LLM API only if Tiers 1 and 2 fail.

Structs§

ComparisonResult
The result of comparing two strings through the pipeline.
SimiFlow
The SimiFlow: a declarative pipeline builder for similarity checks.

Enums§

Algo
Algorithm selector for a tier.
Intent
User intent: declares what kind of comparison is being performed.
Strategy
The comparison strategy for the router.
Threshold
Threshold configuration for a tier.

Functions§

resolve_intent
Map an intent to an algorithm.

Type Aliases§

FallbackFn
Callback type for the Tier 3 (LLM/API) fallback.
Score
A normalized similarity score from [0.0, 1.0].