Struct rig::model::ModelBuilder
source · pub struct ModelBuilder<M: CompletionModel> { /* private fields */ }
Expand description
A builder for creating a model
§Example
use rig::{providers::openai, model::ModelBuilder};
let openai_client = openai::Client::from_env();
let gpt4 = openai_client.completion_model("gpt-4");
// Configure the model
let model = ModelBuilder::new(model)
.temperature(0.8)
.build();
Implementations§
source§impl<M: CompletionModel> ModelBuilder<M>
impl<M: CompletionModel> ModelBuilder<M>
sourcepub fn temperature(self, temperature: f64) -> Self
pub fn temperature(self, temperature: f64) -> Self
Set the temperature of the model
sourcepub fn temperature_opt(self, temperature: Option<f64>) -> Self
pub fn temperature_opt(self, temperature: Option<f64>) -> Self
Set the temperature of the model (set to None
to use the default temperature of the model)
Auto Trait Implementations§
impl<M> Freeze for ModelBuilder<M>where
M: Freeze,
impl<M> RefUnwindSafe for ModelBuilder<M>where
M: RefUnwindSafe,
impl<M> Send for ModelBuilder<M>
impl<M> Sync for ModelBuilder<M>
impl<M> Unpin for ModelBuilder<M>where
M: Unpin,
impl<M> UnwindSafe for ModelBuilder<M>where
M: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more