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
72 references to ChatResponseFormat
Microsoft.Extensions.AI (9)
ChatCompletion\ChatClientStructuredOutputExtensions.cs (9)
29/// <see langword="true" /> to set a JSON schema on the <see cref="ChatResponseFormat"/>; otherwise, <see langword="false" />. The default is <see langword="true" />. 48/// <see langword="true" /> to set a JSON schema on the <see cref="ChatResponseFormat"/>; otherwise, <see langword="false" />. 68/// <see langword="true" /> to set a JSON schema on the <see cref="ChatResponseFormat"/>; otherwise, <see langword="false" />. The default is <see langword="true" />. 88/// <see langword="true" /> to set a JSON schema on the <see cref="ChatResponseFormat"/>; otherwise, <see langword="false" />. The default is <see langword="true" />. 109/// <see langword="true" /> to set a JSON schema on the <see cref="ChatResponseFormat"/>; otherwise, <see langword="false" />. The default is <see langword="true" />. 130/// <see langword="true" /> to set a JSON schema on the <see cref="ChatResponseFormat"/>; otherwise, <see langword="false" />. The default is <see langword="true" />. 151var responseFormat = ChatResponseFormat.ForJsonSchema<T>(serializerOptions); 170responseFormat = ChatResponseFormat.ForJsonSchema(schema, responseFormat.SchemaName, responseFormat.SchemaDescription); 187options.ResponseFormat = ChatResponseFormat.Json;
Microsoft.Extensions.AI.Abstractions (7)
ChatCompletion\ChatOptions.cs (4)
72/// This property can be set to <see cref="ChatResponseFormat.Text"/> to specify that the response should be unstructured text, 73/// to <see cref="ChatResponseFormat.Json"/> to specify that the response should be structured JSON data, or 76/// to honor the request. If the client implementation doesn't recognize the specific kind of <see cref="ChatResponseFormat"/>, 79public ChatResponseFormat? ResponseFormat { get; set; }
ChatCompletion\ChatResponseFormat.cs (1)
28/// <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 (27)
ChatCompletion\ChatOptionsTests.cs (4)
88options.ResponseFormat = ChatResponseFormat.Json; 106Assert.Same(ChatResponseFormat.Json, options.ResponseFormat); 124Assert.Same(ChatResponseFormat.Json, clone.ResponseFormat); 159options.ResponseFormat = ChatResponseFormat.Json;
ChatCompletion\ChatResponseFormatTests.cs (21)
22Assert.Same(ChatResponseFormat.Text, ChatResponseFormat.Text); 23Assert.Same(ChatResponseFormat.Json, ChatResponseFormat.Json); 55string json = JsonSerializer.Serialize(ChatResponseFormat.Text, TestJsonSerializerContext.Default.ChatResponseFormat); 58ChatResponseFormat? result = JsonSerializer.Deserialize(json, TestJsonSerializerContext.Default.ChatResponseFormat); 59Assert.Equal(ChatResponseFormat.Text, result); 65string json = JsonSerializer.Serialize(ChatResponseFormat.Json, TestJsonSerializerContext.Default.ChatResponseFormat); 68ChatResponseFormat? result = JsonSerializer.Deserialize(json, TestJsonSerializerContext.Default.ChatResponseFormat); 79ChatResponseFormat.ForJsonSchema(JsonSerializer.Deserialize<JsonElement>("[1,2,3]", AIJsonUtilities.DefaultOptions), "name", "description"), 83ChatResponseFormat? result = JsonSerializer.Deserialize(json, TestJsonSerializerContext.Default.ChatResponseFormat); 93Assert.Throws<ArgumentNullException>("schemaType", () => ChatResponseFormat.ForJsonSchema(null!)); 94Assert.Throws<ArgumentNullException>("schemaType", () => ChatResponseFormat.ForJsonSchema(null!, TestJsonSerializerContext.Default.Options)); 95Assert.Throws<ArgumentNullException>("schemaType", () => ChatResponseFormat.ForJsonSchema(null!, TestJsonSerializerContext.Default.Options, "name")); 96Assert.Throws<ArgumentNullException>("schemaType", () => ChatResponseFormat.ForJsonSchema(null!, TestJsonSerializerContext.Default.Options, "name", "description")); 105ChatResponseFormat.ForJsonSchema<int>() : 106ChatResponseFormat.ForJsonSchema(typeof(int)); 121ChatResponseFormat.ForJsonSchema<DataContent>() : 122ChatResponseFormat.ForJsonSchema(typeof(DataContent)); 142ChatResponseFormat.ForJsonSchema<SomeType>(TestJsonSerializerContext.Default.Options, name, description) : 143ChatResponseFormat.ForJsonSchema(typeof(SomeType), TestJsonSerializerContext.Default.Options, name, description);
Utilities\AIJsonSchemaTransformCacheTests.cs (2)
65ChatResponseFormatJson responseFormat = ChatResponseFormat.ForJsonSchema(schema); 78JsonElement? transformedSchema = cache.GetOrCreateTransformedSchema(ChatResponseFormat.Json);
Microsoft.Extensions.AI.AzureAIInference.Tests (7)
AzureAIInferenceChatClientTests.cs (7)
361ResponseFormat = ChatResponseFormat.Json, 445ResponseFormat = ChatResponseFormat.Json, 532ResponseFormat = ChatResponseFormat.Json 607ResponseFormat = ChatResponseFormat.Json 796ResponseFormat = ChatResponseFormat.Text, 832ResponseFormat = ChatResponseFormat.Json, 889ResponseFormat = ChatResponseFormat.ForJsonSchema(JsonSerializer.Deserialize<JsonElement>("""
Microsoft.Extensions.AI.Evaluation.Integration.Tests (4)
AgentQualityEvaluatorTests.cs (2)
35ResponseFormat = ChatResponseFormat.Text 42ResponseFormat = ChatResponseFormat.Text,
QualityEvaluatorTests.cs (1)
36ResponseFormat = ChatResponseFormat.Text
SafetyEvaluatorTests.cs (1)
38ResponseFormat = ChatResponseFormat.Text
Microsoft.Extensions.AI.Evaluation.Quality (12)
CoherenceEvaluator.cs (1)
63ResponseFormat = ChatResponseFormat.Text
CompletenessEvaluator.cs (1)
60ResponseFormat = ChatResponseFormat.Text
EquivalenceEvaluator.cs (1)
59ResponseFormat = ChatResponseFormat.Text
FluencyEvaluator.cs (1)
57ResponseFormat = ChatResponseFormat.Text
GroundednessEvaluator.cs (1)
58ResponseFormat = ChatResponseFormat.Text
IntentResolutionEvaluator.cs (1)
71ResponseFormat = ChatResponseFormat.Json
RelevanceEvaluator.cs (1)
61ResponseFormat = ChatResponseFormat.Text
RelevanceTruthAndCompletenessEvaluator.cs (1)
74ResponseFormat = ChatResponseFormat.Json
RetrievalEvaluator.cs (1)
67ResponseFormat = ChatResponseFormat.Text
TaskAdherenceEvaluator.cs (1)
70ResponseFormat = ChatResponseFormat.Text
ToolCallAccuracyEvaluator.cs (1)
72ResponseFormat = ChatResponseFormat.Text
Utilities\JsonOutputFixer.cs (1)
62ResponseFormat = ChatResponseFormat.Json
Microsoft.Extensions.AI.OpenAI.Tests (5)
OpenAIChatClientTests.cs (4)
412ResponseFormat = ChatResponseFormat.Json 489ResponseFormat = ChatResponseFormat.Json 570ResponseFormat = ChatResponseFormat.Json 644ResponseFormat = ChatResponseFormat.Json
OpenAIResponseClientTests.cs (1)
704ResponseFormat = ChatResponseFormat.Json
Microsoft.Extensions.AI.Tests (1)
ChatCompletion\OpenTelemetryChatClientTests.cs (1)
123ResponseFormat = ChatResponseFormat.Json,