Trait rig::completion::Chat
source · pub trait Chat: Send + Sync {
// Required method
fn chat(
&self,
prompt: &str,
chat_history: Vec<Message>,
) -> impl Future<Output = Result<String, PromptError>> + Send;
}
Expand description
Trait defining a high-level LLM chat interface (i.e.: prompt and chat history in, response out).
Required Methods§
sourcefn chat(
&self,
prompt: &str,
chat_history: Vec<Message>,
) -> impl Future<Output = Result<String, PromptError>> + Send
fn chat( &self, prompt: &str, chat_history: Vec<Message>, ) -> impl Future<Output = Result<String, PromptError>> + Send
Send a prompt with optional chat history to the underlying completion model.
If the completion model’s response is a message, then it is returned as a string.
If the completion model’s response is a tool call, then the tool is called and the result is returned as a string.
If the tool does not exist, or the tool call fails, then an error is returned.
Object Safety§
This trait is not object safe.