526 references to User
Aspire.Dashboard (25)
Model\Assistant\AssistantChatViewModel.cs (1)
884chatViewModel.AddChatMessage(new ChatMessage(ChatRole.User, promptText));
Model\Assistant\Prompts\KnownChatMessages.cs (24)
67return new(ChatRole.User, resolvedPromptText); 78return new(ChatRole.User, prompt); 89return new(ChatRole.User, prompt); 99return new(ChatRole.User, message); 112return new(ChatRole.User, prompt); 122return new(ChatRole.User, prompt); 133return new(ChatRole.User, prompt); 142return new(ChatRole.User, prompt); 155return new(ChatRole.User, prompt); 165return new(ChatRole.User, prompt); 174return new(ChatRole.User, prompt); 196return new(ChatRole.User, prompt); 214return new(ChatRole.User, prompt); 224return new(ChatRole.User, prompt); 234return new(ChatRole.User, prompt); 243return new(ChatRole.User, prompt); 255return new(ChatRole.User, message); 264return new(ChatRole.User, message); 274return new ChatMessage(ChatRole.User, message); 284return new ChatMessage(ChatRole.User, message); 311return new(ChatRole.User, prompt); 338return new(ChatRole.User, prompt); 356return new(ChatRole.User, prompt); 365return new(ChatRole.User, prompt);
Microsoft.AspNetCore.Components.AI (3)
Components\MessageInput.cs (1)
158await _agentContext.SendMessageAsync(new ChatMessage(ChatRole.User, text));
Components\MessageListContext.cs (1)
40var role = block.Role == ChatRole.User ? "user" : "assistant";
Engine\AgentContext.cs (1)
64return SendMessageAsync(new ChatMessage(ChatRole.User, text), cancellationToken);
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, 293Role = ChatRole.User, 302Assert.Equal(ChatRole.User, clone.Role); 346Role = ChatRole.User, 360Assert.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)
ChatMessageUtilities.cs (1)
12=> new ChatMessage(ChatRole.User, message);
SafetyEvaluatorTests.cs (3)
337Role = ChatRole.User, 409Role = ChatRole.User, 458Role = ChatRole.User,
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 (6)
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 (7)
MicrosoftExtensionsAIChatExtensions.cs (1)
206resultMessage.Role = ChatRole.User;
OpenAIAssistantsChatClient.cs (1)
253ChatResponseUpdate textUpdate = new(mcu.Role == MessageRole.User ? ChatRole.User : ChatRole.Assistant, mcu.Text)
OpenAIChatClient.cs (2)
169input.Role == ChatRole.User || 756ChatMessageRole.User => ChatRole.User,
OpenAIRealtimeClientSession.cs (1)
1163: messageItem.Role == Sdk.RealtimeMessageRole.User ? ChatRole.User
OpenAIResponsesChatClient.cs (2)
921MessageRole.User => ChatRole.User, 1305if (input.Role == ChatRole.User)
Microsoft.Extensions.AI.OpenAI.Tests (49)
OpenAIChatClientTests.cs (10)
822new(ChatRole.User, "hello!"), 824new(ChatRole.User, "i'm good. how are you?"), 929new(ChatRole.User, "hello!"), 1025new(ChatRole.User, "hello!"), 1027new(ChatRole.User, "i'm good. how are you?"), 1468new(ChatRole.User, "hello!"), 1481new(ChatRole.User, "Thanks!"), 1587new(ChatRole.User, 1764Assert.Equal(ChatRole.User, extMessages[0].Role); 1818Assert.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 (19)
648chatHistory.Add(new ChatMessage(ChatRole.User, "Are you sure?")); 897var response = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "Search the web for the temperature today in Fremont")], chatOptions); 993await foreach (var update in client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "Search the web for the temperature today in Fremont")], chatOptions)) 4822new ChatMessage(ChatRole.User, "test"), 4878new ChatMessage(ChatRole.User, "test"), 4940new ChatMessage(ChatRole.User, "test"), 4997new ChatMessage(ChatRole.User, "test"), 5054new ChatMessage(ChatRole.User, "test"), 5113new ChatMessage(ChatRole.User, "test"), 5176new ChatMessage(ChatRole.User, "test"), 5231new ChatMessage(ChatRole.User, "test"), 5286new ChatMessage(ChatRole.User, "test"), 5343new ChatMessage(ChatRole.User, "test"), 5400new ChatMessage(ChatRole.User, "test"), 5569new ChatMessage(ChatRole.User, [ 5819[new ChatMessage(ChatRole.User, "test")], 6128var response = await client.GetResponseAsync([new ChatMessage(ChatRole.User, "")]); 6227var userMessage = response.Messages.FirstOrDefault(m => m.Role == ChatRole.User); 6290var userMessage = response.Messages.FirstOrDefault(m => m.Role == ChatRole.User);
Microsoft.Extensions.AI.Tests (286)
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 (80)
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, 1467List<ChatMessage> input = [new ChatMessage(ChatRole.User, "hello")]; 1543List<ChatMessage> input = [new ChatMessage(ChatRole.User, "hello")]; 1641List<ChatMessage> input = [new ChatMessage(ChatRole.User, "hello")]; 1685new ChatMessage(ChatRole.User, "hello"), 1690new ChatMessage(ChatRole.User, 1736new ChatMessage(ChatRole.User, "hello"), 1779new ChatMessage(ChatRole.User, "hello"), 1785new ChatMessage(ChatRole.User, 1794new ChatMessage(ChatRole.User, "hello"), 1807new ChatMessage(ChatRole.User, 1863new ChatMessage(ChatRole.User, "hello"), 1869new ChatMessage(ChatRole.User, 1877new ChatMessage(ChatRole.User, "hello"), 1892new ChatMessage(ChatRole.User,
ChatCompletion\FunctionInvokingChatClientTests.cs (72)
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")]; 1449new ChatMessage(ChatRole.User, "hello"), 1478new ChatMessage(ChatRole.User, "hello"), 1531new(ChatRole.User, "hello"), 1550new(ChatRole.User, "hello"), 1579new(ChatRole.User, "hello"), 1608new(ChatRole.User, "hi"), 1681new ChatMessage(ChatRole.User, "hello"), 1762[new ChatMessage(ChatRole.User, "hello")], options)) 1792new ChatMessage(ChatRole.User, "hello"), 1834new ChatMessage(ChatRole.User, "hello"), 1884new ChatMessage(ChatRole.User, "hello"), 1956new ChatMessage(ChatRole.User, "hello"), 2005new ChatMessage(ChatRole.User, "hello"), 2056? await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "hello")], options).ToChatResponseAsync() 2057: await client.GetResponseAsync([new ChatMessage(ChatRole.User, "hello")], options); 2127? await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "hello")], options).ToChatResponseAsync() 2128: await client.GetResponseAsync([new ChatMessage(ChatRole.User, "hello")], options); 2174var response = await client2.GetResponseAsync([new ChatMessage(ChatRole.User, "hello")], options); 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); 3257new ChatMessage(ChatRole.User, "hello"), 3287new ChatMessage(ChatRole.User, "hello"), 3323new ChatMessage(ChatRole.User, "hello"), 3352new ChatMessage(ChatRole.User, "hello"), 3359new ChatMessage(ChatRole.User, "hello"), 3395new ChatMessage(ChatRole.User, "hello"), 3400new ChatMessage(ChatRole.User, 3432new ChatMessage(ChatRole.User, "hello"), 3437new ChatMessage(ChatRole.User, 3492? await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "hello")], options).ToChatResponseAsync() 3493: await client.GetResponseAsync([new ChatMessage(ChatRole.User, "hello")], options); 3569? await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "hello")], options).ToChatResponseAsync() 3570: await client.GetResponseAsync([new ChatMessage(ChatRole.User, "hello")], options); 3632? await client.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "hello")], options).ToChatResponseAsync() 3633: 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);
Microsoft.ML.GenAI.Core.Tests (1)
CausalLMDatasetTest.cs (1)
87new ChatMessage(ChatRole.User, "What is contoso"),
Microsoft.ML.GenAI.LLaMA (2)
Llama3_1ChatTemplateBuilder.cs (2)
93var availableRoles = new[] { ChatRole.System, ChatRole.User, ChatRole.Assistant }; 113_ when message.Role == ChatRole.User => $"<|start_header_id|>user<|end_header_id|>{Newline}{content.Trim()}<|eot_id|>{Newline}",
Microsoft.ML.GenAI.LLaMA.Tests (1)
LLaMA3_1Tests.cs (1)
135new ChatMessage(ChatRole.User, "Hello?"),
Microsoft.ML.GenAI.Phi (2)
Phi3\Phi3ChatTemplateBuilder.cs (2)
94var availableRoles = new[] { ChatRole.System, ChatRole.User, ChatRole.Assistant }; 116_ when message.Role == ChatRole.User => $"<|user|>{Newline}{content}<|end|>{Newline}",
Microsoft.ML.GenAI.Samples (3)
Llama\SFT_Llama_3_2_1B.cs (1)
108new ChatMessage(ChatRole.User, data.input),
MEAI\Llama3_1.cs (1)
47var chatMessage = new ChatMessage(ChatRole.User, task);
MEAI\Phi3.cs (1)
37var chatMessage = new ChatMessage(ChatRole.User, task);