Skip to main content

Chat

Trait Chat 

Source
pub trait Chat: WasmCompatSend + WasmCompatSync {
    // Required method
    fn chat(
        &self,
        prompt: impl Into<Message> + WasmCompatSend,
        chat_history: &mut Vec<Message>,
    ) -> impl Future<Output = Result<String, PromptError>> + WasmCompatSend;
}
Expand description

High-level prompting with caller-owned canonical chat history.

Required Methods§

Source

fn chat( &self, prompt: impl Into<Message> + WasmCompatSend, chat_history: &mut Vec<Message>, ) -> impl Future<Output = Result<String, PromptError>> + WasmCompatSend

Execute one turn and append only committed messages to chat_history.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<M> Chat for Agent<M>
where M: CompletionModel + 'static,