1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Copyright (c) 2026 vectorless developers
// SPDX-License-Identifier: Apache-2.0
//! Pilot - The brain of the Retriever Pipeline.
//!
//! Pilot is the core intelligence component responsible for understanding queries,
//! analyzing document structure, and making navigation decisions. Unlike traditional
//! vector-based retrieval, Pilot uses LLM for semantic understanding and navigation
//! while keeping the algorithm efficient for execution.
//!
//! # Design Philosophy
//!
//! 1. Algorithm handles "how to search" - efficient, deterministic, low latency
//! 2. Pilot handles "where to go" - semantic understanding, disambiguation, direction
//! 3. Intervention at key decision points - not every step, only when needed
//! 4. Layered fallback - algorithm takes over when LLM fails, Pilot rescues when algorithm fails
//!
//! # Architecture
//!
//! ```text
//! ┌─────────────────────────────────────────────────────────────────────────┐
//! │ Pilot Architecture │
//! ├─────────────────────────────────────────────────────────────────────────┤
//! │ │
//! │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
//! │ │ Query │ │ Context │ │ Decision │ │
//! │ │ Analyzer │──▶│ Builder │──▶│ Engine │ │
//! │ └─────────────┘ └─────────────┘ └──────┬──────┘ │
//! │ │ │
//! │ ▼ │
//! │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
//! │ │ Response │◀──│ LLM │◀──│ Prompt │ │
//! │ │ Parser │ │ Client │ │ Builder │ │
//! │ └─────────────┘ └─────────────┘ └─────────────┘ │
//! │ │
//! │ Supporting: BudgetController, FallbackManager, MetricsCollector │
//! └─────────────────────────────────────────────────────────────────────────┘
//! ```
//!
//! # Quick Start
//!
//! ```rust,ignore
//! use vectorless::retrieval::pilot::{LlmPilot, PilotConfig, Pilot};
//!
//! let pilot = LlmPilot::new(llm_client, PilotConfig::default());
//!
//! // Check if intervention needed
//! if pilot.should_intervene(&state) {
//! let decision = pilot.decide(&state).await;
//! // Use decision to guide search
//! }
//! ```
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use LlmPilot;
pub use ;
pub use NoopPilot;
pub use ResponseParser;
pub use PromptBuilder;
pub use r#trait::;