pub struct FormatPolicy {
pub format: OutputFormat,
pub metadata: MetadataLevel,
pub ordering: Ordering,
pub sections: SectionConfig,
pub token_budget: Option<usize>,
pub grain_overrides: HashMap<GrainType, GrainTypeOverride>,
pub query_text: Option<String>,
pub grain_type_diversity: Option<GrainTypeDiversityConfig>,
}Expand description
Complete formatting policy. Constructed via builder pattern.
Fields§
§format: OutputFormat§metadata: MetadataLevel§ordering: Ordering§sections: SectionConfig§token_budget: Option<usize>§grain_overrides: HashMap<GrainType, GrainTypeOverride>§query_text: Option<String>Original query text. Used by Knowledge Update chain rendering to detect recency intent (“currently”, “most recently”, etc.) for update-only suppression mode.
grain_type_diversity: Option<GrainTypeDiversityConfig>Grain type diversity floor. When Some, the budget allocator reserves
slots for underrepresented grain types before filling by priority.
Default: Some(GrainTypeDiversityConfig::default()).
Implementations§
Source§impl FormatPolicy
impl FormatPolicy
pub fn new(format: OutputFormat) -> Self
pub fn metadata(self, level: MetadataLevel) -> Self
pub fn ordering(self, ordering: Ordering) -> Self
pub fn token_budget(self, budget: usize) -> Self
pub fn group_by_type(self) -> Self
pub fn grain_override(self, gt: GrainType, ovr: GrainTypeOverride) -> Self
Sourcepub fn query_text(self, text: impl Into<String>) -> Self
pub fn query_text(self, text: impl Into<String>) -> Self
Set the original query text for recency detection in KU rendering.
Sourcepub fn grain_type_diversity(self, config: GrainTypeDiversityConfig) -> Self
pub fn grain_type_diversity(self, config: GrainTypeDiversityConfig) -> Self
Set grain type diversity configuration.
Sourcepub fn no_grain_type_diversity(self) -> Self
pub fn no_grain_type_diversity(self) -> Self
Disable grain type diversity floor (pure priority allocation).
Source§impl FormatPolicy
impl FormatPolicy
Sourcepub fn claude() -> Self
pub fn claude() -> Self
SML format, minimal metadata, relevance-ordered, grouped by type. Optimized for Claude models which handle SML context natively.
Sourcepub fn gpt4() -> Self
pub fn gpt4() -> Self
Markdown format, minimal metadata, relevance-ordered. Good for GPT-4, GPT-4o, and similar models.
Sourcepub fn gemini() -> Self
pub fn gemini() -> Self
Markdown format, minimal metadata, relevance-ordered.
Alias for gpt4() — Gemini also handles markdown well.
Sourcepub fn local_small() -> Self
pub fn local_small() -> Self
Plain text, no metadata, relevance-ordered. For small local models with tight context windows.
Trait Implementations§
Source§impl Clone for FormatPolicy
impl Clone for FormatPolicy
Source§fn clone(&self) -> FormatPolicy
fn clone(&self) -> FormatPolicy
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 FormatPolicy
impl Debug for FormatPolicy
Auto Trait Implementations§
impl Freeze for FormatPolicy
impl RefUnwindSafe for FormatPolicy
impl Send for FormatPolicy
impl Sync for FormatPolicy
impl Unpin for FormatPolicy
impl UnsafeUnpin for FormatPolicy
impl UnwindSafe for FormatPolicy
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<K, Q> Comparable<Q> for K
impl<K, Q> Comparable<Q> for K
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
Source§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> Fruit for T
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 more