pub struct PhantomTracker { /* private fields */ }Implementations§
Source§impl PhantomTracker
impl PhantomTracker
pub fn new(config: PhantomConfig) -> Self
Sourcepub fn register_entity(&mut self, entity: &str)
pub fn register_entity(&mut self, entity: &str)
Convenience: register an entity in the embedded registry.
Sourcepub fn register_entities(&mut self, entities: &[&str])
pub fn register_entities(&mut self, entities: &[&str])
Convenience: register multiple entities at once.
Sourcepub fn entity_registry(&self) -> &EntityRegistry
pub fn entity_registry(&self) -> &EntityRegistry
Return a reference to the entity registry.
Sourcepub fn entity_registry_mut(&mut self) -> &mut EntityRegistry
pub fn entity_registry_mut(&mut self) -> &mut EntityRegistry
Return a mutable reference to the entity registry.
Sourcepub fn detect_gaps(
&mut self,
content: &str,
known_entities: &[String],
turn_id: u64,
) -> Vec<PhantomMemory>
pub fn detect_gaps( &mut self, content: &str, known_entities: &[String], turn_id: u64, ) -> Vec<PhantomMemory>
Scan content for entity references not in known_entities.
Two detection strategies are combined:
- Registry-based (primary): any registered entity found in
contentthat is NOT inknown_entitiesis flagged atMedium/Highpriority. - Heuristic (fallback): capitalized words, quoted terms, and
technical terms are flagged at
Lowpriority. Disabled whenPhantomConfig::use_heuristic_detectionisfalse.
Sourcepub fn detect_gaps_explicit(
&mut self,
content: &str,
mentioned_entities: &[&str],
turn_id: u64,
) -> Vec<PhantomMemory>
pub fn detect_gaps_explicit( &mut self, content: &str, mentioned_entities: &[&str], turn_id: u64, ) -> Vec<PhantomMemory>
Preferred explicit API: the caller provides exactly which entities were mentioned. Entities not in the registry are flagged as gaps.
pub fn resolve(&mut self, phantom_id: Uuid)
pub fn get_active_phantoms(&self) -> Vec<&PhantomMemory>
pub fn format_phantom_warnings(&self) -> String
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PhantomTracker
impl RefUnwindSafe for PhantomTracker
impl Send for PhantomTracker
impl Sync for PhantomTracker
impl Unpin for PhantomTracker
impl UnsafeUnpin for PhantomTracker
impl UnwindSafe for PhantomTracker
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