pub struct CognitiveLlmService<J: LlmJudge> { /* private fields */ }Expand description
The unified LLM intelligence layer for memory operations.
Wraps any LlmJudge implementation and provides typed judgment methods
with specialized prompts for each cognitive task.
Implementations§
Source§impl<J: LlmJudge> CognitiveLlmService<J>
impl<J: LlmJudge> CognitiveLlmService<J>
Sourcepub async fn judge_invalidation(
&self,
old: &MemorySummary,
new: &MemorySummary,
) -> Result<InvalidationVerdict, LlmJudgeError>
pub async fn judge_invalidation( &self, old: &MemorySummary, new: &MemorySummary, ) -> Result<InvalidationVerdict, LlmJudgeError>
Determine whether a new memory invalidates an existing one.
This is the key method that replaces the cosine similarity heuristic for temporal invalidation. The LLM can understand that “Alice works at Acme” is invalidated by “Alice joined Google” even though the embeddings are quite different.
Sourcepub async fn detect_contradiction(
&self,
a: &MemorySummary,
b: &MemorySummary,
) -> Result<ContradictionVerdict, LlmJudgeError>
pub async fn detect_contradiction( &self, a: &MemorySummary, b: &MemorySummary, ) -> Result<ContradictionVerdict, LlmJudgeError>
Determine whether two memories contradict each other.
Sourcepub async fn resolve_entities(
&self,
candidates: &[EntityCandidate],
) -> Result<Vec<EntityMergeGroup>, LlmJudgeError>
pub async fn resolve_entities( &self, candidates: &[EntityCandidate], ) -> Result<Vec<EntityMergeGroup>, LlmJudgeError>
Resolve a batch of entity references into merge groups.
Sourcepub async fn consolidate(
&self,
cluster: &[ClusterMember],
) -> Result<ConsolidationDecision, LlmJudgeError>
pub async fn consolidate( &self, cluster: &[ClusterMember], ) -> Result<ConsolidationDecision, LlmJudgeError>
Decide how to consolidate a cluster of similar memories.
Sourcepub async fn canonicalize_topic(
&self,
message: &str,
existing_topics: &[String],
) -> Result<TopicLabel, LlmJudgeError>
pub async fn canonicalize_topic( &self, message: &str, existing_topics: &[String], ) -> Result<TopicLabel, LlmJudgeError>
Map a raw user message to a canonical topic label.
Auto Trait Implementations§
impl<J> Freeze for CognitiveLlmService<J>where
J: Freeze,
impl<J> RefUnwindSafe for CognitiveLlmService<J>where
J: RefUnwindSafe,
impl<J> Send for CognitiveLlmService<J>
impl<J> Sync for CognitiveLlmService<J>
impl<J> Unpin for CognitiveLlmService<J>where
J: Unpin,
impl<J> UnsafeUnpin for CognitiveLlmService<J>where
J: UnsafeUnpin,
impl<J> UnwindSafe for CognitiveLlmService<J>where
J: UnwindSafe,
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