Trait rig::completion::Prompt

source ·
pub trait Prompt: Send + Sync {
    // Required method
    fn chat(
        &self,
        prompt: &str,
        chat_history: Vec<Message>,
    ) -> impl Future<Output = Result<String, PromptError>> + Send;

    // Provided method
    fn prompt(
        &self,
        prompt: &str,
    ) -> impl Future<Output = Result<String, PromptError>> + Send { ... }
}
Expand description

Trait defining a high-level LLM chat interface (i.e.: prompt in, response out).

Required Methods§

source

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

Send a prompt to the completion endpoint along with a chat history. If the response is a message, then it is returned as a string. If the response is a tool call, then the tool is called and the result is returned as a string.

Provided Methods§

source

fn prompt( &self, prompt: &str, ) -> impl Future<Output = Result<String, PromptError>> + Send

Object Safety§

This trait is not object safe.

Implementors§