Trait rig::completion::Completion

source ·
pub trait Completion<M: CompletionModel> {
    // Required method
    fn completion(
        &self,
        prompt: &str,
        chat_history: Vec<Message>,
    ) -> impl Future<Output = Result<CompletionRequestBuilder<M>, CompletionError>> + Send;
}
Expand description

Trait defininig a low-level LLM completion interface

Required Methods§

source

fn completion( &self, prompt: &str, chat_history: Vec<Message>, ) -> impl Future<Output = Result<CompletionRequestBuilder<M>, CompletionError>> + Send

Generates a completion request builder for the given prompt and chat_history. This function is meant to be called by the user to further customize the request at prompt time before sending it.

IMPORTANT: The CompletionModel that implements this trait will already populate fields (the exact fields depend on the model) in the builder. For fields that have already been set by the model, calling the corresponding method on the builder will overwrite the value set by the model.

Object Safety§

This trait is not object safe.

Implementors§