Class ChatCompletionRequest
- Inheritance
-
Chat
Completion Request
- Inherited Members
Constructors
ChatCompletionRequest(string?, List<ChatMessage>?, float?, float?, int?, bool?, bool, int?)
Initializes a new instance of the Chat
public ChatCompletionRequest(string? model = null, List<ChatMessage>? messages = null, float? temperature = 0.7, float? topP = 1, int? maxTokens = null, bool? stream = false, bool safePrompt = false, int? randomSeed = null)
Parameters
model
stringID of the model to use. You can use the List Available Models API to see all of your available models, or see our Model overview for model descriptions. (required).
messages
List<ChatMessage >The prompt(s) to generate completions for, encoded as a list of dict with role and content. The first prompt role should be
user
orsystem
. (required).temperature
float?What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or
top_p
but not both. (default to 0.7M).topP
float?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 ortemperature
but not both. (default to 1M).maxTokens
int?The maximum number of tokens to generate in the completion. The token count of your prompt plus
max_tokens
cannot exceed the model's context length. .stream
bool?Whether to stream back partial progress. If set, tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON. (default to false).
safePrompt
boolWhether to inject a safety prompt before all conversations. (default to false).
randomSeed
int?The seed to use for random sampling. If set, different calls will generate deterministic results. .
Properties
MaxTokens
The maximum number of tokens to generate in the completion. The token count of your prompt plus max_tokens
cannot exceed the model's context length.
Property Value
- int?
The maximum number of tokens to generate in the completion. The token count of your prompt plus
max_tokens
cannot exceed the model's context length.
Examples
16
Messages
The prompt(s) to generate completions for, encoded as a list of dict with role and content. The first prompt role should be user
or system
.
Property Value
- List<Chat
Message > The prompt(s) to generate completions for, encoded as a list of dict with role and content. The first prompt role should be
user
orsystem
.
Examples
[{"role":"user","content":"What is the best French cheese?"}]
Model
ID of the model to use. You can use the List Available Models API to see all of your available models, or see our Model overview for model descriptions.
Property Value
- string
ID of the model to use. You can use the List Available Models API to see all of your available models, or see our Model overview for model descriptions.
Examples
mistral-tiny
RandomSeed
The seed to use for random sampling. If set, different calls will generate deterministic results.
Property Value
- int?
The seed to use for random sampling. If set, different calls will generate deterministic results.
ResponseFormat
Property Value
SafePrompt
Whether to inject a safety prompt before all conversations.
Property Value
- bool
Whether to inject a safety prompt before all conversations.
Stop
Property Value
- string[]
Stream
Whether to stream back partial progress. If set, tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.
Property Value
- bool?
Whether to stream back partial progress. If set, tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.
Temperature
What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p
but not both.
Property Value
- float?
What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or
top_p
but not both.
Examples
0.7
ToolChoice
Property Value
Tools
Property Value
TopP
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.
Property Value
- float?
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 ortemperature
but not both.
Examples
1