ChatOptions.ResponseFormat Property

Definition

Gets or sets the response format for the chat request.

C#
public Microsoft.Extensions.AI.ChatResponseFormat? ResponseFormat { get; set; }

Property Value

Remarks

If null, no response format is specified and the client will use its default. This property can be set to Text to specify that the response should be unstructured text, to Json to specify that the response should be structured JSON data, or an instance of ChatResponseFormatJson constructed with a specific JSON schema to request that the response be structured JSON data according to that schema. It is up to the client implementation if or how to honor the request. If the client implementation doesn't recognize the specific kind of ChatResponseFormat, it can be ignored.

Applies to

Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)