pub struct RetrievalPlan {Show 16 fields
pub plan_id: PlanId,
pub turn_id: TurnId,
pub generation: u64,
pub requires_memory: bool,
pub confidence: f32,
pub intent: RetrievalIntent,
pub entities: Vec<RetrievalEntity>,
pub topics: Vec<String>,
pub predicates: Vec<CanonicalPredicate>,
pub lexical_queries: Vec<String>,
pub scopes: Vec<MemoryKind>,
pub kind_filter: Vec<MemoryKind>,
pub subject_hint: Option<String>,
pub predicate_hint: Option<String>,
pub temporal: Option<TemporalConstraint>,
pub source_transcript_hash: String,
}Expand description
A transient plan for one turn’s retrieval.
Fields§
§plan_id: PlanIdPlan identity.
turn_id: TurnIdThe turn the plan was derived from.
generation: u64The generation the plan was derived at.
requires_memory: boolWhether memory should be consulted at all.
confidence: f32Confidence in that judgement.
intent: RetrievalIntentWhat the user appears to want.
entities: Vec<RetrievalEntity>Entities of interest.
topics: Vec<String>Topical terms.
predicates: Vec<CanonicalPredicate>Canonical predicates of interest.
lexical_queries: Vec<String>Independent lexical queries to run and fuse.
scopes: Vec<MemoryKind>Memory kinds worth searching — a hint used for explanation, never a
filter. See kind_filter for the restricting form.
kind_filter: Vec<MemoryKind>A hard kind restriction, set only when a caller explicitly asked for one.
subject_hint: Option<String>Whose fact the caller believes this is — the subject surface form.
A hint, never a restriction: records matching it are boosted in the
fusion, records that do not are still returned. That asymmetry is the
whole design, and it is measured. Over 93 questions, a correct
about+attribute pair applied softly takes top-5 from 79 to 91; a
wrong one costs one question. Applied as a hard filter, a correct pair
reaches the same 91 and a wrong one returns nothing at all — 0 of
93, with the answer absent from the candidate set every single time.
Break-even follows from that: filtering softly beats not filtering once
the caller is right 8% of the time, where filtering hard needs 87%. See
tests/filter_dsl_probe.rs.
predicate_hint: Option<String>Which attribute of the subject — the canonical predicate.
Same soft semantics as subject_hint, and the
more valuable of the two: a model shown
memory_map names the right predicate
69% of the time against 2% without it.
temporal: Option<TemporalConstraint>Time window, if the user named one.
source_transcript_hash: StringHash of the transcript the plan came from, for cache keying.
Implementations§
Source§impl RetrievalPlan
impl RetrievalPlan
Sourcepub fn skip(turn_id: TurnId, generation: u64, transcript: &str) -> Self
pub fn skip(turn_id: TurnId, generation: u64, transcript: &str) -> Self
A plan that says “do not search”.
Sourcepub fn normalized(self) -> Self
pub fn normalized(self) -> Self
Apply the §12.2 caps and drop empties, returning the trimmed plan.
Called on every plan regardless of origin, so a model that returns forty search terms produces a fast plan rather than a slow one.
Sourcepub fn entity_forms(&self) -> Vec<String>
pub fn entity_forms(&self) -> Vec<String>
Every entity surface form the index should boost on.
Trait Implementations§
Source§impl Clone for RetrievalPlan
impl Clone for RetrievalPlan
Source§fn clone(&self) -> RetrievalPlan
fn clone(&self) -> RetrievalPlan
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RetrievalPlan
impl Debug for RetrievalPlan
Source§impl<'de> Deserialize<'de> for RetrievalPlan
impl<'de> Deserialize<'de> for RetrievalPlan
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for RetrievalPlan
impl JsonSchema for RetrievalPlan
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreSource§impl PartialEq for RetrievalPlan
impl PartialEq for RetrievalPlan
Source§impl Serialize for RetrievalPlan
impl Serialize for RetrievalPlan
impl StructuralPartialEq for RetrievalPlan
Auto Trait Implementations§
impl Freeze for RetrievalPlan
impl RefUnwindSafe for RetrievalPlan
impl Send for RetrievalPlan
impl Sync for RetrievalPlan
impl Unpin for RetrievalPlan
impl UnwindSafe for RetrievalPlan
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].