Skip to main content

Max tokens

The maximum number of tokens to generate. Shorter token lengths will provide faster performance.

Stop words

In some cases, when you know the answer to just be a single word, you may set the max_tokens to be 1, such that in the output we only have one token. However, if we have a more complicated query (e.g., information extraction), we may want more than one token and at the same time keep the output short and relevant. In this case we can use stop words as seen in the example below:
Here we set the max_tokens to be 100, as we are expecting several words describing this review, and at the same time we set the stop to be \n\n such that the model will stop when it sees this stop word, and semantically this means that this sentence is over. In this case, we will receive a response like this (only the output field is shown, and other fields are omitted):

Temperature

A decimal number that determines the degree of randomness in the response. A value of 0 will always yield the same output. A temperature much less than 1 favors more correctness and is appropriate for question answering or summarization. A value approaching 1 introduces more randomness in the output.

Top_p

The top_p (nucleus) parameter is used to dynamically adjust the number of choices for each predicted token based on the cumulative probabilities. It specifies a probability threshold, below which all less likely tokens are filtered out. This technique helps to maintain diversity and generate more fluent and natural-sounding text.

Top_k

The top_k parameter is used to limit the number of choices for the next predicted word or token. It specifies the maximum number of tokens to consider at each step, based on their probability of occurrence. This technique helps to speed up the generation process and can improve the quality of the generated text by focusing on the most likely options.

Repetition penalty

Controls the diversity of generated text by reducing the likelihood of repeated sequences. Higher values decrease repetition.

Logprops (API only)

An integer that specifies how many top token log probabilities are included in the response for each token generation step.