pub struct Summarizer<'a> {
pub model: &'a Model,
pub apis: Apis,
pub auth: Auth,
pub thinking_level: ThinkingLevel,
pub retry: RetryPolicy,
pub request: Result<StreamOptions, String>,
pub cancel: CancellationToken,
pub on_retry: Box<dyn Fn(SummaryRetry) + Send + Sync + 'a>,
pub hooks: RequestHooks,
}Expand description
What summary requests need besides the messages.
Fields§
§model: &'a ModelThe model to summarize with.
apis: ApisWire APIs.
auth: AuthCredentials for the model.
thinking_level: ThinkingLevelThe session’s thinking level, used when the model reasons.
retry: RetryPolicyRetries for transient failures.
request: Result<StreamOptions, String>The settings every request carries, as the session’s requests carry them, or the error an invalid one raises.
cancel: CancellationTokenCancels the requests.
on_retry: Box<dyn Fn(SummaryRetry) + Send + Sync + 'a>Hears about retries.
hooks: RequestHooksObservers of the requests.
Implementations§
Source§impl Summarizer<'_>
impl Summarizer<'_>
Sourcepub async fn generate_summary(
&self,
messages: &[Message],
reserve_tokens: u64,
custom_instructions: Option<&str>,
previous: Option<&str>,
) -> Result<Summary, String>
pub async fn generate_summary( &self, messages: &[Message], reserve_tokens: u64, custom_instructions: Option<&str>, previous: Option<&str>, ) -> Result<Summary, String>
Summarizes messages, updating previous when given.
Sourcepub async fn compact(
&self,
preparation: &Preparation,
custom_instructions: Option<&str>,
) -> Result<CompactionResult, String>
pub async fn compact( &self, preparation: &Preparation, custom_instructions: Option<&str>, ) -> Result<CompactionResult, String>
Generates the compaction summary for a preparation.
Source§impl Summarizer<'_>
impl Summarizer<'_>
Sourcepub async fn branch_summary(
&self,
entries: &[FileEntry],
custom_instructions: Option<&str>,
replace: bool,
reserve_tokens: u64,
) -> Result<BranchSummary, String>
pub async fn branch_summary( &self, entries: &[FileEntry], custom_instructions: Option<&str>, replace: bool, reserve_tokens: u64, ) -> Result<BranchSummary, String>
Summarizes abandoned branch entries (chronological). replace makes
custom_instructions the whole instruction instead of an addition.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Summarizer<'a>
impl<'a> !UnwindSafe for Summarizer<'a>
impl<'a> Freeze for Summarizer<'a>
impl<'a> Send for Summarizer<'a>
impl<'a> Sync for Summarizer<'a>
impl<'a> Unpin for Summarizer<'a>
impl<'a> UnsafeUnpin for Summarizer<'a>
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