Skip to main content

Conversation

Trait Conversation 

Source
pub trait Conversation {
    // Required methods
    fn history(&self) -> &Vec<Message>;
    fn add_message(&mut self, message: Message);
    fn push_user_input(&mut self, text: String);
    fn maybe_summarize(&mut self);
    fn send_once<'a>(
        &'a mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'a>>;
}
Expand description

Conversation trait: async-friendly via boxed futures so implementors can perform network calls.

Implementations live in the deepseek submodule.

Required Methods§

Source

fn history(&self) -> &Vec<Message>

Get a reference to the conversation history.

Source

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)

Push a user input into history (convenience for typical flows).

Source

fn maybe_summarize(&mut self)

Optionally trigger summarization immediately.

Source

fn send_once<'a>( &'a mut self, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'a>>

Send the current history as a single request and return the assistant’s content (if any). This returns a boxed future so the trait remains object-safe without additional crates.

Implementors§