2 types derived from ChatResponseFormat
Microsoft.Extensions.AI.Abstractions (2)
ChatCompletion\ChatResponseFormatJson.cs (1)
13public sealed class ChatResponseFormatJson : ChatResponseFormat
ChatCompletion\ChatResponseFormatText.cs (1)
13public sealed class ChatResponseFormatText : ChatResponseFormat
35 references to ChatResponseFormat
Microsoft.Extensions.AI (8)
ChatCompletion\ChatClientStructuredOutputExtensions.cs (8)
33/// Optionally specifies whether to set a JSON schema on the <see cref="ChatResponseFormat"/>. 57/// Optionally specifies whether to set a JSON schema on the <see cref="ChatResponseFormat"/>. 77/// Optionally specifies whether to set a JSON schema on the <see cref="ChatResponseFormat"/>. 98/// Optionally specifies whether to set a JSON schema on the <see cref="ChatResponseFormat"/>. 120/// Optionally specifies whether to set a JSON schema on the <see cref="ChatResponseFormat"/>. 142/// Optionally specifies whether to set a JSON schema on the <see cref="ChatResponseFormat"/>. 205options.ResponseFormat = ChatResponseFormat.ForJsonSchema( 212options.ResponseFormat = ChatResponseFormat.Json;
Microsoft.Extensions.AI.Abstractions (7)
ChatCompletion\ChatOptions.cs (4)
66/// This property can be set to <see cref="ChatResponseFormat.Text"/> to specify that the response should be unstructured text, 67/// to <see cref="ChatResponseFormat.Json"/> to specify that the response should be structured JSON data, or 70/// to honor the request. If the client implementation doesn't recognize the specific kind of <see cref="ChatResponseFormat"/>, 73public ChatResponseFormat? ResponseFormat { get; set; }
ChatCompletion\ChatResponseFormat.cs (1)
17/// <summary>Initializes a new instance of the <see cref="ChatResponseFormat"/> class.</summary>
ChatCompletion\ChatResponseFormatText.cs (2)
10/// Use <see cref="ChatResponseFormat.Text"/> to get an instance of <see cref="ChatResponseFormatText"/>. 16/// <remarks> Use <see cref="ChatResponseFormat.Text"/> to get an instance of <see cref="ChatResponseFormatText"/>.</remarks>
Microsoft.Extensions.AI.Abstractions.Tests (15)
ChatCompletion\ChatOptionsTests.cs (4)
78options.ResponseFormat = ChatResponseFormat.Json; 93Assert.Same(ChatResponseFormat.Json, options.ResponseFormat); 109Assert.Same(ChatResponseFormat.Json, clone.ResponseFormat); 141options.ResponseFormat = ChatResponseFormat.Json;
ChatCompletion\ChatResponseFormatTests.cs (11)
17Assert.Same(ChatResponseFormat.Text, ChatResponseFormat.Text); 18Assert.Same(ChatResponseFormat.Json, ChatResponseFormat.Json); 50string json = JsonSerializer.Serialize(ChatResponseFormat.Text, TestJsonSerializerContext.Default.ChatResponseFormat); 53ChatResponseFormat? result = JsonSerializer.Deserialize(json, TestJsonSerializerContext.Default.ChatResponseFormat); 54Assert.Equal(ChatResponseFormat.Text, result); 60string json = JsonSerializer.Serialize(ChatResponseFormat.Json, TestJsonSerializerContext.Default.ChatResponseFormat); 63ChatResponseFormat? result = JsonSerializer.Deserialize(json, TestJsonSerializerContext.Default.ChatResponseFormat); 74ChatResponseFormat.ForJsonSchema(JsonSerializer.Deserialize<JsonElement>("[1,2,3]"), "name", "description"), 78ChatResponseFormat? result = JsonSerializer.Deserialize(json, TestJsonSerializerContext.Default.ChatResponseFormat);
Microsoft.Extensions.AI.AzureAIInference.Tests (3)
AzureAIInferenceChatClientTests.cs (3)
335ResponseFormat = ChatResponseFormat.Text, 371ResponseFormat = ChatResponseFormat.Json, 410ResponseFormat = ChatResponseFormat.ForJsonSchema(JsonSerializer.Deserialize<JsonElement>("""
Microsoft.Extensions.AI.Ollama (1)
OllamaChatClient.cs (1)
281private static JsonElement? ToOllamaChatResponseFormat(ChatResponseFormat? format)
Microsoft.Extensions.AI.Tests (1)
ChatCompletion\OpenTelemetryChatClientTests.cs (1)
128ResponseFormat = ChatResponseFormat.Json,