OpenAI-compatible completions endpoint
Request
Supported for completion only. Generates best_of completions server-side and returns top n ‘best’ (with the highest cumulative log probability). Results cannot be streamed. When used with n, best_of controls the number of candidate completions and n specifies how many to return - best_of must be greater than n. When best_of != n, best_of is returned by the backend API and n-slicing is done at request output.
Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model’s likelihood to repeat the same line verbatim.
Modify the likelihood of specified tokens appearing in the completion. Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.
Include the log probabilities on the logprobs most likely output tokens, as well the chosen tokens. For example, if logprobs is 5, the API will return a list of the 5 most likely tokens. The API will always return the logprob of the sampled token, so there may be up to logprobs+1 elements in the response.
Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model’s likelihood to talk about new topics.
If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE]
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both.
A unique identifier representing your end-user.
How many of the top tokens to sample from. Must be -1 or greater than or equal to 1.
Whether to include the stop string in the output. This is only applied when the stop or stop_token_ids is set. Can be a boolean or null.
Whether to ignore End of Sequence (EOS) tokens. It is advised to set max_tokens when this is set to avoid overly long response times.
If true (the default), special tokens (e.g. BOS) will be added to the prompt.
An object specifying the format that the model must output. Setting to { "type": "json_object" } enables JSON mode, which guarantees the message the model generates is valid JSON.
If specified, the output will follow the context-free grammar. Can be a string or null.
If specified, will override the default guided decoding backend of the server for this specific request. If set, must be one of ‘outlines’ / ‘lm-format-enforcer’ / name of a custom decoding backend
If specified, will override the default whitespace pattern for guided json decoding. Must be used with guided_json. Supported in ‘outlines’ backend.
If specified with ‘logprobs’, tokens are represented as strings of the form ‘token_id:{token_id}’ so that tokens that are not JSON-encodable can be identified.