pub struct LlmQueryRewriter<M> { /* private fields */ }Expand description
Reference LLM-driven QueryRewriter. Asks the supplied
Runnable<Vec<Message>, Message> model for a corrected
query, then trims surrounding whitespace and quote marks.
Implementations§
Trait Implementations§
Source§impl<M> Clone for LlmQueryRewriter<M>
impl<M> Clone for LlmQueryRewriter<M>
Source§impl<M> Debug for LlmQueryRewriter<M>
impl<M> Debug for LlmQueryRewriter<M>
Source§impl<M> QueryRewriter for LlmQueryRewriter<M>
impl<M> QueryRewriter for LlmQueryRewriter<M>
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
Stable rewriter identifier — surfaces in audit dashboards
alongside the per-attempt query string.
Source§fn rewrite<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
original: &'life1 str,
previous_attempts: &'life2 [String],
ctx: &'life3 ExecutionContext,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn rewrite<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
original: &'life1 str,
previous_attempts: &'life2 [String],
ctx: &'life3 ExecutionContext,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Produce a corrected query.
original is the user’s
untouched first attempt; previous_attempts is every
failed retry since (in chronological order, oldest first)
so the rewriter can avoid emitting an attempt the recipe
has already failed on. An empty previous_attempts slice
means this is the first rewrite — the rewriter sees only
the original.Auto Trait Implementations§
impl<M> Freeze for LlmQueryRewriter<M>
impl<M> RefUnwindSafe for LlmQueryRewriter<M>where
M: RefUnwindSafe,
impl<M> Send for LlmQueryRewriter<M>
impl<M> Sync for LlmQueryRewriter<M>
impl<M> Unpin for LlmQueryRewriter<M>
impl<M> UnsafeUnpin for LlmQueryRewriter<M>
impl<M> UnwindSafe for LlmQueryRewriter<M>where
M: RefUnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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