#[non_exhaustive]pub struct CragConfig { /* private fields */ }Expand description
Operator-tunable knobs for the corrective-RAG recipe. Construct
via Self::new or Self::default; chain with_* setters.
Implementations§
Source§impl CragConfig
impl CragConfig
Sourcepub fn new() -> CragConfig
pub fn new() -> CragConfig
Build with the default thresholds + retrieval top-k + system prompt.
Sourcepub const fn with_min_correct_fraction(self, fraction: f32) -> CragConfig
pub const fn with_min_correct_fraction(self, fraction: f32) -> CragConfig
Override the minimum fraction of Correct verdicts the
recipe needs before generating without a rewrite. Values
are clamped to [0.0, 1.0] at decision time — operators
supplying out-of-range values get the clamped value, no
error.
Sourcepub const fn with_retrieval_top_k(self, top_k: usize) -> CragConfig
pub const fn with_retrieval_top_k(self, top_k: usize) -> CragConfig
Override the retrieval top-k.
Sourcepub const fn with_max_rewrite_attempts(self, max: u32) -> CragConfig
pub const fn with_max_rewrite_attempts(self, max: u32) -> CragConfig
Override the rewrite-loop attempt cap. After this many
rewrites, the recipe generates over whatever the last
retrieval returned (even if every document graded
Incorrect) — surrender beats infinite loop.
Sourcepub fn with_generator_system_prompt(self, prompt: SystemPrompt) -> CragConfig
pub fn with_generator_system_prompt(self, prompt: SystemPrompt) -> CragConfig
Override the system prompt the generator node uses. Default
is DEFAULT_GENERATOR_SYSTEM_PROMPT.
Sourcepub const fn min_correct_fraction(&self) -> f32
pub const fn min_correct_fraction(&self) -> f32
Effective minimum-correct fraction.
Sourcepub const fn retrieval_top_k(&self) -> usize
pub const fn retrieval_top_k(&self) -> usize
Effective retrieval top-k.
Sourcepub const fn max_rewrite_attempts(&self) -> u32
pub const fn max_rewrite_attempts(&self) -> u32
Effective rewrite attempt cap.
Sourcepub const fn generator_system_prompt(&self) -> &SystemPrompt
pub const fn generator_system_prompt(&self) -> &SystemPrompt
Borrow the configured generator system prompt.
Trait Implementations§
Source§impl Clone for CragConfig
impl Clone for CragConfig
Source§fn clone(&self) -> CragConfig
fn clone(&self) -> CragConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CragConfig
impl Debug for CragConfig
Source§impl Default for CragConfig
impl Default for CragConfig
Source§fn default() -> CragConfig
fn default() -> CragConfig
Auto Trait Implementations§
impl Freeze for CragConfig
impl RefUnwindSafe for CragConfig
impl Send for CragConfig
impl Sync for CragConfig
impl Unpin for CragConfig
impl UnsafeUnpin for CragConfig
impl UnwindSafe for CragConfig
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request