SampleRequest

Struct SampleRequest 

Source
pub struct SampleRequest {
Show 18 fields pub model: Option<String>, pub prompt: Option<SampleContent>, pub max_tokens: Option<i32>, pub temperature: Option<f32>, pub top_p: Option<f32>, pub n: Option<i32>, pub stream: Option<bool>, pub stream_options: Option<StreamOptions>, pub stop: Option<Vec<String>>, pub presence_penalty: Option<f32>, pub frequency_penalty: Option<f32>, pub echo: Option<bool>, pub logprobs: Option<bool>, pub best_of: Option<i32>, pub logit_bias: Option<Value>, pub seed: Option<i32>, pub suffix: Option<String>, pub user: Option<String>,
}
Expand description

(Legacy) Request for /v1/completions endpoint.

Fields§

§model: Option<String>

Specifies the model to be used for the request.

§prompt: Option<SampleContent>

Input for generating completions.

§max_tokens: Option<i32>

Limits the number of tokens that can be produced in the output.

§temperature: Option<f32>

What sampling temperature to use, between 0 and 2.

§top_p: Option<f32>

An alternative to sampling with temperature, called nucleus sampling.

§n: Option<i32>

Determines how many completion sequences to produce for each prompt.

§stream: Option<bool>

Whether to stream back partial progress.

§stream_options: Option<StreamOptions>

Options for streaming response.

§stop: Option<Vec<String>>

(Not supported by reasoning models) Up to 4 sequences where the API will stop generating.

§presence_penalty: Option<f32>

(Not supported by grok-3 and reasoning models) Presence penalty.

§frequency_penalty: Option<f32>

(Unsupported) Frequency penalty.

§echo: Option<bool>

Option to include the original prompt in the response.

§logprobs: Option<bool>

Include the log probabilities on the most likely output tokens.

§best_of: Option<i32>

(Unsupported) Generates multiple completions internally.

§logit_bias: Option<Value>

(Unsupported) Logit bias.

§seed: Option<i32>

If specified, system will make a best effort to sample deterministically.

§suffix: Option<String>

(Unsupported) Optional string to append after the generated text.

§user: Option<String>

A unique identifier representing your end-user.

Trait Implementations§

Source§

impl Clone for SampleRequest

Source§

fn clone(&self) -> SampleRequest

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 SampleRequest

Source§

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

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

impl Default for SampleRequest

Source§

fn default() -> SampleRequest

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

impl<'de> Deserialize<'de> for SampleRequest

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for SampleRequest

Source§

fn eq(&self, other: &SampleRequest) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for SampleRequest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for SampleRequest

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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,