1 type derived from ChatResponse
Microsoft.Extensions.AI (1)
ChatCompletion\ChatResponse{T}.cs (1)
21public class ChatResponse<T> : ChatResponse
241 instantiations of ChatResponse
Aspire.Azure.AI.OpenAI.Tests (1)
AspireAzureOpenAIClientBuilderChatClientExtensionsTests.cs (1)
221=> Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Hello from middleware")));
Aspire.OpenAI.Tests (1)
AspireOpenAIClientBuilderChatClientExtensionsTests.cs (1)
269=> Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Hello from middleware")));
Microsoft.Extensions.AI (1)
ChatCompletion\FunctionInvokingChatClient.cs (1)
322return new ChatResponse(responseMessages);
Microsoft.Extensions.AI.Abstractions (3)
ChatCompletion\ChatResponseExtensions.cs (2)
141ChatResponse response = new(); 174ChatResponse response = new();
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.ChatResponse.g.cs (1)
33ObjectCreator = () => new global::Microsoft.Extensions.AI.ChatResponse(),
Microsoft.Extensions.AI.Abstractions.Tests (17)
ChatCompletion\ChatClientExtensionsTests.cs (2)
103var expectedResponse = new ChatResponse(); 164var expectedResponse = new ChatResponse();
ChatCompletion\ChatResponseTests.cs (11)
19response = new(); 23response = new((IList<ChatMessage>?)null); 27Assert.Throws<ArgumentNullException>("message", () => new ChatResponse((ChatMessage)null!)); 33ChatResponse response = new(); 38response = new(messages); 50ChatResponse response = new(); 87ChatResponse original = new(new ChatMessage(ChatRole.Assistant, "the message")) 124ChatResponse original = new(new ChatMessage(ChatRole.Assistant, "the message")) 233ChatResponse response = new(new ChatMessage(ChatRole.Assistant, $"This is a test.{Environment.NewLine}It's multiple lines.")); 241ChatResponse response = new(new ChatMessage(new ChatRole("customRole"), "Text") { MessageId = "someMessage" }) 271ChatResponse response = new(
ChatCompletion\DelegatingChatClientTests.cs (1)
28var expectedResponse = new ChatResponse();
ChatRouting\RoutingChatClientTests.cs (2)
26ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "ok")); 165Task.FromResult(new ChatResponse());
Generated\361d1da7f942c932\TestJsonSerializerContext.ChatResponse.g.cs (1)
31ObjectCreator = () => new global::Microsoft.Extensions.AI.ChatResponse(),
Microsoft.Extensions.AI.Evaluation (2)
EvaluatorExtensions.cs (2)
136new ChatResponse(modelResponse), 226new ChatResponse(modelResponse),
Microsoft.Extensions.AI.Evaluation.Console (1)
Commands\ReportCommand.cs (1)
104result.ModelResponse = new ChatResponse();
Microsoft.Extensions.AI.Evaluation.Integration.Tests (3)
SafetyEvaluatorTests.cs (3)
429var response = new ChatResponse(answer2); 491var response = new ChatResponse(answer3); 567var response = new ChatResponse(completion2);
Microsoft.Extensions.AI.Evaluation.NLP.Tests (17)
BLEUEvaluatorTests.cs (6)
19var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "The quick brown fox jumps over the lazy dog.")); 35var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Completely unrelated sentence.")); 50var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Some text.")); 70var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, hypothesis)); 90var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, hypothesis)); 103var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, ""));
F1EvaluatorTests.cs (5)
19var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "The quick brown fox jumps over the lazy dog.")); 35var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Completely unrelated sentence.")); 50var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Some text.")); 70var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, hypothesis)); 83var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, ""));
GLEUEvaluatorTests.cs (6)
19var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "The quick brown fox jumps over the lazy dog.")); 35var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Completely unrelated sentence.")); 50var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Some text.")); 70var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, hypothesis)); 90var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, hypothesis)); 103var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, ""));
Microsoft.Extensions.AI.Evaluation.Reporting (3)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.ChatResponse.g.cs (1)
33ObjectCreator = () => new global::Microsoft.Extensions.AI.ChatResponse(),
ScenarioRunExtensions.cs (2)
90new ChatResponse(modelResponse), 149new ChatResponse(modelResponse),
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (1)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.ChatResponse.g.cs (1)
33ObjectCreator = () => new global::Microsoft.Extensions.AI.ChatResponse(),
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (5)
ResultStoreTester.cs (1)
34modelResponse: new ChatResponse(new ChatMessage(ChatRole.Assistant, "LLM response")),
ScenarioRunResultTests.cs (3)
89modelResponse: new ChatResponse(new ChatMessage(ChatRole.Assistant, "response")), 181modelResponse: new ChatResponse(new ChatMessage(ChatRole.Assistant, "response")), 242modelResponse: new ChatResponse(
SerializationChainingTests.cs (1)
24modelResponse: new ChatResponse
Microsoft.Extensions.AI.Evaluation.Safety (1)
ContentSafetyChatClient.cs (1)
67return new ChatResponse(new ChatMessage(ChatRole.Assistant, annotationResult))
Microsoft.Extensions.AI.Integration.Tests (1)
ReducingChatClientTests.cs (1)
34return Task.FromResult(new ChatResponse());
Microsoft.Extensions.AI.OpenAI (2)
OpenAIChatClient.cs (1)
578var response = new ChatResponse(returnMessage)
OpenAIResponsesChatClient.cs (1)
137ChatResponse response = new()
Microsoft.Extensions.AI.OpenAI.Tests (16)
OpenAIConversionTests.cs (16)
1519var chatResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, 1558var chatResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Hello")); 1566var emptyResponse = new ChatResponse([]); 1588var chatResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, 1633var chatResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Test")) 1656var chatResponse = new ChatResponse(new ChatMessage(inputRole, "Test")); 1994var chatResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Test")) 2007var chatResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Hello, world!")) 2032var chatResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Test message")) 2064var chatResponse = new ChatResponse([]) 2091var chatResponse = new ChatResponse(messages) 2128var chatResponse = new ChatResponse(messages) 2159var chatResponse = new ChatResponse(messages) 2181var chatResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Default test")); 2199var chatResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Model test")); 2214var chatResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Model priority test"))
Microsoft.Extensions.AI.Tests (159)
ChatCompletion\ChatClientStructuredOutputExtensionsTests.cs (11)
23var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(expectedResult, JsonContext2.Default.Animal))) 100var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(expectedResult, JsonContext2.Default.Options))) 161var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(expectedResult, JsonContext2.Default.Options))); 196var expectedResponse = new ChatResponse( 239var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "This is not valid JSON")); 258var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "null")); 277var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, [new UriContent("https://example.com", "image/*")])); 297var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(expectedResult, JsonContext2.Default.Options))); 332var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(payload, JsonContext2.Default.Options))); 364var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(expectedResult, jso))); 425return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, resultDuplicatedJson)));
ChatCompletion\ConfigureOptionsChatClientTests.cs (1)
37ChatResponse expectedResponse = new();
ChatCompletion\DistributedCachingChatClientTest.cs (8)
48var expectedResponse = new ChatResponse( 141return new ChatResponse(new ChatMessage(ChatRole.Assistant, "Hello")); 215return new ChatResponse(new ChatMessage(ChatRole.Assistant, "A good result")); 560return new(new ChatMessage(ChatRole.Assistant, options!.AdditionalProperties!["someKey"]!.ToString())); 611return new(new ChatMessage(ChatRole.Assistant, innerCallCount.ToString())); 657return new(new ChatMessage(ChatRole.Assistant, options!.AdditionalProperties!["someKey"]!.ToString())); 685var expectedResponse = new ChatResponse( 744return Task.FromResult(new ChatResponse(
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (6)
905Task.FromResult(new ChatResponse([new ChatMessage(ChatRole.Assistant, "world")])), 907YieldAsync(new ChatResponse([new ChatMessage(ChatRole.Assistant, "world")]).ToChatResponseUpdates()), 985Task.FromResult(new ChatResponse([new ChatMessage(ChatRole.Assistant, "world")])), 987YieldAsync(new ChatResponse([new ChatMessage(ChatRole.Assistant, "world")]).ToChatResponseUpdates()), 1981return new ChatResponse(output) { Usage = usage }; 2063return YieldAsync(new ChatResponse(output).ToChatResponseUpdates());
ChatCompletion\FunctionInvokingChatClientTests.cs (80)
379return Task.FromResult(new ChatResponse( 384return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "done"))); 392return YieldAsync(new ChatResponse( 397return YieldAsync(new ChatResponse(new ChatMessage(ChatRole.Assistant, "done")).ToChatResponseUpdates()); 460return Task.FromResult(new ChatResponse( 465return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "done"))); 473return YieldAsync(new ChatResponse( 478return YieldAsync(new ChatResponse(new ChatMessage(ChatRole.Assistant, "done")).ToChatResponseUpdates()); 541return Task.FromResult(new ChatResponse( 546return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "done"))); 554return YieldAsync(new ChatResponse( 559return YieldAsync(new ChatResponse(new ChatMessage(ChatRole.Assistant, "done")).ToChatResponseUpdates()); 669return Task.FromResult(new ChatResponse(message)); 713return YieldAsync(new ChatResponse(message).ToChatResponseUpdates()); 760return Task.FromResult(new ChatResponse(message)); 765return Task.FromResult(new ChatResponse(message)); 805return Task.FromResult(new ChatResponse(message)); 1248return new(message); 1370return Task.FromResult(new ChatResponse(message)); 1412return new ChatResponse(new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId-abc", "Func1")])) 1420return new ChatResponse(new ChatMessage(ChatRole.Assistant, "done!")); 1648return Task.FromResult(new ChatResponse { Messages = messages }); 1743return YieldAsync(new ChatResponse(message).ToChatResponseUpdates()); 2043return new ChatResponse(message); 2049return YieldAsync(new ChatResponse(message).ToChatResponseUpdates()); 2098return new ChatResponse(message); 2104return new ChatResponse(message); 2113return YieldAsync(new ChatResponse(message).ToChatResponseUpdates()); 2119return YieldAsync(new ChatResponse(message).ToChatResponseUpdates()); 2161return new ChatResponse(new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")])); 2165return new ChatResponse(new ChatMessage(ChatRole.Assistant, "Done")); 2228return new ChatResponse(message) { Usage = usage }; 2292return YieldAsync(new ChatResponse(message).ToChatResponseUpdates()); 2388return new ChatResponse([new ChatMessage(ChatRole.Assistant, 2395return new ChatResponse([new ChatMessage(ChatRole.Assistant, 2401return new ChatResponse([new ChatMessage(ChatRole.Assistant, "Done")]); 2425return YieldAsync(new ChatResponse(message).ToChatResponseUpdates()); 2482return new ChatResponse([new ChatMessage(ChatRole.Assistant, 2489return new ChatResponse([new ChatMessage(ChatRole.Assistant, 2495return new ChatResponse([new ChatMessage(ChatRole.Assistant, "Done")]); 2519return YieldAsync(new ChatResponse(message).ToChatResponseUpdates()); 2589return new ChatResponse([new ChatMessage(ChatRole.Assistant, 2595return new ChatResponse([new ChatMessage(ChatRole.Assistant, 2600return new ChatResponse([new ChatMessage(ChatRole.Assistant, "Done")]); 2624return YieldAsync(new ChatResponse(message).ToChatResponseUpdates()); 2687return new ChatResponse([new ChatMessage(ChatRole.Assistant, 2695return new ChatResponse([new ChatMessage(ChatRole.Assistant, 2701return new ChatResponse([new ChatMessage(ChatRole.Assistant, "Done")]); 2726return YieldAsync(new ChatResponse(message).ToChatResponseUpdates()); 2791return new ChatResponse([new ChatMessage(ChatRole.Assistant, 2797return new ChatResponse([new ChatMessage(ChatRole.Assistant, 2802return new ChatResponse([new ChatMessage(ChatRole.Assistant, "Done")]); 2826return YieldAsync(new ChatResponse(message).ToChatResponseUpdates()); 2889return new ChatResponse([new ChatMessage(ChatRole.Assistant, 2894return new ChatResponse([new ChatMessage(ChatRole.Assistant, "Done")]); 2912return YieldAsync(new ChatResponse(message).ToChatResponseUpdates()); 2967return new ChatResponse([new ChatMessage(ChatRole.Assistant, 2975return new ChatResponse([new ChatMessage(ChatRole.Assistant, 2980return new ChatResponse([new ChatMessage(ChatRole.Assistant, "Done")]); 3004return YieldAsync(new ChatResponse(message).ToChatResponseUpdates()); 3068return new ChatResponse([new ChatMessage(ChatRole.Assistant, 3076return new ChatResponse([new ChatMessage(ChatRole.Assistant, 3081return new ChatResponse([new ChatMessage(ChatRole.Assistant, "Done")]); 3105return YieldAsync(new ChatResponse(message).ToChatResponseUpdates()); 3174return new ChatResponse([new ChatMessage(ChatRole.Assistant, 3182return new ChatResponse([new ChatMessage(ChatRole.Assistant, 3187return new ChatResponse([new ChatMessage(ChatRole.Assistant, "Done")]); 3211return YieldAsync(new ChatResponse(message).ToChatResponseUpdates()); 3386Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "world"))) 3423Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "world"))) 3472return new ChatResponse( 3480var response = new ChatResponse( 3536return new ChatResponse( 3544return new ChatResponse(new ChatMessage(ChatRole.Assistant, "done")); 3551var response = new ChatResponse( 3560var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "done")); 3607return new ChatResponse(new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")])); 3611return new ChatResponse(new ChatMessage(ChatRole.Assistant, "done")); 3618var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")])); 3623var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "done"));
ChatCompletion\ImageGeneratingChatClientTests.cs (7)
39return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "test response"))); 76return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "test response"))); 123return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "test response"))); 261return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "test response"))); 284return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "test response"))); 318return Task.FromResult(new ChatResponse(responseMessage)); 413return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, contents)));
ChatCompletion\LoggingChatClientTests.cs (1)
59return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "blue whale")));
ChatCompletion\OpenTelemetryChatClientTests.cs (6)
41return new ChatResponse(new ChatMessage(ChatRole.Assistant, "The blue whale, I think.")) 404return new ChatResponse(new ChatMessage(ChatRole.Assistant, 588return new ChatResponse(new ChatMessage(ChatRole.Assistant, "The blue whale, I think.")); 658return new ChatResponse(new ChatMessage(ChatRole.Assistant, 823return new ChatResponse(new ChatMessage(ChatRole.Assistant, "Done")); 980return new ChatResponse(new ChatMessage(ChatRole.Assistant, "Response"));
ChatCompletion\ReducingChatClientTests.cs (3)
50var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "It's sunny!")); 110return Task.FromResult(new ChatResponse()); 148Task.FromResult(new ChatResponse())
ChatCompletion\UseDelegateChatClientTests.cs (3)
42return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "hello"))); 91return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "hello"))); 184return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "non-streaming hello")));
ChatReduction\SummarizingChatReducerTests.cs (9)
76Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Summary of conversation"))); 108return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Asked about time"))); 156return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Summary of first exchange"))); 209return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "User asked about weather in Seattle and New York."))); 249return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Summary"))); 287return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Summary"))); 310Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Summary"))); 350return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, Summary))); 377return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, Summary)));
ChatRouting\FailoverChatClientTests.cs (7)
212return Task.FromResult(new ChatResponse()); 257ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "ok")); 303return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "ok"))); 367ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "ok")); 418: Task.FromResult(new ChatResponse()), 432ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "ok")); 743ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "ok"));
ChatRouting\OrderedFailoverChatClientTests.cs (9)
38ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "ok")); 59ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "ok")); 140GetResponseAsyncCallback = (_, _, _) => Task.FromResult(new ChatResponse()), 175return Task.FromResult(new ChatResponse()); 217ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "ok")); 251return Task.FromResult(new ChatResponse()); 308return Task.FromResult(new ChatResponse()); 354ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "ok")); 384Task.FromResult(new ChatResponse());
ChatRouting\SemanticRoutingChatClientTests.cs (7)
97ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "code")); 105Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "writing"))), 149Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "code"))), 154Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "writing"))), 192Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "profiled"))), 194ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "default")); 245Task.FromResult(new ChatResponse());
Generated\361d1da7f942c932\TestJsonSerializerContext.ChatResponse.g.cs (1)
31ObjectCreator = () => new global::Microsoft.Extensions.AI.ChatResponse(),
Microsoft.Extensions.DataIngestion.Tests (6)
Processors\AlternativeTextEnricherTests.cs (2)
59return Task.FromResult(new ChatResponse(new[] 147return Task.FromResult(new ChatResponse(new[] { new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(data)) }));
Processors\ClassificationEnricherTests.cs (1)
82return Task.FromResult(new ChatResponse(new[]
Processors\KeywordEnricherTests.cs (1)
82return Task.FromResult(new ChatResponse(new[]
Processors\SentimentEnricherTests.cs (1)
66return Task.FromResult(new ChatResponse(new[]
Processors\SummaryEnricherTests.cs (1)
66return Task.FromResult(new ChatResponse(new[]
Microsoft.ML.GenAI.Core (1)
CausalLMPipelineChatClient.cs (1)
48return Task.FromResult(new ChatResponse([chatMessage])
898 references to ChatResponse
Aspire.Azure.AI.OpenAI.Tests (2)
AspireAzureOpenAIClientBuilderChatClientExtensionsTests.cs (2)
217var completion = await client.GetResponseAsync("Whatever"); 220static Task<ChatResponse> TestMiddleware(IEnumerable<ChatMessage> list, ChatOptions? options, IChatClient client, CancellationToken token)
Aspire.OpenAI.Tests (3)
AspireOpenAIClientBuilderChatClientExtensionsTests.cs (3)
220var completion = await client.GetResponseAsync("Whatever"); 254var completion = await client.GetResponseAsync("Whatever"); 268private static Task<ChatResponse> TestMiddleware(IEnumerable<ChatMessage> list, ChatOptions? options, IChatClient client, CancellationToken token)
Microsoft.AspNetCore.Components.AI (1)
Engine\UIAgent.cs (1)
154var response = assistantUpdates.ToChatResponse();
Microsoft.Extensions.AI (46)
ChatCompletion\AnonymousDelegatingChatClient.cs (7)
21private readonly Func<IEnumerable<ChatMessage>, ChatOptions?, IChatClient, CancellationToken, Task<ChatResponse>>? _getResponseFunc; 77Func<IEnumerable<ChatMessage>, ChatOptions?, IChatClient, CancellationToken, Task<ChatResponse>>? getResponseFunc, 88public override Task<ChatResponse> GetResponseAsync( 97async Task<ChatResponse> GetResponseViaSharedAsync( 100ChatResponse? response = null; 187static async IAsyncEnumerable<ChatResponseUpdate> GetStreamingResponseAsyncViaGetResponseAsync(Task<ChatResponse> task) 189ChatResponse response = await task;
ChatCompletion\CachingChatClient.cs (8)
46public override Task<ChatResponse> GetResponseAsync( 56private async Task<ChatResponse> GetCachedResponseAsync( 153/// Returns a previously cached <see cref="ChatResponse"/>, if available. 160protected abstract Task<ChatResponse?> ReadCacheAsync(string key, CancellationToken cancellationToken); 173/// Stores a <see cref="ChatResponse"/> in the underlying cache. 177/// <param name="value">The <see cref="ChatResponse"/> to be stored.</param> 182protected abstract Task WriteCacheAsync(string key, ChatResponse value, CancellationToken cancellationToken); 189/// <param name="value">The <see cref="ChatResponse"/> to be stored.</param>
ChatCompletion\ChatClientBuilder.cs (1)
143Func<IEnumerable<ChatMessage>, ChatOptions?, IChatClient, CancellationToken, Task<ChatResponse>>? getResponseFunc,
ChatCompletion\ChatClientStructuredOutputExtensions.cs (1)
200var result = await chatClient.GetResponseAsync(messages, options, cancellationToken);
ChatCompletion\ChatResponse{T}.cs (3)
19/// You can access the underlying JSON response on the <see cref="ChatResponse.Text"/> property. 33/// <param name="response">The unstructured <see cref="ChatResponse"/> that is being wrapped.</param> 35public ChatResponse(ChatResponse response, JsonSerializerOptions serializerOptions)
ChatCompletion\ConfigureOptionsChatClient.cs (1)
37public override async Task<ChatResponse> GetResponseAsync(
ChatCompletion\DistributedCachingChatClient.cs (6)
24/// the object models used by <see cref="ChatMessage"/>, <see cref="ChatOptions"/>, <see cref="ChatResponse"/>, <see cref="ChatResponseUpdate"/>, 72protected override async Task<ChatResponse?> ReadCacheAsync(string key, CancellationToken cancellationToken) 79return (ChatResponse?)JsonSerializer.Deserialize(existingJson, JsonSerializerOptions.GetTypeInfo(typeof(ChatResponse))); 100protected override async Task WriteCacheAsync(string key, ChatResponse value, CancellationToken cancellationToken) 106var newJson = JsonSerializer.SerializeToUtf8Bytes(value, JsonSerializerOptions.GetTypeInfo(typeof(ChatResponse)));
ChatCompletion\DistributedCachingChatClientBuilderExtensions.cs (1)
29/// the object models used by <see cref="ChatMessage"/>, <see cref="ChatOptions"/>, <see cref="ChatResponse"/>, <see cref="ChatResponseUpdate"/>,
ChatCompletion\FunctionInvokingChatClient.cs (5)
277public override async Task<ChatResponse> GetResponseAsync( 293ChatResponse? response = null; // the response from the inner client, which is possibly modified and then eventually returned 346Throw.InvalidOperationException($"The inner {nameof(IChatClient)} returned a null {nameof(ChatResponse)}."); 674var response = updates.ToChatResponse(); 749ChatResponse response,
ChatCompletion\ImageGeneratingChatClient.cs (2)
71public override async Task<ChatResponse> GetResponseAsync( 83var response = await base.GetResponseAsync(processedMessages, processedOptions, cancellationToken);
ChatCompletion\LoggingChatClient.cs (2)
54public override async Task<ChatResponse> GetResponseAsync( 71var response = await base.GetResponseAsync(messages, options, cancellationToken);
ChatCompletion\OpenTelemetryChatClient.cs (5)
135public override async Task<ChatResponse> GetResponseAsync( 147ChatResponse? response = null; 399ChatResponse? response, 499private void AddMetricTags(ref TagList tags, string? requestModelId, ChatResponse? response) 539private void AddOutputMessagesTags(ChatResponse response, Activity? activity)
ChatCompletion\ReducingChatClient.cs (1)
32public override async Task<ChatResponse> GetResponseAsync(
ChatReduction\SummarizingChatReducer.cs (1)
130var response = await chatClient.GetResponseAsync(summarizerChatMessages, cancellationToken: cancellationToken);
ChatRouting\FailoverChatClient.cs (2)
97public sealed override async Task<ChatResponse> GetResponseAsync( 113ChatResponse? response = null;
Microsoft.Extensions.AI.Abstractions (88)
ChatCompletion\ChatClientExtensions.cs (2)
91public static Task<ChatResponse> GetResponseAsync( 111public static Task<ChatResponse> GetResponseAsync(
ChatCompletion\ChatOptions.cs (1)
198/// can be polled for completion by obtaining the token from the <see cref="ChatResponse.ContinuationToken"/> property
ChatCompletion\ChatResponse.cs (9)
14/// <see cref="ChatResponse"/> provides one or more response messages and metadata about the response. 18/// it uses, all of the involved messages might be surfaced as part of the final <see cref="ChatResponse"/>. 25/// <summary>Initializes a new instance of the <see cref="ChatResponse"/> class.</summary> 30/// <summary>Initializes a new instance of the <see cref="ChatResponse"/> class.</summary> 40/// <summary>Initializes a new instance of the <see cref="ChatResponse"/> class.</summary> 72/// (and this <see cref="ChatResponse"/>'s message) as part of the <c>messages</c> parameter. Note that the value might differ on every response, depending on whether the underlying provider uses a fixed ID for each conversation 107/// If a <see cref="ChatResponse"/> is created to represent some underlying object from another object 120/// <summary>Creates an array of <see cref="ChatResponseUpdate" /> instances that represent this <see cref="ChatResponse" />.</summary> 121/// <returns>An array of <see cref="ChatResponseUpdate" /> instances that can be used to represent this <see cref="ChatResponse" />.</returns>
ChatCompletion\ChatResponseExtensions.cs (16)
21/// Provides extension methods for working with <see cref="ChatResponse"/> and <see cref="ChatResponseUpdate"/> instances. 30public static void AddMessages(this IList<ChatMessage> list, ChatResponse response) 126/// <summary>Combines <see cref="ChatResponseUpdate"/> instances into a single <see cref="ChatResponse"/>.</summary> 128/// <returns>The combined <see cref="ChatResponse"/>.</returns> 131/// As part of combining <paramref name="updates"/> into a single <see cref="ChatResponse"/>, the method will attempt to reconstruct 136public static ChatResponse ToChatResponse( 141ChatResponse response = new(); 153/// <summary>Combines <see cref="ChatResponseUpdate"/> instances into a single <see cref="ChatResponse"/>.</summary> 156/// <returns>The combined <see cref="ChatResponse"/>.</returns> 159/// As part of combining <paramref name="updates"/> into a single <see cref="ChatResponse"/>, the method will attempt to reconstruct 164public static Task<ChatResponse> ToChatResponseAsync( 171static async Task<ChatResponse> ToChatResponseAsync( 174ChatResponse response = new(); 526private static void FinalizeResponse(ChatResponse response) 537/// <param name="response">The <see cref="ChatResponse"/> object that should be updated based on <paramref name="update"/>.</param> 538private static void ProcessUpdate(ChatResponseUpdate update, ChatResponse response)
ChatCompletion\ChatResponseUpdate.cs (5)
19/// <see cref="ChatResponse"/> and <see cref="ChatMessage"/> in streaming output. 22/// The relationship between <see cref="ChatResponse"/> and <see cref="ChatResponseUpdate"/> is 24/// <see cref="ChatResponse.ToChatResponseUpdates"/>, which enable bidirectional conversions 27/// such an object available in <see cref="ChatResponse.RawRepresentation"/>. Similarly, if different 29/// only one of the values will be used to populate <see cref="ChatResponse.ModelId"/>.
ChatCompletion\DelegatingChatClient.cs (1)
43public virtual Task<ChatResponse> GetResponseAsync(
ChatCompletion\IChatClient.cs (1)
42Task<ChatResponse> GetResponseAsync(
ChatRouting\RoutingChatClient.cs (1)
64public virtual async Task<ChatResponse> GetResponseAsync(
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.ChatResponse.g.cs (50)
15private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse>? _ChatResponse; 21public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse> ChatResponse 24get => _ChatResponse ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.ChatResponse)); 27private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse> Create_ChatResponse(global::System.Text.Json.JsonSerializerOptions options) 29if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.ChatResponse>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse> jsonTypeInfo)) 31var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.ChatResponse> 37ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty<global::System.Type>(), modifiers: null), 41jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.ChatResponse>(options, objectInfo); 58DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 60Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).Messages, 61Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).Messages = value!, 68AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("Messages", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.IList<global::Microsoft.Extensions.AI.ChatMessage>), global::System.Array.Empty<global::System.Type>(), null), 79DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 89AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("Text", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 100DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 102Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ResponseId, 103Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ResponseId = value!, 110AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("ResponseId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 120DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 122Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ConversationId, 123Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ConversationId = value!, 130AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("ConversationId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 140DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 142Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ModelId, 143Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ModelId = value!, 150AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("ModelId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 160DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 162Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).CreatedAt, 163Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).CreatedAt = value!, 170AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("CreatedAt", InstanceMemberBindingFlags, null, typeof(global::System.DateTimeOffset?), global::System.Array.Empty<global::System.Type>(), null), 180DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 182Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).FinishReason, 183Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).FinishReason = value!, 190AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("FinishReason", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.ChatFinishReason?), global::System.Array.Empty<global::System.Type>(), null), 200DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 202Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).Usage, 203Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).Usage = value!, 210AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("Usage", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.UsageDetails), global::System.Array.Empty<global::System.Type>(), null), 220DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 222Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ContinuationToken, 223Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ContinuationToken = value!, 230AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("ContinuationToken", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.ResponseContinuationToken), global::System.Array.Empty<global::System.Type>(), null), 240DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 250AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("RawRepresentation", InstanceMemberBindingFlags, null, typeof(object), global::System.Array.Empty<global::System.Type>(), null), 260DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 262Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).AdditionalProperties, 263Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).AdditionalProperties = value!, 270AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("AdditionalProperties", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.AdditionalPropertiesDictionary), global::System.Array.Empty<global::System.Type>(), null),
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.GetJsonTypeInfo.g.cs (1)
108if (type == typeof(global::Microsoft.Extensions.AI.ChatResponse))
Utilities\AIJsonUtilities.Defaults.cs (1)
103[JsonSerializable(typeof(ChatResponse))]
Microsoft.Extensions.AI.Abstractions.Tests (103)
ChatCompletion\ChatClientExtensionsTests.cs (4)
103var expectedResponse = new ChatResponse(); 123ChatResponse response = await client.GetResponseAsync("hello", expectedOptions, cts.Token); 164var expectedResponse = new ChatResponse(); 197ChatResponse response = await client.GetResponseAsync([], expectedChatOptions, cts.Token);
ChatCompletion\ChatResponseTests.cs (13)
17ChatResponse response; 33ChatResponse response = new(); 50ChatResponse response = new(); 87ChatResponse original = new(new ChatMessage(ChatRole.Assistant, "the message")) 101ChatResponse? result = JsonSerializer.Deserialize(json, TestJsonSerializerContext.Default.ChatResponse); 124ChatResponse original = new(new ChatMessage(ChatRole.Assistant, "the message")) 139ChatResponse? result = JsonSerializer.Deserialize<ChatResponse>(json, AIJsonUtilities.DefaultOptions); 200ChatResponse? result = JsonSerializer.Deserialize<ChatResponse>(Json, AIJsonUtilities.DefaultOptions); 233ChatResponse response = new(new ChatMessage(ChatRole.Assistant, $"This is a test.{Environment.NewLine}It's multiple lines.")); 241ChatResponse response = new(new ChatMessage(new ChatRole("customRole"), "Text") { MessageId = "someMessage" }) 271ChatResponse response = new(
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (27)
39ChatResponse response = useAsync ? 91ChatResponse response = useAsync ? 154ChatResponse response = useAsync ? 204ChatResponse response = useAsync ? 261ChatResponse response = useAsync ? 291ChatResponse response = useAsync ? 326ChatResponse response = useAsync ? 364ChatResponse response = useAsync ? 394ChatResponse response = useAsync ? 431ChatResponse response = useAsync ? 467ChatResponse response = useAsync ? 514ChatResponse response = useAsync ? 562ChatResponse response = useAsync ? 666ChatResponse response = useAsync ? await YieldAsync(updates).ToChatResponseAsync() : updates.ToChatResponse(); 707ChatResponse response = useAsync ? await YieldAsync(updates).ToChatResponseAsync() : updates.ToChatResponse(); 737ChatResponse response = useAsync ? await YieldAsync(updates).ToChatResponseAsync() : updates.ToChatResponse(); 782ChatResponse response = useAsync ? await YieldAsync(updates).ToChatResponseAsync() : updates.ToChatResponse(); 809ChatResponse response = await YieldAsync(updates).ToChatResponseAsync(); 858ChatResponse response = useAsync ? 907ChatResponse response = useAsync ? 949ChatResponse response = useAsync ? await YieldAsync(updates).ToChatResponseAsync() : updates.ToChatResponse(); 997ChatResponse response = useAsync ? await YieldAsync(updates).ToChatResponseAsync() : updates.ToChatResponse(); 1040ChatResponse response = useAsync ? await YieldAsync(updates).ToChatResponseAsync() : updates.ToChatResponse(); 1071ChatResponse response = useAsync ? await YieldAsync(updates).ToChatResponseAsync() : updates.ToChatResponse(); 1091ChatResponse response = useAsync ? await YieldAsync(updates).ToChatResponseAsync() : updates.ToChatResponse(); 1131ChatResponse response1 = useAsync ? await YieldAsync(updates).ToChatResponseAsync() : updates.ToChatResponse(); 1137ChatResponse response2 = useAsync ? await YieldAsync(updates).ToChatResponseAsync() : updates.ToChatResponse();
ChatCompletion\DelegatingChatClientTests.cs (2)
27var expectedResult = new TaskCompletionSource<ChatResponse>(); 28var expectedResponse = new ChatResponse();
ChatRouting\RoutingChatClientTests.cs (3)
26ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "ok")); 48ChatResponse response = await router.GetResponseAsync(messages, options, cancellationSource.Token); 162public Task<ChatResponse> GetResponseAsync(
Generated\361d1da7f942c932\TestJsonSerializerContext.ChatResponse.g.cs (50)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse>? _ChatResponse; 19public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse> ChatResponse 22get => _ChatResponse ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.ChatResponse)); 25private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse> Create_ChatResponse(global::System.Text.Json.JsonSerializerOptions options) 27if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.ChatResponse>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse> jsonTypeInfo)) 29var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.ChatResponse> 35ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty<global::System.Type>(), modifiers: null), 39jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.ChatResponse>(options, objectInfo); 56DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 58Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).Messages, 59Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).Messages = value!, 66AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("Messages", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.IList<global::Microsoft.Extensions.AI.ChatMessage>), global::System.Array.Empty<global::System.Type>(), null), 78DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 88AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("Text", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 99DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 101Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ResponseId, 102Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ResponseId = value!, 109AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("ResponseId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 119DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 121Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ConversationId, 122Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ConversationId = value!, 129AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("ConversationId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 139DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 141Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ModelId, 142Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ModelId = value!, 149AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("ModelId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 159DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 161Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).CreatedAt, 162Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).CreatedAt = value!, 169AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("CreatedAt", InstanceMemberBindingFlags, null, typeof(global::System.DateTimeOffset?), global::System.Array.Empty<global::System.Type>(), null), 179DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 181Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).FinishReason, 182Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).FinishReason = value!, 189AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("FinishReason", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.ChatFinishReason?), global::System.Array.Empty<global::System.Type>(), null), 199DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 201Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).Usage, 202Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).Usage = value!, 209AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("Usage", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.UsageDetails), global::System.Array.Empty<global::System.Type>(), null), 219DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 221Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ContinuationToken, 222Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ContinuationToken = value!, 229AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("ContinuationToken", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.ResponseContinuationToken), global::System.Array.Empty<global::System.Type>(), null), 239DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 249AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("RawRepresentation", InstanceMemberBindingFlags, null, typeof(object), global::System.Array.Empty<global::System.Type>(), null), 259DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 261Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).AdditionalProperties, 262Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).AdditionalProperties = value!, 269AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("AdditionalProperties", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.AdditionalPropertiesDictionary), global::System.Array.Empty<global::System.Type>(), null),
Generated\361d1da7f942c932\TestJsonSerializerContext.GetJsonTypeInfo.g.cs (1)
94if (type == typeof(global::Microsoft.Extensions.AI.ChatResponse))
TestChatClient.cs (2)
20public Func<IEnumerable<ChatMessage>, ChatOptions?, CancellationToken, Task<ChatResponse>>? GetResponseAsyncCallback { get; set; } 29public Task<ChatResponse> GetResponseAsync(IEnumerable<ChatMessage> messages, ChatOptions? options = null, CancellationToken cancellationToken = default)
TestJsonSerializerContext.cs (1)
17[JsonSerializable(typeof(ChatResponse))]
Microsoft.Extensions.AI.Evaluation (20)
ChatResponseExtensions.cs (9)
9/// Extension methods for <see cref="ChatResponse"/>. 20/// This function only considers the <see cref="ChatResponse.Text"/> and ignores any <see cref="AIContent"/>s 21/// (present within the <see cref="ChatMessage.Contents"/> of the <see cref="ChatResponse.Messages"/>) that are not 22/// <see cref="TextContent"/>s. Any <see cref="ChatResponse.Messages"/> that contain no <see cref="TextContent"/>s 23/// will be skipped and will not be rendered. If none of the <see cref="ChatResponse.Messages"/> include any 27/// The rendered <see cref="ChatResponse.Messages"/> are each prefixed with the <see cref="ChatMessage.Role"/> and 29/// <see cref="ChatResponse.Messages"/>s are also always separated by new line characters in the returned string. 32/// <param name="response">The <see cref="ChatResponse"/> that is to be rendered.</param> 34public static string RenderText(this ChatResponse response)
CompositeEvaluator.cs (2)
102ChatResponse modelResponse, 127ChatResponse modelResponse,
EvaluationContext.cs (1)
23/// <see cref="IEvaluator.EvaluateAsync(IEnumerable{ChatMessage}, ChatResponse, ChatConfiguration?, IEnumerable{EvaluationContext}?, CancellationToken)"/>.
EvaluationMetricExtensions.cs (2)
144/// <param name="response">The <see cref="ChatResponse"/> that contains metadata to be added or updated.</param> 152ChatResponse response,
EvaluationResultExtensions.cs (2)
173/// <param name="response">The <see cref="ChatResponse"/> that contains metadata to be added or updated.</param> 181ChatResponse response,
EvaluatorExtensions.cs (2)
171ChatResponse modelResponse, 265ChatResponse modelResponse,
IEvaluator.cs (1)
59ChatResponse modelResponse,
Utilities\ModelInfo.cs (1)
71/// The <see cref="ChatResponse.ModelId"/> that identifies the model that produced a particular response.
Microsoft.Extensions.AI.Evaluation.Console (1)
parent\Microsoft.Extensions.AI.Evaluation\Utilities\ModelInfo.cs (1)
71/// The <see cref="ChatResponse.ModelId"/> that identifies the model that produced a particular response.
Microsoft.Extensions.AI.Evaluation.Integration.Tests (21)
AgentQualityEvaluatorTests.cs (8)
92(IEnumerable<ChatMessage> messages, ChatResponse response) = 115(IEnumerable<ChatMessage> messages, ChatResponse response) = 148(IEnumerable<ChatMessage> messages, ChatResponse response) = 172(IEnumerable<ChatMessage> messages, ChatResponse response) = 203private static async Task<(IEnumerable<ChatMessage> messages, ChatResponse response)> 212ChatResponse response = await chatClient.GetResponseAsync(messages, _chatOptions); 216private static async Task<(IEnumerable<ChatMessage> messages, ChatResponse response)> 225ChatResponse response = await chatClient.GetResponseAsync(messages, _chatOptionsWithTools);
QualityEvaluatorTests.cs (4)
92ChatResponse response = await chatClient.GetResponseAsync(messages, _chatOptions); 132ChatResponse response = await chatClient.GetResponseAsync(messages, _chatOptions, cancellationToken); 170ChatResponse response = await chatClient.GetResponseAsync(messages, _chatOptions); 205ChatResponse response = await chatClient.GetResponseAsync(messages, _chatOptions);
SafetyEvaluatorTests.cs (8)
196ChatResponse response = await chatClient.GetResponseAsync(messages, _chatOptions); 274ChatResponse response1 = await chatClient.GetResponseAsync(messages, _chatOptions); 280ChatResponse response2 = await chatClient.GetResponseAsync(messages, _chatOptions); 429var response = new ChatResponse(answer2); 491var response = new ChatResponse(answer3); 567var response = new ChatResponse(completion2); 594ChatResponse response1 = await chatClient.GetResponseAsync(messages, _chatOptions); 600ChatResponse response2 = await chatClient.GetResponseAsync(messages, _chatOptions);
TestEvaluator.cs (1)
28ChatResponse modelResponse,
Microsoft.Extensions.AI.Evaluation.NLP (3)
BLEUEvaluator.cs (1)
43ChatResponse modelResponse,
F1Evaluator.cs (1)
43ChatResponse modelResponse,
GLEUEvaluator.cs (1)
43ChatResponse modelResponse,
Microsoft.Extensions.AI.Evaluation.NLP.Tests (17)
BLEUEvaluatorTests.cs (6)
19var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "The quick brown fox jumps over the lazy dog.")); 35var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Completely unrelated sentence.")); 50var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Some text.")); 70var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, hypothesis)); 90var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, hypothesis)); 103var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, ""));
F1EvaluatorTests.cs (5)
19var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "The quick brown fox jumps over the lazy dog.")); 35var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Completely unrelated sentence.")); 50var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Some text.")); 70var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, hypothesis)); 83var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, ""));
GLEUEvaluatorTests.cs (6)
19var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "The quick brown fox jumps over the lazy dog.")); 35var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Completely unrelated sentence.")); 50var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Some text.")); 70var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, hypothesis)); 90var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, hypothesis)); 103var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, ""));
Microsoft.Extensions.AI.Evaluation.Quality (39)
ChatResponseExtensions.cs (2)
14internal static string RenderAsJson(this ChatResponse modelResponse, JsonSerializerOptions? options = null) 22this ChatResponse modelResponse,
CoherenceEvaluator.cs (3)
69ChatResponse modelResponse, 93(ChatResponse evaluationResponse, TimeSpan evaluationDuration) = 105private static List<ChatMessage> GetEvaluationInstructions(ChatMessage? userRequest, ChatResponse modelResponse)
CompletenessEvaluator.cs (3)
66ChatResponse modelResponse, 98(ChatResponse evaluationResponse, TimeSpan evaluationDuration) = 112ChatResponse modelResponse,
EquivalenceEvaluator.cs (3)
67ChatResponse modelResponse, 101(ChatResponse evaluationResponse, TimeSpan evaluationDuration) = 116ChatResponse modelResponse,
EvaluationMetricExtensions.cs (2)
57ChatResponse evaluationResponse, 68ChatResponse evaluationResponse,
FluencyEvaluator.cs (3)
63ChatResponse modelResponse, 85(ChatResponse evaluationResponse, TimeSpan evaluationDuration) = 97private static List<ChatMessage> GetEvaluationInstructions(ChatResponse modelResponse)
GroundednessEvaluator.cs (3)
64ChatResponse modelResponse, 99(ChatResponse evaluationResponse, TimeSpan evaluationDuration) = 114ChatResponse modelResponse,
IntentResolutionEvaluator.cs (4)
77ChatResponse modelResponse, 143(ChatResponse evaluationResponse, TimeSpan evaluationDuration) = 167ChatResponse modelResponse, 323ChatResponse evaluationResponse,
RelevanceEvaluator.cs (3)
67ChatResponse modelResponse, 98(ChatResponse evaluationResponse, TimeSpan evaluationDuration) = 110private static List<ChatMessage> GetEvaluationInstructions(ChatMessage userRequest, ChatResponse modelResponse)
RelevanceTruthAndCompletenessEvaluator.cs (4)
80ChatResponse modelResponse, 120(ChatResponse evaluationResponse, TimeSpan evaluationDuration) = 139ChatResponse modelResponse, 271ChatResponse evaluationResponse,
RetrievalEvaluator.cs (2)
73ChatResponse modelResponse, 114(ChatResponse evaluationResponse, TimeSpan evaluationDuration) =
TaskAdherenceEvaluator.cs (3)
76ChatResponse modelResponse, 142(ChatResponse evaluationResponse, TimeSpan evaluationDuration) = 162ChatResponse modelResponse,
ToolCallAccuracyEvaluator.cs (3)
78ChatResponse modelResponse, 142(ChatResponse evaluationResponse, TimeSpan evaluationDuration) = 157ChatResponse modelResponse,
Utilities\JsonOutputFixer.cs (1)
71ChatResponse response =
Microsoft.Extensions.AI.Evaluation.Reporting (81)
ChatTurnDetails.cs (6)
25/// Returns <see langword="null"/> if this information was not available via <see cref="ChatResponse.ModelId"/>. 42/// Returns <see langword="null"/> if usage details were not available via <see cref="ChatResponse.Usage"/>. 71/// <see langword="null"/> if this information was not available via <see cref="ChatResponse.ModelId"/>. 75/// <see langword="null"/> if usage details were not available via <see cref="ChatResponse.Usage"/>. 105/// <see langword="null"/> if this information was not available via <see cref="ChatResponse.ModelId"/>. 114/// <see langword="null"/> if usage details were not available via <see cref="ChatResponse.Usage"/>.
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.ChatResponse.g.cs (50)
15private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse>? _ChatResponse; 21public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse> ChatResponse 24get => _ChatResponse ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.ChatResponse)); 27private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse> Create_ChatResponse(global::System.Text.Json.JsonSerializerOptions options) 29if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.ChatResponse>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse> jsonTypeInfo)) 31var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.ChatResponse> 37ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty<global::System.Type>(), modifiers: null), 41jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.ChatResponse>(options, objectInfo); 58DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 60Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).Messages, 61Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).Messages = value!, 68AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("Messages", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.IList<global::Microsoft.Extensions.AI.ChatMessage>), global::System.Array.Empty<global::System.Type>(), null), 80DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 90AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("Text", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 101DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 103Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ResponseId, 104Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ResponseId = value!, 111AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("ResponseId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 121DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 123Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ConversationId, 124Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ConversationId = value!, 131AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("ConversationId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 141DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 143Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ModelId, 144Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ModelId = value!, 151AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("ModelId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 161DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 163Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).CreatedAt, 164Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).CreatedAt = value!, 171AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("CreatedAt", InstanceMemberBindingFlags, null, typeof(global::System.DateTimeOffset?), global::System.Array.Empty<global::System.Type>(), null), 181DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 183Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).FinishReason, 184Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).FinishReason = value!, 191AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("FinishReason", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.ChatFinishReason?), global::System.Array.Empty<global::System.Type>(), null), 201DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 203Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).Usage, 204Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).Usage = value!, 211AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("Usage", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.UsageDetails), global::System.Array.Empty<global::System.Type>(), null), 221DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 223Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ContinuationToken, 224Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ContinuationToken = value!, 231AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("ContinuationToken", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.ResponseContinuationToken), global::System.Array.Empty<global::System.Type>(), null), 241DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 251AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("RawRepresentation", InstanceMemberBindingFlags, null, typeof(object), global::System.Array.Empty<global::System.Type>(), null), 261DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 263Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).AdditionalProperties, 264Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).AdditionalProperties = value!, 271AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("AdditionalProperties", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.AdditionalPropertiesDictionary), global::System.Array.Empty<global::System.Type>(), null),
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.GetJsonTypeInfo.g.cs (1)
72if (type == typeof(global::Microsoft.Extensions.AI.ChatResponse))
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.ScenarioRunResult.g.cs (7)
34ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.Evaluation.Reporting.ScenarioRunResult((string)args[0], (string)args[1], (string)args[2], (global::System.DateTime)args[3], (global::System.Collections.Generic.IList<global::Microsoft.Extensions.AI.ChatMessage>)args[4], (global::Microsoft.Extensions.AI.ChatResponse)args[5], (global::Microsoft.Extensions.AI.Evaluation.EvaluationResult)args[6], (global::Microsoft.Extensions.AI.Evaluation.Reporting.ChatDetails)args[7], (global::System.Collections.Generic.IList<string>)args[8], (int?)args[9]), 37ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.Evaluation.Reporting.ScenarioRunResult).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string), typeof(string), typeof(string), typeof(global::System.DateTime), typeof(global::System.Collections.Generic.IList<global::Microsoft.Extensions.AI.ChatMessage>), typeof(global::Microsoft.Extensions.AI.ChatResponse), typeof(global::Microsoft.Extensions.AI.Evaluation.EvaluationResult), typeof(global::Microsoft.Extensions.AI.Evaluation.Reporting.ChatDetails), typeof(global::System.Collections.Generic.IList<string>), typeof(int?)}, modifiers: null), 161var info5 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::Microsoft.Extensions.AI.ChatResponse> 176AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.Evaluation.Reporting.ScenarioRunResult).GetProperty("ModelResponse", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.ChatResponse), global::System.Array.Empty<global::System.Type>(), null), 179properties[5] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::Microsoft.Extensions.AI.ChatResponse>(options, info5); 302global::Microsoft.Extensions.AI.ChatResponse __value_ModelResponse = ((global::Microsoft.Extensions.AI.Evaluation.Reporting.ScenarioRunResult)value).ModelResponse; 391ParameterType = typeof(global::Microsoft.Extensions.AI.ChatResponse),
parent\parent\Microsoft.Extensions.AI.Evaluation\Utilities\ModelInfo.cs (1)
71/// The <see cref="ChatResponse.ModelId"/> that identifies the model that produced a particular response.
ResponseCachingChatClient.cs (5)
34protected override async Task<ChatResponse?> ReadCacheAsync(string key, CancellationToken cancellationToken) 38ChatResponse? response = await base.ReadCacheAsync(key, cancellationToken).ConfigureAwait(false); 81ChatResponse response = updates.ToChatResponse(); 98protected override async Task WriteCacheAsync(string key, ChatResponse value, CancellationToken cancellationToken) 131ChatResponse response = value.ToChatResponse();
ScenarioRun.cs (1)
145ChatResponse modelResponse,
ScenarioRunExtensions.cs (2)
110ChatResponse modelResponse, 174ChatResponse modelResponse,
ScenarioRunResult.cs (5)
15/// <see cref="ScenarioRun.EvaluateAsync(IEnumerable{ChatMessage}, ChatResponse, IEnumerable{Microsoft.Extensions.AI.Evaluation.EvaluationContext}?, CancellationToken)"/> 52ChatResponse modelResponse, 87ChatResponse modelResponse, 133public ChatResponse ModelResponse { get; set; } = modelResponse; 141/// <see cref="ScenarioRun.EvaluateAsync(IEnumerable{ChatMessage}, ChatResponse, IEnumerable{Microsoft.Extensions.AI.Evaluation.EvaluationContext}?, CancellationToken)"/>
SimpleChatClient.cs (3)
25public async override Task<ChatResponse> GetResponseAsync( 30ChatResponse? response = null; 83ChatResponse response = updates.ToChatResponse();
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (58)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.ChatResponse.g.cs (50)
15private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse>? _ChatResponse; 21public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse> ChatResponse 24get => _ChatResponse ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.ChatResponse)); 27private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse> Create_ChatResponse(global::System.Text.Json.JsonSerializerOptions options) 29if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.ChatResponse>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse> jsonTypeInfo)) 31var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.ChatResponse> 37ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty<global::System.Type>(), modifiers: null), 41jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.ChatResponse>(options, objectInfo); 58DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 60Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).Messages, 61Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).Messages = value!, 68AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("Messages", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.IList<global::Microsoft.Extensions.AI.ChatMessage>), global::System.Array.Empty<global::System.Type>(), null), 80DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 90AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("Text", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 101DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 103Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ResponseId, 104Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ResponseId = value!, 111AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("ResponseId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 121DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 123Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ConversationId, 124Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ConversationId = value!, 131AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("ConversationId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 141DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 143Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ModelId, 144Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ModelId = value!, 151AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("ModelId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 161DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 163Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).CreatedAt, 164Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).CreatedAt = value!, 171AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("CreatedAt", InstanceMemberBindingFlags, null, typeof(global::System.DateTimeOffset?), global::System.Array.Empty<global::System.Type>(), null), 181DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 183Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).FinishReason, 184Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).FinishReason = value!, 191AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("FinishReason", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.ChatFinishReason?), global::System.Array.Empty<global::System.Type>(), null), 201DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 203Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).Usage, 204Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).Usage = value!, 211AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("Usage", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.UsageDetails), global::System.Array.Empty<global::System.Type>(), null), 221DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 223Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ContinuationToken, 224Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ContinuationToken = value!, 231AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("ContinuationToken", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.ResponseContinuationToken), global::System.Array.Empty<global::System.Type>(), null), 241DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 251AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("RawRepresentation", InstanceMemberBindingFlags, null, typeof(object), global::System.Array.Empty<global::System.Type>(), null), 261DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 263Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).AdditionalProperties, 264Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).AdditionalProperties = value!, 271AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("AdditionalProperties", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.AdditionalPropertiesDictionary), global::System.Array.Empty<global::System.Type>(), null),
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.GetJsonTypeInfo.g.cs (1)
72if (type == typeof(global::Microsoft.Extensions.AI.ChatResponse))
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.ScenarioRunResult.g.cs (7)
34ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.Evaluation.Reporting.ScenarioRunResult((string)args[0], (string)args[1], (string)args[2], (global::System.DateTime)args[3], (global::System.Collections.Generic.IList<global::Microsoft.Extensions.AI.ChatMessage>)args[4], (global::Microsoft.Extensions.AI.ChatResponse)args[5], (global::Microsoft.Extensions.AI.Evaluation.EvaluationResult)args[6], (global::Microsoft.Extensions.AI.Evaluation.Reporting.ChatDetails)args[7], (global::System.Collections.Generic.IList<string>)args[8], (int?)args[9]), 37ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.Evaluation.Reporting.ScenarioRunResult).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string), typeof(string), typeof(string), typeof(global::System.DateTime), typeof(global::System.Collections.Generic.IList<global::Microsoft.Extensions.AI.ChatMessage>), typeof(global::Microsoft.Extensions.AI.ChatResponse), typeof(global::Microsoft.Extensions.AI.Evaluation.EvaluationResult), typeof(global::Microsoft.Extensions.AI.Evaluation.Reporting.ChatDetails), typeof(global::System.Collections.Generic.IList<string>), typeof(int?)}, modifiers: null), 161var info5 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::Microsoft.Extensions.AI.ChatResponse> 176AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.Evaluation.Reporting.ScenarioRunResult).GetProperty("ModelResponse", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.ChatResponse), global::System.Array.Empty<global::System.Type>(), null), 179properties[5] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::Microsoft.Extensions.AI.ChatResponse>(options, info5); 302global::Microsoft.Extensions.AI.ChatResponse __value_ModelResponse = ((global::Microsoft.Extensions.AI.Evaluation.Reporting.ScenarioRunResult)value).ModelResponse; 391ParameterType = typeof(global::Microsoft.Extensions.AI.ChatResponse),
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (4)
ScenarioRunResultTests.cs (4)
420private class ChatResponseComparer : IEqualityComparer<ChatResponse> 424public bool Equals(ChatResponse? x, ChatResponse? y) 429public int GetHashCode(ChatResponse obj)
Microsoft.Extensions.AI.Evaluation.Safety (11)
ChatResponseExtensions.cs (1)
8internal static bool ContainsImageWithSupportedFormat(this ChatResponse response)
CodeVulnerabilityEvaluator.cs (1)
48ChatResponse modelResponse,
ContentHarmEvaluator.cs (1)
50ChatResponse modelResponse,
ContentSafetyChatClient.cs (1)
50public async Task<ChatResponse> GetResponseAsync(
ContentSafetyEvaluator.cs (3)
38ChatResponse modelResponse, 84ChatResponse modelResponse, 135(ChatResponse annotationResponse, TimeSpan annotationDuration) =
GroundednessProEvaluator.cs (1)
49ChatResponse modelResponse,
parent\Microsoft.Extensions.AI.Evaluation\Utilities\ModelInfo.cs (1)
71/// The <see cref="ChatResponse.ModelId"/> that identifies the model that produced a particular response.
ProtectedMaterialEvaluator.cs (1)
68ChatResponse modelResponse,
UngroundedAttributesEvaluator.cs (1)
53ChatResponse modelResponse,
Microsoft.Extensions.AI.Integration.Tests (53)
CallCountingChatClient.cs (1)
19public override Task<ChatResponse> GetResponseAsync(
ChatClientIntegrationTests.cs (33)
56var response = await ChatClient.GetResponseAsync("What's the biggest animal?"); 66var response = await ChatClient.GetResponseAsync( 84var response = await ChatClient.GetResponseAsync( 121var response = await ChatClient.GetResponseAsync("Explain in 10 words how AI works"); 181var response = await ChatClient.GetResponseAsync( 199var response = await ChatClient.GetResponseAsync( 234var response = await chatClient.GetResponseAsync(messages, new() 250var response = await chatClient.GetResponseAsync("What is the result of SecretComputation on 42 and 84?", new() 302var response = await chatClient.GetResponseAsync(messages, new() 334var response = await chatClient.GetResponseAsync(messages, new() 366var response = await chatClient.GetResponseAsync(messages, new() 376private static void AssertUsageAgainstActivities(ChatResponse response, List<Activity> activities) 507var response = await chatClient.GetResponseAsync("Briefly, what is the most popular tower in Paris?", options); 573var response = await chatClient.GetResponseAsync("How much older is Elsa than Anna? Return the age difference as a single number.", new() 605var response = await chatClient.GetResponseAsync("Are birds real?", new() 626var response = await chatClient.GetResponseAsync("What's the current secret number?", new() 641var firstResponse = await ChatClient.GetResponseAsync([message]); 643var secondResponse = await ChatClient.GetResponseAsync([message]); 657var firstResponse = await chatClient.GetResponseAsync([message]); 662var secondResponse = await chatClient.GetResponseAsync([message]); 668var thirdResponse = await chatClient.GetResponseAsync([message]); 734var response = await chatClient.GetResponseAsync([message]); 741var secondResponse = await chatClient.GetResponseAsync([message]); 773var response = await chatClient.GetResponseAsync([message]); 781var secondResponse = await chatClient.GetResponseAsync([message]); 815var response = await chatClient.GetResponseAsync([message]); 824var secondResponse = await chatClient.GetResponseAsync([message]); 941var response = await chatClient.GetResponseAsync([new(ChatRole.User, "What's the biggest animal?")]); 1146var response = await chatClient.GetResponseAsync(messages); 1189var response = await chatClient.GetResponseAsync(messages); 1247var response = await chatClient.GetResponseAsync(messages, new() { Tools = [getWeather] }); 1329var response = await chatClient.GetResponseAsync(messages); 1383public Task<ChatResponse> GetResponseAsync(IEnumerable<ChatMessage> messages, ChatOptions? options = null, CancellationToken cancellationToken = default)
ImageGeneratingChatClientIntegrationTests.cs (14)
69protected async Task<ChatResponse> GetResponseAsync(bool useStreaming, IEnumerable<ChatMessage> messages, ChatOptions? options = null, IChatClient? chatClient = null) 82static ChatResponse ValidateChatResponse(ChatResponse response) 127var response = await GetResponseAsync(useStreaming, 165var response = await GetResponseAsync(useStreaming, 199var firstResponse = await GetResponseAsync(useStreaming, chatHistory, chatOptions); 204var secondResponse = await GetResponseAsync(useStreaming, chatHistory, chatOptions); 249var firstResponse = await GetResponseAsync(useStreaming, chatHistory, chatOptions); 254var secondResponse = await GetResponseAsync(useStreaming, chatHistory, chatOptions); 259var thirdResponse = await GetResponseAsync(useStreaming, chatHistory, chatOptions); 294var firstResponse = await GetResponseAsync(useStreaming, chatHistory, chatOptions); 299var secondResponse = await GetResponseAsync(useStreaming, chatHistory, chatOptions); 304var thirdResponse = await GetResponseAsync(useStreaming, chatHistory, chatOptions); 340var response = await GetResponseAsync(useStreaming,
parent\Microsoft.Extensions.AI.Abstractions.Tests\TestChatClient.cs (2)
20public Func<IEnumerable<ChatMessage>, ChatOptions?, CancellationToken, Task<ChatResponse>>? GetResponseAsyncCallback { get; set; } 29public Task<ChatResponse> GetResponseAsync(IEnumerable<ChatMessage> messages, ChatOptions? options = null, CancellationToken cancellationToken = default)
PromptBasedFunctionCallingChatClient.cs (3)
42public override async Task<ChatResponse> GetResponseAsync( 83var result = await base.GetResponseAsync(chatMessages, options, cancellationToken); 140var response = await GetResponseAsync(messages, options, cancellationToken);
Microsoft.Extensions.AI.OllamaSharp.Integration.Tests (3)
OllamaSharpChatClientIntegrationTests.cs (3)
44var response = await chatClient.GetResponseAsync("What is the current secret number? Answer with digits only.", new ChatOptions 79var response = await chatClient.GetResponseAsync("What's the stock price for Microsoft in British pounds?", new ChatOptions 110public override Task<ChatResponse> GetResponseAsync(
Microsoft.Extensions.AI.OpenAI (20)
MicrosoftExtensionsAIChatExtensions.cs (7)
48/// <summary>Creates an OpenAI <see cref="ChatCompletion"/> from a <see cref="ChatResponse"/>.</summary> 49/// <param name="response">The <see cref="ChatResponse"/> to convert to a <see cref="ChatCompletion"/>.</param> 53public static ChatCompletion AsOpenAIChatCompletion(this ChatResponse response) 256/// <summary>Creates a Microsoft.Extensions.AI <see cref="ChatResponse"/> from a <see cref="ChatCompletion"/>.</summary> 257/// <param name="chatCompletion">The <see cref="ChatCompletion"/> to convert to a <see cref="ChatResponse"/>.</param> 259/// <returns>A converted <see cref="ChatResponse"/>.</returns> 262public static ChatResponse AsChatResponse(this ChatCompletion chatCompletion, ChatCompletionOptions? options = null) =>
MicrosoftExtensionsAIResponsesExtensions.cs (6)
62/// <summary>Creates a Microsoft.Extensions.AI <see cref="ChatResponse"/> from an <see cref="ResponseResult"/>.</summary> 63/// <param name="response">The <see cref="ResponseResult"/> to convert to a <see cref="ChatResponse"/>.</param> 65/// <returns>A converted <see cref="ChatResponse"/>.</returns> 67public static ChatResponse AsChatResponse(this ResponseResult response, CreateResponseOptions? options = null) => 83/// <summary>Creates an OpenAI <see cref="ResponseResult"/> from a <see cref="ChatResponse"/>.</summary> 87public static ResponseResult AsOpenAIResponseResult(this ChatResponse response, ChatOptions? options = null)
OpenAIAssistantsChatClient.cs (1)
71public Task<ChatResponse> GetResponseAsync(
OpenAIChatClient.cs (3)
90public async Task<ChatResponse> GetResponseAsync( 497internal static ChatResponse FromOpenAIChatCompletion(ChatCompletion openAICompletion, ChatCompletionOptions? chatCompletionOptions) 578var response = new ChatResponse(returnMessage)
OpenAIResponsesChatClient.cs (3)
101public async Task<ChatResponse> GetResponseAsync( 132internal static ChatResponse FromOpenAIResponse(ResponseResult responseResult, CreateResponseOptions? openAIOptions, string? conversationId) 137ChatResponse response = new()
Microsoft.Extensions.AI.OpenAI.Tests (131)
OpenAIAssistantChatClientIntegrationTests.cs (1)
55var response = await ChatClient.GetResponseAsync("Use the code interpreter to calculate the square root of 42.", new()
OpenAIChatClientTests.cs (13)
155var response = await client.GetResponseAsync("hello", new() 332var response = await client.GetResponseAsync("hello", new() 418var response = await client.GetResponseAsync("hello", chatOptions); 576var response = await client.GetResponseAsync("hello", chatOptions); 827var response = await client.GetResponseAsync(messages, new() 932var response = await client.GetResponseAsync(messages); 1030var response = await client.GetResponseAsync(messages); 1141var response = await client.GetResponseAsync("How old is Alice?", new() 1226var response = await client.GetResponseAsync("What day is it?", new() 1484var response = await client.GetResponseAsync(messages); 1585var response = await client.GetResponseAsync( 1680var response = await client.GetResponseAsync("hello", new() 1910var response = await client.GetResponseAsync("hello");
OpenAIConversionTests.cs (20)
893ChatResponse response = cc.AsChatResponse(); 924var response = updates.ToChatResponse(); 1513Assert.Throws<ArgumentNullException>("response", () => ((ChatResponse)null!).AsOpenAIChatCompletion()); 1519var chatResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, 1558var chatResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Hello")); 1566var emptyResponse = new ChatResponse([]); 1588var chatResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, 1633var chatResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Test")) 1656var chatResponse = new ChatResponse(new ChatMessage(inputRole, "Test")); 1975Assert.Throws<ArgumentNullException>("response", () => ((ChatResponse)null!).AsOpenAIResponseResult()); 1994var chatResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Test")) 2007var chatResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Hello, world!")) 2032var chatResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Test message")) 2064var chatResponse = new ChatResponse([]) 2091var chatResponse = new ChatResponse(messages) 2128var chatResponse = new ChatResponse(messages) 2159var chatResponse = new ChatResponse(messages) 2181var chatResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Default test")); 2199var chatResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Model test")); 2214var chatResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "Model priority test"))
OpenAIHostedFileClientIntegrationTests.cs (4)
277var response = await chatClient.GetResponseAsync( 346var response = await chatClient.GetResponseAsync( 396var setupResponse = await chatClient.GetResponseAsync( 425var processResponse = await chatClient.GetResponseAsync(
OpenAIResponseClientIntegrationTests.cs (24)
38var response = await ChatClient.GetResponseAsync("Use the code interpreter to calculate the square root of 42. Return only the nearest integer value and no other text.", new() 82var response = await ChatClient.GetResponseAsync( 156ChatResponse response = streaming 196ChatResponse response = await CreateChatClient()!.GetResponseAsync("Which tools are available on the wiki_tools MCP server?", chatOptions); 228ChatResponse response = streaming ? 268ChatResponse response = streaming ? 331ChatResponse response = await ChatClient.GetResponseAsync( 362var response = await ChatClient.GetResponseAsync("What's the biggest animal?", chatOptions); 395var response = await chatClient.GetResponseAsync("What time is it?", chatOptions); 533ChatResponse response = streaming ? 572var response = await client.GetResponseAsync("What is 25 plus 17? Use the AddNumbers function.", chatOptions); 596var response = await client.GetResponseAsync("What's the weather in Seattle? Use GetWeather.", chatOptions); 620var response = await client.GetResponseAsync("Call GetDotnetLogo and tell me what you see in the image.", chatOptions); 645var response = await client.GetResponseAsync("Call GetDocument and tell me what text is in the PDF.", chatOptions); 673var response = await client.GetResponseAsync("Call AnalyzeImage and describe what you see.", chatOptions); 708var response1 = await ChatClient.GetResponseAsync(chatHistory, chatOptions); 726var response2 = await ChatClient.GetResponseAsync(chatHistory, chatOptions); 745var response3 = await ChatClient.GetResponseAsync(deserializedHistory, chatOptions); 789var response1 = await ChatClient.GetStreamingResponseAsync(chatHistory, chatOptions).ToChatResponseAsync(); 807var response2 = await ChatClient.GetStreamingResponseAsync(chatHistory, chatOptions).ToChatResponseAsync(); 826var response3 = await ChatClient.GetStreamingResponseAsync(deserializedHistory, chatOptions).ToChatResponseAsync(); 862var response = await client.GetResponseAsync( 966var response = await client.GetResponseAsync( 1009var response = await client.GetResponseAsync(
OpenAIResponseClientTests.cs (69)
153var response = await client.GetResponseAsync("hello", new() 897var response = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "Search the web for the temperature today in Fremont")], chatOptions); 1088var response = await client.GetResponseAsync("hello", new() 1265var response = await client.GetResponseAsync("hello", chatOptions); 1361var response = await client.GetResponseAsync("hello", new() 1495var response = await client.GetResponseAsync( 1616var response = await client.GetResponseAsync( 1768var response = await client.GetResponseAsync(messages); 1995var response = await client.GetResponseAsync("Tell me the path to the README.md file for Microsoft.Extensions.AI.Abstractions in the dotnet/extensions repository", chatOptions); 2405var response = await client.GetStreamingResponseAsync("Tell me the path to the README.md file for Microsoft.Extensions.AI.Abstractions in the dotnet/extensions repository", chatOptions) 2615var response = await client.GetResponseAsync("Test error handling", chatOptions); 2724var response = await client.GetResponseAsync("hello", new ChatOptions { Tools = [mcpTool] }); 2814var response = await client.GetResponseAsync("hello", new ChatOptions { Tools = [mcpTool] }); 2876var response = await client.GetResponseAsync("hello", new() 2967var response = await client.GetResponseAsync([], new() 3384var response = await client.GetResponseAsync("Calculate the sum of numbers from 1 to 5", new() 3604var response = await client.GetStreamingResponseAsync("Calculate the sum of numbers from 1 to 10 using Python", new() 3734var response = updates.ToChatResponse(); 3812var response = await client.GetResponseAsync("hello", new() 3870var response = await client.GetResponseAsync("hello", new() 3929var response = await client.GetResponseAsync("hello", new() 3990var response = await client.GetResponseAsync("hello", new() 4052var response = await client.GetResponseAsync("hello", new() 4115var response = await client.GetResponseAsync("hello", new() 4340var response = await client.GetResponseAsync("hello", new() 4631var response = await client.GetResponseAsync("hello", new() 4692var response = await client.GetResponseAsync("hello", new() 4821var response = await client.GetResponseAsync([ 4877var response = await client.GetResponseAsync([ 4939var response = await client.GetResponseAsync([ 4996var response = await client.GetResponseAsync([ 5053var response = await client.GetResponseAsync([ 5112var response = await client.GetResponseAsync([ 5175var response = await client.GetResponseAsync([ 5230var response = await client.GetResponseAsync([ 5285var response = await client.GetResponseAsync([ 5342var response = await client.GetResponseAsync([ 5399var response = await client.GetResponseAsync([ 5436var response = await client.GetResponseAsync("test"); 5468var response = await client.GetResponseAsync("test"); 5512var response = await client.GetResponseAsync("test"); 5568var response = await client.GetResponseAsync([ 5613var response = await client.GetResponseAsync("test"); 6083var response = updates.ToChatResponse(); 6128var response = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "")]); 6169var response = await client.GetResponseAsync("harmful request"); 6223var response = await client.GetResponseAsync("What is in this image?"); 6286var response = await client.GetResponseAsync("What is in this image?"); 6368var response = await client.GetResponseAsync("Generate an image of a cat", new ChatOptions 6845var response = await client.GetResponseAsync("Create a hello world file", new() 7127var response = await client.GetResponseAsync("What is the latest news about .NET?", new() 7300var response = updates.ToChatResponse(); 7364var response = await client.GetResponseAsync("hello", new() 7451var response = await client.GetResponseAsync("hello", new() 7543var response = await client.GetResponseAsync("hello", new() 7610var response = await client.GetResponseAsync("hello", new() 7720var response = await client.GetResponseAsync("hello", new() 7820var response = await client.GetResponseAsync("hello", new() 7925var response = await client.GetResponseAsync("hello", new() 8025var response = await client.GetResponseAsync("hello", new() 8112var response = await client.GetResponseAsync("hello", new() 8203var response = await client.GetResponseAsync("hello", new() 8289var response = await client.GetResponseAsync("hello", new() 8402var response = await client.GetResponseAsync("hello", new() 8501var response = await client.GetResponseAsync("hello", new() 8605var response = await client.GetResponseAsync("hello", new() 8718var response = await client.GetResponseAsync("hello", new() 8836var response = await client.GetResponseAsync( 8946var response = updates.ToChatResponse();
Microsoft.Extensions.AI.Tests (183)
ChatCompletion\ChatClientStructuredOutputExtensionsTests.cs (10)
23var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(expectedResult, JsonContext2.Default.Animal))) 100var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(expectedResult, JsonContext2.Default.Options))) 161var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(expectedResult, JsonContext2.Default.Options))); 196var expectedResponse = new ChatResponse( 239var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "This is not valid JSON")); 258var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "null")); 277var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, [new UriContent("https://example.com", "image/*")])); 297var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(expectedResult, JsonContext2.Default.Options))); 332var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(payload, JsonContext2.Default.Options))); 364var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(expectedResult, jso)));
ChatCompletion\ConfigureOptionsChatClientTests.cs (2)
37ChatResponse expectedResponse = new(); 76var response = await client.GetResponseAsync(Array.Empty<ChatMessage>(), providedOptions, cts.Token);
ChatCompletion\DistributedCachingChatClientTest.cs (21)
48var expectedResponse = new ChatResponse( 97var result1 = await outer.GetResponseAsync("some input", options); 102var result2 = await outer.GetResponseAsync("some input", options); 233var result2 = await outer.GetResponseAsync([input]); 569var result1 = await outer.GetResponseAsync([], new ChatOptions 573var result2 = await outer.GetResponseAsync([], new ChatOptions 584var result3 = await outer.GetResponseAsync([], new ChatOptions 588var result4 = await outer.GetResponseAsync([], new ChatOptions 619var result1 = await outer.GetResponseAsync([]); 620var result2 = await outer.GetResponseAsync([]); 629var result3 = await outer.GetResponseAsync([]); 630var result4 = await outer.GetResponseAsync([]); 639var result5 = await outer.GetResponseAsync([]); 666var result1 = await outer.GetResponseAsync([], new ChatOptions 670var result2 = await outer.GetResponseAsync([], new ChatOptions 685var expectedResponse = new ChatResponse( 720var result1 = await outer.GetResponseAsync("some input"); 724var result2 = await outer.GetResponseAsync("some input"); 758var result = await outer.GetResponseAsync("some input"); 790private static void AssertResponsesEqual(ChatResponse expected, ChatResponse actual)
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (5)
1436var result = await service.GetResponseAsync(CloneInput(input), options); 1447var result = await service.GetStreamingResponseAsync(CloneInput(input), options).ToChatResponseAsync(); 1987var result = await service.GetResponseAsync(new EnumeratedOnceEnumerable<ChatMessage>(CloneInput(input)), options, cts.Token); 2069var result = await service.GetStreamingResponseAsync(new EnumeratedOnceEnumerable<ChatMessage>(CloneInput(input)), options, cts.Token).ToChatResponseAsync(); 2124public override Task<ChatResponse> GetResponseAsync(
ChatCompletion\FunctionInvokingChatClientTests.cs (38)
419ChatResponse response; 498ChatResponse response; 582ChatResponse response; 1212var response = await client.GetStreamingResponseAsync(messages, options, CancellationToken.None).ToChatResponseAsync(); 1254ChatResponse response = await client.GetResponseAsync(messages, options); 1379var result = await chatClient.GetResponseAsync(messages, chatOptions); 1404Func<IEnumerable<ChatMessage>, ChatOptions?, CancellationToken, ChatResponse> callback = 2055ChatResponse response = streaming 2126ChatResponse response = streaming 2174var response = await client2.GetResponseAsync([new ChatMessage(ChatRole.User, "hello")], options); 2234var result = await service.GetResponseAsync(new EnumeratedOnceEnumerable<ChatMessage>(chat), options, cts.Token); 2298var result = await service.GetStreamingResponseAsync(new EnumeratedOnceEnumerable<ChatMessage>(chat), options, cts.Token).ToChatResponseAsync(); 2433var result = await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "test")], options).ToChatResponseAsync(); 2438var result = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "test")], options); 2527var result = await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "test")], options).ToChatResponseAsync(); 2536var result = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "test")], options); 2632var result = await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "test")], options).ToChatResponseAsync(); 2642var result = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "test")], options); 2737var result = await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "test")], options).ToChatResponseAsync(); 2745var result = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "test")], options); 2837var result = await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "test")], options).ToChatResponseAsync(); 2847var result = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "test")], options); 2920var result = await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "test")], options).ToChatResponseAsync(); 2925var result = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "test")], options); 3012var result = await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "test")], options).ToChatResponseAsync(); 3021var result = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "test")], options); 3113var result = await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "test")], options).ToChatResponseAsync(); 3123var result = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "test")], options); 3219var result = await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "test")], options).ToChatResponseAsync(); 3230var result = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "test")], options); 3480var response = new ChatResponse( 3491ChatResponse response = streaming 3551var response = new ChatResponse( 3560var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "done")); 3568ChatResponse response = streaming 3618var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")])); 3623var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, "done")); 3631ChatResponse response = streaming
ChatCompletion\ImageGeneratingChatClientTests.cs (6)
52var response = await client.GetResponseAsync([new(ChatRole.User, "test")], chatOptions); 89var response = await client.GetResponseAsync([new(ChatRole.User, "test")], chatOptions); 137var response = await client.GetResponseAsync([new(ChatRole.User, "test")], chatOptions); 269var response = await client.GetResponseAsync([new(ChatRole.User, "test")], null); 331var response = await client.GetResponseAsync([new(ChatRole.User, "test")], chatOptions); 426var response = await client.GetResponseAsync([new(ChatRole.User, "test")], chatOptions);
ChatCompletion\OpenTelemetryChatClientTests.cs (1)
611var response = await chatClient.GetResponseAsync(messages);
ChatCompletion\ReducingChatClientTests.cs (2)
50var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, "It's sunny!")); 87var response = await client.GetResponseAsync(originalMessages);
ChatCompletion\UseDelegateChatClientTests.cs (6)
67ChatResponse response = await client.GetResponseAsync(expectedMessages, expectedOptions, expectedCts.Token); 102var cc = await innerClient.GetResponseAsync(messages, options, cancellationToken); 110ChatResponse response = await client.GetResponseAsync(expectedMessages, expectedOptions, expectedCts.Token); 161ChatResponse response = await client.GetResponseAsync(expectedMessages, expectedOptions, expectedCts.Token); 205var cc = await innerClient.GetResponseAsync(messages, options, cancellationToken); 232ChatResponse response = await client.GetResponseAsync(expectedMessages, expectedOptions, expectedCts.Token);
ChatRouting\FailoverChatClientTests.cs (20)
57Task<ChatResponse> operation = streaming 81Task<ChatResponse> operation = streaming 105Task<ChatResponse> operation = streaming 257ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "ok")); 275ChatResponse response = streaming 367ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "ok")); 395ChatResponse response = await router.GetResponseAsync([new(ChatRole.User, "hi")]); 432ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "ok")); 446ChatResponse response = await router.GetResponseAsync([new(ChatRole.User, "hi")]); 486GetResponseAsyncCallback = (_, _, _) => Task.FromResult<ChatResponse>(null!), 502ChatResponse? response = await router.GetResponseAsync([new(ChatRole.User, "hi")]); 651ChatResponse response = 743ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "ok")); 758ChatResponse response = await client.GetResponseAsync([new(ChatRole.User, "hi")]); 782ChatResponse response = 810ChatResponse response = 861ChatResponse response = 884ChatResponse response = 915ChatResponse response = 1003ChatResponse response =
ChatRouting\OrderedFailoverChatClientTests.cs (11)
38ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "ok")); 49ChatResponse response = await client.GetResponseAsync([new(ChatRole.User, "hi")]); 59ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "ok")); 80ChatResponse response = await client.GetResponseAsync([new(ChatRole.User, "hi")]); 180Task<ChatResponse>[] requests = 217ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "ok")); 226ChatResponse response = await failover.GetResponseAsync([new(ChatRole.User, "hi")]); 287ChatResponse response = 354ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "ok")); 362ChatResponse response = await outer.GetResponseAsync([new(ChatRole.User, "hi")]); 381public Task<ChatResponse> GetResponseAsync(
ChatRouting\SemanticRoutingChatClientTests.cs (7)
97ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "code")); 118ChatResponse first = await router.GetResponseAsync([new(ChatRole.User, "debug this code")]); 119ChatResponse second = await router.GetResponseAsync([new(ChatRole.User, "debug this code")]); 170ChatResponse response = await router.GetResponseAsync([new(ChatRole.User, "query")]); 194ChatResponse expected = new(new ChatMessage(ChatRole.Assistant, "default")); 210ChatResponse response = 242public Task<ChatResponse> GetResponseAsync(
Generated\361d1da7f942c932\TestJsonSerializerContext.ChatResponse.g.cs (50)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse>? _ChatResponse; 19public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse> ChatResponse 22get => _ChatResponse ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.ChatResponse)); 25private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse> Create_ChatResponse(global::System.Text.Json.JsonSerializerOptions options) 27if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.ChatResponse>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.ChatResponse> jsonTypeInfo)) 29var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.ChatResponse> 35ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty<global::System.Type>(), modifiers: null), 39jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.ChatResponse>(options, objectInfo); 56DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 58Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).Messages, 59Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).Messages = value!, 66AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("Messages", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.IList<global::Microsoft.Extensions.AI.ChatMessage>), global::System.Array.Empty<global::System.Type>(), null), 78DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 88AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("Text", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 99DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 101Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ResponseId, 102Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ResponseId = value!, 109AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("ResponseId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 119DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 121Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ConversationId, 122Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ConversationId = value!, 129AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("ConversationId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 139DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 141Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ModelId, 142Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ModelId = value!, 149AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("ModelId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 159DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 161Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).CreatedAt, 162Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).CreatedAt = value!, 169AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("CreatedAt", InstanceMemberBindingFlags, null, typeof(global::System.DateTimeOffset?), global::System.Array.Empty<global::System.Type>(), null), 179DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 181Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).FinishReason, 182Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).FinishReason = value!, 189AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("FinishReason", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.ChatFinishReason?), global::System.Array.Empty<global::System.Type>(), null), 199DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 201Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).Usage, 202Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).Usage = value!, 209AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("Usage", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.UsageDetails), global::System.Array.Empty<global::System.Type>(), null), 219DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 221Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ContinuationToken, 222Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).ContinuationToken = value!, 229AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("ContinuationToken", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.ResponseContinuationToken), global::System.Array.Empty<global::System.Type>(), null), 239DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 249AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("RawRepresentation", InstanceMemberBindingFlags, null, typeof(object), global::System.Array.Empty<global::System.Type>(), null), 259DeclaringType = typeof(global::Microsoft.Extensions.AI.ChatResponse), 261Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponse)obj).AdditionalProperties, 262Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponse)obj).AdditionalProperties = value!, 269AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.ChatResponse).GetProperty("AdditionalProperties", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.AdditionalPropertiesDictionary), global::System.Array.Empty<global::System.Type>(), null),
Generated\361d1da7f942c932\TestJsonSerializerContext.GetJsonTypeInfo.g.cs (1)
82if (type == typeof(global::Microsoft.Extensions.AI.ChatResponse))
parent\Microsoft.Extensions.AI.Abstractions.Tests\TestChatClient.cs (2)
20public Func<IEnumerable<ChatMessage>, ChatOptions?, CancellationToken, Task<ChatResponse>>? GetResponseAsyncCallback { get; set; } 29public Task<ChatResponse> GetResponseAsync(IEnumerable<ChatMessage> messages, ChatOptions? options = null, CancellationToken cancellationToken = default)
TestJsonSerializerContext.cs (1)
13[JsonSerializable(typeof(ChatResponse))]
Microsoft.Extensions.DataIngestion.Tests (7)
parent\Microsoft.Extensions.AI.Abstractions.Tests\TestChatClient.cs (2)
20public Func<IEnumerable<ChatMessage>, ChatOptions?, CancellationToken, Task<ChatResponse>>? GetResponseAsyncCallback { get; set; } 29public Task<ChatResponse> GetResponseAsync(IEnumerable<ChatMessage> messages, ChatOptions? options = null, CancellationToken cancellationToken = default)
Processors\AlternativeTextEnricherTests.cs (1)
166GetResponseAsyncCallback = (messages, options, cancellationToken) => Task.FromException<ChatResponse>(new ExpectedException())
Processors\ClassificationEnricherTests.cs (1)
105GetResponseAsyncCallback = (messages, options, cancellationToken) => Task.FromException<ChatResponse>(new ExpectedException())
Processors\KeywordEnricherTests.cs (1)
105GetResponseAsyncCallback = (messages, options, cancellationToken) => Task.FromException<ChatResponse>(new ExpectedException())
Processors\SentimentEnricherTests.cs (1)
92GetResponseAsyncCallback = (messages, options, cancellationToken) => Task.FromException<ChatResponse>(new ExpectedException())
Processors\SummaryEnricherTests.cs (1)
89GetResponseAsyncCallback = (messages, options, cancellationToken) => Task.FromException<ChatResponse>(new ExpectedException())
Microsoft.ML.GenAI.Core (1)
CausalLMPipelineChatClient.cs (1)
36public virtual Task<ChatResponse> GetResponseAsync(IEnumerable<ChatMessage> messages, ChatOptions? options = null, CancellationToken cancellationToken = default)
Microsoft.ML.GenAI.LLaMA (1)
Llama3CausalLMChatClient.cs (1)
27public override Task<ChatResponse> GetResponseAsync(
Microsoft.ML.GenAI.Phi (1)
Phi3\Phi3CausalLMChatClient.cs (1)
32public override Task<ChatResponse> GetResponseAsync(