7 instantiations of ChatResponseFormatJson
Microsoft.Extensions.AI.Abstractions (2)
ChatCompletion\ChatResponseFormat.cs (2)
27public static ChatResponseFormatJson Json { get; } = new(schema: null); 36new(schema,
Microsoft.Extensions.AI.Abstractions.Tests (5)
ChatCompletion\ChatResponseFormatTests.cs (5)
24Assert.Throws<ArgumentException>("schemaName", () => new ChatResponseFormatJson(null, "name")); 25Assert.Throws<ArgumentException>("schemaDescription", () => new ChatResponseFormatJson(null, null, "description")); 26Assert.Throws<ArgumentException>("schemaName", () => new ChatResponseFormatJson(null, "name", "description")); 32ChatResponseFormatJson f = new(null); 41ChatResponseFormatJson f = new(EmptySchema, "name", "description");
25 references to ChatResponseFormatJson
Microsoft.Extensions.AI (2)
ChatCompletion\OpenTelemetryChatClient.cs (2)
281ChatResponseFormatJson { Schema: null } => "json_schema", 282ChatResponseFormatJson => "json_object",
Microsoft.Extensions.AI.Abstractions (7)
ChatCompletion\ChatOptions.cs (1)
40/// an instance of <see cref="ChatResponseFormatJson"/> constructed with a specific JSON schema to request that the
ChatCompletion\ChatResponseFormat.cs (5)
12[JsonDerivedType(typeof(ChatResponseFormatJson), typeDiscriminator: "json")] 27public static ChatResponseFormatJson Json { get; } = new(schema: null); 29/// <summary>Creates a <see cref="ChatResponseFormatJson"/> representing structured JSON data with the specified schema.</summary> 33/// <returns>The <see cref="ChatResponseFormatJson"/> instance.</returns> 34public static ChatResponseFormatJson ForJsonSchema(
ChatCompletion\ChatResponseFormatJson.cs (1)
15/// <summary>Initializes a new instance of the <see cref="ChatResponseFormatJson"/> class with the specified schema.</summary>
Microsoft.Extensions.AI.Abstractions.Tests (7)
ChatCompletion\ChatOptionsTests.cs (1)
158Assert.IsType<ChatResponseFormatJson>(deserialized.ResponseFormat);
ChatCompletion\ChatResponseFormatTests.cs (6)
32ChatResponseFormatJson f = new(null); 41ChatResponseFormatJson f = new(EmptySchema, "name", "description"); 64var actual = Assert.IsType<ChatResponseFormatJson>(result); 79var actual = Assert.IsType<ChatResponseFormatJson>(result);
Microsoft.Extensions.AI.AzureAIInference (1)
AzureAIInferenceChatClient.cs (1)
367else if (options.ResponseFormat is ChatResponseFormatJson)
Microsoft.Extensions.AI.Ollama (1)
OllamaChatClient.cs (1)
268if (format is ChatResponseFormatJson jsonFormat)
Microsoft.Extensions.AI.OpenAI (1)
OpenAIModelMapper.ChatCompletion.cs (1)
330else if (options.ResponseFormat is ChatResponseFormatJson jsonFormat)
Microsoft.Extensions.AI.Tests (6)
ChatCompletion\ChatClientStructuredOutputExtensionsTests.cs (6)
33var responseFormat = Assert.IsType<ChatResponseFormatJson>(options!.ResponseFormat); 177var responseFormat = Assert.IsType<ChatResponseFormatJson>(options!.ResponseFormat); 221var responseFormat = Assert.IsType<ChatResponseFormatJson>(options!.ResponseFormat);