379 references to Assistant
Aspire.Azure.AI.OpenAI.Tests (1)
AspireAzureOpenAIClientBuilderChatClientExtensionsTests.cs (1)
221
=> Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Hello from middleware")));
Aspire.Dashboard (3)
Model\Assistant\AIHelpers.cs (1)
398
list.Add(new ChatMessage(update.Role ?? ChatRole.
Assistant
, contentsList)
Model\Assistant\AssistantChatViewModel.cs (2)
565
var assistantMessage = new ChatMessage(ChatRole.
Assistant
, responseText.ToString());
602
var assistantMessage = new ChatMessage(ChatRole.
Assistant
, responseText.ToString());
Aspire.OpenAI.Tests (1)
AspireOpenAIClientBuilderChatClientExtensionsTests.cs (1)
269
=> Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Hello from middleware")));
AzureAIFoundryEndToEnd.WebStory (1)
Components_Pages_Home_razor.g.cs (1)
110
foreach (var message in chatMessages.Where(m => m.Role == ChatRole.
Assistant
))
AzureOpenAIEndToEnd.WebStory (1)
Components_Pages_Home_razor.g.cs (1)
110
foreach (var message in chatMessages.Where(m => m.Role == ChatRole.
Assistant
))
GitHubModelsEndToEnd.WebStory (1)
Components_Pages_Home_razor.g.cs (1)
110
foreach (var message in chatMessages.Where(m => m.Role == ChatRole.
Assistant
))
Microsoft.Extensions.AI (5)
ChatCompletion\FunctionInvokingChatClient.cs (1)
1459
ChatMessage functionCallMessage = resultWithRequestMessage.RequestMessage?.Clone() ?? new() { Role = ChatRole.
Assistant
};
ChatCompletion\OpenTelemetryChatClient.cs (1)
236
message.Role == ChatRole.
Assistant
? "assistant" :
ChatCompletion\OpenTelemetryImageGenerator.cs (1)
254
OpenTelemetryChatClient.SerializeChatMessages([new(ChatRole.
Assistant
, contents)]));
ChatReduction\SummarizingChatReducer.cs (2)
150
yield return new ChatMessage(ChatRole.
Assistant
, summary);
163
yield return new ChatMessage(ChatRole.
Assistant
, summary);
Microsoft.Extensions.AI.Abstractions (2)
ChatCompletion\ChatResponseExtensions.cs (2)
86
list.Add(new(update.Role ?? ChatRole.
Assistant
, contentsList)
331
message = new(ChatRole.
Assistant
, []);
Microsoft.Extensions.AI.Abstractions.Tests (25)
ChatCompletion\ChatClientExtensionsTests.cs (1)
146
return YieldAsync([new ChatResponseUpdate(ChatRole.
Assistant
, "world")]);
ChatCompletion\ChatMessageTests.cs (2)
36
ChatMessage message = new(ChatRole.
Assistant
, text);
38
Assert.Equal(ChatRole.
Assistant
, message.Role);
ChatCompletion\ChatResponseTests.cs (3)
87
ChatResponse original = new(new ChatMessage(ChatRole.
Assistant
, "the message"))
103
Assert.Equal(ChatRole.
Assistant
, result.Messages.Single().Role);
122
ChatResponse response = new(new ChatMessage(ChatRole.
Assistant
, $"This is a test.{Environment.NewLine}It's multiple lines."));
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (14)
30
new(ChatRole.
Assistant
, "Hello") { ResponseId = "someResponse", MessageId = "12345", CreatedAt = new DateTimeOffset(1, 2, 3, 4, 5, 6, TimeSpan.Zero), ModelId = "model123" },
31
new(ChatRole.
Assistant
, ", ") { AuthorName = "Someone", AdditionalProperties = new() { ["a"] = "b" } },
55
Assert.Equal(ChatRole.
Assistant
, message.Role);
75
new(ChatRole.
Assistant
, "a") { MessageId = "1" },
76
new(ChatRole.
Assistant
, "b") { MessageId = "2" },
79
new(ChatRole.
Assistant
, "e") { MessageId = "3" },
96
Assert.Equal(ChatRole.
Assistant
, response.Messages[0].Role);
99
Assert.Equal(ChatRole.
Assistant
, response.Messages[1].Role);
105
Assert.Equal(ChatRole.
Assistant
, response.Messages[3].Role);
120
Assert.Equal(ChatRole.
Assistant
, response.Messages[8].Role);
133
new(ChatRole.
Assistant
, "Hello") { MessageId = "msg1", CreatedAt = new DateTimeOffset(2024, 1, 1, 10, 0, 0, TimeSpan.Zero), AuthorName = "Assistant" },
143
new(ChatRole.
Assistant
, "I'm doing well,") { MessageId = "msg3", CreatedAt = new DateTimeOffset(2024, 1, 1, 12, 0, 0, TimeSpan.Zero) },
160
Assert.Equal(ChatRole.
Assistant
, message1.Role);
176
Assert.Equal(ChatRole.
Assistant
, message3.Role);
ChatCompletion\ChatResponseUpdateTests.cs (4)
40
update.Role = ChatRole.
Assistant
;
41
Assert.Equal(ChatRole.
Assistant
, update.Role);
118
Role = ChatRole.
Assistant
,
158
Assert.Equal(ChatRole.
Assistant
, result.Role);
ChatCompletion\ChatRoleTests.cs (1)
48
Assert.Equal("assistant", ChatRole.
Assistant
.Value);
Microsoft.Extensions.AI.AzureAIInference (2)
AzureAIInferenceChatClient.cs (2)
264
role.Equals(global::Azure.AI.Inference.ChatRole.Assistant) ? ChatRole.
Assistant
:
478
else if (input.Role == ChatRole.
Assistant
)
Microsoft.Extensions.AI.AzureAIInference.Tests (9)
AzureAIInferenceChatClientTests.cs (9)
158
Assert.Equal(ChatRole.
Assistant
, response.Messages.Single().Role);
241
Assert.Equal(ChatRole.
Assistant
, updates[i].Role);
988
new(ChatRole.
Assistant
, "hi, how are you?"),
990
new(ChatRole.
Assistant
, [new FunctionCallContent("abcd123", "GetMood")]),
1007
Assert.Equal(ChatRole.
Assistant
, response.Messages.Single().Role);
1132
new(ChatRole.
Assistant
, (string?)null),
1142
Assert.Equal(ChatRole.
Assistant
, response.Messages.Single().Role);
1258
Assert.Equal(ChatRole.
Assistant
, response.Messages.Single().Role);
1354
Assert.Equal(ChatRole.
Assistant
, updates[i].Role);
Microsoft.Extensions.AI.Evaluation (2)
EvaluatorExtensions.cs (2)
51
modelResponse: new ChatMessage(ChatRole.
Assistant
, modelResponse),
96
modelResponse: new ChatMessage(ChatRole.
Assistant
, modelResponse),
Microsoft.Extensions.AI.Evaluation.Integration.Tests (4)
SafetyEvaluatorTests.cs (3)
376
Role = ChatRole.
Assistant
,
423
Role = ChatRole.
Assistant
,
472
Role = ChatRole.
Assistant
,
test\Libraries\Microsoft.Extensions.AI.Evaluation.Tests\ChatMessageUtilities.cs (1)
15
=> new ChatMessage(ChatRole.
Assistant
, message);
Microsoft.Extensions.AI.Evaluation.NLP.Tests (17)
BLEUEvaluatorTests.cs (6)
18
var response = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "The quick brown fox jumps over the lazy dog."));
34
var response = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Completely unrelated sentence."));
49
var response = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Some text."));
69
var response = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, hypothesis));
89
var response = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, hypothesis));
102
var response = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, ""));
F1EvaluatorTests.cs (5)
18
var response = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "The quick brown fox jumps over the lazy dog."));
34
var response = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Completely unrelated sentence."));
49
var response = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Some text."));
69
var response = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, hypothesis));
82
var response = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, ""));
GLEUEvaluatorTests.cs (6)
18
var response = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "The quick brown fox jumps over the lazy dog."));
34
var response = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Completely unrelated sentence."));
49
var response = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Some text."));
69
var response = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, hypothesis));
89
var response = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, hypothesis));
102
var response = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, ""));
Microsoft.Extensions.AI.Evaluation.Reporting (2)
ScenarioRunExtensions.cs (2)
36
modelResponse: new ChatMessage(ChatRole.
Assistant
, modelResponse),
66
modelResponse: new ChatMessage(ChatRole.
Assistant
, modelResponse),
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (3)
ResultStoreTester.cs (1)
35
modelResponse: new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "LLM response")),
ScenarioRunResultTests.cs (2)
88
modelResponse: new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "response")),
180
modelResponse: new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "response")),
Microsoft.Extensions.AI.Evaluation.Safety (5)
ContentSafetyChatClient.cs (2)
67
return new ChatResponse(new ChatMessage(ChatRole.
Assistant
, annotationResult))
100
yield return new ChatResponseUpdate(ChatRole.
Assistant
, annotationResult)
ContentSafetyServicePayloadUtilities.cs (3)
429
else if (message.Role == ChatRole.
Assistant
)
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)
15
=> new ChatMessage(ChatRole.
Assistant
, message);
Microsoft.Extensions.AI.Integration.Tests (25)
ChatClientIntegrationTests.cs (22)
70
new(ChatRole.
Assistant
, "Seattle"),
72
new(ChatRole.
Assistant
, "Jakarta"),
89
new(ChatRole.
Assistant
, []),
168
Assert.Equal(ChatRole.
Assistant
, history[1].Role);
1138
new(ChatRole.
Assistant
, "Nice to meet you, Alice! Hiking in the mountains sounds wonderful. Do you have a favorite trail?"),
1140
new(ChatRole.
Assistant
, "The Pacific Crest Trail is amazing! Which section did you hike?"),
1142
new(ChatRole.
Assistant
, "The Sierra Nevada section is known for its stunning views. How long did it take you?"),
1155
Assert.Equal(ChatRole.
Assistant
, m.Role); // Indicates this is the assistant's summary
1180
new(ChatRole.
Assistant
, "Ahoy matey! The weather be fine today, with clear skies on the horizon!"),
1182
new(ChatRole.
Assistant
, "Arr, tomorrow be lookin' a bit cloudy, might be some rain blowin' in from the east!"),
1184
new(ChatRole.
Assistant
, "Aye, ye best be bringin' yer umbrella, unless ye want to be soaked like a barnacle!"),
1200
m => Assert.Equal(ChatRole.
Assistant
, m.Role), // Summary message
1240
new(ChatRole.
Assistant
, "Let me check the weather in Seattle for you."),
1242
new(ChatRole.
Assistant
, "I'll check Miami's weather as well."),
1274
new(ChatRole.
Assistant
, "Nice to meet you, Bob! Working at a startup must be exciting. What kind of software do you develop?"),
1276
new(ChatRole.
Assistant
, "That sounds impactful! AI in education has so much potential."),
1278
new(ChatRole.
Assistant
, "Personalized learning is the future of education!"),
1295
Assert.Equal(ChatRole.
Assistant
, m.Role); // Summary
1320
new(ChatRole.
Assistant
, "That's 5 pets total! You must have a lively household."),
1322
new(ChatRole.
Assistant
, "That's a significant expense, but I'm sure they're worth it!"),
1324
new(ChatRole.
Assistant
, "That's quite a bit of food for your furry friends!"),
1337
Assert.Equal(ChatRole.
Assistant
, summaryMessage.Role);
PromptBasedFunctionCallingChatClient.cs (1)
77
chatMessagesList[messageIndex] = new ChatMessage(ChatRole.
Assistant
, $"<tool_call_json>{toolCallJson}</tool_call_json>");
ReducingChatClientTests.cs (2)
47
new 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."),
49
new 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.OpenAI (10)
OpenAIAssistantsChatClient.cs (4)
177
Role = ChatRole.
Assistant
,
204
ChatResponseUpdate textUpdate = new(mcu.Role == MessageRole.User ? ChatRole.User : ChatRole.
Assistant
, mcu.Text)
260
Role = ChatRole.
Assistant
,
499
chatMessage.Role == ChatRole.
Assistant
? MessageRole.Assistant : MessageRole.User,
OpenAIChatClient.cs (2)
187
else if (input.Role == ChatRole.
Assistant
)
676
ChatMessageRole.Assistant => ChatRole.
Assistant
,
OpenAIResponsesChatClient.cs (4)
148
message ??= new(ChatRole.
Assistant
, (string?)null);
285
lastRole = ChatRole.
Assistant
;
388
_ => ChatRole.
Assistant
,
633
if (input.Role == ChatRole.
Assistant
)
Microsoft.Extensions.AI.OpenAI.Tests (55)
OpenAIChatClientTests.cs (14)
164
Assert.Equal(ChatRole.
Assistant
, response.Messages.Single().Role);
252
Assert.Equal(ChatRole.
Assistant
, updates[i].Role);
821
new(ChatRole.
Assistant
, "hi, how are you?"),
838
Assert.Equal(ChatRole.
Assistant
, response.Messages.Single().Role);
936
Assert.Equal(ChatRole.
Assistant
, response.Messages.Single().Role);
1024
new(ChatRole.
Assistant
, (string?)null),
1034
Assert.Equal(ChatRole.
Assistant
, response.Messages.Single().Role);
1147
Assert.Equal(ChatRole.
Assistant
, response.Messages.Single().Role);
1231
Assert.Equal(ChatRole.
Assistant
, response.Messages.Single().Role);
1341
Assert.Equal(ChatRole.
Assistant
, updates[i].Role);
1466
new(ChatRole.
Assistant
,
1477
new(ChatRole.
Assistant
, "You are great."),
1487
Assert.Equal(ChatRole.
Assistant
, response.Messages.Single().Role);
1601
Assert.Equal(ChatRole.
Assistant
, response.Messages.Single().Role);
OpenAIConversionTests.cs (35)
163
new(ChatRole.
Assistant
,
173
new(ChatRole.
Assistant
, "The answer is 42.") { AuthorName = "@#$#$@$" },
232
new(ChatRole.
Assistant
,
242
new(ChatRole.
Assistant
, "The answer is 42."),
334
Assert.Equal(ChatRole.
Assistant
, message.Role);
409
new(ChatRole.
Assistant
, "Hi there!")
419
Assert.Equal(ChatRole.
Assistant
, message.Role);
435
new(ChatRole.
Assistant
,
448
Assert.Equal(ChatRole.
Assistant
, message.Role);
471
var chatResponse = new ChatResponse(new ChatMessage(ChatRole.
Assistant
,
510
var chatResponse = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Hello"));
540
var chatResponse = new ChatResponse(new ChatMessage(ChatRole.
Assistant
,
585
var chatResponse = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Test"))
600
(ChatRole.
Assistant
, ChatMessageRole.Assistant),
646
var responseUpdate = new ChatResponseUpdate(ChatRole.
Assistant
, "Hello")
664
var responseUpdate = new ChatResponseUpdate(ChatRole.
Assistant
, "Hello, world!")
732
var responseUpdate = new ChatResponseUpdate(ChatRole.
Assistant
, [functionCallContent])
767
var responseUpdate = new ChatResponseUpdate(ChatRole.
Assistant
, [functionCall1, functionCall2])
795
var responseUpdate = new ChatResponseUpdate(ChatRole.
Assistant
,
835
(ChatRole.
Assistant
, ChatMessageRole.Assistant),
869
var responseUpdate = new ChatResponseUpdate(ChatRole.
Assistant
, "Test")
890
new ChatResponseUpdate(ChatRole.
Assistant
, "Hello, ")
897
new ChatResponseUpdate(ChatRole.
Assistant
, "world!")
947
var chatResponse = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Test"))
960
var chatResponse = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Hello, world!"))
985
var chatResponse = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Test message"))
1035
new(ChatRole.
Assistant
, "First message"),
1036
new(ChatRole.
Assistant
, "Second message"),
1037
new(ChatRole.
Assistant
,
1072
new(ChatRole.
Assistant
,
1078
new(ChatRole.
Assistant
, "The weather in Seattle is sunny!")
1109
new(ChatRole.
Assistant
, "I'm doing well, thank you for asking!")
1134
var chatResponse = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Default test"));
1152
var chatResponse = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Model test"));
1167
var chatResponse = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Model priority test"))
OpenAIResponseClientTests.cs (6)
160
Assert.Equal(ChatRole.
Assistant
, response.Messages.Single().Role);
457
Assert.Equal(ChatRole.
Assistant
, updates[i].Role);
817
Assert.Equal(ChatRole.
Assistant
, response.Messages[0].Role);
819
Assert.Equal(ChatRole.
Assistant
, response.Messages[1].Role);
1058
Assert.Equal(ChatRole.
Assistant
, response.Messages[0].Role);
1472
Assert.Equal(ChatRole.
Assistant
, response.Messages[0].Role);
Microsoft.Extensions.AI.Tests (194)
ChatCompletion\ChatClientStructuredOutputExtensionsTests.cs (12)
23
var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, JsonSerializer.Serialize(expectedResult, JsonContext2.Default.Animal)))
100
var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, JsonSerializer.Serialize(expectedResult, JsonContext2.Default.Options)))
161
var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, JsonSerializer.Serialize(expectedResult, JsonContext2.Default.Options)));
198
new ChatMessage(ChatRole.
Assistant
,
204
new ChatMessage(ChatRole.
Assistant
, JsonSerializer.Serialize(expectedResult, JsonContext2.Default.Options))
239
var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "This is not valid JSON"));
258
var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "null"));
277
var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, [new UriContent("https://example.com", "image/*")]));
297
var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, JsonSerializer.Serialize(expectedResult, JsonContext2.Default.Options)));
332
var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, JsonSerializer.Serialize(payload, JsonContext2.Default.Options)));
364
var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, JsonSerializer.Serialize(expectedResult, jso)));
425
return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.
Assistant
, resultDuplicatedJson)));
ChatCompletion\DistributedCachingChatClientTest.cs (19)
140
return new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Hello"));
214
return new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "A good result"));
313
new(ChatRole.
Assistant
, "This"),
314
new(ChatRole.
Assistant
, " becomes one chunk"),
315
new() { Role = ChatRole.
Assistant
, Contents = [new FunctionCallContent("callId1", "separator")] },
316
new(ChatRole.
Assistant
, "... and this"),
317
new(ChatRole.
Assistant
, " becomes another"),
318
new(ChatRole.
Assistant
, " one."),
368
new() { Role = ChatRole.
Assistant
, Contents = [new TextContent("Hello")] },
369
new() { Role = ChatRole.
Assistant
, Contents = [new TextContent(" world, ")] },
372
Role = ChatRole.
Assistant
,
383
Role = ChatRole.
Assistant
,
436
new(ChatRole.
Assistant
, "Chunk 1"),
484
() => new(ChatRole.
Assistant
, "Chunk 1"),
523
[() => new(ChatRole.
Assistant
, "A good result")]);
559
return new(new ChatMessage(ChatRole.
Assistant
, options!.AdditionalProperties!["someKey"]!.ToString()));
610
return new(new ChatMessage(ChatRole.
Assistant
, innerCallCount.ToString()));
656
return new(new ChatMessage(ChatRole.
Assistant
, options!.AdditionalProperties!["someKey"]!.ToString()));
744
new ChatMessage(ChatRole.
Assistant
, [new TextContent("Hey")])));
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (59)
41
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
46
new ChatMessage(ChatRole.
Assistant
,
77
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
82
new ChatMessage(ChatRole.
Assistant
,
121
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
126
new ChatMessage(ChatRole.
Assistant
,
153
new ChatMessage(ChatRole.
Assistant
,
168
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
174
new ChatMessage(ChatRole.
Assistant
, "world"),
179
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
181
new ChatMessage(ChatRole.
Assistant
, "world"),
204
new ChatMessage(ChatRole.
Assistant
,
208
new ChatMessage(ChatRole.
Assistant
,
225
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1")]) { MessageId = "resp1" },
226
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]) { MessageId = "resp2" },
232
new ChatMessage(ChatRole.
Assistant
, "world"),
237
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1")]) { MessageId = "resp1" },
238
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]) { MessageId = "resp2" },
240
new ChatMessage(ChatRole.
Assistant
, "world"),
263
new ChatMessage(ChatRole.
Assistant
,
278
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
288
new ChatMessage(ChatRole.
Assistant
, "world"),
293
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
299
new ChatMessage(ChatRole.
Assistant
, "world"),
322
new ChatMessage(ChatRole.
Assistant
,
337
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
344
new ChatMessage(ChatRole.
Assistant
, "world"),
349
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
352
new ChatMessage(ChatRole.
Assistant
, "world"),
357
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
363
new ChatMessage(ChatRole.
Assistant
, "world"),
386
new ChatMessage(ChatRole.
Assistant
,
401
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
407
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 3 } })]),
412
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
414
new ChatMessage(ChatRole.
Assistant
,
440
new ChatMessage(ChatRole.
Assistant
,
450
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
452
new ChatMessage(ChatRole.
Assistant
,
465
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
467
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId3", "Func1")]),
473
new ChatMessage(ChatRole.
Assistant
, "World"),
478
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId3", "Func1")]),
480
new ChatMessage(ChatRole.
Assistant
, "World"),
503
new ChatMessage(ChatRole.
Assistant
,
543
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
549
new ChatMessage(ChatRole.
Assistant
, "world"),
554
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
556
new ChatMessage(ChatRole.
Assistant
, "world"),
593
new ChatMessage(ChatRole.
Assistant
, "world"),
598
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
600
new ChatMessage(ChatRole.
Assistant
, "world"),
643
yield return new ChatResponseUpdate(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1")]) { MessageId = messageId };
647
ChatRole.
Assistant
,
716
yield return new ChatResponseUpdate(ChatRole.
Assistant
, [new TextContent("Text 1")]) { MessageId = messageId };
718
yield return new ChatResponseUpdate(ChatRole.
Assistant
, [new TextContent("Text 2")]) { MessageId = messageId };
720
yield return new ChatResponseUpdate(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1")]) { MessageId = messageId };
723
ChatRole.
Assistant
,
729
yield return new ChatResponseUpdate(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func3")]) { MessageId = messageId };
ChatCompletion\FunctionInvokingChatClientTests.cs (59)
93
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1")]),
95
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
97
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]),
99
new ChatMessage(ChatRole.
Assistant
, "world"),
127
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1")]),
129
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
131
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]),
133
new ChatMessage(ChatRole.
Assistant
, "world"),
160
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1")]),
162
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
164
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]),
166
new ChatMessage(ChatRole.
Assistant
, "world"),
191
new ChatMessage(ChatRole.
Assistant
,
203
new ChatMessage(ChatRole.
Assistant
,
213
new ChatMessage(ChatRole.
Assistant
, "world"),
251
new ChatMessage(ChatRole.
Assistant
,
261
new ChatMessage(ChatRole.
Assistant
, "done"),
295
new ChatMessage(ChatRole.
Assistant
,
305
new ChatMessage(ChatRole.
Assistant
, "done"),
329
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1")]),
331
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
333
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]),
335
new ChatMessage(ChatRole.
Assistant
, "world"),
378
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent($"callId0", "VoidReturn")]),
386
plan.Add(new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent($"callId{(i + 1)}", "VoidReturn")]));
521
var assistantMessage = new ChatMessage(ChatRole.
Assistant
, []);
552
new ChatMessage(ChatRole.
Assistant
, [new TextContent("extra"), new FunctionCallContent("callId1", "Func1"), new TextContent("stuff")]),
554
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
556
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } }), new TextContent("more")]),
558
new ChatMessage(ChatRole.
Assistant
, "world"),
589
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1")]),
591
new ChatMessage(ChatRole.
Assistant
, "world"),
611
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["arg1"] = "value1" })]),
613
new ChatMessage(ChatRole.
Assistant
, "world"),
668
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["arg1"] = "value1" })]),
670
new ChatMessage(ChatRole.
Assistant
, "world"),
813
new(ChatRole.
Assistant
, [new FunctionCallContent($"callId{chatContents.Count()}", "Func1")]) :
814
new(ChatRole.
Assistant
, "The answer is 42.");
862
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["i"] = 41 })]),
864
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId2", "Func1", new Dictionary<string, object?> { ["i"] = 42 })]),
872
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId3", "Func1", new Dictionary<string, object?> { ["i"] = 43 })]),
874
new ChatMessage(ChatRole.
Assistant
, "world"),
937
var message = new ChatMessage(ChatRole.
Assistant
, resultContents);
980
return new ChatResponse(new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId-abc", "Func1")]))
988
return new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "done!"));
1018
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["arg1"] = "value1" })]),
1020
new ChatMessage(ChatRole.
Assistant
, "world"),
1047
new ChatMessage(ChatRole.
Assistant
, [
1056
new ChatMessage(ChatRole.
Assistant
, "world"),
1100
new(ChatRole.
Assistant
, [
1108
new(ChatRole.
Assistant
, "done"),
1119
new(ChatRole.
Assistant
, [
1127
new(ChatRole.
Assistant
, "done"),
1148
new(ChatRole.
Assistant
, [new FunctionCallContent("callId1", "DefOnly")]),
1150
new(ChatRole.
Assistant
, "world"),
1177
new(ChatRole.
Assistant
, [
1182
new(ChatRole.
Assistant
, "done"),
1235
var message = new ChatMessage(ChatRole.
Assistant
, [.. plan[contents.Count()].Contents])
1299
ChatMessage message = new(ChatRole.
Assistant
, [.. plan[contents.Count()].Contents])
ChatCompletion\LoggingChatClientTests.cs (3)
59
return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "blue whale")));
108
yield return new(ChatRole.
Assistant
, "blue ");
109
yield return new(ChatRole.
Assistant
, "whale");
ChatCompletion\OpenTelemetryChatClientTests.cs (4)
38
return new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "The blue whale, I think."))
69
yield return new ChatResponseUpdate(ChatRole.
Assistant
, text)
109
new(ChatRole.
Assistant
, [new FunctionCallContent("12345", "GetPersonName")]),
111
new(ChatRole.
Assistant
, "Hey John, what's up?"),
ChatCompletion\ReducingChatClientTests.cs (3)
38
new(ChatRole.
Assistant
, "Hi there!"),
49
var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "It's sunny!"));
50
var expectedUpdates = new[] { new ChatResponseUpdate(ChatRole.
Assistant
, "It's"), new ChatResponseUpdate(null, " sunny!") };
ChatCompletion\UseDelegateChatClientTests.cs (3)
42
return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "hello")));
91
return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "hello")));
184
return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "non-streaming hello")));
ChatReduction\MessageCountingChatReducerTests.cs (17)
55
new ChatMessage(ChatRole.
Assistant
, "Hi there!"),
57
new ChatMessage(ChatRole.
Assistant
, "I'm doing well, thanks!"),
76
Assert.Equal(ChatRole.
Assistant
, m.Role);
91
new ChatMessage(ChatRole.
Assistant
, "Hi"),
93
new ChatMessage(ChatRole.
Assistant
, "I'm fine!"),
112
Assert.Equal(ChatRole.
Assistant
, m.Role);
128
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("call1", "get_weather", new Dictionary<string, object?> { ["location"] = "Seattle" })]),
130
new ChatMessage(ChatRole.
Assistant
, "The weather in Seattle is sunny and 72°F."),
132
new ChatMessage(ChatRole.
Assistant
, "You're welcome!"),
148
Assert.Equal(ChatRole.
Assistant
, m.Role);
167
messages.Add(new ChatMessage(i % 2 == 0 ? ChatRole.User : ChatRole.
Assistant
, $"Message {i}"));
183
var expectedRole = expectedIndex % 2 == 0 ? ChatRole.User : ChatRole.
Assistant
;
223
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("call1", "func", null)]),
225
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("call2", "func", null)]),
243
new ChatMessage(ChatRole.
Assistant
, "Second"),
245
new ChatMessage(ChatRole.
Assistant
, "Fourth"),
259
Assert.Equal(ChatRole.
Assistant
, m.Role);
ChatReduction\SummarizingChatReducerTests.cs (15)
71
new ChatMessage(ChatRole.
Assistant
, "Hi there!"),
76
Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Summary of conversation")));
95
new ChatMessage(ChatRole.
Assistant
, [new FunctionCallContent("call1", "get_weather", new Dictionary<string, object?> { ["location"] = "Seattle" })]),
97
new ChatMessage(ChatRole.
Assistant
, "The weather in Seattle is sunny and 72°F."),
124
messages.Add(new ChatMessage(i % 2 == 0 ? ChatRole.User : ChatRole.
Assistant
, $"Message {i}"));
131
return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Summary")));
159
new ChatMessage(ChatRole.
Assistant
, "Response 1"),
169
return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Summary")));
187
new ChatMessage(ChatRole.
Assistant
, "Hi"),
192
Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.
Assistant
, "Summary")));
213
new 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."),
215
new 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."),
232
return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.
Assistant
, Summary)));
243
messages.Add(new ChatMessage(ChatRole.
Assistant
, "Golden retrievers get along well with kids! They're able to be playful and energetic while remaining gentle."));
259
return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.
Assistant
, Summary)));
Microsoft.ML.GenAI.Core (2)
CausalLMPipelineChatClient.cs (2)
47
var chatMessage = new ChatMessage(ChatRole.
Assistant
, output);
73
yield return new(ChatRole.
Assistant
, output)
Microsoft.ML.GenAI.Core.Tests (1)
CausalLMDatasetTest.cs (1)
93
new ChatMessage(ChatRole.
Assistant
, "Contoso is a company"),
Microsoft.ML.GenAI.LLaMA (2)
Llama3_1ChatTemplateBuilder.cs (2)
93
var 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)
136
new ChatMessage(ChatRole.
Assistant
, "World!"),
Microsoft.ML.GenAI.Phi (2)
Phi3\Phi3ChatTemplateBuilder.cs (2)
94
var 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)
111
var assistantMessage = new ChatMessage(ChatRole.
Assistant
, data.output);
OpenAIEndToEnd.WebStory (1)
Components_Pages_Home_razor.g.cs (1)
110
foreach (var message in chatMessages.Where(m => m.Role == ChatRole.
Assistant
))