89 references to ChatMessage
Aspire.Azure.AI.OpenAI.Tests (1)
Aspire.OpenAI.Tests (1)
Microsoft.Extensions.AI (3)
ChatCompletion\ChatClientStructuredOutputExtensions.cs (3)
70CompleteAsync<T>(chatClient, [new ChatMessage(ChatRole.User, chatMessage)], options, useNativeJsonSchema, cancellationToken);
92CompleteAsync<T>(chatClient, [new ChatMessage(ChatRole.User, chatMessage)], serializerOptions, options, useNativeJsonSchema, cancellationToken);
174promptAugmentation = new ChatMessage(ChatRole.User, $$"""
Microsoft.Extensions.AI.Abstractions (2)
Microsoft.Extensions.AI.Abstractions.Tests (10)
ChatCompletion\ChatCompletionTests.cs (9)
130new ChatMessage(ChatRole.Assistant, "Choice1"),
131new ChatMessage(ChatRole.Assistant, "Choice2"),
132new ChatMessage(ChatRole.Assistant, "Choice3"),
133new ChatMessage(ChatRole.Assistant, "Choice4"),
176new ChatMessage(ChatRole.Assistant, "This is a test." + Environment.NewLine + "It's multiple lines.")
187new ChatMessage(ChatRole.Assistant, "This is a test." + Environment.NewLine + "It's multiple lines."),
188new ChatMessage(ChatRole.Assistant, "So is" + Environment.NewLine + " this."),
189new ChatMessage(ChatRole.Assistant, "And this."),
208ChatCompletion completion = new(new ChatMessage(new ChatRole("customRole"), "Text"))
Microsoft.Extensions.AI.Integration.Tests (9)
ReducingChatClientTests.cs (5)
47new ChatMessage(ChatRole.User, "Hi there! Can you tell me about golden retrievers?"),
48new ChatMessage(ChatRole.Assistant, "Of course! Golden retrievers are known for their friendly and tolerant attitudes. They're great family pets and are very intelligent and easy to train."),
49new ChatMessage(ChatRole.User, "What kind of exercise do they need?"),
50new ChatMessage(ChatRole.Assistant, "Golden retrievers are quite active and need regular exercise. Daily walks, playtime, and activities like fetching or swimming are great for them."),
51new ChatMessage(ChatRole.User, "Are they good with kids?"),
Microsoft.Extensions.AI.Tests (51)
ChatCompletion\ChatClientStructuredOutputExtensionsTests.cs (13)
56var chatHistory = new List<ChatMessage> { new(ChatRole.User, "Hello") };
81var expectedCompletion = new ChatCompletion([new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(expectedResult))]);
113var expectedCompletion = new ChatCompletion([new ChatMessage(ChatRole.Assistant, "This is not valid JSON")]);
119var chatHistory = new List<ChatMessage> { new(ChatRole.User, "Hello") };
132var expectedCompletion = new ChatCompletion([new ChatMessage(ChatRole.Assistant, "null")]);
138var chatHistory = new List<ChatMessage> { new(ChatRole.User, "Hello") };
157var chatHistory = new List<ChatMessage> { new(ChatRole.User, "Hello") };
193var chatHistory = new List<ChatMessage> { new(ChatRole.User, "Hello") };
227var chatHistory = new List<ChatMessage> { new(ChatRole.User, "Hello") };
248var expectedCompletion = new ChatCompletion([new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(payload))]);
255var chatHistory = new List<ChatMessage> { new(ChatRole.User, "Hello") };
301var chatHistory = new List<ChatMessage> { new(ChatRole.User, "Hello") };
329var chatHistory = new List<ChatMessage> { new(ChatRole.User, "Hello") };
ChatCompletion\FunctionInvokingChatClientTests.cs (28)
57new ChatMessage(ChatRole.User, "hello"),
64new ChatMessage(ChatRole.Assistant, "world"),
88new ChatMessage(ChatRole.User, "hello"),
111new ChatMessage(ChatRole.Assistant, "world"),
140new ChatMessage(ChatRole.User, "hello"),
151new ChatMessage(ChatRole.Assistant, "done"),
183new ChatMessage(ChatRole.User, "hello"),
194new ChatMessage(ChatRole.Assistant, "done"),
219new ChatMessage(ChatRole.User, "hello"),
226new ChatMessage(ChatRole.Assistant, "world"),
231new ChatMessage(ChatRole.User, "hello"),
232new ChatMessage(ChatRole.Assistant, "world")
271new ChatMessage(ChatRole.User, "hello"),
278new ChatMessage(ChatRole.Assistant, "world"),
286new ChatMessage(ChatRole.User, "hello"),
288new ChatMessage(ChatRole.Assistant, "more"),
289new ChatMessage(ChatRole.Assistant, "world"),
294new ChatMessage(ChatRole.User, "hello"),
301new ChatMessage(ChatRole.Assistant, "extrastuffmoreworld"),
304new ChatMessage(ChatRole.User, "hello"),
305new ChatMessage(ChatRole.Assistant, "extrastuffmoreworld"),
337new ChatMessage(ChatRole.User, "hello"),
340new ChatMessage(ChatRole.Assistant, "world"),
375List<ChatMessage> chat = [new ChatMessage(ChatRole.User, "hello")];
396new ChatMessage(ChatRole.User, "hello"),
399new ChatMessage(ChatRole.Assistant, "world"),
452new ChatMessage(ChatRole.User, "hello"),
455new ChatMessage(ChatRole.Assistant, "world"),
Microsoft.ML.GenAI.Core (1)
Microsoft.ML.GenAI.Core.Tests (3)
Microsoft.ML.GenAI.LLaMA.Tests (3)
Microsoft.ML.GenAI.Samples (5)