Skip to main content

CompletionRequestBuilder

Struct CompletionRequestBuilder 

Source
pub struct CompletionRequestBuilder { /* private fields */ }
Expand description

Builder for CompletionRequest.

Implementations§

Source§

impl CompletionRequestBuilder

Source

pub fn model(self, model: impl Into<String>) -> Self

Set the model.

Source

pub fn message(self, message: Message) -> Self

Add a message.

Source

pub fn messages(self, messages: Vec<Message>) -> Self

Set all messages at once.

Source

pub fn max_tokens(self, max_tokens: u32) -> Self

Set max_tokens.

Source

pub fn temperature(self, temperature: f32) -> Self

Set temperature.

Source

pub fn top_p(self, top_p: f32) -> Self

Set top_p.

Source

pub fn stream(self, stream: bool) -> Self

Enable streaming.

Source

pub fn n(self, n: u32) -> Self

Set number of completions.

Source

pub fn stop(self, stop: Vec<String>) -> Self

Set stop sequences.

Source

pub fn presence_penalty(self, penalty: f32) -> Self

Set presence penalty.

Source

pub fn frequency_penalty(self, penalty: f32) -> Self

Set frequency penalty.

Source

pub fn user(self, user: impl Into<String>) -> Self

Set user identifier.

Source

pub fn response_format(self, format: ResponseFormat) -> Self

Set response format.

Source

pub fn json_mode(self) -> Self

Enable JSON object mode (no schema validation).

Source

pub fn json_schema(self, name: impl Into<String>, schema: Value) -> Self

Enable structured output with JSON schema.

Source

pub fn build(self) -> Result<CompletionRequest>

Build and validate the request.

Trait Implementations§

Source§

impl Clone for CompletionRequestBuilder

Source§

fn clone(&self) -> CompletionRequestBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CompletionRequestBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CompletionRequestBuilder

Source§

fn default() -> CompletionRequestBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V