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§
sourcefn completion(
&self,
prompt: &str,
chat_history: Vec<Message>,
) -> impl Future<Output = Result<CompletionRequestBuilder<M>, CompletionError>> + Send
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 type that implements this trait might have already populated fields in the builder (the exact fields depend on the type). 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.
For example, the request builder returned by Agent::completion
will already
contain the preamble
provided when creating the agent.
Object Safety§
This trait is not object safe.