pub struct DeepseekConversation { /* private fields */ }Expand description
DeepseekConversation: a concrete Conversation implementation.
- owns an
ApiClient(used to send requests) - stores
history: Vec<Message> - holds a
Summarizerimplementation (boxed) - supports auto-summary toggle
Implementations§
Source§impl DeepseekConversation
impl DeepseekConversation
Sourcepub fn new(client: ApiClient) -> Self
pub fn new(client: ApiClient) -> Self
Create a conversation with an ApiClient and default summarizer.
Sourcepub fn with_summarizer(self, s: impl Summarizer + 'static) -> Self
pub fn with_summarizer(self, s: impl Summarizer + 'static) -> Self
Builder: set a custom summarizer
Sourcepub fn enable_auto_summary(self, v: bool) -> Self
pub fn enable_auto_summary(self, v: bool) -> Self
Builder: enable or disable auto-summary behavior
Sourcepub fn with_history(self, history: Vec<Message>) -> Self
pub fn with_history(self, history: Vec<Message>) -> Self
Builder: seed conversation history with initial messages
Sourcepub fn history_mut(&mut self) -> &mut Vec<Message>
pub fn history_mut(&mut self) -> &mut Vec<Message>
Inspect mutable history (advanced use)
Sourcepub async fn stream_text(
&mut self,
) -> Result<BoxStream<'_, Result<String, ApiError>>>
pub async fn stream_text( &mut self, ) -> Result<BoxStream<'_, Result<String, ApiError>>>
Stream text fragments (delta.content) as a boxed stream of Result<String, ApiError>.
This is an inherent async method (not part of the Conversation trait) to avoid
trait object lifetime complexity. It simply delegates to the underlying ApiClient.
Trait Implementations§
Source§impl Conversation for DeepseekConversation
impl Conversation for DeepseekConversation
Source§fn add_message(&mut self, message: Message)
fn add_message(&mut self, message: Message)
Add an arbitrary message to the history (any role).
Source§fn push_user_input(&mut self, text: String)
fn push_user_input(&mut self, text: String)
Push a user input into history (convenience for typical flows).
Source§fn maybe_summarize(&mut self)
fn maybe_summarize(&mut self)
Optionally trigger summarization immediately.
Auto Trait Implementations§
impl Freeze for DeepseekConversation
impl !RefUnwindSafe for DeepseekConversation
impl Send for DeepseekConversation
impl Sync for DeepseekConversation
impl Unpin for DeepseekConversation
impl UnsafeUnpin for DeepseekConversation
impl !UnwindSafe for DeepseekConversation
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