pub struct FactExtractor { /* private fields */ }Expand description
Asks a model for durable facts in a transcript slice.
Implementations§
Source§impl FactExtractor
impl FactExtractor
pub fn new(provider: impl Provider + 'static, model: impl Into<String>) -> Self
pub fn from_arc(provider: Arc<dyn Provider>, model: impl Into<String>) -> Self
Sourcepub fn min_user_chars(self, chars: usize) -> Self
pub fn min_user_chars(self, chars: usize) -> Self
Skip turns whose user message is shorter than this (default 20 characters, as in the daemon). A length gate, not a word list.
pub fn max_transcript_chars(self, chars: usize) -> Self
Sourcepub fn should_extract(&self, messages: &[Message]) -> bool
pub fn should_extract(&self, messages: &[Message]) -> bool
Whether the latest user-authored message is long enough to hold a durable fact.
Sourcepub async fn extract(
&self,
messages: &[Message],
known_keys: &[(String, String)],
) -> Result<Extraction>
pub async fn extract( &self, messages: &[Message], known_keys: &[(String, String)], ) -> Result<Extraction>
Ask the model. known_keys are existing (category, key) pairs so
corrections reuse them. Provider failures are errors; unparseable
output is an empty Extraction with parse_error set.
Auto Trait Implementations§
impl !RefUnwindSafe for FactExtractor
impl !UnwindSafe for FactExtractor
impl Forget for FactExtractor
impl Freeze for FactExtractor
impl Move for FactExtractor
impl Send for FactExtractor
impl Sync for FactExtractor
impl Unpin for FactExtractor
impl UnsafeUnpin for FactExtractorwhere
*const ArcInner<dyn Provider> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Provider>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
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> 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