pub struct PageContext {
pub url: String,
pub title: Option<String>,
pub extracted: Option<Value>,
pub summary: Option<String>,
pub html: Option<String>,
pub relevance: f64,
pub index: usize,
pub error: Option<String>,
}Expand description
Context for a single page in multi-page synthesis.
Fields§
§url: StringPage URL.
title: Option<String>Page title.
extracted: Option<Value>Extracted data from this page (if any).
summary: Option<String>Summary of the page content.
html: Option<String>Raw HTML content (truncated).
relevance: f64Relevance score (0.0 to 1.0).
index: usizePage index in the original list.
error: Option<String>Any error that occurred processing this page.
Implementations§
Source§impl PageContext
impl PageContext
Sourcepub fn with_title(self, title: impl Into<String>) -> Self
pub fn with_title(self, title: impl Into<String>) -> Self
Set title.
Sourcepub fn with_extracted(self, data: Value) -> Self
pub fn with_extracted(self, data: Value) -> Self
Set extracted data.
Sourcepub fn with_summary(self, summary: impl Into<String>) -> Self
pub fn with_summary(self, summary: impl Into<String>) -> Self
Set summary.
Sourcepub fn with_relevance(self, relevance: f64) -> Self
pub fn with_relevance(self, relevance: f64) -> Self
Set relevance.
Sourcepub fn with_error(self, error: impl Into<String>) -> Self
pub fn with_error(self, error: impl Into<String>) -> Self
Set error.
Sourcepub fn has_content(&self) -> bool
pub fn has_content(&self) -> bool
Check if this page has usable content.
Sourcepub fn estimated_tokens(&self) -> usize
pub fn estimated_tokens(&self) -> usize
Estimate token count for this page’s content.
Trait Implementations§
Source§impl Clone for PageContext
impl Clone for PageContext
Source§fn clone(&self) -> PageContext
fn clone(&self) -> PageContext
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 PageContext
impl Debug for PageContext
Source§impl<'de> Deserialize<'de> for PageContext
impl<'de> Deserialize<'de> for PageContext
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PageContext
impl RefUnwindSafe for PageContext
impl Send for PageContext
impl Sync for PageContext
impl Unpin for PageContext
impl UnwindSafe for PageContext
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