127 references to Assistant
Aspire.Azure.AI.OpenAI.Tests (1)
AspireAzureOpenAIClientBuilderChatClientExtensionsTests.cs (1)
221=> Task.FromResult(new ChatCompletion(new ChatMessage(ChatRole.Assistant, "Hello from middleware")));
Aspire.OpenAI.Tests (1)
AspireOpenAIClientBuilderChatClientExtensionsTests.cs (1)
222=> Task.FromResult(new ChatCompletion(new ChatMessage(ChatRole.Assistant, "Hello from middleware")));
Microsoft.Extensions.AI (2)
ChatCompletion\FunctionInvokingChatClient.cs (1)
363ChatMessage functionCallMessage = new(ChatRole.Assistant, [.. functionCallContents]);
ChatCompletion\OpenTelemetryChatClient.cs (1)
414if (message.Role == ChatRole.Assistant)
Microsoft.Extensions.AI.Abstractions (3)
ChatCompletion\StreamingChatCompletionUpdate.cs (2)
27/// value must have the same value (e.g. <see cref="ChatRole.Assistant"/>. It should never be the case, for example, 28/// that one <see cref="StreamingChatCompletionUpdate"/> in a completion has a role of <see cref="ChatRole.Assistant"/>
ChatCompletion\StreamingChatCompletionUpdateExtensions.cs (1)
156entry.Value.Role = ChatRole.Assistant;
Microsoft.Extensions.AI.Abstractions.Tests (18)
ChatCompletion\ChatCompletionTests.cs (10)
130new ChatMessage(ChatRole.Assistant, "Choice1"), 131new ChatMessage(ChatRole.Assistant, "Choice2"), 132new ChatMessage(ChatRole.Assistant, "Choice3"), 133new ChatMessage(ChatRole.Assistant, "Choice4"), 154Assert.Equal(ChatRole.Assistant, result.Choices[i].Role); 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."), 239new ChatMessage(ChatRole.Assistant,
ChatCompletion\ChatMessageTests.cs (2)
35ChatMessage message = new(ChatRole.Assistant, text); 37Assert.Equal(ChatRole.Assistant, message.Role);
ChatCompletion\ChatRoleTests.cs (1)
48Assert.Equal("assistant", ChatRole.Assistant.Value);
ChatCompletion\StreamingChatCompletionUpdateExtensionsTests.cs (1)
89Assert.Equal(ChatRole.Assistant, message.Role);
ChatCompletion\StreamingChatCompletionUpdateTests.cs (4)
40update.Role = ChatRole.Assistant; 41Assert.Equal(ChatRole.Assistant, update.Role); 168Role = ChatRole.Assistant, 208Assert.Equal(ChatRole.Assistant, result.Role);
Microsoft.Extensions.AI.AzureAIInference (2)
AzureAIInferenceChatClient.cs (2)
274role.Equals(global::Azure.AI.Inference.ChatRole.Assistant) ? ChatRole.Assistant : 446else if (input.Role == ChatRole.Assistant)
Microsoft.Extensions.AI.AzureAIInference.Tests (8)
AzureAIInferenceChatClientTests.cs (8)
150Assert.Equal(ChatRole.Assistant, response.Message.Role); 220Assert.Equal(ChatRole.Assistant, updates[i].Role); 311new(ChatRole.Assistant, "hi, how are you?"), 328Assert.Equal(ChatRole.Assistant, response.Message.Role); 402new(ChatRole.Assistant, (string?)null), 412Assert.Equal(ChatRole.Assistant, response.Message.Role); 518Assert.Equal(ChatRole.Assistant, response.Message.Role); 619Assert.Equal(ChatRole.Assistant, updates[i].Role);
Microsoft.Extensions.AI.Integration.Tests (5)
ChatClientIntegrationTests.cs (2)
63new(ChatRole.Assistant, "Seattle"), 65new(ChatRole.Assistant, "Jakarta"),
PromptBasedFunctionCallingChatClient.cs (1)
73message.Role = ChatRole.Assistant;
ReducingChatClientTests.cs (2)
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."), 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."),
Microsoft.Extensions.AI.Ollama.Tests (7)
OllamaChatClientTests.cs (7)
122Assert.Equal(ChatRole.Assistant, response.Message.Role); 189Assert.Equal(ChatRole.Assistant, updates[i].Role); 261new(ChatRole.Assistant, "hi, how are you?"), 284Assert.Equal(ChatRole.Assistant, response.Message.Role); 373Assert.Equal(ChatRole.Assistant, response.Message.Role); 460new(ChatRole.Assistant, [new FunctionCallContent("abcd1234", "GetPersonAge", new Dictionary<string, object?> { ["personName"] = "Alice" })]), 471Assert.Equal(ChatRole.Assistant, response.Message.Role);
Microsoft.Extensions.AI.OpenAI (2)
OpenAIChatClient.cs (2)
379ChatMessageRole.Assistant => ChatRole.Assistant, 614else if (input.Role == ChatRole.Assistant)
Microsoft.Extensions.AI.OpenAI.Tests (12)
OpenAIChatClientTests.cs (12)
193Assert.Equal(ChatRole.Assistant, response.Message.Role); 267Assert.Equal(ChatRole.Assistant, updates[i].Role); 357new(ChatRole.Assistant, "hi, how are you?"), 374Assert.Equal(ChatRole.Assistant, response.Message.Role); 466Assert.Equal(ChatRole.Assistant, response.Message.Role); 549new(ChatRole.Assistant, (string?)null), 559Assert.Equal(ChatRole.Assistant, response.Message.Role); 666Assert.Equal(ChatRole.Assistant, response.Message.Role); 770Assert.Equal(ChatRole.Assistant, updates[i].Role); 889new(ChatRole.Assistant, 900new(ChatRole.Assistant, "You are great."), 910Assert.Equal(ChatRole.Assistant, response.Message.Role);
Microsoft.Extensions.AI.Tests (57)
ChatCompletion\ChatClientStructuredOutputExtensionsTests.cs (10)
20var expectedCompletion = new ChatCompletion([new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(expectedResult))]) 81var expectedCompletion = new ChatCompletion([new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(expectedResult))]); 113var expectedCompletion = new ChatCompletion([new ChatMessage(ChatRole.Assistant, "This is not valid JSON")]); 132var expectedCompletion = new ChatCompletion([new ChatMessage(ChatRole.Assistant, "null")]); 151var expectedCompletion = new ChatCompletion([new ChatMessage(ChatRole.Assistant, [new ImageContent("https://example.com")])]); 171var expectedCompletion = new ChatCompletion([new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(expectedResult))]); 213var expectedCompletion = new ChatCompletion([new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(expectedResult))]); 248var expectedCompletion = new ChatCompletion([new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(payload))]); 279var expectedCompletion = new ChatCompletion([new ChatMessage(ChatRole.Assistant, JsonSerializer.Serialize(expectedResult, jso))]); 325return Task.FromResult(new ChatCompletion([new ChatMessage(ChatRole.Assistant, resultDuplicatedJson)]));
ChatCompletion\DistributedCachingChatClientTest.cs (1)
113return new ChatCompletion([new(ChatRole.Assistant, "Hello")]);
ChatCompletion\FunctionInvokingChatClientTests.cs (38)
58new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 60new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 62new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]), 64new ChatMessage(ChatRole.Assistant, "world"), 89new ChatMessage(ChatRole.Assistant, 101new ChatMessage(ChatRole.Assistant, 111new ChatMessage(ChatRole.Assistant, "world"), 141new ChatMessage(ChatRole.Assistant, 151new ChatMessage(ChatRole.Assistant, "done"), 184new ChatMessage(ChatRole.Assistant, 194new ChatMessage(ChatRole.Assistant, "done"), 220new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 222new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 224new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]), 226new ChatMessage(ChatRole.Assistant, "world"), 232new ChatMessage(ChatRole.Assistant, "world") 272new ChatMessage(ChatRole.Assistant, [new TextContent("extra"), new FunctionCallContent("callId1", "Func1"), new TextContent("stuff")]), 274new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 276new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } }), new TextContent("more")]), 278new ChatMessage(ChatRole.Assistant, "world"), 287new ChatMessage(ChatRole.Assistant, [new TextContent("extra"), new TextContent("stuff")]), 288new ChatMessage(ChatRole.Assistant, "more"), 289new ChatMessage(ChatRole.Assistant, "world"), 295new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 297new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 299new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]), 301new ChatMessage(ChatRole.Assistant, "extrastuffmoreworld"), 305new ChatMessage(ChatRole.Assistant, "extrastuffmoreworld"), 338new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 340new ChatMessage(ChatRole.Assistant, "world"), 358new(ChatRole.Assistant, [new FunctionCallContent("callId1", func1.Metadata.Name)]), 359new(ChatRole.Assistant, [new FunctionCallContent("callId2", func2.Metadata.Name)]), 397new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["arg1"] = "value1" })]), 399new ChatMessage(ChatRole.Assistant, "world"), 453new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["arg1"] = "value1" })]), 455new ChatMessage(ChatRole.Assistant, "world"), 520return new ChatCompletion(new ChatMessage(ChatRole.Assistant, [.. plan[contents.Count].Contents])); 587return YieldAsync(new ChatCompletion(new ChatMessage(ChatRole.Assistant, [.. plan[contents.Count].Contents])).ToStreamingChatCompletionUpdates());
ChatCompletion\LoggingChatClientTests.cs (1)
40return Task.FromResult(new ChatCompletion([new(ChatRole.Assistant, "blue whale")]));
ChatCompletion\OpenTelemetryChatClientTests.cs (4)
42return new ChatCompletion([new ChatMessage(ChatRole.Assistant, "The blue whale, I think.")]) 67Role = ChatRole.Assistant, 102new(ChatRole.Assistant, [new FunctionCallContent("12345", "GetPersonName")]), 104new(ChatRole.Assistant, "Hey John, what's up?"),
ChatCompletion\UseDelegateChatClientTests.cs (3)
50return Task.FromResult(new ChatCompletion(new ChatMessage(ChatRole.Assistant, "hello"))); 99return Task.FromResult(new ChatCompletion(new ChatMessage(ChatRole.Assistant, "hello"))); 192return Task.FromResult(new ChatCompletion(new ChatMessage(ChatRole.Assistant, "non-streaming hello")));
Microsoft.ML.GenAI.Core (2)
CausalLMPipelineChatClient.cs (2)
48var chatMessage = new ChatMessage(ChatRole.Assistant, output); 74Role = ChatRole.Assistant,
Microsoft.ML.GenAI.Core.Tests (1)
CasualLMDatasetTest.cs (1)
93new ChatMessage(ChatRole.Assistant, "Contoso is a company"),
Microsoft.ML.GenAI.LLaMA (2)
Llama3_1ChatTemplateBuilder.cs (2)
93var availableRoles = new[] { ChatRole.System, ChatRole.User, ChatRole.Assistant }; 114_ when message.Role == ChatRole.Assistant => $"<|start_header_id|>assistant<|end_header_id|>{Newline}{content.Trim()}<|eot_id|>{Newline}",
Microsoft.ML.GenAI.LLaMA.Tests (1)
LLaMA3_1Tests.cs (1)
136new ChatMessage(ChatRole.Assistant, "World!"),
Microsoft.ML.GenAI.Phi (2)
Phi3\Phi3ChatTemplateBuilder.cs (2)
94var availableRoles = new[] { ChatRole.System, ChatRole.User, ChatRole.Assistant }; 117_ when message.Role == ChatRole.Assistant => $"<|assistant|>{Newline}{content}<|end|>{Newline}",
Microsoft.ML.GenAI.Samples (1)
Llama\SFT_Llama_3_2_1B.cs (1)
111var assistantMessage = new ChatMessage(ChatRole.Assistant, data.output);