語言

ChatResponseFormat 類別

定義

代表呼叫者所期望的回應格式。

public ref class ChatResponseFormat
[System.Text.Json.Serialization.JsonDerivedType(typeof(Microsoft.Extensions.AI.ChatResponseFormatText), "text")]
[System.Text.Json.Serialization.JsonDerivedType(typeof(Microsoft.Extensions.AI.ChatResponseFormatJson), "json")]
[System.Text.Json.Serialization.JsonPolymorphic(TypeDiscriminatorPropertyName="$type")]
public class ChatResponseFormat
[<System.Text.Json.Serialization.JsonDerivedType(typeof(Microsoft.Extensions.AI.ChatResponseFormatText), "text")>]
[<System.Text.Json.Serialization.JsonDerivedType(typeof(Microsoft.Extensions.AI.ChatResponseFormatJson), "json")>]
[<System.Text.Json.Serialization.JsonPolymorphic(TypeDiscriminatorPropertyName="$type")>]
type ChatResponseFormat = class
Public Class ChatResponseFormat
繼承
ChatResponseFormat
衍生
屬性

屬性

名稱 Description
Json

它會得到一個代表結構化 JSON 資料的單例,但沒有特定的結構結構。

Text

取得一個代表非結構化文本資料的單例實例。

方法

名稱 Description
ForJsonSchema(JsonElement, String, String)

建立 ChatResponseFormatJson 一個代表結構化 JSON 資料,並附上指定的結構化 JSON。

ForJsonSchema(Type, JsonSerializerOptions, String, String)

建立 ChatResponseFormatJson 一個以結構化 JSON 為基礎 schemaType的結構化 JSON 資料。

ForJsonSchema<T>(JsonSerializerOptions, String, String)

建立 ChatResponseFormatJson 一個以結構化 JSON 為基礎 T的結構化 JSON 資料。

擴充方法

名稱 Description
AsOpenAIChatResponseFormat(ChatResponseFormat, ChatOptions)

從 ChatResponseFormatChatResponseFormat.

AsOpenAIResponseTextFormat(ChatResponseFormat, ChatOptions)

從 ResponseTextFormatChatResponseFormat.

適用於