Struct GenerateRequest

Source
pub struct GenerateRequest<'input> {
Show 15 fields pub prompt: &'input str, pub model: Option<GenerateModel>, pub max_tokens: Option<u32>, pub preset: Option<String>, pub temperature: Option<f64>, pub num_generations: Option<u8>, pub k: Option<u64>, pub p: Option<f64>, pub frequency_penalty: Option<f64>, pub presence_penalty: Option<f64>, pub end_sequences: Option<Vec<String>>, pub stop_sequences: Option<Vec<String>>, pub return_likelihoods: Option<ReturnLikelihoods>, pub logit_bias: Option<HashMap<u64, f32>>, pub truncate: Option<Truncate>,
}

Fields§

§prompt: &'input str

Represents the prompt or text to be completed.

§model: Option<GenerateModel>

optional - The model to use for text generation. Custom models can also be supplied with their full ID.

§max_tokens: Option<u32>

optional - Denotes the number of tokens to predict per generation.

§preset: Option<String>

optional - The ID of a custom playground preset.

§temperature: Option<f64>

optional - A non-negative float that tunes the degree of randomness in generation.

§num_generations: Option<u8>

optional - Denotes the maximum number of generations that will be returned. Defaults to 1, max value of 5.

§k: Option<u64>

optional - If set to a positive integer, it ensures only the top k most likely tokens are considered for generation at each step. Defaults to 0 (disabled)

§p: Option<f64>

optional - If set to a probability 0.0 < p < 1.0, it ensures that only the most likely tokens, with total probability mass of p, are considered for generation at each step. If both k and p are enabled, p acts after k. Max value of 1.0. Defaults to 0.75.

§frequency_penalty: Option<f64>

optional - Can be used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation. Max value of 1.0. Defaults to 0.0.

§presence_penalty: Option<f64>

optional - Can be used to reduce repetitiveness of generated tokens. Similar to frequency_penalty, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies. Max value of 1.0. Defaults to 0.0.

§end_sequences: Option<Vec<String>>

optional - The generated text will be cut at the beginning of the earliest occurrence of an end sequence. The sequence will be excluded from the text.

§stop_sequences: Option<Vec<String>>

optional - The generated text will be cut at the end of the earliest occurrence of a stop sequence. The sequence will be included the text.

§return_likelihoods: Option<ReturnLikelihoods>

optional - One of GENERATION|ALL|NONE to specify how and if the token likelihoods are returned with the response. If GENERATION is selected, the token likelihoods will only be provided for generated text. If ALL is selected, the token likelihoods will be provided both for the prompt and the generated text.

§logit_bias: Option<HashMap<u64, f32>>

optional - Used to prevent the model from generating unwanted tokens or to incentivize it to include desired tokens A map of tokens to biases where bias is a float between -10 and +10 Negative values will disincentivize that token from appearing while positives values will incentivize them Tokens can be obtained from text using the tokenizer Note: logit bias may not be supported for all finetune models

§truncate: Option<Truncate>

optional - Specify how the API will handle inputs longer than the maximum token length. Passing START will discard the start of the input. END will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. If NONE is selected, when the input exceeds the maximum input token length an error will be returned.

Trait Implementations§

Source§

impl<'input> Debug for GenerateRequest<'input>

Source§

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

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

impl<'input> Default for GenerateRequest<'input>

Source§

fn default() -> GenerateRequest<'input>

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

impl<'input> Serialize for GenerateRequest<'input>

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

Auto Trait Implementations§

§

impl<'input> Freeze for GenerateRequest<'input>

§

impl<'input> RefUnwindSafe for GenerateRequest<'input>

§

impl<'input> Send for GenerateRequest<'input>

§

impl<'input> Sync for GenerateRequest<'input>

§

impl<'input> Unpin for GenerateRequest<'input>

§

impl<'input> UnwindSafe for GenerateRequest<'input>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,