pub struct CompletionArgsBuilder { /* private fields */ }
Expand description
Builder for CompletionArgs
.
Implementations§
Source§impl CompletionArgsBuilder
impl CompletionArgsBuilder
Sourcepub fn prompt<VALUE: Into<String>>(&self, value: VALUE) -> Self
pub fn prompt<VALUE: Into<String>>(&self, value: VALUE) -> Self
The prompt to complete from.
Defaults to "<|endoftext|>"
which is a special token seen during training.
§Example
CompletionArgs::builder().prompt("Once upon a time...");
Sourcepub fn max_tokens(&self, value: u64) -> Self
pub fn max_tokens(&self, value: u64) -> Self
Maximum number of tokens to complete.
Defaults to 16
§Example
CompletionArgs::builder().max_tokens(64);
Sourcepub fn temperature(&self, value: f64) -> Self
pub fn temperature(&self, value: f64) -> Self
What sampling temperature to use.
Default is 1.0
Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer.
OpenAI recommends altering this or top_p but not both.
§Example
let builder = CompletionArgs::builder().temperature(0.7);
let args: CompletionArgs = builder.try_into()?;
pub fn top_p(&self, value: f64) -> Self
pub fn n(&self, value: u64) -> Self
pub fn logprobs(&self, value: u64) -> Self
pub fn echo(&self, value: bool) -> Self
pub fn stop(&self, value: Vec<String>) -> Self
pub fn presence_penalty(&self, value: f64) -> Self
pub fn frequency_penalty(&self, value: f64) -> Self
pub fn logit_bias(&self, value: HashMap<String, f64>) -> Self
Sourcepub fn build(&self) -> Result<CompletionArgs, CompletionArgsBuilderError>
pub fn build(&self) -> Result<CompletionArgs, CompletionArgsBuilderError>
Trait Implementations§
Source§impl Clone for CompletionArgsBuilder
impl Clone for CompletionArgsBuilder
Source§fn clone(&self) -> CompletionArgsBuilder
fn clone(&self) -> CompletionArgsBuilder
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Default for CompletionArgsBuilder
impl Default for CompletionArgsBuilder
Source§impl TryFrom<CompletionArgsBuilder> for CompletionArgs
impl TryFrom<CompletionArgsBuilder> for CompletionArgs
Source§type Error = CompletionArgsBuilderError
type Error = CompletionArgsBuilderError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl Freeze for CompletionArgsBuilder
impl RefUnwindSafe for CompletionArgsBuilder
impl Send for CompletionArgsBuilder
impl Sync for CompletionArgsBuilder
impl Unpin for CompletionArgsBuilder
impl UnwindSafe for CompletionArgsBuilder
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