pub struct LlmPilot { /* private fields */ }Expand description
LLM-based Pilot implementation.
Uses an LLM client to provide semantic navigation guidance at key decision points during tree search.
§Architecture
┌─────────────────────────────────────────────────────────────┐
│ LlmPilot │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Context │ │ Prompt │ │ Response │ │
│ │ Builder │─▶│ Builder │─▶│ Parser │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
│ │
│ ┌─────────────┐ ┌───────────────────────┐ │
│ │ Budget │ │ LlmExecutor │ │
│ │ Controller │ │ (throttle+retry+fall) │ │
│ └─────────────┘ └───────────────────────┘ │
│ │
│ ┌─────────────┐ ┌───────────────────────┐ │
│ │ Memo │ │ (cache LLM decisions) │ │
│ │ Store │ │ │ │
│ └─────────────┘ └───────────────────────┘ │
└─────────────────────────────────────────────────────────────┘§Example
use vectorless::retrieval::pilot::{LlmPilot, PilotConfig};
use vectorless::llm::{LlmClient, LlmExecutor};
let client = LlmClient::for_model("gpt-4o-mini");
let pilot = LlmPilot::new(client, PilotConfig::default());
// Or with executor for unified throttle/retry/fallback
let executor = LlmExecutor::for_model("gpt-4o-mini");
let pilot = LlmPilot::with_executor(executor, PilotConfig::default());
// Use in search
if pilot.should_intervene(&state) {
let decision = pilot.decide(&state).await;
}Implementations§
Source§impl LlmPilot
impl LlmPilot
Sourcepub fn new(client: LlmClient, config: PilotConfig) -> Self
pub fn new(client: LlmClient, config: PilotConfig) -> Self
Create a new LLM-based Pilot.
Sourcepub fn with_executor(executor: LlmExecutor, config: PilotConfig) -> Self
pub fn with_executor(executor: LlmExecutor, config: PilotConfig) -> Self
Create a Pilot with LlmExecutor for unified throttle/retry/fallback.
Create a Pilot with shared executor (for sharing throttle/fallback across pilots).
Sourcepub fn with_builders(
client: LlmClient,
config: PilotConfig,
context_builder: ContextBuilder,
prompt_builder: PromptBuilder,
) -> Self
pub fn with_builders( client: LlmClient, config: PilotConfig, context_builder: ContextBuilder, prompt_builder: PromptBuilder, ) -> Self
Create with custom builders.
Sourcepub fn with_executor_mut(self, executor: LlmExecutor) -> Self
pub fn with_executor_mut(self, executor: LlmExecutor) -> Self
Add an executor to an existing pilot.
Sourcepub fn with_learner(self, learner: Arc<PilotLearner>) -> Self
pub fn with_learner(self, learner: Arc<PilotLearner>) -> Self
Add a feedback learner to the pilot.
Sourcepub fn with_feedback_store(self, store: Arc<FeedbackStore>) -> Self
pub fn with_feedback_store(self, store: Arc<FeedbackStore>) -> Self
Add a feedback learner from a feedback store.
Sourcepub fn with_memo_store(self, store: MemoStore) -> Self
pub fn with_memo_store(self, store: MemoStore) -> Self
Add a memo store for caching decisions.
When enabled, the pilot will cache LLM decisions based on context fingerprints, avoiding redundant API calls for similar navigation scenarios.
Sourcepub fn has_executor(&self) -> bool
pub fn has_executor(&self) -> bool
Check if using LlmExecutor (unified throttle/retry/fallback).
Sourcepub fn has_learner(&self) -> bool
pub fn has_learner(&self) -> bool
Check if using feedback learner.
Sourcepub fn has_memo_store(&self) -> bool
pub fn has_memo_store(&self) -> bool
Check if using memo store.
Sourcepub fn learner(&self) -> Option<&PilotLearner>
pub fn learner(&self) -> Option<&PilotLearner>
Get the feedback learner (if any).
Sourcepub fn memo_store(&self) -> Option<&MemoStore>
pub fn memo_store(&self) -> Option<&MemoStore>
Get the memo store (if any).
Sourcepub fn record_feedback(&self, record: FeedbackRecord)
pub fn record_feedback(&self, record: FeedbackRecord)
Record feedback for a decision.
Trait Implementations§
Source§impl Pilot for LlmPilot
impl Pilot for LlmPilot
Source§fn should_intervene(&self, state: &SearchState<'_>) -> bool
fn should_intervene(&self, state: &SearchState<'_>) -> bool
Source§fn decide<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 SearchState<'life2>,
) -> Pin<Box<dyn Future<Output = PilotDecision> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn decide<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 SearchState<'life2>,
) -> Pin<Box<dyn Future<Output = PilotDecision> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn guide_start<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tree: &'life1 DocumentTree,
query: &'life2 str,
) -> Pin<Box<dyn Future<Output = Option<PilotDecision>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn guide_start<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tree: &'life1 DocumentTree,
query: &'life2 str,
) -> Pin<Box<dyn Future<Output = Option<PilotDecision>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn guide_backtrack<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 SearchState<'life2>,
) -> Pin<Box<dyn Future<Output = Option<PilotDecision>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn guide_backtrack<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 SearchState<'life2>,
) -> Pin<Box<dyn Future<Output = Option<PilotDecision>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn config(&self) -> &PilotConfig
fn config(&self) -> &PilotConfig
Auto Trait Implementations§
impl !Freeze for LlmPilot
impl !RefUnwindSafe for LlmPilot
impl Send for LlmPilot
impl Sync for LlmPilot
impl Unpin for LlmPilot
impl UnsafeUnpin for LlmPilot
impl !UnwindSafe for LlmPilot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more