pub struct Stopping<'a> {
    pub maximum_tokens: u32,
    pub stop_sequences: &'a [&'a str],
}
Expand description

Controls the conditions under which the language models stops generating text.

Fields

maximum_tokens: u32

The maximum number of tokens to be generated. Completion will terminate after the maximum number of tokens is reached.Increase this value to allow for longer outputs. A text is split into tokens. Usually there are more tokens than words. The total number of tokens of prompt and maximum_tokens depends on the model.

stop_sequences: &'a [&'a str]

List of strings which will stop generation if they are generated. Stop sequences are helpful in structured texts. E.g.: In a question answering scenario a text may consist of lines starting with either “Question: “ or “Answer: “ (alternating). After producing an answer, the model will be likely to generate “Question: “. “Question: “ may therfore be used as stop sequence in order not to have the model generate more questions but rather restrict text generation to the answers.

Implementations

Only stop once the model generates end of text, or maximum tokens are reached.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more