Skip to main content

ExtractionConfig

Struct ExtractionConfig 

Source
pub struct ExtractionConfig {
Show 16 fields pub provider: LlmProvider, pub api_key: Option<String>, pub api_url: String, pub model: String, pub region: Option<String>, pub max_extractions_per_conversation: usize, pub quality_threshold: f32, pub deduplication_threshold: f32, pub enable_contradiction_check: bool, pub enable_deduplication: bool, pub extraction_passes: usize, pub max_output_tokens: u32, pub effort: Option<String>, pub reader_model: Option<String>, pub request_timeout_secs: u64, pub connect_timeout_secs: u64,
}
Expand description

Configuration for the extraction pipeline.

Fields§

§provider: LlmProvider

Which LLM provider to use.

§api_key: Option<String>

API key for the provider (not needed for Ollama).

§api_url: String

API endpoint URL (defaults based on provider).

Ignored for the Bedrock provider, whose endpoint is derived from region and model per-request.

§model: String

Model name to use.

§region: Option<String>

AWS region for the Bedrock provider (e.g. “us-east-1”). Ignored by all other providers. Defaults from MENTEDB_LLM_REGION/AWS_REGION.

§max_extractions_per_conversation: usize

Maximum number of memories to extract from a single conversation.

§quality_threshold: f32

Minimum confidence score for a memory to be accepted (0.0 to 1.0).

§deduplication_threshold: f32

Embedding similarity above which a memory is considered a duplicate (0.0 to 1.0).

§enable_contradiction_check: bool

Whether to check new memories against existing ones for contradictions.

§enable_deduplication: bool

Whether to check new memories against existing ones for duplicates.

§extraction_passes: usize

Number of extraction passes (1 = single pass, 2 = first pass + verification).

§max_output_tokens: u32

Output token ceiling for each LLM call. Claude 5.5 models think before answering by default and the thinking counts against this budget, so it must leave room for both. Only tokens actually produced are billed.

§effort: Option<String>

Reasoning effort for Claude models, sent as output_config.effort (“low”, “medium”, “high”). None keeps the model default. Lower effort thinks less, which is faster and cheaper.

§reader_model: Option<String>

Model for judge and rerank calls (reading and comparing memories), when it should differ from model, which stays the extraction and enrichment model. None uses model for both.

§request_timeout_secs: u64

Whole request timeout for one LLM call, in seconds.

§connect_timeout_secs: u64

Connection timeout for one LLM call, in seconds.

Implementations§

Source§

impl ExtractionConfig

Source

pub fn with_output_env(self) -> Self

Apply MENTEDB_LLM_MAX_OUTPUT_TOKENS and MENTEDB_LLM_EFFORT from the environment, keeping the current values when they are unset or invalid.

Source

pub fn reader_config(&self) -> Self

The config for judge and rerank calls: this one with model set to reader_model when that is given.

Source

pub fn openai(api_key: impl Into<String>) -> Self

Create a config for OpenAI with the given API key.

Source

pub fn anthropic(api_key: impl Into<String>) -> Self

Create a config for Anthropic with the given API key.

Source

pub fn ollama() -> Self

Create a config for a local Ollama instance.

Source

pub fn bedrock(region: impl Into<String>) -> Self

Create a config for AWS Bedrock (Anthropic Claude on Bedrock) in the given region. Credentials are read from the AWS environment variables at call time, not stored here. Requires the bedrock feature to actually dispatch calls.

Trait Implementations§

Source§

impl Clone for ExtractionConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ExtractionConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ExtractionConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ExtractionConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ExtractionConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more