Skip to main content

MultiPageContext

Struct MultiPageContext 

Source
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: usize

Total token budget for synthesis.

§goal: Option<String>

The synthesis goal/question.

§config: SynthesisConfig

Synthesis configuration.

Implementations§

Source§

impl MultiPageContext

Source

pub fn new(total_token_budget: usize) -> Self

Create a new multi-page context.

Source

pub fn with_config(self, config: SynthesisConfig) -> Self

Set the configuration.

Source

pub fn with_goal(self, goal: impl Into<String>) -> Self

Set the goal.

Source

pub fn add_page(&mut self, page: PageContext)

Add a page.

Source

pub fn page_count(&self) -> usize

Get the number of pages.

Source

pub fn pages_by_relevance(&self) -> Vec<&PageContext>

Get pages sorted by relevance (highest first).

Source

pub fn relevant_pages(&self) -> Vec<&PageContext>

Get pages that meet minimum relevance threshold.

Source

pub fn fit_to_budget(&mut self)

Truncate pages to fit within token budget.

Source

pub fn to_prompt(&self) -> String

Build the synthesis prompt.

Source

pub fn total_estimated_tokens(&self) -> usize

Get total estimated tokens across all pages.

Trait Implementations§

Source§

impl Clone for MultiPageContext

Source§

fn clone(&self) -> MultiPageContext

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for MultiPageContext

Source§

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

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

impl<'de> Deserialize<'de> for MultiPageContext

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 MultiPageContext

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<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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,