298 instantiations of FunctionCallContent
Microsoft.Extensions.AI.Abstractions (1)
Contents\FunctionCallContent.cs (1)
105
return new
FunctionCallContent
(callId, name, arguments)
Microsoft.Extensions.AI.Abstractions.Tests (26)
ChatCompletion\ChatMessageTests.cs (2)
148
new
FunctionCallContent
("callId1", "fc1"),
271
new
FunctionCallContent
("function-id", "plugin-name-function-name", new Dictionary<string, object?> { ["parameter"] = "argument" }),
ChatCompletion\ChatResponseUpdateTests.cs (2)
94
new
FunctionCallContent
("callId1", "fc1"),
123
new
FunctionCallContent
("callId1", "fc1"),
Contents\AIContentTests.cs (3)
68
new
FunctionCallContent
("call123", "functionName", new Dictionary<string, object?> { { "param1", 123 } }),
73
new FunctionApprovalRequestContent("request123", new
FunctionCallContent
("call123", "functionName", new Dictionary<string, object?> { { "param1", 123 } })),
74
new FunctionApprovalResponseContent("request123", approved: true, new
FunctionCallContent
("call123", "functionName", new Dictionary<string, object?> { { "param1", 123 } })),
Contents\FunctionApprovalRequestContentTests.cs (5)
16
FunctionCallContent functionCall =
new
("FCC1", "TestFunction");
31
FunctionCallContent functionCall =
new
("FCC1", "TestFunction");
45
FunctionCallContent functionCall =
new
("FCC1", "TestFunction");
66
FunctionCallContent functionCall =
new
("FCC1", "TestFunction");
82
var content = new FunctionApprovalRequestContent("request123", new
FunctionCallContent
("call123", "functionName", new Dictionary<string, object?> { { "param1", 123 } }));
Contents\FunctionApprovalResponseContentTests.cs (3)
15
FunctionCallContent functionCall =
new
("FCC1", "TestFunction");
30
FunctionCallContent functionCall =
new
("FCC1", "TestFunction");
43
var content = new FunctionApprovalResponseContent("request123", true, new
FunctionCallContent
("call123", "functionName"))
Contents\FunctionCallContentTests.cs (6)
21
FunctionCallContent c =
new
("callId1", "name");
39
FunctionCallContent c =
new
("id", "name", args);
52
FunctionCallContent c =
new
("callId1", "name");
87
var sut = new
FunctionCallContent
("callId1", "functionName", new Dictionary<string, object?> { ["key"] = "value" })
148
var original = new
FunctionCallContent
("callId1", "functionName") { InvocationRequired = invocationRequired };
164
var sut = new
FunctionCallContent
("callId1", "functionName", new Dictionary<string, object?> { ["key"] = "value" }) { Exception = ex };
Contents\UserInputRequestContentTests.cs (2)
36
UserInputRequestContent content = new FunctionApprovalRequestContent("request123", new
FunctionCallContent
("call123", "functionName", new Dictionary<string, object?> { { "param1", 123 } }));
44
new FunctionApprovalRequestContent("request123", new
FunctionCallContent
("call123", "functionName", new Dictionary<string, object?> { { "param1", 123 } })),
Contents\UserInputResponseContentTests.cs (2)
34
UserInputResponseContent content = new FunctionApprovalResponseContent("request123", true, new
FunctionCallContent
("call123", "functionName"));
42
new FunctionApprovalResponseContent("request123", true, new
FunctionCallContent
("call123", "functionName")),
SpeechToText\SpeechToTextResponseUpdateTests.cs (1)
64
new
FunctionCallContent
("callId1", "fc1"),
Microsoft.Extensions.AI.Integration.Tests (1)
PromptBasedFunctionCallingChatClient.cs (1)
118
message.Contents.Add(new
FunctionCallContent
(id, toolCallParsed.Name!, toolCallParsed.Arguments is { } args ? new ReadOnlyDictionary<string, object?>(args) : null));
Microsoft.Extensions.AI.OpenAI.Tests (12)
OpenAIChatClientTests.cs (2)
1469
new
FunctionCallContent
("12345", "SayHello"),
1470
new
FunctionCallContent
("12346", "SayHi"),
OpenAIConversionTests.cs (10)
644
new
FunctionCallContent
("callid123", "SomeFunction", new Dictionary<string, object?>
713
new
FunctionCallContent
("callid123", "SomeFunction", new Dictionary<string, object?>
953
new
FunctionCallContent
("call123", "TestFunction", new Dictionary<string, object?> { ["param"] = "value" })
1058
new
FunctionCallContent
("process_data", "ProcessComplexData", complexArgs)
1241
var functionCallContent = new
FunctionCallContent
("call-123", "GetWeather", new Dictionary<string, object?>
1279
var functionCall1 = new
FunctionCallContent
("call-1", "Function1", new Dictionary<string, object?> { ["param1"] = "value1" });
1280
var functionCall2 = new
FunctionCallContent
("call-2", "Function2", new Dictionary<string, object?> { ["param2"] = "value2" });
1313
new
FunctionCallContent
("call-123", "GetWeather", new Dictionary<string, object?> { ["location"] = "Seattle" }),
1555
new
FunctionCallContent
("call-123", "TestFunction", new Dictionary<string, object?> { ["param"] = "value" })
1590
new
FunctionCallContent
("call-456", "GetWeather", new Dictionary<string, object?> { ["location"] = "Seattle" })
Microsoft.Extensions.AI.Tests (258)
ChatCompletion\ChatClientStructuredOutputExtensionsTests.cs (1)
201
new
FunctionCallContent
("callid123", "get_data"),
ChatCompletion\DistributedCachingChatClientTest.cs (4)
52
Contents = [new
FunctionCallContent
("someCallId", "functionName", new Dictionary<string, object?>
255
new
FunctionCallContent
("someCallId", "someFn", new Dictionary<string, object?> { ["arg1"] = "value1" }),
266
Contents = [new
FunctionCallContent
("someCallId", "someFn", new Dictionary<string, object?> { ["arg1"] = "value1" })],
316
new() { Role = ChatRole.Assistant, Contents = [new
FunctionCallContent
("callId1", "separator")] },
ChatCompletion\FunctionInvocationContextTests.cs (1)
55
FunctionCallContent callContent =
new
(string.Empty, string.Empty, new Dictionary<string, object?>());
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (123)
41
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
48
new FunctionApprovalRequestContent("callId1", new
FunctionCallContent
("callId1", "Func1")),
49
new FunctionApprovalRequestContent("callId2", new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
77
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
84
new FunctionApprovalRequestContent("callId1", new
FunctionCallContent
("callId1", "Func1")),
85
new FunctionApprovalRequestContent("callId2", new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
121
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
128
new FunctionApprovalRequestContent("callId1", new
FunctionCallContent
("callId1", "Func1")),
129
new FunctionApprovalRequestContent("callId2", new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
155
new FunctionApprovalRequestContent("callId1", new
FunctionCallContent
("callId1", "Func1")),
156
new FunctionApprovalRequestContent("callId2", new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
160
new FunctionApprovalResponseContent("callId1", true, new
FunctionCallContent
("callId1", "Func1")),
161
new FunctionApprovalResponseContent("callId2", true, new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
168
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
179
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
207
new FunctionApprovalRequestContent("callId1", new
FunctionCallContent
("callId1", "Func1")),
208
new FunctionApprovalRequestContent("callId2", new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
212
new FunctionApprovalResponseContent("callId1", true, new
FunctionCallContent
("callId1", "Func1")),
213
new FunctionApprovalResponseContent("callId2", true, new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
221
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
232
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
259
new FunctionApprovalRequestContent("callId1", new
FunctionCallContent
("callId1", "Func1")),
263
new FunctionApprovalRequestContent("callId2", new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
267
new FunctionApprovalResponseContent("callId1", true, new
FunctionCallContent
("callId1", "Func1")),
271
new FunctionApprovalResponseContent("callId2", true, new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
278
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]) { MessageId = "resp1" },
279
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]) { MessageId = "resp2" },
290
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]) { MessageId = "resp1" },
291
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]) { MessageId = "resp2" },
318
new FunctionApprovalRequestContent("callId1", new
FunctionCallContent
("callId1", "Func1")),
319
new FunctionApprovalRequestContent("callId2", new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
323
new FunctionApprovalResponseContent("callId1", false, new
FunctionCallContent
("callId1", "Func1")),
324
new FunctionApprovalResponseContent("callId2", false, new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
331
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
346
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
377
new FunctionApprovalRequestContent("callId1", new
FunctionCallContent
("callId1", "Func1")),
378
new FunctionApprovalRequestContent("callId2", new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
382
new FunctionApprovalResponseContent("callId1", false, new
FunctionCallContent
("callId1", "Func1")),
383
new FunctionApprovalResponseContent("callId2", true, new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
390
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
402
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
410
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
441
new FunctionApprovalRequestContent("callId1", new
FunctionCallContent
("callId1", "Func1")),
442
new FunctionApprovalRequestContent("callId2", new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
446
new FunctionApprovalResponseContent("callId1", false, new
FunctionCallContent
("callId1", "Func1"))
450
new FunctionApprovalResponseContent("callId2", false, new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
460
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
475
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
507
new FunctionApprovalRequestContent("callId1", new
FunctionCallContent
("callId1", "Func1")),
508
new FunctionApprovalRequestContent("callId2", new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })),
509
new FunctionApprovalRequestContent("callId3", new
FunctionCallContent
("callId3", "Func3", arguments: new Dictionary<string, object?> { { "s", "test" } }))
513
new FunctionApprovalResponseContent("callId1", false, new
FunctionCallContent
("callId1", "Func1")) { Reason = "Custom rejection for Func1" },
514
new FunctionApprovalResponseContent("callId2", false, new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })),
515
new FunctionApprovalResponseContent("callId3", true, new
FunctionCallContent
("callId3", "Func3", arguments: new Dictionary<string, object?> { { "s", "test" } }))
524
new
FunctionCallContent
("callId1", "Func1"),
525
new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }),
526
new
FunctionCallContent
("callId3", "Func3", arguments: new Dictionary<string, object?> { { "s", "test" } })
545
new
FunctionCallContent
("callId1", "Func1"),
546
new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }),
547
new
FunctionCallContent
("callId3", "Func3", arguments: new Dictionary<string, object?> { { "s", "test" } })
562
new
FunctionCallContent
("callId1", "Func1"),
563
new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }),
564
new
FunctionCallContent
("callId3", "Func3", arguments: new Dictionary<string, object?> { { "s", "test" } })
599
new FunctionApprovalRequestContent("callId1", new
FunctionCallContent
("callId1", "Func1")),
603
new FunctionApprovalResponseContent("callId1", false, new
FunctionCallContent
("callId1", "Func1"))
613
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]),
627
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]),
657
new FunctionApprovalRequestContent("callId1", new
FunctionCallContent
("callId1", "Func1")),
658
new FunctionApprovalRequestContent("callId2", new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
662
new FunctionApprovalResponseContent("callId1", true, new
FunctionCallContent
("callId1", "Func1")),
663
new FunctionApprovalResponseContent("callId2", true, new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
670
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
676
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 3 } })]),
681
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
685
new FunctionApprovalRequestContent("callId2", new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 3 } }))
711
new FunctionApprovalRequestContent("callId1", new
FunctionCallContent
("callId1", "Func1")),
712
new FunctionApprovalRequestContent("callId2", new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
716
new FunctionApprovalResponseContent("callId1", true, new
FunctionCallContent
("callId1", "Func1")),
717
new FunctionApprovalResponseContent("callId2", true, new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
719
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
723
new FunctionApprovalRequestContent("callId3", new
FunctionCallContent
("callId3", "Func1")),
727
new FunctionApprovalResponseContent("callId3", true, new
FunctionCallContent
("callId3", "Func1")),
734
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
736
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId3", "Func1")]),
747
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId3", "Func1")]),
791
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
800
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
810
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
837
new FunctionApprovalRequestContent("callId1", new
FunctionCallContent
("callId1", "Func1")),
867
new FunctionApprovalResponseContent("callId1", true, new
FunctionCallContent
("callId1", "Func1")),
868
new FunctionApprovalResponseContent("callId2", true, new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
875
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
886
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
913
new FunctionApprovalResponseContent("callId1", true, new
FunctionCallContent
("callId1", "Func1")),
914
new FunctionApprovalResponseContent("callId2", true, new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
930
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1"), new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
975
yield return new ChatResponseUpdate(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]) { MessageId = messageId };
981
new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })
1052
yield return new ChatResponseUpdate(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]) { MessageId = messageId };
1057
new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })
1061
yield return new ChatResponseUpdate(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func3")]) { MessageId = messageId };
1134
var alreadyProcessedFunctionCall = new
FunctionCallContent
("callId1", "Func1") { InvocationRequired = false };
ChatCompletion\FunctionInvokingChatClientTests.cs (117)
94
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]),
96
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
98
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]),
128
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]),
130
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
132
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]),
161
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]),
163
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
165
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]),
194
new
FunctionCallContent
("callId1", "Func1"),
195
new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 34 } }),
196
new
FunctionCallContent
("callId3", "Func2", arguments: new Dictionary<string, object?> { { "i", 56 } }),
206
new
FunctionCallContent
("callId4", "Func2", arguments: new Dictionary<string, object?> { { "i", 78 } }),
207
new
FunctionCallContent
("callId5", "Func1")
254
new
FunctionCallContent
("callId1", "Func", arguments: new Dictionary<string, object?> { { "arg", "hello" } }),
255
new
FunctionCallContent
("callId2", "Func", arguments: new Dictionary<string, object?> { { "arg", "world" } }),
298
new
FunctionCallContent
("callId1", "Func", arguments: new Dictionary<string, object?> { { "arg", "hello" } }),
299
new
FunctionCallContent
("callId2", "Func", arguments: new Dictionary<string, object?> { { "arg", "world" } }),
330
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]),
332
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
334
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]),
380
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")])));
393
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")])).ToChatResponseUpdates());
461
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")])));
474
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")])).ToChatResponseUpdates());
542
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")])));
555
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")])).ToChatResponseUpdates());
637
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
($"callId0", "VoidReturn")]),
645
plan.Add(new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
($"callId{(i + 1)}", "VoidReturn")]));
668
var message = new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
($"callId{capturedOptions.Count}", "Func1")]);
712
var message = new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
($"callId{capturedOptions.Count}", "Func1")]);
759
var message = new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]);
804
var message = new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]);
960
assistantMessage.Contents.Add(new
FunctionCallContent
(callId, "Func",
984
new ChatMessage(ChatRole.Assistant, [new TextContent("extra"), new
FunctionCallContent
("callId1", "Func1"), new TextContent("stuff")]),
986
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
988
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } }), new TextContent("more")]),
1021
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]),
1043
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1", new Dictionary<string, object?> { ["arg1"] = "value1" })]),
1100
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1", new Dictionary<string, object?> { ["arg1"] = "value1" })]),
1192
new() { Contents = [new
FunctionCallContent
("callId1", "Func1", new Dictionary<string, object?> { ["text"] = "Input 1" })] },
1193
new() { Contents = [new
FunctionCallContent
("callId2", "Func1", new Dictionary<string, object?> { ["text"] = "Input 2" })] }
1245
new(ChatRole.Assistant, [new
FunctionCallContent
($"callId{chatContents.Count()}", "Func1")]) :
1294
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1", new Dictionary<string, object?> { ["i"] = 41 })]),
1296
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId2", "Func1", new Dictionary<string, object?> { ["i"] = 42 })]),
1304
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId3", "Func1", new Dictionary<string, object?> { ["i"] = 43 })]),
1364
new
FunctionCallContent
("callId1", "Search"),
1365
new
FunctionCallContent
("callId2", "Search", new Dictionary<string, object?> { { "result", "birds" } }),
1366
new
FunctionCallContent
("callId3", "Search"),
1412
return new ChatResponse(new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId-abc", "Func1")]))
1450
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1", new Dictionary<string, object?> { ["arg1"] = "value1" })]),
1480
new
FunctionCallContent
("callId1", "Func1", new Dictionary<string, object?> { ["arg"] = "value1" }),
1481
new
FunctionCallContent
("callId2", "Func1", new Dictionary<string, object?> { ["arg"] = "value2" }),
1533
new
FunctionCallContent
("callId1", "UnknownFunc", new Dictionary<string, object?> { ["i"] = 1 }),
1534
new
FunctionCallContent
("callId2", "KnownFunc", new Dictionary<string, object?> { ["i"] = 2 })
1552
new
FunctionCallContent
("callId1", "UnknownFunc", new Dictionary<string, object?> { ["i"] = 1 }),
1553
new
FunctionCallContent
("callId2", "KnownFunc", new Dictionary<string, object?> { ["i"] = 2 })
1580
new(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "DefOnly")]),
1610
new
FunctionCallContent
("callId1", "Known"),
1611
new
FunctionCallContent
("callId2", "DefOnly")
1645
messages.Add(new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]));
1679
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]),
1728
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]),
1768
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]),
1817
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1", new Dictionary<string, object?> { ["arg1"] = "secret" })]),
1889
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]),
1938
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]),
1965
var alreadyProcessedFunctionCall = new
FunctionCallContent
("callId1", "Func1") { InvocationRequired = false };
2017
var needsProcessing = new
FunctionCallContent
("callId1", "Func1") { InvocationRequired = true };
2018
var alreadyProcessed = new
FunctionCallContent
("callId2", "Func2") { InvocationRequired = false };
2093
return new ChatResponse(new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]));
2261
cloned.Add(new
FunctionCallContent
(fcc.CallId, fcc.Name, fcc.Arguments)
2321
[new
FunctionCallContent
("callId1", "FunctionA")])]);
2328
[new
FunctionCallContent
("callId2", "FunctionB")])]);
2344
[new
FunctionCallContent
("callId1", "FunctionA")]);
2350
[new
FunctionCallContent
("callId2", "FunctionB")]);
2415
[new
FunctionCallContent
("callId1", "FunctionA")])]);
2422
[new
FunctionCallContent
("callId2", "FunctionB")])]);
2438
[new
FunctionCallContent
("callId1", "FunctionA")]);
2444
[new
FunctionCallContent
("callId2", "FunctionB")]);
2522
[new
FunctionCallContent
("callId1", "FunctionA")])]);
2528
[new
FunctionCallContent
("callId2", "FunctionB")])]);
2543
[new
FunctionCallContent
("callId1", "FunctionA")]);
2549
[new
FunctionCallContent
("callId2", "FunctionB")]);
2620
[new
FunctionCallContent
("callId1", "FunctionA")])]);
2628
[new
FunctionCallContent
("callId2", "FunctionB"),
2629
new
FunctionCallContent
("callId3", "AdditionalTool")])]);
2644
[new
FunctionCallContent
("callId1", "FunctionA")]);
2650
[new
FunctionCallContent
("callId2", "FunctionB"),
2651
new
FunctionCallContent
("callId3", "AdditionalTool")]);
2724
[new
FunctionCallContent
("callId1", "FunctionA")])]);
2730
[new
FunctionCallContent
("callId2", "SharedName")])]);
2745
[new
FunctionCallContent
("callId1", "FunctionA")]);
2751
[new
FunctionCallContent
("callId2", "SharedName")]);
2822
[new
FunctionCallContent
($"callId{callCount}", "FunctionA")])]);
2837
[new
FunctionCallContent
($"callId{callCount}", "FunctionA")]);
2900
[new
FunctionCallContent
("callId1", "FunctionA")])]);
2908
[new
FunctionCallContent
("callId2", "FunctionB")])]);
2923
[new
FunctionCallContent
("callId1", "FunctionA")]);
2929
[new
FunctionCallContent
("callId2", "FunctionB")]);
3001
[new
FunctionCallContent
("callId1", "FunctionA")])]);
3009
[new
FunctionCallContent
("callId2", "FunctionB")])]);
3024
[new
FunctionCallContent
("callId1", "FunctionA")]);
3030
[new
FunctionCallContent
("callId2", "FunctionB")]);
3107
[new
FunctionCallContent
("callId1", "FunctionA")])]);
3115
[new
FunctionCallContent
("callId2", "FunctionB")])]);
3130
[new
FunctionCallContent
("callId1", "FunctionA")]);
3136
[new
FunctionCallContent
("callId2", "FunctionB")]);
3190
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "UnknownFunc")]),
3220
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]),
3256
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "TerminatingFunc")]),
3285
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("callId1", "Func1")]),
3294
new FunctionApprovalRequestContent("callId1", new
FunctionCallContent
("callId1", "Func1"))
3330
new FunctionApprovalRequestContent("callId1", new
FunctionCallContent
("callId1", "Func1"))
3334
new FunctionApprovalResponseContent("callId1", true, new
FunctionCallContent
("callId1", "Func1"))
3367
new FunctionApprovalRequestContent("callId1", new
FunctionCallContent
("callId1", "Func1"))
3371
new FunctionApprovalResponseContent("callId1", false, new
FunctionCallContent
("callId1", "Func1")) { Reason = "User denied" }
ChatCompletion\ImageGeneratingChatClientTests.cs (2)
317
[new
FunctionCallContent
(callId, "GenerateImage", new Dictionary<string, object?> { ["prompt"] = "a cat" })]);
360
[new
FunctionCallContent
(callId, "GenerateImage", new Dictionary<string, object?> { ["prompt"] = "a cat" })]);
ChatCompletion\OpenTelemetryChatClientTests.cs (4)
111
new(ChatRole.Assistant, [new
FunctionCallContent
("12345", "GetPersonName")]),
360
new
FunctionCallContent
("call-123", "GetWeather", new Dictionary<string, object?> { ["location"] = "Seattle" }),
376
yield return new() { Contents = [new
FunctionCallContent
("call-123", "GetWeather", new Dictionary<string, object?> { ["location"] = "Seattle" })] };
402
new(ChatRole.Assistant, [new
FunctionCallContent
("call-456", "SearchFiles")]),
ChatReduction\MessageCountingChatReducerTests.cs (3)
128
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("call1", "get_weather", new Dictionary<string, object?> { ["location"] = "Seattle" })]),
223
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("call1", "func", null)]),
225
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("call2", "func", null)]),
ChatReduction\SummarizingChatReducerTests.cs (3)
99
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("call1", "get_weather"), new TestUserInputRequestContent("uir1")]),
188
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("call1", "get_weather", new Dictionary<string, object?> { ["location"] = "Seattle" }), new TestUserInputRequestContent("uir2")]),
193
new ChatMessage(ChatRole.Assistant, [new
FunctionCallContent
("call2", "get_weather", new Dictionary<string, object?> { ["location"] = "New York" })]),
171 references to FunctionCallContent
Microsoft.Extensions.AI (43)
ChatCompletion\FunctionInvocationContext.cs (1)
40
public
FunctionCallContent
CallContent
ChatCompletion\FunctionInvokingChatClient.cs (38)
30
/// When this client receives a <see cref="
FunctionCallContent
"/> in a chat response from its inner
38
/// <see cref="FunctionInvokingChatClient"/> will not attempt to invoke it, and instead allow that <see cref="
FunctionCallContent
"/>
44
/// attempt to invoke it directly. Instead, it will replace that <see cref="
FunctionCallContent
"/> with a <see cref="FunctionApprovalRequestContent"/>
45
/// that wraps the <see cref="
FunctionCallContent
"/> and indicates that the function requires approval before it can be invoked. The caller is then
50
/// Due to the nature of interactions with an underlying <see cref="IChatClient"/>, if any <see cref="
FunctionCallContent
"/> is received
51
/// for a function that requires approval, all received <see cref="
FunctionCallContent
"/> in that same response will also require approval,
286
List<
FunctionCallContent
>? functionCallContents = null; // function call contents that need responding to in the current turn
432
List<
FunctionCallContent
>? functionCallContents = null; // function call contents that need responding to in the current turn
809
/// <summary>Copies any <see cref="
FunctionCallContent
"/> from <paramref name="messages"/> to <paramref name="functionCalls"/>.</summary>
811
IList<ChatMessage> messages, [NotNullWhen(true)] ref List<
FunctionCallContent
>? functionCalls)
823
/// <summary>Copies any <see cref="
FunctionCallContent
"/> from <paramref name="content"/> to <paramref name="functionCalls"/>.</summary>
825
IList<AIContent> content, [NotNullWhen(true)] ref List<
FunctionCallContent
>? functionCalls)
831
if (content[i] is
FunctionCallContent
functionCall && functionCall.InvocationRequired)
925
private bool ShouldTerminateLoopBasedOnHandleableFunctions(List<
FunctionCallContent
>? functionCalls, ChatOptions? options)
941
foreach (
var
fcc in functionCalls)
952
foreach (
var
fcc in functionCalls)
994
List<
FunctionCallContent
> functionCallContents, int iteration, int consecutiveErrorCount,
1123
List<
FunctionCallContent
> callContents,
1126
var
callContent = callContents[functionCallIndex];
1385
/// 2. Recreate <see cref="
FunctionCallContent
"/> for any <see cref="FunctionApprovalResponseContent"/> that haven't been executed yet.
1578
/// Extracts the <see cref="
FunctionCallContent
"/> from the provided <see cref="FunctionApprovalResponseContent"/> to recreate the original function call messages.
1579
/// The output messages tries to mimic the original messages that contained the <see cref="
FunctionCallContent
"/>, e.g. if the <see cref="
FunctionCallContent
"/>
1580
/// had been split into separate messages, this method will recreate similarly split messages, each with their own <see cref="
FunctionCallContent
"/>.
1651
/// Takes the <see cref="
FunctionCallContent
"/> from the <paramref name="resultWithRequestMessage"/> and wraps it in a <see cref="ChatMessage"/>
1652
/// using the same message id that the <see cref="
FunctionCallContent
"/> was originally returned with from the downstream <see cref="IChatClient"/>.
1668
List<
FunctionCallContent
>? functionCallContents,
1684
var
fcc = functionCallContents![lastApprovalCheckedFCCIndex];
1700
/// Replaces all <see cref="
FunctionCallContent
"/> with <see cref="FunctionApprovalRequestContent"/> and ouputs a new list if any of them were replaced.
1702
/// <returns>true if any <see cref="
FunctionCallContent
"/> was replaced, false otherwise.</returns>
1711
if (content[i] is
FunctionCallContent
fcc && fcc.InvocationRequired)
1723
/// Replaces all <see cref="
FunctionCallContent
"/> from <paramref name="messages"/> with <see cref="FunctionApprovalRequestContent"/>
1742
if (content[j] is
FunctionCallContent
functionCall && functionCall.InvocationRequired)
1767
var
functionCall = (
FunctionCallContent
)message.Contents[contentIndex];
1787
/// Execute the provided <see cref="FunctionApprovalResponseContent"/> and return the resulting <see cref="
FunctionCallContent
"/>
1865
internal FunctionInvocationResult(bool terminate, FunctionInvocationStatus status,
FunctionCallContent
callContent, object? result, Exception? exception)
1878
public
FunctionCallContent
CallContent { get; }
ChatCompletion\ImageGeneratingChatClient.cs (1)
328
if (content is
FunctionCallContent
functionCall &&
ChatCompletion\OpenTelemetryChatClient.cs (1)
261
case
FunctionCallContent
fcc:
ChatReduction\MessageCountingChatReducer.cs (1)
57
else if (!message.Contents.Any(m => m is
FunctionCallContent
or FunctionResultContent))
ChatReduction\SummarizingChatReducer.cs (1)
209
is
FunctionCallContent
Microsoft.Extensions.AI.Abstractions (11)
Contents\AIContent.cs (1)
13
[JsonDerivedType(typeof(
FunctionCallContent
), typeDiscriminator: "functionCall")]
Contents\FunctionApprovalRequestContent.cs (2)
25
public FunctionApprovalRequestContent(string id,
FunctionCallContent
functionCall)
34
public
FunctionCallContent
FunctionCall { get; }
Contents\FunctionApprovalResponseContent.cs (2)
26
public FunctionApprovalResponseContent(string id, bool approved,
FunctionCallContent
functionCall)
41
public
FunctionCallContent
FunctionCall { get; }
Contents\FunctionCallContent.cs (4)
20
/// Initializes a new instance of the <see cref="
FunctionCallContent
"/> class.
70
/// Creates a new instance of <see cref="
FunctionCallContent
"/> parsing arguments using a specified encoding and parser.
77
/// <returns>A new instance of <see cref="
FunctionCallContent
"/> containing the parse result.</returns>
82
public static
FunctionCallContent
CreateFromParsedArguments<TEncoding>(
Contents\FunctionResultContent.cs (2)
38
/// If this is the result for a <see cref="
FunctionCallContent
"/>, this property should contain the same
39
/// <see cref="
FunctionCallContent
.CallId"/> value.
Microsoft.Extensions.AI.Abstractions.Tests (35)
AssertExtensions.cs (3)
38
if (expectedItem is
FunctionCallContent
expectedFunctionCall)
40
var
chatFunctionCall = (
FunctionCallContent
)chatItem;
ChatCompletion\ChatMessageTests.cs (2)
326
var
functionCallContent = deserializedMessage.Contents[4] as
FunctionCallContent
;
ChatCompletion\ChatResponseUpdateTests.cs (2)
148
Assert.IsType<
FunctionCallContent
>(result.Contents[2]);
149
Assert.Equal("fc1", ((
FunctionCallContent
)result.Contents[2]).Name);
Contents\FunctionApprovalRequestContentTests.cs (4)
16
FunctionCallContent
functionCall = new("FCC1", "TestFunction");
31
FunctionCallContent
functionCall = new("FCC1", "TestFunction");
45
FunctionCallContent
functionCall = new("FCC1", "TestFunction");
66
FunctionCallContent
functionCall = new("FCC1", "TestFunction");
Contents\FunctionApprovalResponseContentTests.cs (2)
15
FunctionCallContent
functionCall = new("FCC1", "TestFunction");
30
FunctionCallContent
functionCall = new("FCC1", "TestFunction");
Contents\FunctionCallContentTests.cs (22)
21
FunctionCallContent
c = new("callId1", "name");
39
FunctionCallContent
c = new("id", "name", args);
52
FunctionCallContent
c = new("callId1", "name");
87
var
sut = new FunctionCallContent("callId1", "functionName", new Dictionary<string, object?> { ["key"] = "value" })
121
var
deserialized = JsonSerializer.Deserialize<
FunctionCallContent
>(json, TestJsonSerializerContext.Default.Options);
134
var
deserialized = JsonSerializer.Deserialize<
FunctionCallContent
>(json, TestJsonSerializerContext.Default.Options);
148
var
original = new FunctionCallContent("callId1", "functionName") { InvocationRequired = invocationRequired };
150
var
deserialized = JsonSerializer.Deserialize<
FunctionCallContent
>(json, TestJsonSerializerContext.Default.Options);
164
var
sut = new FunctionCallContent("callId1", "functionName", new Dictionary<string, object?> { ["key"] = "value" }) { Exception = ex };
168
var
deserializedSut = JsonSerializer.Deserialize<
FunctionCallContent
>(json, TestJsonSerializerContext.Default.Options);
344
var
content =
FunctionCallContent
.CreateFromParsedArguments(
389
var
content =
FunctionCallContent
.CreateFromParsedArguments(exc, "callId", "functionName", ThrowingParser);
403
Assert.Throws<ArgumentNullException>("encodedArguments", () =>
FunctionCallContent
.CreateFromParsedArguments((string)null!, "callId", "functionName", _ => null));
404
Assert.Throws<ArgumentNullException>("callId", () =>
FunctionCallContent
.CreateFromParsedArguments("{}", null!, "functionName", _ => null));
405
Assert.Throws<ArgumentNullException>("name", () =>
FunctionCallContent
.CreateFromParsedArguments("{}", "callId", null!, _ => null));
406
Assert.Throws<ArgumentNullException>("argumentParser", () =>
FunctionCallContent
.CreateFromParsedArguments("{}", "callId", "functionName", null!));
Microsoft.Extensions.AI.Evaluation.Quality (13)
ChatResponseExtensions.cs (3)
31
if (content is
FunctionCallContent
or FunctionResultContent)
34
content is
FunctionCallContent
? typeof(
FunctionCallContent
) : typeof(FunctionResultContent);
IntentResolutionEvaluator.cs (2)
120
IEnumerable<
FunctionCallContent
> toolCalls =
121
modelResponse.Messages.SelectMany(m => m.Contents).OfType<
FunctionCallContent
>();
TaskAdherenceEvaluator.cs (2)
119
IEnumerable<
FunctionCallContent
> toolCalls =
120
modelResponse.Messages.SelectMany(m => m.Contents).OfType<
FunctionCallContent
>();
ToolCallAccuracyEvaluator.cs (4)
21
/// (i.e., <see cref="
FunctionCallContent
"/>s) present in the supplied response to assess the relevance of these tool
99
IEnumerable<
FunctionCallContent
> toolCalls =
100
modelResponse.Messages.SelectMany(m => m.Contents).OfType<
FunctionCallContent
>();
105
EvaluationDiagnostic.Error($"The {nameof(modelResponse)} supplied for evaluation did not contain any tool calls (i.e., {nameof(
FunctionCallContent
)}s)."));
ToolCallAccuracyEvaluatorContext.cs (2)
17
/// (i.e., <see cref="
FunctionCallContent
"/>s) present in the supplied response to assess the relevance of these tool
81
/// (i.e., <see cref="
FunctionCallContent
"/>s) present in the supplied response to assess the relevance of these
Microsoft.Extensions.AI.Integration.Tests (1)
PromptBasedFunctionCallingChatClient.cs (1)
74
else if (message.Contents[itemIndex] is
FunctionCallContent
fcc)
Microsoft.Extensions.AI.OpenAI (17)
MicrosoftExtensionsAIChatExtensions.cs (3)
70
.OfType<
FunctionCallContent
>().Select(c => ChatToolCall.CreateFunctionToolCall(c.CallId, c.Name,
150
var toolCallUpdates = update.Contents.OfType<
FunctionCallContent
>().Select((fcc, index) =>
193
var
fcc = OpenAIClientExtensions.ParseCallContent(toolCall.FunctionArguments, toolCall.Id, toolCall.FunctionName);
OpenAIAssistantsChatClient.cs (1)
188
var
fcc = OpenAIClientExtensions.ParseCallContent(
OpenAIChatClient.cs (3)
200
case
FunctionCallContent
fc:
431
var
callContent = OpenAIClientExtensions.ParseCallContent(
497
var
callContent = OpenAIClientExtensions.ParseCallContent(toolCall.FunctionArguments, toolCall.Id, toolCall.FunctionName);
OpenAIClientExtensions.cs (8)
198
/// <summary>Creates a new instance of <see cref="
FunctionCallContent
"/> parsing arguments using a specified encoding and parser.</summary>
202
/// <returns>A new instance of <see cref="
FunctionCallContent
"/> containing the parse result.</returns>
205
internal static
FunctionCallContent
ParseCallContent(string json, string callId, string name) =>
206
FunctionCallContent
.CreateFromParsedArguments(json, callId, name,
209
/// <summary>Creates a new instance of <see cref="
FunctionCallContent
"/> parsing arguments using a specified encoding and parser.</summary>
213
/// <returns>A new instance of <see cref="
FunctionCallContent
"/> containing the parse result.</returns>
216
internal static
FunctionCallContent
ParseCallContent(BinaryData utf8json, string callId, string name) =>
217
FunctionCallContent
.CreateFromParsedArguments(utf8json, callId, name,
OpenAIResponsesChatClient.cs (2)
196
var
fcc = OpenAIClientExtensions.ParseCallContent(functionCall.FunctionArguments, functionCall.CallId, functionCall.FunctionName);
1082
case
FunctionCallContent
callContent:
Microsoft.Extensions.AI.OpenAI.Tests (14)
OpenAIChatClientTests.cs (4)
1166
FunctionCallContent
fcc = Assert.IsType<
FunctionCallContent
>(response.Messages.Single().Contents[0]);
1345
FunctionCallContent
fcc = Assert.IsType<
FunctionCallContent
>(Assert.Single(updates[updates.Count - 1].Contents));
OpenAIConversionTests.cs (7)
823
Assert.Equal("functionName", Assert.IsType<
FunctionCallContent
>(message.Contents[2], exactMatch: false).Name);
854
Assert.Equal("functionName", Assert.IsType<
FunctionCallContent
>(message.Contents[2], exactMatch: false).Name);
966
var
functionCall = message.Contents.OfType<
FunctionCallContent
>().FirstOrDefault();
1241
var
functionCallContent = new FunctionCallContent("call-123", "GetWeather", new Dictionary<string, object?>
1279
var
functionCall1 = new FunctionCallContent("call-1", "Function1", new Dictionary<string, object?> { ["param1"] = "value1" });
1280
var
functionCall2 = new FunctionCallContent("call-2", "Function2", new Dictionary<string, object?> { ["param2"] = "value2" });
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (3)
38
if (expectedItem is
FunctionCallContent
expectedFunctionCall)
40
var
chatFunctionCall = (
FunctionCallContent
)chatItem;
Microsoft.Extensions.AI.Tests (37)
ChatCompletion\DistributedCachingChatClientTest.cs (8)
348
c => Assert.IsType<
FunctionCallContent
>(c),
356
c => Assert.IsType<
FunctionCallContent
>(Assert.Single(c.Contents)),
816
if (expectedItem is
FunctionCallContent
expectedFcc)
818
var
actualFcc = (
FunctionCallContent
)actualItem;
850
if (expectedItemItem is
FunctionCallContent
expectedFcc)
852
var
actualFcc = (
FunctionCallContent
)actualItemItem;
ChatCompletion\FunctionInvocationContextTests.cs (1)
55
FunctionCallContent
callContent = new(string.Empty, string.Empty, new Dictionary<string, object?>());
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (3)
996
var
functionCall = update.Contents.OfType<
FunctionCallContent
>().First();
1134
var
alreadyProcessedFunctionCall = new FunctionCallContent("callId1", "Func1") { InvocationRequired = false };
ChatCompletion\FunctionInvokingChatClientTests.cs (15)
1001
Assert.Contains(content, c => c is
FunctionCallContent
or FunctionResultContent);
1217
c => Assert.Equal("Input 1", Assert.IsType<
FunctionCallContent
>(c).Arguments!["text"]),
1218
c => Assert.Equal("Input 2", Assert.IsType<
FunctionCallContent
>(c).Arguments!["text"])),
1258
Assert.IsType<
FunctionCallContent
>(Assert.Single(response.Messages[0].Contents));
1260
Assert.IsType<
FunctionCallContent
>(Assert.Single(response.Messages[2].Contents));
1643
if (!chatContents.Any(m => m.Contents.OfType<
FunctionCallContent
>().Any()))
1946
var functionCallMessage = chat.First(m => m.Contents.Any(c => c is
FunctionCallContent
));
1947
var
functionCallContent = functionCallMessage.Contents.OfType<
FunctionCallContent
>().First();
1965
var
alreadyProcessedFunctionCall = new FunctionCallContent("callId1", "Func1") { InvocationRequired = false };
1995
Assert.Contains(response.Messages, m => m.Contents.Any(c => c is
FunctionCallContent
fcc && !fcc.InvocationRequired));
2017
var
needsProcessing = new FunctionCallContent("callId1", "Func1") { InvocationRequired = true };
2018
var
alreadyProcessed = new FunctionCallContent("callId2", "Func2") { InvocationRequired = false };
2112
Assert.Contains(response.Messages, m => m.Contents.Any(c => c is
FunctionCallContent
fcc && fcc.CallId == "callId1" && !fcc.InvocationRequired));
2259
if (content is
FunctionCallContent
fcc)
ChatReduction\MessageCountingChatReducerTests.cs (2)
143
Assert.DoesNotContain(m.Contents, c => c is
FunctionCallContent
);
150
Assert.DoesNotContain(m.Contents, c => c is
FunctionCallContent
);
ChatReduction\SummarizingChatReducerTests.cs (5)
107
Assert.DoesNotContain(msgs, m => m.Contents.Any(c => c is
FunctionCallContent
or FunctionResultContent or TestUserInputRequestContent or TestUserInputResponseContent));
122
Assert.Contains(m.Contents, c => c is
FunctionCallContent
);
203
Assert.DoesNotContain(msgList, m => m.Contents.Any(c => c is
FunctionCallContent
or FunctionResultContent or TestUserInputRequestContent or TestUserInputResponseContent));
219
Assert.Contains(resultList, m => m.Contents.Any(c => c is
FunctionCallContent
fc && fc.CallId == "call2"));
221
Assert.DoesNotContain(resultList, m => m.Contents.Any(c => c is
FunctionCallContent
fc && fc.CallId == "call1"));
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (3)
38
if (expectedItem is
FunctionCallContent
expectedFunctionCall)
40
var
chatFunctionCall = (
FunctionCallContent
)chatItem;