504 references to User
DotNetInvocationHostedAgent (1)
EchoAIAgent.cs (1)
67if (message.Role == ChatRole.User)
Microsoft.AspNetCore.Components.AI (6)
Components\MessageInput.cs (1)
158await _agentContext.SendMessageAsync(new ChatMessage(ChatRole.User, text));
Components\MessageListContext.cs (1)
47var role = block.Role == ChatRole.User ? "user" : "assistant";
Engine\AgentContext.cs (3)
65return SendMessageAsync(new ChatMessage(ChatRole.User, text), cancellationToken); 113if (block.Role == ChatRole.User) 318var role = result is FunctionResultContent ? ChatRole.Tool : ChatRole.User;
Engine\UIAgent.cs (1)
258if (update.Role == ChatRole.User)
Microsoft.Extensions.AI (6)
ChatCompletion\ChatClientStructuredOutputExtensions.cs (3)
61GetResponseAsync<T>(chatClient, new ChatMessage(ChatRole.User, chatMessage), options, useJsonSchemaResponseFormat, cancellationToken); 101GetResponseAsync<T>(chatClient, new ChatMessage(ChatRole.User, chatMessage), serializerOptions, options, useJsonSchemaResponseFormat, cancellationToken); 190promptAugmentation = new ChatMessage(ChatRole.User, $$"""
ChatCompletion\OpenTelemetryImageGenerator.cs (1)
190OtelMessageSerializer.SerializeChatMessages([new(ChatRole.User, content)]));
ChatReduction\SummarizingChatReducer.cs (1)
173if (unsummarizedMessages[i].Role == ChatRole.User)
ChatRouting\SemanticRoutingChatClient.cs (1)
178static message => message.Role == ChatRole.User)?.Text;
Microsoft.Extensions.AI.Abstractions (4)
ChatCompletion\ChatClientExtensions.cs (2)
100return client.GetResponseAsync(new ChatMessage(ChatRole.User, chatMessage), options, cancellationToken); 140return client.GetStreamingResponseAsync(new ChatMessage(ChatRole.User, chatMessage), options, cancellationToken);
ChatCompletion\ChatMessage.cs (2)
21/// <remarks>The instance defaults to having a role of <see cref="ChatRole.User"/>.</remarks> 73public ChatRole Role { get; set; } = ChatRole.User;
Microsoft.Extensions.AI.Abstractions.Tests (38)
ChatCompletion\ChatClientExtensionsTests.cs (2)
112Assert.Equal(ChatRole.User, m.Role); 139Assert.Equal(ChatRole.User, m.Role);
ChatCompletion\ChatMessageTests.cs (7)
21Assert.Equal(ChatRole.User, message.Role); 68message = new(ChatRole.User, (string?)null); 72message = new(ChatRole.User, (IList<AIContent>?)null); 76message = new ChatMessage(ChatRole.User, Array.Empty<AIContent>()); 144ChatMessage message = new(ChatRole.User, 276var chatMessage = new ChatMessage(ChatRole.User, contents: items) 377Assert.Equal(ChatRole.User, result.Role);
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (10)
78new(ChatRole.User, "c") { MessageId = "2" }, 79new(ChatRole.User, "d") { MessageId = "2" }, 103Assert.Equal(ChatRole.User, response.Messages[2].Role); 197new(ChatRole.User, "F") { MessageId = "2", AuthorName = "Bob" }, 227Assert.Equal(ChatRole.User, response.Messages[3].Role); 391new(ChatRole.User, "User message") { MessageId = "1" }, 405Assert.Equal(ChatRole.User, response.Messages[1].Role); 460new(ChatRole.User, "Second message") { MessageId = "msg2", AdditionalProperties = new() { ["key1"] = "different_value1" } }, 550new(ChatRole.User, "How") { MessageId = "msg3", CreatedAt = new DateTimeOffset(2024, 1, 1, 11, 0, 0, TimeSpan.Zero), AuthorName = "User" }, 588Assert.Equal(ChatRole.User, message3.Role);
ChatCompletion\ChatResponseUpdateTests.cs (5)
89Role = ChatRole.User, 296Role = ChatRole.User, 305Assert.Equal(ChatRole.User, clone.Role); 349Role = ChatRole.User, 363Assert.Equal(ChatRole.User, original.Role);
ChatCompletion\ChatRoleTests.cs (1)
51Assert.Equal("user", ChatRole.User.Value);
ChatCompletion\DelegatingChatClientTests.cs (2)
61new(ChatRole.User, "Message 1"), 62new(ChatRole.User, "Message 2")
ChatRouting\RoutingChatClientTests.cs (5)
23var messages = new ChatMessage[] { new(ChatRole.User, "hi") }; 76() => router.GetResponseAsync([new(ChatRole.User, "hi")])); 88() => router.GetResponseAsync([new(ChatRole.User, "hi")])); 90() => CollectAsync(router.GetStreamingResponseAsync([new(ChatRole.User, "hi")]))); 113_ = await router.GetResponseAsync([new(ChatRole.User, "hi")]);
ChatRouting\RoutingContextTests.cs (1)
15var messages = new List<ChatMessage> { new(ChatRole.User, "initial") };
Contents\AIContentTests.cs (1)
65ChatMessage message = new(ChatRole.User,
Realtime\RealtimeClientMessageTests.cs (2)
41var item = new RealtimeConversationItem(contents, "item_1", ChatRole.User); 140new RealtimeConversationItem([new TextContent("Hello")], "item_1", ChatRole.User),
Realtime\RealtimeConversationItemTests.cs (2)
29var item = new RealtimeConversationItem(contents, "item_123", ChatRole.User); 33Assert.Equal(ChatRole.User, item.Role);
Microsoft.Extensions.AI.Evaluation (7)
ChatMessageExtensions.cs (6)
26/// last <see cref="ChatMessage"/> has <see cref="ChatMessage.Role"/> set to <see cref="ChatRole.User"/>; 31/// <paramref name="messages"/> has <see cref="ChatMessage.Role"/> set to <see cref="ChatRole.User"/>; 39messages.LastOrDefault() is ChatMessage lastMessage && lastMessage.Role == ChatRole.User 56/// last <see cref="ChatMessage"/> has <see cref="ChatMessage.Role"/> set to <see cref="ChatRole.User"/>; 65/// <paramref name="messages"/> has <see cref="ChatMessage.Role"/> set to <see cref="ChatRole.User"/>; 78lastMessage.Role == ChatRole.User)
EvaluatorExtensions.cs (1)
95userRequest: new ChatMessage(ChatRole.User, userRequest),
Microsoft.Extensions.AI.Evaluation.Integration.Tests (4)
SafetyEvaluatorTests.cs (3)
337Role = ChatRole.User, 409Role = ChatRole.User, 458Role = ChatRole.User,
test\Libraries\Microsoft.Extensions.AI.Evaluation.Tests\ChatMessageUtilities.cs (1)
12=> new ChatMessage(ChatRole.User, message);
Microsoft.Extensions.AI.Evaluation.Quality (11)
CoherenceEvaluator.cs (1)
195evaluationInstructions.Add(new ChatMessage(ChatRole.User, evaluationPrompt));
CompletenessEvaluator.cs (1)
187evaluationInstructions.Add(new ChatMessage(ChatRole.User, evaluationPrompt));
EquivalenceEvaluator.cs (1)
174evaluationInstructions.Add(new ChatMessage(ChatRole.User, evaluationPrompt));
FluencyEvaluator.cs (1)
175evaluationInstructions.Add(new ChatMessage(ChatRole.User, evaluationPrompt));
GroundednessEvaluator.cs (1)
297evaluationInstructions.Add(new ChatMessage(ChatRole.User, evaluationPrompt));
IntentResolutionEvaluator.cs (1)
316evaluationInstructions.Add(new ChatMessage(ChatRole.User, evaluationPrompt));
RelevanceEvaluator.cs (1)
201evaluationInstructions.Add(new ChatMessage(ChatRole.User, evaluationPrompt));
RelevanceTruthAndCompletenessEvaluator.cs (1)
266return [new ChatMessage(ChatRole.User, evaluationPrompt)];
RetrievalEvaluator.cs (1)
226evaluationInstructions.Add(new ChatMessage(ChatRole.User, evaluationPrompt));
ToolCallAccuracyEvaluator.cs (1)
219evaluationInstructions.Add(new ChatMessage(ChatRole.User, evaluationPrompt));
Utilities\JsonOutputFixer.cs (1)
68new ChatMessage(ChatRole.User, fixPrompt)
Microsoft.Extensions.AI.Evaluation.Reporting (1)
ScenarioRunExtensions.cs (1)
65userRequest: new ChatMessage(ChatRole.User, userRequest),
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (8)
AzureStorage\AzureStoragePathValidationTests.cs (1)
44messages: [new ChatMessage(ChatRole.User, "User prompt")],
DiskBased\DiskBasedResultStoreTests.cs (1)
80messages: [new ChatMessage(ChatRole.User, "prompt")],
ResultStoreTester.cs (1)
33messages: [new ChatMessage(ChatRole.User, "User prompt")],
ScenarioRunResultTests.cs (3)
88messages: [new ChatMessage(ChatRole.User, "prompt")], 180messages: [new ChatMessage(ChatRole.User, "prompt")], 235ChatRole.User,
SerializationChainingTests.cs (2)
30Role = ChatRole.User, 46Assert.Equal(ChatRole.User, resp.ModelResponse.Messages[0].Role);
Microsoft.Extensions.AI.Evaluation.Safety (4)
ContentSafetyEvaluator.cs (1)
133var payloadMessage = new ChatMessage(ChatRole.User, payload);
ContentSafetyServicePayloadUtilities.cs (3)
420if (message.Role == ChatRole.User) 493$"{evaluatorName} only considers messages with role '{ChatRole.User}' and '{ChatRole.Assistant}'. " + 503$"These turns were either missing a message with role '{ChatRole.User}' or '{ChatRole.Assistant}'. " +
Microsoft.Extensions.AI.Evaluation.Tests (1)
ChatMessageUtilities.cs (1)
12=> new ChatMessage(ChatRole.User, message);
Microsoft.Extensions.AI.Integration.Tests (57)
ChatClientIntegrationTests.cs (40)
68new(ChatRole.User, "Pick a city, any city"), 70new(ChatRole.User, "And another one"), 72new(ChatRole.User, "What continent are they each in?"), 87new(ChatRole.User, []), 89new(ChatRole.User, "What is 1 + 2? Reply with a single number."), 102new(ChatRole.User, "Quote, word for word, Neil Armstrong's famous words.") 160List<ChatMessage> history = [new(ChatRole.User, "Explain in 100 words how AI works")]; 183new(ChatRole.User, 201new(ChatRole.User, 231new(ChatRole.User, "What is the current secret number?") 298new(ChatRole.User, "What is the secret number for id foo?") 330new(ChatRole.User, "What is the secret number for John aged 19?") 360new(ChatRole.User, "Can you add bacon, lettuce, and tomatoes to Peter's shopping cart?") 640var message = new ChatMessage(ChatRole.User, "Pick a random number, uniformly distributed between 1 and 1000000"); 656var message = new ChatMessage(ChatRole.User, "Pick a random number, uniformly distributed between 1 and 1000000"); 681var message = new ChatMessage(ChatRole.User, "Pick a random number, uniformly distributed between 1 and 1000000"); 733var message = new ChatMessage(ChatRole.User, "What is the temperature?"); 772var message = new ChatMessage(ChatRole.User, "What is the temperature?"); 814var message = new ChatMessage(ChatRole.User, "What is the temperature?"); 842await chatClient.GetResponseAsync([new(ChatRole.User, "What's the biggest animal?")]); 941var response = await chatClient.GetResponseAsync([new(ChatRole.User, "What's the biggest animal?")]); 1137new(ChatRole.User, "My name is Alice and I love hiking in the mountains."), 1139new(ChatRole.User, "Yes, I love the Pacific Crest Trail. I hiked a section last summer."), 1141new(ChatRole.User, "I hiked the section through the Sierra Nevada. It was challenging but beautiful."), 1143new(ChatRole.User, "What's my name and what activity do I enjoy?") 1180new(ChatRole.User, "Tell me about the weather"), 1182new(ChatRole.User, "What about tomorrow?"), 1184new(ChatRole.User, "Should I bring an umbrella?"), 1186new(ChatRole.User, "What's 2 + 2?") 1240new(ChatRole.User, "What's the weather in Seattle?"), 1242new(ChatRole.User, "And what about Miami?"), 1244new(ChatRole.User, "Which city had better weather?") 1274new(ChatRole.User, "I'm Bob and I work as a software engineer at a startup."), 1276new(ChatRole.User, "We build AI-powered tools for education."), 1278new(ChatRole.User, "Yes, we focus on personalized learning experiences."), 1280new(ChatRole.User, "Was anyone named in the conversation? Provide their name and job.") 1320new(ChatRole.User, "I have 3 cats and 2 dogs."), 1322new(ChatRole.User, "Yes, and I spend about $200 per month on pet food."), 1324new(ChatRole.User, "They eat 10 cans of food per week."), 1326new(ChatRole.User, "How many pets do I have in total?")
ImageGeneratingChatClientIntegrationTests.cs (13)
128[new ChatMessage(ChatRole.User, "Please generate an image of a cat")], 166[new ChatMessage(ChatRole.User, [new TextContent("Please edit this image to add a red border"), originalImageData])], 195new(ChatRole.User, "Please generate an image of a dog") 203chatHistory.Add(new ChatMessage(ChatRole.User, "Please edit the image to make it more colorful")); 245new(ChatRole.User, "Please generate an image of a tree") 253chatHistory.Add(new ChatMessage(ChatRole.User, "Please edit the image to add flowers")); 258chatHistory.Add(new ChatMessage(ChatRole.User, "Please edit that last image to add birds")); 290new(ChatRole.User, "Please generate an image of a tree") 298chatHistory.Add(new ChatMessage(ChatRole.User, "Please edit the image to add fruit")); 303chatHistory.Add(new ChatMessage(ChatRole.User, "That didn't work out. Please edit the original image to add birds")); 341[new ChatMessage(ChatRole.User, "Generate an image of a castle")], 379new ChatMessage(ChatRole.User, 391var userMessage = processedMessages.First(m => m.Role == ChatRole.User);
PromptBasedFunctionCallingChatClient.cs (1)
72chatMessagesList[messageIndex] = new ChatMessage(ChatRole.User, $"<tool_call_result>{toolCallResultJson}</tool_call_result>");
ReducingChatClientTests.cs (3)
45new ChatMessage(ChatRole.User, "Hi there! Can you tell me about golden retrievers?"), 47new ChatMessage(ChatRole.User, "What kind of exercise do they need?"), 49new ChatMessage(ChatRole.User, "Are they good with kids?"),
Microsoft.Extensions.AI.OpenAI (6)
MicrosoftExtensionsAIChatExtensions.cs (1)
206resultMessage.Role = ChatRole.User;
OpenAIChatClient.cs (2)
169input.Role == ChatRole.User || 759ChatMessageRole.User => ChatRole.User,
OpenAIRealtimeClientSession.cs (1)
1163: messageItem.Role == Sdk.RealtimeMessageRole.User ? ChatRole.User
OpenAIResponsesChatClient.cs (2)
933MessageRole.User => ChatRole.User, 1317if (input.Role == ChatRole.User)
Microsoft.Extensions.AI.OpenAI.Tests (50)
OpenAIChatClientTests.cs (10)
854new(ChatRole.User, "hello!"), 856new(ChatRole.User, "i'm good. how are you?"), 961new(ChatRole.User, "hello!"), 1057new(ChatRole.User, "hello!"), 1059new(ChatRole.User, "i'm good. how are you?"), 1500new(ChatRole.User, "hello!"), 1513new(ChatRole.User, "Thanks!"), 1624new(ChatRole.User, 1801Assert.Equal(ChatRole.User, extMessages[0].Role); 1855Assert.Equal(ChatRole.User, extMessages[1].Role);
OpenAIConversionTests.cs (10)
727new(ChatRole.User, "Hello") { AuthorName = "Jane" }, 796new(ChatRole.User, "Hello"), 848new(ChatRole.User, 861new(ChatRole.User, 905Assert.Equal(ChatRole.User, message.Role); 1455Assert.Equal(ChatRole.User, message.Role); 1475Assert.Equal(ChatRole.User, message.Role); 1649(ChatRole.User, ChatMessageRole.User), 1884(ChatRole.User, ChatMessageRole.User), 2155new(ChatRole.User, "Hello, how are you?"),
OpenAIResponseClientIntegrationTests.cs (10)
267List<ChatMessage> input = [new ChatMessage(ChatRole.User, "Tell me the path to the README.md file for Microsoft.Extensions.AI.Abstractions in the dotnet/extensions repository")]; 531List<ChatMessage> input = [new ChatMessage(ChatRole.User, "What is on my calendar for today?")]; 706List<ChatMessage> chatHistory = [new ChatMessage(ChatRole.User, "What is 2+2? Think step by step but be very brief.")]; 724chatHistory.Add(new ChatMessage(ChatRole.User, "What is 3+3?")); 743deserializedHistory.Add(new ChatMessage(ChatRole.User, "What is 4+4?")); 758deserializedHistory.Add(new ChatMessage(ChatRole.User, "What is 5+5?")); 787List<ChatMessage> chatHistory = [new ChatMessage(ChatRole.User, "What is 2+2? Think step by step but be very brief.")]; 805chatHistory.Add(new ChatMessage(ChatRole.User, "What is 3+3?")); 824deserializedHistory.Add(new ChatMessage(ChatRole.User, "What is 4+4?")); 839deserializedHistory.Add(new ChatMessage(ChatRole.User, "What is 5+5?"));
OpenAIResponseClientTests.cs (20)
754chatHistory.Add(new ChatMessage(ChatRole.User, "Are you sure?")); 1003var response = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "Search the web for the temperature today in Fremont")], chatOptions); 1099await foreach (var update in client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "Search the web for the temperature today in Fremont")], chatOptions)) 4928new ChatMessage(ChatRole.User, "test"), 4984new ChatMessage(ChatRole.User, "test"), 5046new ChatMessage(ChatRole.User, "test"), 5103new ChatMessage(ChatRole.User, "test"), 5160new ChatMessage(ChatRole.User, "test"), 5219new ChatMessage(ChatRole.User, "test"), 5282new ChatMessage(ChatRole.User, "test"), 5337new ChatMessage(ChatRole.User, "test"), 5392new ChatMessage(ChatRole.User, "test"), 5449new ChatMessage(ChatRole.User, "test"), 5506new ChatMessage(ChatRole.User, "test"), 5675new ChatMessage(ChatRole.User, [ 5727new ChatMessage(ChatRole.User, [ 5970[new ChatMessage(ChatRole.User, "test")], 6279var response = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "")]); 6378var userMessage = response.Messages.FirstOrDefault(m => m.Role == ChatRole.User); 6441var userMessage = response.Messages.FirstOrDefault(m => m.Role == ChatRole.User);
Microsoft.Extensions.AI.Tests (292)
ChatCompletion\ChatClientStructuredOutputExtensionsTests.cs (10)
75var chatHistory = new List<ChatMessage> { new(ChatRole.User, "Hello") }; 123Assert.Equal(ChatRole.User, message.Role); 136var chatHistory = new List<ChatMessage> { new(ChatRole.User, "Hello") }; 245var chatHistory = new List<ChatMessage> { new(ChatRole.User, "Hello") }; 264var chatHistory = new List<ChatMessage> { new(ChatRole.User, "Hello") }; 283var chatHistory = new List<ChatMessage> { new(ChatRole.User, "Hello") }; 311var chatHistory = new List<ChatMessage> { new(ChatRole.User, "Hello") }; 339var chatHistory = new List<ChatMessage> { new(ChatRole.User, "Hello") }; 401var chatHistory = new List<ChatMessage> { new(ChatRole.User, "Hello") }; 429var chatHistory = new List<ChatMessage> { new(ChatRole.User, "Hello") };
ChatCompletion\DistributedCachingChatClientTest.cs (4)
185var input = new ChatMessage(ChatRole.User, "abc"); 224var input = new ChatMessage(ChatRole.User, "abc"); 495var input = new ChatMessage(ChatRole.User, "abc"); 533var input = new ChatMessage(ChatRole.User, "abc");
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (82)
36new ChatMessage(ChatRole.User, "hello"), 72new ChatMessage(ChatRole.User, "hello"), 119new ChatMessage(ChatRole.User, "hello"), 169new ChatMessage(ChatRole.User, "hello"), 214new ChatMessage(ChatRole.User, "hello"), 256new ChatMessage(ChatRole.User, "hello"), 262new ChatMessage(ChatRole.User, 271new ChatMessage(ChatRole.User, "hello"), 308new ChatMessage(ChatRole.User, "hello"), 314new ChatMessage(ChatRole.User, 324new ChatMessage(ChatRole.User, "hello"), 360new ChatMessage(ChatRole.User, "hello"), 369new ChatMessage(ChatRole.User, 373new ChatMessage(ChatRole.User, 381new ChatMessage(ChatRole.User, "hello"), 419new ChatMessage(ChatRole.User, "hello"), 425new ChatMessage(ChatRole.User, 434new ChatMessage(ChatRole.User, "hello"), 478new ChatMessage(ChatRole.User, "hello"), 484new ChatMessage(ChatRole.User, 493new ChatMessage(ChatRole.User, "hello"), 542new ChatMessage(ChatRole.User, "hello"), 548new ChatMessage(ChatRole.User, 563new ChatMessage(ChatRole.User, "hello"), 608new ChatMessage(ChatRole.User, "hello"), 615new ChatMessage(ChatRole.User, 625new ChatMessage(ChatRole.User, "hello"), 700new ChatMessage(ChatRole.User, "hello"), 705new ChatMessage(ChatRole.User, 716new ChatMessage(ChatRole.User, "hello"), 758new ChatMessage(ChatRole.User, "hello"), 764new ChatMessage(ChatRole.User, 773new ChatMessage(ChatRole.User, "hello"), 812new ChatMessage(ChatRole.User, "hello"), 818new ChatMessage(ChatRole.User, 829new ChatMessage(ChatRole.User, 837new ChatMessage(ChatRole.User, "hello"), 891new ChatMessage(ChatRole.User, "hello"), 896new ChatMessage(ChatRole.User, 963new ChatMessage(ChatRole.User, "hello"), 968new ChatMessage(ChatRole.User, 976new ChatMessage(ChatRole.User, 1028new ChatMessage(ChatRole.User, "hello"), 1035new ChatMessage(ChatRole.User, "hello"), 1039new ChatMessage(ChatRole.User, "hello"), 1083new ChatMessage(ChatRole.User, "hello"), 1113new ChatMessage(ChatRole.User, "hello"), 1114new ChatMessage(ChatRole.User, 1123new ChatMessage(ChatRole.User, "hello"), 1160new ChatMessage(ChatRole.User, 1204new ChatMessage(ChatRole.User, 1210new ChatMessage(ChatRole.User, "By the way, please keep the answer concise."), 1218new ChatMessage(ChatRole.User, "By the way, please keep the answer concise."), 1254new ChatMessage(ChatRole.User, 1266new ChatMessage(ChatRole.User, "please proceed"), 1299new ChatMessage(ChatRole.User, "hello"), 1304new ChatMessage(ChatRole.User, 1310new ChatMessage(ChatRole.User, "By the way, please keep the answer concise."), 1317new ChatMessage(ChatRole.User, "hello"), 1320new ChatMessage(ChatRole.User, "By the way, please keep the answer concise."), 1354new ChatMessage(ChatRole.User, "hello"), 1359new ChatMessage(ChatRole.User, 1368new ChatMessage(ChatRole.User, "hello"), 1371new ChatMessage(ChatRole.User, "please proceed"), 1412new ChatMessage(ChatRole.User, "hello"), 1417new ChatMessage(ChatRole.User, 1469new ChatMessage(ChatRole.User, "hello"), 1474new ChatMessage(ChatRole.User, 1524List<ChatMessage> input = [new ChatMessage(ChatRole.User, "hello")]; 1600List<ChatMessage> input = [new ChatMessage(ChatRole.User, "hello")]; 1698List<ChatMessage> input = [new ChatMessage(ChatRole.User, "hello")]; 1742new ChatMessage(ChatRole.User, "hello"), 1747new ChatMessage(ChatRole.User, 1793new ChatMessage(ChatRole.User, "hello"), 1836new ChatMessage(ChatRole.User, "hello"), 1842new ChatMessage(ChatRole.User, 1851new ChatMessage(ChatRole.User, "hello"), 1864new ChatMessage(ChatRole.User, 1920new ChatMessage(ChatRole.User, "hello"), 1926new ChatMessage(ChatRole.User, 1934new ChatMessage(ChatRole.User, "hello"), 1949new ChatMessage(ChatRole.User,
ChatCompletion\FunctionInvokingChatClientTests.cs (76)
93new ChatMessage(ChatRole.User, "hello"), 127new ChatMessage(ChatRole.User, "hello"), 160new ChatMessage(ChatRole.User, "hello"), 191new ChatMessage(ChatRole.User, "hello"), 251new ChatMessage(ChatRole.User, "hello"), 295new ChatMessage(ChatRole.User, "hello"), 329new ChatMessage(ChatRole.User, "hello"), 416new ChatMessage(ChatRole.User, "hello"), 495new ChatMessage(ChatRole.User, "hello"), 579new ChatMessage(ChatRole.User, "hello"), 636new ChatMessage(ChatRole.User, "hello"), 858new ChatMessage(ChatRole.User, "hello"), 936new ChatMessage(ChatRole.User, "hello"), 983new ChatMessage(ChatRole.User, "hello"), 1020new ChatMessage(ChatRole.User, "hello"), 1042new ChatMessage(ChatRole.User, "hello"), 1099new ChatMessage(ChatRole.User, "hello"), 1177new(ChatRole.User, "Hello"), 1235new(ChatRole.User, "Hello"), 1293new ChatMessage(ChatRole.User, "hello"), 1377List<ChatMessage> messages = [new(ChatRole.User, "hello")]; 1411new ChatMessage(ChatRole.User, "hello"), 1453new ChatMessage(ChatRole.User, "hello"), 1490new ChatMessage(ChatRole.User, "hello"), 1602new ChatMessage(ChatRole.User, "hello"), 1631new ChatMessage(ChatRole.User, "hello"), 1684new(ChatRole.User, "hello"), 1703new(ChatRole.User, "hello"), 1732new(ChatRole.User, "hello"), 1761new(ChatRole.User, "hi"), 1834new ChatMessage(ChatRole.User, "hello"), 1915[new ChatMessage(ChatRole.User, "hello")], options)) 1945new ChatMessage(ChatRole.User, "hello"), 1987new ChatMessage(ChatRole.User, "hello"), 2037new ChatMessage(ChatRole.User, "hello"), 2109new ChatMessage(ChatRole.User, "hello"), 2158new ChatMessage(ChatRole.User, "hello"), 2209? await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "hello")], options).ToChatResponseAsync() 2210: await client.GetResponseAsync([new ChatMessage(ChatRole.User, "hello")], options); 2280? await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "hello")], options).ToChatResponseAsync() 2281: await client.GetResponseAsync([new ChatMessage(ChatRole.User, "hello")], options); 2327var response = await client2.GetResponseAsync([new ChatMessage(ChatRole.User, "hello")], options); 2586var result = await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "test")], options).ToChatResponseAsync(); 2591var result = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "test")], options); 2680var result = await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "test")], options).ToChatResponseAsync(); 2689var result = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "test")], options); 2785var result = await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "test")], options).ToChatResponseAsync(); 2795var result = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "test")], options); 2890var result = await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "test")], options).ToChatResponseAsync(); 2898var result = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "test")], options); 2990var result = await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "test")], options).ToChatResponseAsync(); 3000var result = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "test")], options); 3073var result = await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "test")], options).ToChatResponseAsync(); 3078var result = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "test")], options); 3165var result = await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "test")], options).ToChatResponseAsync(); 3174var result = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "test")], options); 3266var result = await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "test")], options).ToChatResponseAsync(); 3276var result = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "test")], options); 3372var result = await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "test")], options).ToChatResponseAsync(); 3383var result = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "test")], options); 3410new ChatMessage(ChatRole.User, "hello"), 3440new ChatMessage(ChatRole.User, "hello"), 3476new ChatMessage(ChatRole.User, "hello"), 3508new ChatMessage(ChatRole.User, "hello"), 3537new ChatMessage(ChatRole.User, "hello"), 3544new ChatMessage(ChatRole.User, "hello"), 3580new ChatMessage(ChatRole.User, "hello"), 3585new ChatMessage(ChatRole.User, 3617new ChatMessage(ChatRole.User, "hello"), 3622new ChatMessage(ChatRole.User, 3677? await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "hello")], options).ToChatResponseAsync() 3678: await client.GetResponseAsync([new ChatMessage(ChatRole.User, "hello")], options); 3754? await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "hello")], options).ToChatResponseAsync() 3755: await client.GetResponseAsync([new ChatMessage(ChatRole.User, "hello")], options); 3817? await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "hello")], options).ToChatResponseAsync() 3818: await client.GetResponseAsync([new ChatMessage(ChatRole.User, "hello")], options);
ChatCompletion\ImageGeneratingChatClientTests.cs (10)
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); 241await foreach (var update in client.GetStreamingResponseAsync([new(ChatRole.User, "test")], chatOptions)) 269var response = await client.GetResponseAsync([new(ChatRole.User, "test")], null); 297await client.GetResponseAsync([new(ChatRole.User, "test")], chatOptions); 331var response = await client.GetResponseAsync([new(ChatRole.User, "test")], chatOptions); 373await foreach (var responseUpdate in client.GetStreamingResponseAsync([new(ChatRole.User, "test")], chatOptions)) 426var response = await client.GetResponseAsync([new(ChatRole.User, "test")], chatOptions); 501await foreach (var update in client.GetStreamingResponseAsync([new(ChatRole.User, "test")], chatOptions))
ChatCompletion\LoggingChatClientTests.cs (2)
69[new(ChatRole.User, "What's the biggest animal?")], 118[new(ChatRole.User, "What's the biggest animal?")],
ChatCompletion\OpenTelemetryChatClientTests.cs (11)
115new(ChatRole.User, "Hey!") { AuthorName = "Alice" }, 119new(ChatRole.User, "What's the biggest animal?") 442new(ChatRole.User, 603new(ChatRole.User, 705new(ChatRole.User, "Execute code and generate an image"), 847new(ChatRole.User, 932await foreach (var update in chatClient.GetStreamingResponseAsync([new(ChatRole.User, "Hello")], new ChatOptions { ModelId = "mymodel" })) 992await chatClient.GetResponseAsync([new(ChatRole.User, "Hello")]); 1037await foreach (var update in chatClient.GetStreamingResponseAsync([new(ChatRole.User, "Hello")])) 1046chatClient.GetResponseAsync([new(ChatRole.User, "Hello")])); 1091await foreach (var update in chatClient.GetStreamingResponseAsync([new(ChatRole.User, "Hello")]))
ChatCompletion\ReducingChatClientTests.cs (5)
38new(ChatRole.User, "Hello"), 40new(ChatRole.User, "What's the weather?") 46new(ChatRole.User, "What's the weather?") 98var reducedMessages = new List<ChatMessage> { new(ChatRole.User, "Reduced message") }; 119await client.GetResponseAsync(new List<ChatMessage> { new(ChatRole.User, "Original message") });
ChatReduction\MessageCountingChatReducerTests.cs (13)
54new ChatMessage(ChatRole.User, "Hello"), 56new ChatMessage(ChatRole.User, "How are you?"), 71Assert.Equal(ChatRole.User, m.Role); 89new ChatMessage(ChatRole.User, "Hello"), 92new ChatMessage(ChatRole.User, "How are you?"), 107Assert.Equal(ChatRole.User, m.Role); 127new ChatMessage(ChatRole.User, "What's the weather?"), 131new ChatMessage(ChatRole.User, "Thanks!"), 141Assert.Equal(ChatRole.User, m.Role); 167messages.Add(new ChatMessage(i % 2 == 0 ? ChatRole.User : ChatRole.Assistant, $"Message {i}")); 183var expectedRole = expectedIndex % 2 == 0 ? ChatRole.User : ChatRole.Assistant; 242new ChatMessage(ChatRole.User, "First"), 244new ChatMessage(ChatRole.User, "Third"),
ChatReduction\SummarizingChatReducerTests.cs (19)
70new ChatMessage(ChatRole.User, "Hello"), 72new ChatMessage(ChatRole.User, "How are you?"), 96new ChatMessage(ChatRole.User, "What's the time?"), 98new ChatMessage(ChatRole.User, "What's the weather?"), 101new ChatMessage(ChatRole.User, [new TestInputResponseContent("uir1")]), 141new ChatMessage(ChatRole.User, "First question"), 143new ChatMessage(ChatRole.User, "Second question"), 145new ChatMessage(ChatRole.User, "Third question"), 187new ChatMessage(ChatRole.User, "What's the weather in Seattle?"), 190new ChatMessage(ChatRole.User, [new TestInputResponseContent("uir2")]), 192new ChatMessage(ChatRole.User, "What about New York?"), 276new ChatMessage(ChatRole.User, "Message 1"), 278new ChatMessage(ChatRole.User, "Message 2"), 303new ChatMessage(ChatRole.User, "Hello"), 306new ChatMessage(ChatRole.User, "How are you?"), 330new ChatMessage(ChatRole.User, "Hi there! Can you tell me about golden retrievers?"), 332new ChatMessage(ChatRole.User, "What kind of exercise do they need?"), 334new ChatMessage(ChatRole.User, "Are they good with kids?"), 362messages.Add(new ChatMessage(ChatRole.User, "Do they make good lap dogs?"));
ChatRouting\FailoverChatClientTests.cs (40)
58? router.GetStreamingResponseAsync([new(ChatRole.User, "hi")]).ToChatResponseAsync() 59: router.GetResponseAsync([new(ChatRole.User, "hi")]); 83[new(ChatRole.User, "hi")], 86[new(ChatRole.User, "hi")], 106? router.GetStreamingResponseAsync([new(ChatRole.User, "hi")]).ToChatResponseAsync() 107: router.GetResponseAsync([new(ChatRole.User, "hi")]); 134() => router.GetResponseAsync([new(ChatRole.User, "hi")])); 165() => router.GetResponseAsync([new(ChatRole.User, "hi")])); 196() => router.GetResponseAsync([new(ChatRole.User, "hi")])); 225_ = await router.GetResponseAsync([new(ChatRole.User, "hi")], requestOptions); 276? await router.GetStreamingResponseAsync([new(ChatRole.User, "hi")], requestOptions).ToChatResponseAsync() 277: await router.GetResponseAsync([new(ChatRole.User, "hi")], requestOptions); 323? await router.GetStreamingResponseAsync([new(ChatRole.User, "hi")], requestOptions).ToChatResponseAsync() 324: await router.GetResponseAsync([new(ChatRole.User, "hi")], requestOptions); 352() => router.GetResponseAsync([new(ChatRole.User, "hi")])); 395ChatResponse response = await router.GetResponseAsync([new(ChatRole.User, "hi")]); 423_ = await router.GetResponseAsync([new(ChatRole.User, "hi")]); 446ChatResponse response = await router.GetResponseAsync([new(ChatRole.User, "hi")]); 474() => router.GetResponseAsync([new(ChatRole.User, "hi")])); 502ChatResponse? response = await router.GetResponseAsync([new(ChatRole.User, "hi")]); 529[new(ChatRole.User, "hi")], 557[new(ChatRole.User, "hi")], 590[new(ChatRole.User, "hi")], 628() => CollectAsync(router.GetStreamingResponseAsync([new(ChatRole.User, "hi")]))); 652await router.GetStreamingResponseAsync([new(ChatRole.User, "hi")]).ToChatResponseAsync(); 686[new(ChatRole.User, "hi")], 730[new(ChatRole.User, "hi")], 758ChatResponse response = await client.GetResponseAsync([new(ChatRole.User, "hi")]); 783await client.GetStreamingResponseAsync([new(ChatRole.User, "hi")]).ToChatResponseAsync(); 811await client.GetStreamingResponseAsync([new(ChatRole.User, "hi")]).ToChatResponseAsync(); 839() => CollectAsync(router.GetStreamingResponseAsync([new(ChatRole.User, "hi")]))); 862await router.GetStreamingResponseAsync([new(ChatRole.User, "hi")]).ToChatResponseAsync(); 885await router.GetStreamingResponseAsync([new(ChatRole.User, "hi")]).ToChatResponseAsync(); 916await router.GetStreamingResponseAsync([new(ChatRole.User, "hi")]).ToChatResponseAsync(); 955[new(ChatRole.User, "hi")], 1004await router.GetStreamingResponseAsync([new(ChatRole.User, "hi")]).ToChatResponseAsync(); 1042await foreach (ChatResponseUpdate update in router.GetStreamingResponseAsync([new(ChatRole.User, "hi")])) 1080await CollectAsync(router.GetStreamingResponseAsync([new(ChatRole.User, "hi")])); 1111await CollectAsync(router.GetStreamingResponseAsync([new(ChatRole.User, "hi")])); 1135await ConsumeOneAsync(router.GetStreamingResponseAsync([new(ChatRole.User, "hi")]));
ChatRouting\OrderedFailoverChatClientTests.cs (13)
49ChatResponse response = await client.GetResponseAsync([new(ChatRole.User, "hi")]); 80ChatResponse response = await client.GetResponseAsync([new(ChatRole.User, "hi")]); 101() => client.GetResponseAsync([new(ChatRole.User, "hi")])); 121() => client.GetResponseAsync([new(ChatRole.User, "hi")])); 144_ = await client.GetResponseAsync([new(ChatRole.User, "one")]); 145_ = await client.GetResponseAsync([new(ChatRole.User, "two")]); 183client.GetResponseAsync([new(ChatRole.User, index.ToString())])), 205client.GetStreamingResponseAsync([new(ChatRole.User, "hi")]).GetAsyncEnumerator()) 226ChatResponse response = await failover.GetResponseAsync([new(ChatRole.User, "hi")]); 262[new(ChatRole.User, "hi")], 288await client.GetStreamingResponseAsync([new(ChatRole.User, "hi")]).ToChatResponseAsync(); 315[new(ChatRole.User, "hi")], 362ChatResponse response = await outer.GetResponseAsync([new(ChatRole.User, "hi")]);
ChatRouting\SemanticRoutingChatClientTests.cs (4)
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")]); 211await router.GetResponseAsync([new(ChatRole.User, "unrelated query")]);
Realtime\OpenTelemetryRealtimeClientTests.cs (3)
1001var item = new RealtimeConversationItem([new TextContent("Hello from client")], role: ChatRole.User); 1010var item = new RealtimeConversationItem([new TextContent("User text message")], role: ChatRole.User); 1021var item = new RealtimeConversationItem([imageData], role: ChatRole.User);
Microsoft.Extensions.DataIngestion (2)
Processors\ImageAlternativeTextEnricher.cs (1)
99[_systemPrompt, new(ChatRole.User, contents)],
Utils\Batching.cs (1)
41new(ChatRole.User, contents)
Microsoft.Extensions.DataIngestion.Tests (6)
Processors\AlternativeTextEnricherTests.cs (2)
49Assert.Equal(ChatRole.User, materializedMessages[1].Role); 136Assert.Equal(ChatRole.User, materializedMessages[1].Role);
Processors\ClassificationEnricherTests.cs (1)
79Assert.Equal(ChatRole.User, materializedMessages[1].Role);
Processors\KeywordEnricherTests.cs (1)
79Assert.Equal(ChatRole.User, materializedMessages[1].Role);
Processors\SentimentEnricherTests.cs (1)
63Assert.Equal(ChatRole.User, materializedMessages[1].Role);
Processors\SummaryEnricherTests.cs (1)
63Assert.Equal(ChatRole.User, materializedMessages[1].Role);