pub struct Summarizer {
pub prompts: SummaryPrompts,
pub limits: SummaryLimits,
}Expand description
Builds the request for a summary of a conversation’s older messages and reads the summary from the model’s answer. The conversation goes as text in one user message, so the model reads it rather than continues it.
Fields§
§prompts: SummaryPromptsWhat the model is asked.
limits: SummaryLimitsSizes.
Implementations§
Source§impl Summarizer
impl Summarizer
Source§impl Summarizer
impl Summarizer
Sourcepub fn request(
&self,
older: &[Arc<Message>],
previous: &str,
focus: &str,
spec: &ModelSpec,
) -> Result<CompletionRequest, UnsupportedOption>
pub fn request( &self, older: &[Arc<Message>], previous: &str, focus: &str, spec: &ModelSpec, ) -> Result<CompletionRequest, UnsupportedOption>
The request to spec for a summary of older, merged into
previous when that is not empty. focus is what the summary
should keep above all; it may be empty.
Sourcepub fn max_tokens(&self, spec: &ModelSpec) -> u64
pub fn max_tokens(&self, spec: &ModelSpec) -> u64
The longest summary asked of spec: the limit’s, or the model’s
output limit when that is lower.
Sourcepub fn instruction(&self, focus: &str) -> String
pub fn instruction(&self, focus: &str) -> String
The message that asks for a summary at the end of the conversation
itself, the agent’s own request with its system prompt and tools cut
before the first message kept, so the provider can read all of it
from its prompt cache: SummaryPrompts::in_place, focus when it
is not empty, and the format.
Sourcepub fn summary_text(
response: &CompletionResponse,
) -> Result<String, SummaryError>
pub fn summary_text( response: &CompletionResponse, ) -> Result<String, SummaryError>
The summary in a finished answer, or why it cannot be used.
Trait Implementations§
Source§impl Clone for Summarizer
impl Clone for Summarizer
Source§impl Debug for Summarizer
impl Debug for Summarizer
Source§impl Default for Summarizer
impl Default for Summarizer
Source§impl<'de> Deserialize<'de> for Summarizerwhere
Summarizer: Default,
impl<'de> Deserialize<'de> for Summarizerwhere
Summarizer: Default,
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>,
impl Eq for Summarizer
Source§impl PartialEq for Summarizer
impl PartialEq for Summarizer
Source§impl Serialize for Summarizer
impl Serialize for Summarizer
impl StructuralPartialEq for Summarizer
Auto Trait Implementations§
impl Freeze for Summarizer
impl RefUnwindSafe for Summarizer
impl Send for Summarizer
impl Sync for Summarizer
impl Unpin for Summarizer
impl UnsafeUnpin for Summarizer
impl UnwindSafe for Summarizer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.