pub struct PromptFactsCache {
pub triples: Vec<(String, String, String)>,
pub formatted: String,
}Expand description
Cached prompt-facts surface: raw triples and a pre-formatted Markdown block.
Why: The get_prompt_context tool serves two access modes — unfiltered
(returns the pre-formatted block directly) and filtered (re-runs the
formatter on a query-matching subset). Caching only the formatted string
would force a fresh gather_hot_triples pass for every filtered call;
caching only the triples would force re-formatting for every unfiltered
call. Holding both lets the hot path stay O(1) and the filtered path stay
O(n) without ever re-walking the KG.
What: A plain Default + Clone struct. triples holds the active
(subject, predicate, object) rows for every hot predicate across every
palace; formatted is build_prompt_context(&triples) cached for the
no-filter case.
Test: rebuild_prompt_cache_populates_triples_and_formatted (in
tools::tests); get_prompt_context_filters_by_query.
Fields§
§triples: Vec<(String, String, String)>All active hot-predicate triples: (subject, predicate, object).
formatted: StringPre-formatted string of all triples (used when no query filter).
Trait Implementations§
Source§impl Clone for PromptFactsCache
impl Clone for PromptFactsCache
Source§fn clone(&self) -> PromptFactsCache
fn clone(&self) -> PromptFactsCache
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for PromptFactsCache
impl Default for PromptFactsCache
Source§fn default() -> PromptFactsCache
fn default() -> PromptFactsCache
Auto Trait Implementations§
impl Freeze for PromptFactsCache
impl RefUnwindSafe for PromptFactsCache
impl Send for PromptFactsCache
impl Sync for PromptFactsCache
impl Unpin for PromptFactsCache
impl UnsafeUnpin for PromptFactsCache
impl UnwindSafe for PromptFactsCache
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,
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