ChatCompletionsOptions Class

Definition

The configuration information for a chat completions request. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.

public class ChatCompletionsOptions : System.ClientModel.Primitives.IJsonModel<Azure.AI.OpenAI.ChatCompletionsOptions>, System.ClientModel.Primitives.IPersistableModel<Azure.AI.OpenAI.ChatCompletionsOptions>
type ChatCompletionsOptions = class
    interface IJsonModel<ChatCompletionsOptions>
    interface IPersistableModel<ChatCompletionsOptions>
Public Class ChatCompletionsOptions
Implements IJsonModel(Of ChatCompletionsOptions), IPersistableModel(Of ChatCompletionsOptions)
Inheritance
ChatCompletionsOptions
Implements

Constructors

ChatCompletionsOptions()

Initializes a new instance of ChatCompletionsOptions.

ChatCompletionsOptions(String, IEnumerable<ChatRequestMessage>)

Initializes a new instance of ChatCompletionsOptions.

Properties

AzureExtensionsOptions

Gets or sets the additional configuration details to use for Azure OpenAI chat completions extensions.

ChoiceCount

Gets or sets the number of choices that should be generated per provided prompt. Has a valid range of 1 to 128.

DeploymentName

The deployment name to use for a chat completions request.

EnableLogProbabilities

Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the content of message. This option is currently not available on the gpt-4-vision-preview model.

FrequencyPenalty

Gets or sets a value that influences the probability of generated tokens appearing based on their cumulative frequency in generated text. Has a valid range of -2.0 to 2.0.

FunctionCall

Controls how the model will use provided Functions.

Functions

A list of functions the model may generate JSON inputs for.

LogProbabilitiesPerToken

An integer between 0 and 5 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true if this parameter is used.

MaxTokens

Gets the maximum number of tokens to generate. Has minimum of 0.

Messages

The collection of context messages associated with this chat completions request. Typical usage begins with a chat message for the System role that provides instructions for the behavior of the assistant, followed by alternating messages between the User and Assistant roles. Please note ChatRequestMessage is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. The available derived classes include ChatRequestAssistantMessage, ChatRequestFunctionMessage, ChatRequestSystemMessage, ChatRequestToolMessage and ChatRequestUserMessage.

NucleusSamplingFactor

Gets or set a an alternative value to Temperature, called nucleus sampling, that causes the model to consider the results of the tokens with NucleusSamplingFactor probability mass.

PresencePenalty

Gets or sets a value that influences the probability of generated tokens appearing based on their existing presence in generated text. Has a valid range of -2.0 to 2.0.

ResponseFormat

An object specifying the format that the model must output. Used to enable JSON mode. Please note ChatCompletionsResponseFormat is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes..

Seed

If specified, the system will make a best effort to sample deterministically such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed, and you should refer to the system_fingerprint response parameter to monitor changes in the backend."

StopSequences

Gets a list of textual sequences that will end completions generation. A maximum of four stop sequences are allowed.

Temperature

Gets or sets the sampling temperature to use that controls the apparent creativity of generated completions. Has a valid range of 0.0 to 2.0 and defaults to 1.0 if not otherwise specified.

TokenSelectionBiases

Gets a dictionary of modifications to the likelihood of specified GPT tokens appearing in a chat completions result. Maps token IDs to associated bias scores from -100 to 100, with minimum and maximum values corresponding to a ban or exclusive selection of that token, respectively.

ToolChoice

If specified, the model will configure which of the provided tools it can use for the chat completions response.

Tools

The available tool definitions that the chat completions request can use, including caller-defined functions. Please note ChatCompletionsToolDefinition is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. The available derived classes include ChatCompletionsFunctionToolDefinition.

User

An identifier for the caller or end user of the operation. This may be used for tracking or rate-limiting purposes.

Explicit Interface Implementations

IJsonModel<ChatCompletionsOptions>.Create(Utf8JsonReader, ModelReaderWriterOptions)

Reads one JSON value (including objects or arrays) from the provided reader and converts it to a model.

IJsonModel<ChatCompletionsOptions>.Write(Utf8JsonWriter, ModelReaderWriterOptions)

Writes the model to the provided Utf8JsonWriter.

IPersistableModel<ChatCompletionsOptions>.Create(BinaryData, ModelReaderWriterOptions)

Converts the provided BinaryData into a model.

IPersistableModel<ChatCompletionsOptions>.GetFormatFromOptions(ModelReaderWriterOptions)

Gets the data interchange format (JSON, Xml, etc) that the model uses when communicating with the service.

IPersistableModel<ChatCompletionsOptions>.Write(ModelReaderWriterOptions)

Writes the model into a BinaryData.

Applies to