pub struct MultiPageContext {
pub pages: Vec<PageContext>,
pub total_token_budget: usize,
pub goal: Option<String>,
pub config: SynthesisConfig,
}Expand description
Multi-page context for synthesis.
Fields§
§pages: Vec<PageContext>All pages in the context.
total_token_budget: usizeTotal token budget for synthesis.
goal: Option<String>The synthesis goal/question.
config: SynthesisConfigSynthesis configuration.
Implementations§
Source§impl MultiPageContext
impl MultiPageContext
Sourcepub fn new(total_token_budget: usize) -> MultiPageContext
pub fn new(total_token_budget: usize) -> MultiPageContext
Create a new multi-page context.
Sourcepub fn with_config(self, config: SynthesisConfig) -> MultiPageContext
pub fn with_config(self, config: SynthesisConfig) -> MultiPageContext
Set the configuration.
Sourcepub fn with_goal(self, goal: impl Into<String>) -> MultiPageContext
pub fn with_goal(self, goal: impl Into<String>) -> MultiPageContext
Set the goal.
Sourcepub fn add_page(&mut self, page: PageContext)
pub fn add_page(&mut self, page: PageContext)
Add a page.
Sourcepub fn page_count(&self) -> usize
pub fn page_count(&self) -> usize
Get the number of pages.
Sourcepub fn pages_by_relevance(&self) -> Vec<&PageContext>
pub fn pages_by_relevance(&self) -> Vec<&PageContext>
Get pages sorted by relevance (highest first).
Sourcepub fn relevant_pages(&self) -> Vec<&PageContext>
pub fn relevant_pages(&self) -> Vec<&PageContext>
Get pages that meet minimum relevance threshold.
Sourcepub fn fit_to_budget(&mut self)
pub fn fit_to_budget(&mut self)
Truncate pages to fit within token budget.
Sourcepub fn total_estimated_tokens(&self) -> usize
pub fn total_estimated_tokens(&self) -> usize
Get total estimated tokens across all pages.
Trait Implementations§
Source§impl Clone for MultiPageContext
impl Clone for MultiPageContext
Source§fn clone(&self) -> MultiPageContext
fn clone(&self) -> MultiPageContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MultiPageContext
impl Debug for MultiPageContext
Source§impl<'de> Deserialize<'de> for MultiPageContext
impl<'de> Deserialize<'de> for MultiPageContext
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MultiPageContext, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MultiPageContext, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for MultiPageContext
impl Serialize for MultiPageContext
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for MultiPageContext
impl RefUnwindSafe for MultiPageContext
impl Send for MultiPageContext
impl Sync for MultiPageContext
impl Unpin for MultiPageContext
impl UnwindSafe for MultiPageContext
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