Table of Contents

Class ChatCompletionRequest

Namespace
AutoGen.Mistral
Assembly
AutoGen.Mistral.dll
public class ChatCompletionRequest
Inheritance
ChatCompletionRequest
Inherited Members

Constructors

ChatCompletionRequest(string?, List<ChatMessage>?, float?, float?, int?, bool?, bool, int?)

Initializes a new instance of the ChatCompletionRequest class.

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 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. (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 or system. (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 or temperature 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 bool

Whether 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.

[JsonPropertyName("max_tokens")]
public int? MaxTokens { get; set; }

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.

[JsonPropertyName("messages")]
public List<ChatMessage> Messages { get; set; }

Property Value

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 or system.

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.

[JsonPropertyName("model")]
public string Model { get; set; }

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.

[JsonPropertyName("random_seed")]
public int? RandomSeed { get; set; }

Property Value

int?

The seed to use for random sampling. If set, different calls will generate deterministic results.

ResponseFormat

[JsonPropertyName("response_format")]
public ResponseFormat? ResponseFormat { get; set; }

Property Value

ResponseFormat

SafePrompt

Whether to inject a safety prompt before all conversations.

[JsonPropertyName("safe_prompt")]
public bool SafePrompt { get; set; }

Property Value

bool

Whether to inject a safety prompt before all conversations.

Stop

[JsonPropertyName("stop")]
public string[]? Stop { get; set; }

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.

[JsonPropertyName("stream")]
public bool? Stream { get; set; }

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.

[JsonPropertyName("temperature")]
public float? Temperature { get; set; }

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

[JsonPropertyName("tool_choice")]
public ToolChoiceEnum? ToolChoice { get; set; }

Property Value

ToolChoiceEnum?

Tools

[JsonPropertyName("tools")]
public List<FunctionTool>? Tools { get; set; }

Property Value

List<FunctionTool>

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.

[JsonPropertyName("top_p")]
public float? TopP { get; set; }

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 or temperature but not both.

Examples

1