375 instantiations of FunctionCallContent
Microsoft.Extensions.AI (1)
ChatCompletion\FunctionInvocationContext.cs (1)
42get => field ??= new(string.Empty, _nopFunction.Name, EmptyReadOnlyDictionary<string, object?>.Instance);
Microsoft.Extensions.AI.Abstractions (2)
Contents\FunctionCallContent.cs (1)
100return new FunctionCallContent(callId, name, arguments)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.FunctionCallContent.g.cs (1)
34ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.FunctionCallContent((string)args[0], (string)args[1], (global::System.Collections.Generic.IDictionary<string, object>)args[2]),
Microsoft.Extensions.AI.Abstractions.Tests (34)
ChatCompletion\ChatMessageTests.cs (2)
148new FunctionCallContent("callId1", "fc1"), 271new FunctionCallContent("function-id", "plugin-name-function-name", new Dictionary<string, object?> { ["parameter"] = "argument" }),
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (1)
1127new() { Contents = [new FunctionCallContent("fc1", "SearchTool", new Dictionary<string, object?> { ["q"] = "test" })] },
ChatCompletion\ChatResponseUpdateTests.cs (3)
94new FunctionCallContent("callId1", "fc1"), 123new FunctionCallContent("callId1", "fc1"), 186new FunctionCallContent("callId1", "fc1"),
Contents\AIContentTests.cs (3)
72new FunctionCallContent("call123", "functionName", new Dictionary<string, object?> { { "param1", 123 } }), 77new ToolApprovalRequestContent("request123", new FunctionCallContent("call123", "functionName", new Dictionary<string, object?> { { "param1", 123 } })), 78new ToolApprovalResponseContent("request123", approved: true, new FunctionCallContent("call123", "functionName", new Dictionary<string, object?> { { "param1", 123 } })),
Contents\FunctionCallContentTests.cs (7)
21FunctionCallContent c = new("callId1", "name"); 39FunctionCallContent c = new("id", "name", args); 52FunctionCallContent c = new("callId1", "name"); 87var sut = new FunctionCallContent("callId1", "functionName", new Dictionary<string, object?> { ["key"] = "value" }) 148var original = new FunctionCallContent("callId1", "functionName") { InformationalOnly = informationalOnly }; 164var sut = new FunctionCallContent("callId1", "functionName", new Dictionary<string, object?> { ["key"] = "value" }) { Exception = ex }; 412var content = new FunctionCallContent("call123", "myFunction")
Contents\InputRequestContentTests.cs (1)
40new ToolApprovalRequestContent("request123", new FunctionCallContent("call123", "functionName", new Dictionary<string, object?> { { "param1", 123 } })),
Contents\InputResponseContentTests.cs (1)
39new ToolApprovalResponseContent("request123", true, new FunctionCallContent("call123", "functionName")),
Contents\ToolApprovalRequestContentTests.cs (7)
16Assert.Throws<ArgumentNullException>("requestId", () => new ToolApprovalRequestContent(null!, new FunctionCallContent("FCC1", "TestFunction"))); 17Assert.Throws<ArgumentException>("requestId", () => new ToolApprovalRequestContent("", new FunctionCallContent("FCC1", "TestFunction"))); 18Assert.Throws<ArgumentException>("requestId", () => new ToolApprovalRequestContent("\r\t\n ", new FunctionCallContent("FCC1", "TestFunction"))); 24new FunctionCallContent("FCC1", "TestFunction", new Dictionary<string, object?> { { "param1", 123 } }), 65FunctionCallContent functionCall = new("FCC1", "TestFunction"); 137var content = new ToolApprovalRequestContent("req-1", new FunctionCallContent("call1", "Func")); 146var content = new ToolApprovalRequestContent("req-1", new FunctionCallContent("call1", "Func"))
Contents\ToolApprovalResponseContentTests.cs (5)
16Assert.Throws<ArgumentNullException>("requestId", () => new ToolApprovalResponseContent(null!, true, new FunctionCallContent("FCC1", "TestFunction"))); 17Assert.Throws<ArgumentException>("requestId", () => new ToolApprovalResponseContent("", true, new FunctionCallContent("FCC1", "TestFunction"))); 18Assert.Throws<ArgumentException>("requestId", () => new ToolApprovalResponseContent("\r\t\n ", true, new FunctionCallContent("FCC1", "TestFunction"))); 24new FunctionCallContent("FCC1", "TestFunction", new Dictionary<string, object?> { { "param1", 123 } }), 82var content = new ToolApprovalResponseContent("request123", true, new FunctionCallContent("call123", "functionName"))
Contents\ToolCallContentTests.cs (1)
56new FunctionCallContent("call1", "function1", new Dictionary<string, object?> { { "param1", 123 } }),
Generated\361d1da7f942c932\TestJsonSerializerContext.FunctionCallContent.g.cs (1)
32ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.FunctionCallContent((string)args[0], (string)args[1], (global::System.Collections.Generic.IDictionary<string, object>)args[2]),
Realtime\RealtimeConversationItemTests.cs (1)
57var functionCall = new FunctionCallContent("call_1", "myFunc");
SpeechToText\SpeechToTextResponseUpdateTests.cs (1)
64new FunctionCallContent("callId1", "fc1"),
Microsoft.Extensions.AI.Evaluation.Reporting (1)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.FunctionCallContent.g.cs (1)
34ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.FunctionCallContent((string)args[0], (string)args[1], (global::System.Collections.Generic.IDictionary<string, object>)args[2]),
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (1)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.FunctionCallContent.g.cs (1)
34ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.FunctionCallContent((string)args[0], (string)args[1], (global::System.Collections.Generic.IDictionary<string, object>)args[2]),
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (1)
ScenarioRunResultTests.cs (1)
219var functionCall = new FunctionCallContent(
Microsoft.Extensions.AI.Integration.Tests (1)
PromptBasedFunctionCallingChatClient.cs (1)
118message.Contents.Add(new FunctionCallContent(id, toolCallParsed.Name!, toolCallParsed.Arguments is { } args ? new ReadOnlyDictionary<string, object?>(args) : null));
Microsoft.Extensions.AI.OpenAI (1)
OpenAIRealtimeClientSession.cs (1)
1117[new FunctionCallContent(funcCallItem.CallId ?? string.Empty, funcCallItem.FunctionName, arguments)],
Microsoft.Extensions.AI.OpenAI.Tests (12)
OpenAIChatClientTests.cs (2)
1472new FunctionCallContent("12345", "SayHello"), 1473new FunctionCallContent("12346", "SayHi"),
OpenAIConversionTests.cs (10)
731new FunctionCallContent("callid123", "SomeFunction", new Dictionary<string, object?> 800new FunctionCallContent("callid123", "SomeFunction", new Dictionary<string, object?> 1220new FunctionCallContent("call123", "TestFunction", new Dictionary<string, object?> { ["param"] = "value" }) 1591new FunctionCallContent("process_data", "ProcessComplexData", complexArgs) 1774var functionCallContent = new FunctionCallContent("call-123", "GetWeather", new Dictionary<string, object?> 1812var functionCall1 = new FunctionCallContent("call-1", "Function1", new Dictionary<string, object?> { ["param1"] = "value1" }); 1813var functionCall2 = new FunctionCallContent("call-2", "Function2", new Dictionary<string, object?> { ["param2"] = "value2" }); 1846new FunctionCallContent("call-123", "GetWeather", new Dictionary<string, object?> { ["location"] = "Seattle" }), 2087new FunctionCallContent("call-123", "TestFunction", new Dictionary<string, object?> { ["param"] = "value" }) 2122new FunctionCallContent("call-456", "GetWeather", new Dictionary<string, object?> { ["location"] = "Seattle" })
Microsoft.Extensions.AI.Stabilization.Tests (1)
Generated\361d1da7f942c932\AIContentSerializationRegressionContext.FunctionCallContent.g.cs (1)
32ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.FunctionCallContent((string)args[0], (string)args[1], (global::System.Collections.Generic.IDictionary<string, object>)args[2]),
Microsoft.Extensions.AI.Tests (320)
ChatCompletion\ChatClientStructuredOutputExtensionsTests.cs (1)
201new FunctionCallContent("callid123", "get_data"),
ChatCompletion\DistributedCachingChatClientTest.cs (4)
52Contents = [new FunctionCallContent("someCallId", "functionName", new Dictionary<string, object?> 255new FunctionCallContent("someCallId", "someFn", new Dictionary<string, object?> { ["arg1"] = "value1" }), 266Contents = [new FunctionCallContent("someCallId", "someFn", new Dictionary<string, object?> { ["arg1"] = "value1" })], 316new() { Role = ChatRole.Assistant, Contents = [new FunctionCallContent("callId1", "separator")] },
ChatCompletion\FunctionInvocationContextTests.cs (1)
55FunctionCallContent callContent = new(string.Empty, string.Empty, new Dictionary<string, object?>());
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (165)
41new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 48new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")), 49new ToolApprovalRequestContent("ficc_callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 77new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 84new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")), 85new ToolApprovalRequestContent("ficc_callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 124new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 133new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")) 137new ToolApprovalRequestContent("ficc_callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 175new FunctionCallContent("callId1", "Func1"), 176new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }) 184new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")), 185new ToolApprovalRequestContent("ficc_callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 220new FunctionCallContent("callId1", "Func1"), 221new FunctionCallContent("callId2", "Unknown"), 229new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")), 230new ToolApprovalRequestContent("ficc_callId2", new FunctionCallContent("callId2", "Unknown")) 259new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")), 260new ToolApprovalRequestContent("ficc_callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 264new ToolApprovalResponseContent("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")), 265new ToolApprovalResponseContent("ficc_callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 272new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 283new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 311new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")), 312new ToolApprovalRequestContent("ficc_callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 316new ToolApprovalResponseContent("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")), 317new ToolApprovalResponseContent("ficc_callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 325new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 336new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 363new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")), 367new ToolApprovalRequestContent("ficc_callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 371new ToolApprovalResponseContent("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")), 375new ToolApprovalResponseContent("ficc_callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 382new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]) { MessageId = "resp1" }, 383new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]) { MessageId = "resp2" }, 394new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]) { MessageId = "resp1" }, 395new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]) { MessageId = "resp2" }, 422new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")), 423new ToolApprovalRequestContent("ficc_callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 427new ToolApprovalResponseContent("ficc_callId1", false, new FunctionCallContent("callId1", "Func1")), 428new ToolApprovalResponseContent("ficc_callId2", false, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 435new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 450new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 481new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")), 482new ToolApprovalRequestContent("ficc_callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 486new ToolApprovalResponseContent("ficc_callId1", false, new FunctionCallContent("callId1", "Func1")), 487new ToolApprovalResponseContent("ficc_callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 494new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 506new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 514new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 545new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")), 546new ToolApprovalRequestContent("ficc_callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 550new ToolApprovalResponseContent("ficc_callId1", false, new FunctionCallContent("callId1", "Func1")) 554new ToolApprovalResponseContent("ficc_callId2", false, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 564new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 579new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 611new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")), 612new ToolApprovalRequestContent("ficc_callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })), 613new ToolApprovalRequestContent("ficc_callId3", new FunctionCallContent("callId3", "Func3", arguments: new Dictionary<string, object?> { { "s", "test" } })) 617new ToolApprovalResponseContent("ficc_callId1", false, new FunctionCallContent("callId1", "Func1")) { Reason = "Custom rejection for Func1" }, 618new ToolApprovalResponseContent("ficc_callId2", false, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })), 619new ToolApprovalResponseContent("ficc_callId3", true, new FunctionCallContent("callId3", "Func3", arguments: new Dictionary<string, object?> { { "s", "test" } })) 628new FunctionCallContent("callId1", "Func1"), 629new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }), 630new FunctionCallContent("callId3", "Func3", arguments: new Dictionary<string, object?> { { "s", "test" } }) 649new FunctionCallContent("callId1", "Func1"), 650new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }), 651new FunctionCallContent("callId3", "Func3", arguments: new Dictionary<string, object?> { { "s", "test" } }) 666new FunctionCallContent("callId1", "Func1"), 667new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }), 668new FunctionCallContent("callId3", "Func3", arguments: new Dictionary<string, object?> { { "s", "test" } }) 703new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")), 707new ToolApprovalResponseContent("ficc_callId1", false, new FunctionCallContent("callId1", "Func1")) 717new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 731new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 761new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")), 762new ToolApprovalRequestContent("ficc_callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 766new ToolApprovalResponseContent("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")), 767new ToolApprovalResponseContent("ficc_callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 774new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 780new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 3 } })]), 785new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 789new ToolApprovalRequestContent("ficc_callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 3 } })) 815new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")), 816new ToolApprovalRequestContent("ficc_callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 820new ToolApprovalResponseContent("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")), 821new ToolApprovalResponseContent("ficc_callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 823new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 827new ToolApprovalRequestContent("ficc_callId3", new FunctionCallContent("callId3", "Func1")), 831new ToolApprovalResponseContent("ficc_callId3", true, new FunctionCallContent("callId3", "Func1")), 838new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 840new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "Func1")]), 851new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "Func1")]), 875var requestFcc = new FunctionCallContent("callId1", "Func1"); 876var responseFcc = new FunctionCallContent("callId1", "Func1"); 945var request1Fcc = new FunctionCallContent("callId1", "Func1"); 946var response1Fcc = new FunctionCallContent("callId1", "Func1") { InformationalOnly = true }; 948var request2Fcc = new FunctionCallContent("callId2", "Func1"); 1040new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 1049new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 1059new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 1086new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")), 1116new ToolApprovalResponseContent("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")), 1117new ToolApprovalResponseContent("ficc_callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 1124new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 1135new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 1162new ToolApprovalResponseContent("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")), 1163new ToolApprovalResponseContent("ficc_callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 1179new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 1206new ToolApprovalResponseContent("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")), 1228new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 1256new ToolApprovalResponseContent("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")), 1276new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 1302new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")), 1306new ToolApprovalResponseContent("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")), 1318new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 1330new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 1357new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")), 1361new ToolApprovalResponseContent("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")), 1369new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 1381new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 1415new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")), 1419new ToolApprovalResponseContent("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")), 1425new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 1482yield return new ChatResponseUpdate(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]) { MessageId = messageId }; 1488new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }) 1562yield return new ChatResponseUpdate(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]) { MessageId = messageId }; 1567new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }) 1571yield return new ChatResponseUpdate(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func3")]) { MessageId = messageId }; 1644var alreadyProcessedFunctionCall = new FunctionCallContent("callId1", "Func1") { InformationalOnly = true }; 1688new ToolApprovalRequestContent("approval-request-id", new FunctionCallContent("function-call-id", "Func1")) 1692new ToolApprovalResponseContent("approval-request-id", true, new FunctionCallContent("function-call-id", "Func1")) 1704new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("function-call-id", "Func1")]) { MessageId = OriginalMessageId }, 1743new FunctionCallContent("callId1", "Func"), 1752new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func")), 1782new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func")), 1787new ToolApprovalResponseContent("ficc_callId1", true, new FunctionCallContent("callId1", "Func")), 1801new FunctionCallContent("callId1", "Func") 1825new FunctionCallContent("callId1", "Func") 1866new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func")), 1871new ToolApprovalResponseContent("ficc_callId1", approveFuncCall, new FunctionCallContent("callId1", "Func")), 1884new FunctionCallContent("callId1", "Func") 1911new FunctionCallContent("callId1", "Func"), 2098FunctionCallContent fcc => new FunctionCallContent(fcc.CallId, fcc.Name, fcc.Arguments)
ChatCompletion\FunctionInvokingChatClientTests.cs (126)
94new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 96new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 98new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]), 128new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 130new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 132new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]), 161new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 163new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 165new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]), 194new FunctionCallContent("callId1", "Func1"), 195new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 34 } }), 196new FunctionCallContent("callId3", "Func2", arguments: new Dictionary<string, object?> { { "i", 56 } }), 206new FunctionCallContent("callId4", "Func2", arguments: new Dictionary<string, object?> { { "i", 78 } }), 207new FunctionCallContent("callId5", "Func1") 254new FunctionCallContent("callId1", "Func", arguments: new Dictionary<string, object?> { { "arg", "hello" } }), 255new FunctionCallContent("callId2", "Func", arguments: new Dictionary<string, object?> { { "arg", "world" } }), 298new FunctionCallContent("callId1", "Func", arguments: new Dictionary<string, object?> { { "arg", "hello" } }), 299new FunctionCallContent("callId2", "Func", arguments: new Dictionary<string, object?> { { "arg", "world" } }), 330new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 332new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 334new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]), 380new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]))); 393new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")])).ToChatResponseUpdates()); 461new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]))); 474new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")])).ToChatResponseUpdates()); 542new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]))); 555new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")])).ToChatResponseUpdates()); 637new ChatMessage(ChatRole.Assistant, [new FunctionCallContent($"callId0", "VoidReturn")]), 645plan.Add(new ChatMessage(ChatRole.Assistant, [new FunctionCallContent($"callId{(i + 1)}", "VoidReturn")])); 668var message = new ChatMessage(ChatRole.Assistant, [new FunctionCallContent($"callId{capturedOptions.Count}", "Func1")]); 712var message = new ChatMessage(ChatRole.Assistant, [new FunctionCallContent($"callId{capturedOptions.Count}", "Func1")]); 759var message = new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]); 804var message = new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]); 960assistantMessage.Contents.Add(new FunctionCallContent(callId, "Func", 984new ChatMessage(ChatRole.Assistant, [new TextContent("extra"), new FunctionCallContent("callId1", "Func1"), new TextContent("stuff")]), 986new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 988new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } }), new TextContent("more")]), 1021new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 1043new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["arg1"] = "value1" })]), 1100new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["arg1"] = "value1" })]), 1192new() { Contents = [new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["text"] = "Input 1" })] }, 1193new() { Contents = [new FunctionCallContent("callId2", "Func1", new Dictionary<string, object?> { ["text"] = "Input 2" })] } 1245new(ChatRole.Assistant, [new FunctionCallContent($"callId{chatContents.Count()}", "Func1")]) : 1294new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["i"] = 41 })]), 1296new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func1", new Dictionary<string, object?> { ["i"] = 42 })]), 1304new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "Func1", new Dictionary<string, object?> { ["i"] = 43 })]), 1364new FunctionCallContent("callId1", "Search"), 1365new FunctionCallContent("callId2", "Search", new Dictionary<string, object?> { { "result", "birds" } }), 1366new FunctionCallContent("callId3", "Search"), 1412return new ChatResponse(new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId-abc", "Func1")])) 1450new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["arg1"] = "value1" })]), 1480new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["arg"] = "value1" }), 1481new FunctionCallContent("callId2", "Func1", new Dictionary<string, object?> { ["arg"] = "value2" }), 1533new FunctionCallContent("callId1", "UnknownFunc", new Dictionary<string, object?> { ["i"] = 1 }), 1534new FunctionCallContent("callId2", "KnownFunc", new Dictionary<string, object?> { ["i"] = 2 }) 1552new FunctionCallContent("callId1", "UnknownFunc", new Dictionary<string, object?> { ["i"] = 1 }), 1553new FunctionCallContent("callId2", "KnownFunc", new Dictionary<string, object?> { ["i"] = 2 }) 1580new(ChatRole.Assistant, [new FunctionCallContent("callId1", "DefOnly")]), 1610new FunctionCallContent("callId1", "Known"), 1611new FunctionCallContent("callId2", "DefOnly") 1645messages.Add(new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")])); 1682new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 1741? new(ChatRole.Assistant, [new FunctionCallContent("call1", "Func1")]) 1793new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 1835new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 1885new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["arg1"] = "secret" })]), 1957new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 2006new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 2033var alreadyProcessedFunctionCall = new FunctionCallContent("callId1", "Func1") { InformationalOnly = true }; 2085var needsProcessing = new FunctionCallContent("callId1", "Func1") { InformationalOnly = false }; 2086var alreadyProcessed = new FunctionCallContent("callId2", "Func2") { InformationalOnly = true }; 2161return new ChatResponse(new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")])); 2329cloned.Add(new FunctionCallContent(fcc.CallId, fcc.Name, fcc.Arguments) 2389[new FunctionCallContent("callId1", "FunctionA")])]); 2396[new FunctionCallContent("callId2", "FunctionB")])]); 2412[new FunctionCallContent("callId1", "FunctionA")]); 2418[new FunctionCallContent("callId2", "FunctionB")]); 2483[new FunctionCallContent("callId1", "FunctionA")])]); 2490[new FunctionCallContent("callId2", "FunctionB")])]); 2506[new FunctionCallContent("callId1", "FunctionA")]); 2512[new FunctionCallContent("callId2", "FunctionB")]); 2590[new FunctionCallContent("callId1", "FunctionA")])]); 2596[new FunctionCallContent("callId2", "FunctionB")])]); 2611[new FunctionCallContent("callId1", "FunctionA")]); 2617[new FunctionCallContent("callId2", "FunctionB")]); 2688[new FunctionCallContent("callId1", "FunctionA")])]); 2696[new FunctionCallContent("callId2", "FunctionB"), 2697new FunctionCallContent("callId3", "AdditionalTool")])]); 2712[new FunctionCallContent("callId1", "FunctionA")]); 2718[new FunctionCallContent("callId2", "FunctionB"), 2719new FunctionCallContent("callId3", "AdditionalTool")]); 2792[new FunctionCallContent("callId1", "FunctionA")])]); 2798[new FunctionCallContent("callId2", "SharedName")])]); 2813[new FunctionCallContent("callId1", "FunctionA")]); 2819[new FunctionCallContent("callId2", "SharedName")]); 2890[new FunctionCallContent($"callId{callCount}", "FunctionA")])]); 2905[new FunctionCallContent($"callId{callCount}", "FunctionA")]); 2968[new FunctionCallContent("callId1", "FunctionA")])]); 2976[new FunctionCallContent("callId2", "FunctionB")])]); 2991[new FunctionCallContent("callId1", "FunctionA")]); 2997[new FunctionCallContent("callId2", "FunctionB")]); 3069[new FunctionCallContent("callId1", "FunctionA")])]); 3077[new FunctionCallContent("callId2", "FunctionB")])]); 3092[new FunctionCallContent("callId1", "FunctionA")]); 3098[new FunctionCallContent("callId2", "FunctionB")]); 3175[new FunctionCallContent("callId1", "FunctionA")])]); 3183[new FunctionCallContent("callId2", "FunctionB")])]); 3198[new FunctionCallContent("callId1", "FunctionA")]); 3204[new FunctionCallContent("callId2", "FunctionB")]); 3258new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "UnknownFunc")]), 3288new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 3324new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "TerminatingFunc")]), 3353new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 3362new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")) 3398new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")) 3402new ToolApprovalResponseContent("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")) 3435new ToolApprovalRequestContent("ficc_callId1", new FunctionCallContent("callId1", "Func1")) 3439new ToolApprovalResponseContent("ficc_callId1", false, new FunctionCallContent("callId1", "Func1")) { Reason = "User denied" } 3474new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 3482new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 3538new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2")]), 3553new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2")]), 3607return new ChatResponse(new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")])); 3618var response = new ChatResponse(new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]));
ChatCompletion\ImageGeneratingChatClientTests.cs (8)
317[new FunctionCallContent(callId, "GenerateImage", new Dictionary<string, object?> { ["prompt"] = "a cat" })]); 360[new FunctionCallContent(callId, "GenerateImage", new Dictionary<string, object?> { ["prompt"] = "a cat" })]); 405"at-start" => [new FunctionCallContent(imageCallId, "GenerateImage", new Dictionary<string, object?> { ["prompt"] = "a cat" }), 408new FunctionCallContent(imageCallId, "GenerateImage", new Dictionary<string, object?> { ["prompt"] = "a cat" })], 410new FunctionCallContent(imageCallId, "GenerateImage", new Dictionary<string, object?> { ["prompt"] = "a cat" }), 480"at-start" => [new FunctionCallContent(imageCallId, "GenerateImage", new Dictionary<string, object?> { ["prompt"] = "a cat" }), 483new FunctionCallContent(imageCallId, "GenerateImage", new Dictionary<string, object?> { ["prompt"] = "a cat" })], 485new FunctionCallContent(imageCallId, "GenerateImage", new Dictionary<string, object?> { ["prompt"] = "a cat" }),
ChatCompletion\OpenTelemetryChatClientTests.cs (4)
116new(ChatRole.Assistant, [new FunctionCallContent("12345", "GetPersonName")]), 408new FunctionCallContent("call-123", "GetWeather", new Dictionary<string, object?> { ["location"] = "Seattle" }), 424yield return new() { Contents = [new FunctionCallContent("call-123", "GetWeather", new Dictionary<string, object?> { ["location"] = "Seattle" })] }; 450new(ChatRole.Assistant, [new FunctionCallContent("call-456", "SearchFiles")]),
ChatReduction\MessageCountingChatReducerTests.cs (3)
128new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("call1", "get_weather", new Dictionary<string, object?> { ["location"] = "Seattle" })]), 223new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("call1", "func", null)]), 225new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("call2", "func", null)]),
ChatReduction\SummarizingChatReducerTests.cs (3)
99new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("call1", "get_weather"), new TestInputRequestContent("uir1")]), 188new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("call1", "get_weather", new Dictionary<string, object?> { ["location"] = "Seattle" }), new TestInputRequestContent("uir2")]), 193new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("call2", "get_weather", new Dictionary<string, object?> { ["location"] = "New York" })]),
Generated\361d1da7f942c932\TestJsonSerializerContext.FunctionCallContent.g.cs (1)
32ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.FunctionCallContent((string)args[0], (string)args[1], (global::System.Collections.Generic.IDictionary<string, object>)args[2]),
Realtime\FunctionInvokingRealtimeClientTests.cs (3)
481new FunctionCallContent("call_a", "slow_func"), 482new FunctionCallContent("call_b", "slow_func"), 641var functionCallContent = new FunctionCallContent(callId, functionName, arguments);
Realtime\OpenTelemetryRealtimeClientTests.cs (1)
602[new FunctionCallContent("call_123", "search", new Dictionary<string, object?> { ["query"] = "test" })],
419 references to FunctionCallContent
Microsoft.AspNetCore.Components.AI (9)
Blocks\FunctionApprovalBlock.cs (1)
42public FunctionCallContent? Call => InnerBlock switch
Blocks\FunctionInvocationContentBlock.cs (2)
26private FunctionCallContent? _call; 31public FunctionCallContent? Call
Blocks\UIActionBlock.cs (2)
31internal UIActionBlock(AIFunction function, FunctionCallContent call) 40public FunctionCallContent Call { get; }
Pipeline\FunctionApprovalHandler.cs (2)
34Id = approvalRequest.ToolCall is FunctionCallContent functionCall 48if (toolCall is FunctionCallContent functionCall)
Pipeline\FunctionInvocationHandler.cs (1)
24if (content is FunctionCallContent call)
Pipeline\UIActionHandler.cs (1)
26if (content is FunctionCallContent call &&
Microsoft.Extensions.AI (76)
ChatCompletion\FunctionInvocationContext.cs (1)
40public FunctionCallContent CallContent
ChatCompletion\FunctionInvokingChatClient.cs (56)
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="ToolApprovalRequestContent"/> 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, 296List<FunctionCallContent>? functionCallContents = null; // function call contents that need responding to in the current turn 454List<FunctionCallContent>? functionCallContents = null; // function call contents that need responding to in the current turn 863/// instances with a <see cref="FunctionCallContent"/> tool call that the FICC needs to process. 870c is ToolApprovalRequestContent { ToolCall: FunctionCallContent { InformationalOnly: false } } 871or ToolApprovalResponseContent { ToolCall: FunctionCallContent { InformationalOnly: false } }); 876/// non-informational <see cref="FunctionCallContent"/>). When this returns <see langword="false"/>, the anchor 884c is ToolApprovalRequestContent { ToolCall: FunctionCallContent { InformationalOnly: false } } 885or ToolApprovalResponseContent { ToolCall: FunctionCallContent { InformationalOnly: false } }); 887/// <summary>Copies any <see cref="FunctionCallContent"/> from <paramref name="messages"/> to <paramref name="functionCalls"/>.</summary> 889IList<ChatMessage> messages, [NotNullWhen(true)] ref List<FunctionCallContent>? functionCalls) 901/// <summary>Copies any <see cref="FunctionCallContent"/> from <paramref name="content"/> to <paramref name="functionCalls"/>.</summary> 903IList<AIContent> content, [NotNullWhen(true)] ref List<FunctionCallContent>? functionCalls) 909if (content[i] is FunctionCallContent functionCall && !functionCall.InformationalOnly) 920/// Marks any <see cref="FunctionCallContent"/> in <paramref name="messages"/> as <see cref="FunctionCallContent.InformationalOnly"/> 954if (contents[j] is FunctionCallContent fcc && !fcc.InformationalOnly && resultCallIds.Contains(fcc.CallId)) 963/// Marks any <see cref="FunctionCallContent"/> in the streaming <paramref name="updates"/> as <see cref="FunctionCallContent.InformationalOnly"/> 968private static void MarkServerHandledFunctionCalls(List<ChatResponseUpdate> updates, List<FunctionCallContent>? functionCallContents) 1091private bool ShouldTerminateLoopBasedOnHandleableFunctions(List<FunctionCallContent>? functionCalls, ChatOptions? options) 1107foreach (var fcc in functionCalls) 1118foreach (var fcc in functionCalls) 1164List<FunctionCallContent> functionCallContents, int iteration, int consecutiveErrorCount, 1330/// 2. Recreate <see cref="FunctionCallContent"/> for any <see cref="ToolApprovalResponseContent"/> that haven't been executed yet. 1452case ToolApprovalRequestContent tarc when tarc.ToolCall is FunctionCallContent { InformationalOnly: false }: 1458case ToolApprovalResponseContent tarc when tarc.ToolCall is FunctionCallContent { InformationalOnly: false }: 1519if (approvalResponse.ToolCall is not FunctionCallContent fcc || functionResultCallIds?.Contains(fcc.CallId) is true) 1572/// Extracts the <see cref="FunctionCallContent"/> from the provided <see cref="ToolApprovalResponseContent"/> to recreate the original function call messages. 1573/// The output messages tries to mimic the original messages that contained the <see cref="FunctionCallContent"/>, e.g. if the <see cref="FunctionCallContent"/> 1574/// had been split into separate messages, this method will recreate similarly split messages, each with their own <see cref="FunctionCallContent"/>. 1645/// Takes the <see cref="FunctionCallContent"/> from the <paramref name="resultWithRequestMessage"/> and wraps it in a <see cref="ChatMessage"/> 1646/// using the same message id that the <see cref="FunctionCallContent"/> was originally returned with from the downstream <see cref="IChatClient"/>. 1662List<FunctionCallContent>? functionCallContents, 1678var fcc = functionCallContents![lastApprovalCheckedFCCIndex]; 1694/// Replaces all <see cref="FunctionCallContent"/> with <see cref="ToolApprovalRequestContent"/> and ouputs a new list if any of them were replaced. 1696/// <returns>true if any <see cref="FunctionCallContent"/> was replaced, false otherwise.</returns> 1708if (content[i] is FunctionCallContent fcc && !fcc.InformationalOnly) 1734/// Replaces all <see cref="FunctionCallContent"/> from <paramref name="messages"/> with <see cref="ToolApprovalRequestContent"/> 1753if (content[j] is FunctionCallContent functionCall && !functionCall.InformationalOnly) 1788var functionCall = (FunctionCallContent)message.Contents[contentIndex]; 1807/// Execute the provided <see cref="ToolApprovalResponseContent"/> and return the resulting <see cref="FunctionCallContent"/> 1827originalMessages, options, notInvokedApprovals.Select(x => x.Response.ToolCall).OfType<FunctionCallContent>().ToList(), 0, consecutiveErrorCount, isStreaming, cancellationToken, insertIndex); 1876internal FunctionInvocationResult(bool terminate, FunctionInvocationStatus status, FunctionCallContent callContent, object? result, Exception? exception) 1889public FunctionCallContent CallContent { get; } 1919public FunctionCallContent ResponseFunctionCallContent => (FunctionCallContent)Response.ToolCall; 1920public FunctionCallContent? RequestFunctionCallContent => Request?.ToolCall as FunctionCallContent;
ChatCompletion\ImageGeneratingChatClient.cs (1)
328if (content is FunctionCallContent functionCall &&
ChatReduction\MessageCountingChatReducer.cs (1)
57else if (!message.Contents.Any(m => m is FunctionCallContent or FunctionResultContent))
ChatReduction\SummarizingChatReducer.cs (1)
209is FunctionCallContent
Common\FunctionInvocationProcessor.cs (4)
63List<FunctionCallContent> functionCallContents, 66Func<FunctionCallContent, AIFunction, int, FunctionInvocationContext> createContext, 107FunctionCallContent callContent, 110Func<FunctionCallContent, AIFunction, int, FunctionInvocationContext> createContext,
Common\OtelMessageSerializer.cs (1)
77case FunctionCallContent fcc:
Realtime\FunctionInvokingRealtimeClient.cs (1)
21/// When sessions created by this client receive a <see cref="FunctionCallContent"/> in a realtime server message from the inner
Realtime\FunctionInvokingRealtimeClientSession.cs (9)
29/// When this session receives a <see cref="FunctionCallContent"/> in a realtime server message from its inner 37/// <see cref="FunctionInvokingRealtimeClientSession"/> will not attempt to invoke it, and instead allow that <see cref="FunctionCallContent"/> 155List<FunctionCallContent>? functionCallContents = null; 211private static bool ExtractFunctionCalls(ResponseOutputItemRealtimeServerMessage message, List<FunctionCallContent> functionCallContents) 222if (content is FunctionCallContent functionCallContent) 276private bool ShouldTerminateBasedOnFunctionCalls(List<FunctionCallContent> functionCallContents) 283foreach (var fcc in functionCallContents) 294foreach (var fcc in functionCallContents) 320List<FunctionCallContent> functionCallContents,
Realtime\OpenTelemetryRealtimeClientSession.cs (1)
539case FunctionCallContent fcc:
Microsoft.Extensions.AI.Abstractions (29)
Contents\AIContent.cs (1)
13[JsonDerivedType(typeof(FunctionCallContent), typeDiscriminator: "functionCall")]
Contents\FunctionCallContent.cs (4)
20/// Initializes a new instance of the <see cref="FunctionCallContent"/> class. 65/// Creates a new instance of <see cref="FunctionCallContent"/> parsing arguments using a specified encoding and parser. 72/// <returns>A new instance of <see cref="FunctionCallContent"/> containing the parse result.</returns> 77public static FunctionCallContent CreateFromParsedArguments<TEncoding>(
Contents\ToolCallContent.cs (1)
13[JsonDerivedType(typeof(FunctionCallContent), "functionCall")]
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.FunctionCallContent.g.cs (22)
15private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent>? _FunctionCallContent; 21public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent> FunctionCallContent 24get => _FunctionCallContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.FunctionCallContent)); 27private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent> Create_FunctionCallContent(global::System.Text.Json.JsonSerializerOptions options) 29if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.FunctionCallContent>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent> jsonTypeInfo)) 31var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.FunctionCallContent> 37ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string), typeof(string), typeof(global::System.Collections.Generic.IDictionary<string, object>)}, modifiers: null), 41jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.FunctionCallContent>(options, objectInfo); 58DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 60Getter = static obj => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).Name, 68AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetProperty("Name", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 79DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 81Getter = static obj => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).Arguments, 82Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).Arguments = value!, 89AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetProperty("Arguments", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.IDictionary<string, object>), global::System.Array.Empty<global::System.Type>(), null), 99DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 119DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 121Getter = static obj => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).InformationalOnly, 122Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).InformationalOnly = value!, 129AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetProperty("InformationalOnly", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.GetJsonTypeInfo.g.cs (1)
192if (type == typeof(global::Microsoft.Extensions.AI.FunctionCallContent))
Microsoft.Extensions.AI.Abstractions.Tests (91)
AssertExtensions.cs (5)
38if (expectedItem is FunctionCallContent expectedFunctionCall) 40var chatFunctionCall = (FunctionCallContent)chatItem; 79FunctionCallContent fcc => (fcc.Name, fcc.Arguments), 86FunctionCallContent fcc => (fcc.Name, fcc.Arguments),
ChatCompletion\ChatMessageTests.cs (4)
326var functionCallContent = deserializedMessage.Contents[4] as FunctionCallContent; 387var funcCall = Assert.IsType<FunctionCallContent>(result.Contents[1]);
ChatCompletion\ChatResponseUpdateTests.cs (4)
150Assert.IsType<FunctionCallContent>(result.Contents[2]); 151Assert.Equal("fc1", ((FunctionCallContent)result.Contents[2]).Name); 214Assert.IsType<FunctionCallContent>(result.Contents[2]); 215Assert.Equal("fc1", ((FunctionCallContent)result.Contents[2]).Name);
Contents\FunctionCallContentTests.cs (29)
21FunctionCallContent c = new("callId1", "name"); 39FunctionCallContent c = new("id", "name", args); 52FunctionCallContent c = new("callId1", "name"); 87var sut = new FunctionCallContent("callId1", "functionName", new Dictionary<string, object?> { ["key"] = "value" }) 121var deserialized = JsonSerializer.Deserialize<FunctionCallContent>(json, TestJsonSerializerContext.Default.Options); 134var deserialized = JsonSerializer.Deserialize<FunctionCallContent>(json, TestJsonSerializerContext.Default.Options); 148var original = new FunctionCallContent("callId1", "functionName") { InformationalOnly = informationalOnly }; 150var deserialized = JsonSerializer.Deserialize<FunctionCallContent>(json, TestJsonSerializerContext.Default.Options); 164var sut = new FunctionCallContent("callId1", "functionName", new Dictionary<string, object?> { ["key"] = "value" }) { Exception = ex }; 168var deserializedSut = JsonSerializer.Deserialize<FunctionCallContent>(json, TestJsonSerializerContext.Default.Options); 344var content = FunctionCallContent.CreateFromParsedArguments( 389var content = FunctionCallContent.CreateFromParsedArguments(exc, "callId", "functionName", ThrowingParser); 403Assert.Throws<ArgumentNullException>("encodedArguments", () => FunctionCallContent.CreateFromParsedArguments((string)null!, "callId", "functionName", _ => null)); 404Assert.Throws<ArgumentNullException>("callId", () => FunctionCallContent.CreateFromParsedArguments("{}", null!, "functionName", _ => null)); 405Assert.Throws<ArgumentNullException>("name", () => FunctionCallContent.CreateFromParsedArguments("{}", "callId", null!, _ => null)); 406Assert.Throws<ArgumentNullException>("argumentParser", () => FunctionCallContent.CreateFromParsedArguments("{}", "callId", "functionName", null!)); 412var content = new FunctionCallContent("call123", "myFunction") 417AssertSerializationRoundtrips<FunctionCallContent>(content); 421static void AssertSerializationRoundtrips<T>(FunctionCallContent content) 428var deserializedContent = Assert.IsType<FunctionCallContent>(deserialized); 458var funcCall = Assert.IsType<FunctionCallContent>(result);
Contents\InputRequestContentTests.cs (2)
89var funcCall = Assert.IsType<FunctionCallContent>(approvalRequest.ToolCall);
Contents\InputResponseContentTests.cs (2)
91var funcCall = Assert.IsType<FunctionCallContent>(approvalResponse.ToolCall);
Contents\ToolApprovalRequestContentTests.cs (3)
65FunctionCallContent functionCall = new("FCC1", "TestFunction"); 127var funcCall = Assert.IsType<FunctionCallContent>(approvalRequest.ToolCall);
Contents\ToolApprovalResponseContentTests.cs (5)
95var functionCall = Assert.IsType<FunctionCallContent>(deserializedContent.ToolCall); 97Assert.Equal(((FunctionCallContent)content.ToolCall).Name, functionCall.Name); 127var funcCall = Assert.IsType<FunctionCallContent>(approvalResponse.ToolCall);
Generated\361d1da7f942c932\TestJsonSerializerContext.FunctionCallContent.g.cs (22)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent>? _FunctionCallContent; 19public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent> FunctionCallContent 22get => _FunctionCallContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.FunctionCallContent)); 25private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent> Create_FunctionCallContent(global::System.Text.Json.JsonSerializerOptions options) 27if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.FunctionCallContent>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent> jsonTypeInfo)) 29var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.FunctionCallContent> 35ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string), typeof(string), typeof(global::System.Collections.Generic.IDictionary<string, object>)}, modifiers: null), 39jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.FunctionCallContent>(options, objectInfo); 56DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 58Getter = static obj => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).Name, 66AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetProperty("Name", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 77DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 79Getter = static obj => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).Arguments, 80Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).Arguments = value!, 87AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetProperty("Arguments", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.IDictionary<string, object>), global::System.Array.Empty<global::System.Type>(), null), 97DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 117DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 119Getter = static obj => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).InformationalOnly, 120Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).InformationalOnly = value!, 127AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetProperty("InformationalOnly", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
Generated\361d1da7f942c932\TestJsonSerializerContext.FunctionCallContentArray.g.cs (10)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent[]>? _FunctionCallContentArray; 19public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent[]> FunctionCallContentArray 22get => _FunctionCallContentArray ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent[]>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.FunctionCallContent[])); 25private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent[]> Create_FunctionCallContentArray(global::System.Text.Json.JsonSerializerOptions options) 27if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.FunctionCallContent[]>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent[]> jsonTypeInfo)) 29var info = new global::System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues<global::Microsoft.Extensions.AI.FunctionCallContent[]> 35jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateArrayInfo<global::Microsoft.Extensions.AI.FunctionCallContent>(options, info); 45private void FunctionCallContentArraySerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Microsoft.Extensions.AI.FunctionCallContent[]? value)
Generated\361d1da7f942c932\TestJsonSerializerContext.GetJsonTypeInfo.g.cs (2)
178if (type == typeof(global::Microsoft.Extensions.AI.FunctionCallContent)) 182if (type == typeof(global::Microsoft.Extensions.AI.FunctionCallContent[]))
Realtime\RealtimeConversationItemTests.cs (2)
57var functionCall = new FunctionCallContent("call_1", "myFunc"); 64Assert.IsType<FunctionCallContent>(item.Contents[0]);
TestJsonSerializerContext.cs (1)
48[JsonSerializable(typeof(FunctionCallContent[]))]
Microsoft.Extensions.AI.Evaluation.Quality (13)
ChatResponseExtensions.cs (3)
31if (content is FunctionCallContent or FunctionResultContent) 34content is FunctionCallContent ? typeof(FunctionCallContent) : typeof(FunctionResultContent);
IntentResolutionEvaluator.cs (2)
120IEnumerable<FunctionCallContent> toolCalls = 121modelResponse.Messages.SelectMany(m => m.Contents).OfType<FunctionCallContent>();
TaskAdherenceEvaluator.cs (2)
119IEnumerable<FunctionCallContent> toolCalls = 120modelResponse.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 99IEnumerable<FunctionCallContent> toolCalls = 100modelResponse.Messages.SelectMany(m => m.Contents).OfType<FunctionCallContent>(); 105EvaluationDiagnostic.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.Evaluation.Reporting (23)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.FunctionCallContent.g.cs (22)
15private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent>? _FunctionCallContent; 21public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent> FunctionCallContent 24get => _FunctionCallContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.FunctionCallContent)); 27private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent> Create_FunctionCallContent(global::System.Text.Json.JsonSerializerOptions options) 29if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.FunctionCallContent>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent> jsonTypeInfo)) 31var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.FunctionCallContent> 37ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string), typeof(string), typeof(global::System.Collections.Generic.IDictionary<string, object>)}, modifiers: null), 41jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.FunctionCallContent>(options, objectInfo); 58DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 60Getter = static obj => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).Name, 68AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetProperty("Name", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 79DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 81Getter = static obj => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).Arguments, 82Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).Arguments = value!, 89AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetProperty("Arguments", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.IDictionary<string, object>), global::System.Array.Empty<global::System.Type>(), null), 99DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 119DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 121Getter = static obj => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).InformationalOnly, 122Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).InformationalOnly = value!, 129AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetProperty("InformationalOnly", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.GetJsonTypeInfo.g.cs (1)
160if (type == typeof(global::Microsoft.Extensions.AI.FunctionCallContent))
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (23)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.FunctionCallContent.g.cs (22)
15private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent>? _FunctionCallContent; 21public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent> FunctionCallContent 24get => _FunctionCallContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.FunctionCallContent)); 27private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent> Create_FunctionCallContent(global::System.Text.Json.JsonSerializerOptions options) 29if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.FunctionCallContent>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent> jsonTypeInfo)) 31var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.FunctionCallContent> 37ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string), typeof(string), typeof(global::System.Collections.Generic.IDictionary<string, object>)}, modifiers: null), 41jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.FunctionCallContent>(options, objectInfo); 58DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 60Getter = static obj => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).Name, 68AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetProperty("Name", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 79DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 81Getter = static obj => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).Arguments, 82Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).Arguments = value!, 89AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetProperty("Arguments", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.IDictionary<string, object>), global::System.Array.Empty<global::System.Type>(), null), 99DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 119DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 121Getter = static obj => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).InformationalOnly, 122Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).InformationalOnly = value!, 129AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetProperty("InformationalOnly", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.GetJsonTypeInfo.g.cs (1)
156if (type == typeof(global::Microsoft.Extensions.AI.FunctionCallContent))
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (1)
ScenarioRunResultTests.cs (1)
219var functionCall = new FunctionCallContent(
Microsoft.Extensions.AI.Integration.Tests (1)
PromptBasedFunctionCallingChatClient.cs (1)
74else if (message.Contents[itemIndex] is FunctionCallContent fcc)
Microsoft.Extensions.AI.OpenAI (18)
MicrosoftExtensionsAIChatExtensions.cs (3)
74.OfType<FunctionCallContent>().Select(c => ChatToolCall.CreateFunctionToolCall(c.CallId, c.Name, 155var toolCallUpdates = update.Contents.OfType<FunctionCallContent>().Select((fcc, index) => 198var fcc = OpenAIClientExtensions.ParseCallContent(toolCall.FunctionArguments, toolCall.Id, toolCall.FunctionName);
OpenAIAssistantsChatClient.cs (1)
191var fcc = OpenAIClientExtensions.ParseCallContent(
OpenAIChatClient.cs (3)
217case FunctionCallContent fc: 465var callContent = OpenAIClientExtensions.ParseCallContent( 540var callContent = OpenAIClientExtensions.ParseCallContent(toolCall.FunctionArguments, toolCall.Id, toolCall.FunctionName);
OpenAIClientExtensions.cs (8)
257/// <summary>Creates a new instance of <see cref="FunctionCallContent"/> parsing arguments using a specified encoding and parser.</summary> 261/// <returns>A new instance of <see cref="FunctionCallContent"/> containing the parse result.</returns> 265internal static FunctionCallContent ParseCallContent(string json, string callId, string name) => 266FunctionCallContent.CreateFromParsedArguments(json, callId, name, 270/// <summary>Creates a new instance of <see cref="FunctionCallContent"/> parsing arguments using a specified encoding and parser.</summary> 274/// <returns>A new instance of <see cref="FunctionCallContent"/> containing the parse result.</returns> 278internal static FunctionCallContent ParseCallContent(BinaryData utf8json, string callId, string name) => 279FunctionCallContent.CreateFromParsedArguments(utf8json, callId, name,
OpenAIRealtimeClientSession.cs (1)
646if (firstContent is FunctionCallContent functionCall)
OpenAIResponsesChatClient.cs (2)
211var fcc = OpenAIClientExtensions.ParseCallContent(functionCall.FunctionArguments, functionCall.CallId, functionCall.FunctionName); 1578case FunctionCallContent callContent:
Microsoft.Extensions.AI.OpenAI.Tests (31)
OpenAIChatClientTests.cs (4)
1168FunctionCallContent fcc = Assert.IsType<FunctionCallContent>(response.Messages.Single().Contents[0]); 1348FunctionCallContent fcc = Assert.IsType<FunctionCallContent>(Assert.Single(updates[updates.Count - 1].Contents));
OpenAIConversionTests.cs (11)
910Assert.Equal("functionName", Assert.IsType<FunctionCallContent>(message.Contents[2], exactMatch: false).Name); 941Assert.Equal("functionName", Assert.IsType<FunctionCallContent>(message.Contents[2], exactMatch: false).Name); 1019FunctionCallContent? fcc = updates[0].Contents.OfType<FunctionCallContent>().FirstOrDefault(); 1233var functionCall = message.Contents.OfType<FunctionCallContent>().FirstOrDefault(); 1318FunctionCallContent? functionCallContent = message.Contents.OfType<FunctionCallContent>().FirstOrDefault(); 1774var functionCallContent = new FunctionCallContent("call-123", "GetWeather", new Dictionary<string, object?> 1812var functionCall1 = new FunctionCallContent("call-1", "Function1", new Dictionary<string, object?> { ["param1"] = "value1" }); 1813var functionCall2 = new FunctionCallContent("call-2", "Function2", new Dictionary<string, object?> { ["param2"] = "value2" });
OpenAIResponseClientTests.cs (11)
6063var functionCallUpdate = updates.FirstOrDefault(u => u.Contents.OfType<FunctionCallContent>().Any()); 6066var fcc = functionCallUpdate.Contents.OfType<FunctionCallContent>().Single(); 6091Assert.Single(message.Contents.OfType<FunctionCallContent>()); 8841var call = Assert.IsType<FunctionCallContent>(Assert.Single(response.Messages[0].Contents)); 8937var functionCallUpdate = updates.FirstOrDefault(u => u.Contents.OfType<FunctionCallContent>().Any()); 8939var call = functionCallUpdate.Contents.OfType<FunctionCallContent>().Single(); 8948var coalesced = response.Messages[0].Contents.OfType<FunctionCallContent>().Single();
parent\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (5)
38if (expectedItem is FunctionCallContent expectedFunctionCall) 40var chatFunctionCall = (FunctionCallContent)chatItem; 79FunctionCallContent fcc => (fcc.Name, fcc.Arguments), 86FunctionCallContent fcc => (fcc.Name, fcc.Arguments),
Microsoft.Extensions.AI.Stabilization.Tests (23)
Generated\361d1da7f942c932\AIContentSerializationRegressionContext.FunctionCallContent.g.cs (22)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent>? _FunctionCallContent; 19public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent> FunctionCallContent 22get => _FunctionCallContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.FunctionCallContent)); 25private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent> Create_FunctionCallContent(global::System.Text.Json.JsonSerializerOptions options) 27if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.FunctionCallContent>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent> jsonTypeInfo)) 29var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.FunctionCallContent> 35ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string), typeof(string), typeof(global::System.Collections.Generic.IDictionary<string, object>)}, modifiers: null), 39jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.FunctionCallContent>(options, objectInfo); 56DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 58Getter = static obj => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).Name, 66AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetProperty("Name", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 77DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 79Getter = static obj => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).Arguments, 80Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).Arguments = value!, 87AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetProperty("Arguments", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.IDictionary<string, object>), global::System.Array.Empty<global::System.Type>(), null), 97DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 117DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 119Getter = static obj => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).InformationalOnly, 120Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).InformationalOnly = value!, 127AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetProperty("InformationalOnly", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
Generated\361d1da7f942c932\AIContentSerializationRegressionContext.GetJsonTypeInfo.g.cs (1)
66if (type == typeof(global::Microsoft.Extensions.AI.FunctionCallContent))
Microsoft.Extensions.AI.Tests (81)
ChatCompletion\DistributedCachingChatClientTest.cs (8)
348c => Assert.IsType<FunctionCallContent>(c), 356c => Assert.IsType<FunctionCallContent>(Assert.Single(c.Contents)), 816if (expectedItem is FunctionCallContent expectedFcc) 818var actualFcc = (FunctionCallContent)actualItem; 850if (expectedItemItem is FunctionCallContent expectedFcc) 852var actualFcc = (FunctionCallContent)actualItemItem;
ChatCompletion\FunctionInvocationContextTests.cs (1)
55FunctionCallContent callContent = new(string.Empty, string.Empty, new Dictionary<string, object?>());
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (15)
875var requestFcc = new FunctionCallContent("callId1", "Func1"); 876var responseFcc = new FunctionCallContent("callId1", "Func1"); 945var request1Fcc = new FunctionCallContent("callId1", "Func1"); 946var response1Fcc = new FunctionCallContent("callId1", "Func1") { InformationalOnly = true }; 948var request2Fcc = new FunctionCallContent("callId2", "Func1"); 1503var functionCall = update.Contents.OfType<FunctionCallContent>().First(); 1599Assert.Equal("Func1", ((FunctionCallContent)approvalRequest1.ToolCall).Name); 1607Assert.Equal("Func2", ((FunctionCallContent)approvalRequest2.ToolCall).Name); 1615Assert.Equal("Func3", ((FunctionCallContent)approvalRequest3.ToolCall).Name); 1644var alreadyProcessedFunctionCall = new FunctionCallContent("callId1", "Func1") { InformationalOnly = true }; 2098FunctionCallContent fcc => new FunctionCallContent(fcc.CallId, fcc.Name, fcc.Arguments) 2145.Where(t => t.ToolCall is FunctionCallContent { InformationalOnly: true }) 2153foreach (var fcc in allContents 2156.OfType<FunctionCallContent>()
ChatCompletion\FunctionInvokingChatClientTests.cs (21)
1001Assert.Contains(content, c => c is FunctionCallContent or FunctionResultContent); 1217c => Assert.Equal("Input 1", Assert.IsType<FunctionCallContent>(c).Arguments!["text"]), 1218c => Assert.Equal("Input 2", Assert.IsType<FunctionCallContent>(c).Arguments!["text"])), 1258Assert.IsType<FunctionCallContent>(Assert.Single(response.Messages[0].Contents)); 1260Assert.IsType<FunctionCallContent>(Assert.Single(response.Messages[2].Contents)); 1643if (!chatContents.Any(m => m.Contents.OfType<FunctionCallContent>().Any())) 2014var functionCallMessage = chat.First(m => m.Contents.Any(c => c is FunctionCallContent)); 2015var functionCallContent = functionCallMessage.Contents.OfType<FunctionCallContent>().First(); 2033var alreadyProcessedFunctionCall = new FunctionCallContent("callId1", "Func1") { InformationalOnly = true }; 2063Assert.Contains(response.Messages, m => m.Contents.Any(c => c is FunctionCallContent fcc && fcc.InformationalOnly)); 2085var needsProcessing = new FunctionCallContent("callId1", "Func1") { InformationalOnly = false }; 2086var alreadyProcessed = new FunctionCallContent("callId2", "Func2") { InformationalOnly = true }; 2180Assert.Contains(response.Messages, m => m.Contents.Any(c => c is FunctionCallContent fcc && fcc.CallId == "callId1" && fcc.InformationalOnly)); 2327if (content is FunctionCallContent fcc) 3116Assert.Contains(result.Messages, m => m.Contents.OfType<ToolApprovalRequestContent>().Any(frc => ((FunctionCallContent)frc.ToolCall).Name == "FunctionB")); 3126Assert.Contains(result.Messages, m => m.Contents.OfType<ToolApprovalRequestContent>().Any(frc => ((FunctionCallContent)frc.ToolCall).Name == "FunctionB")); 3222Assert.Contains(result.Messages, m => m.Contents.OfType<ToolApprovalRequestContent>().Any(frc => ((FunctionCallContent)frc.ToolCall).Name == "FunctionB")); 3233Assert.Contains(result.Messages, m => m.Contents.OfType<ToolApprovalRequestContent>().Any(frc => ((FunctionCallContent)frc.ToolCall).Name == "FunctionB")); 3500m.Contents.Any(c => c is FunctionCallContent fcc2 && fcc2.CallId == "callId1" && fcc2.InformationalOnly)); 3578m.Contents.Any(c => c is FunctionCallContent fcc2 && fcc2.CallId == "callId1" && fcc2.InformationalOnly));
ChatReduction\MessageCountingChatReducerTests.cs (2)
143Assert.DoesNotContain(m.Contents, c => c is FunctionCallContent); 150Assert.DoesNotContain(m.Contents, c => c is FunctionCallContent);
ChatReduction\SummarizingChatReducerTests.cs (5)
107Assert.DoesNotContain(msgs, m => m.Contents.Any(c => c is FunctionCallContent or FunctionResultContent or TestInputRequestContent or TestInputResponseContent)); 122Assert.Contains(m.Contents, c => c is FunctionCallContent); 203Assert.DoesNotContain(msgList, m => m.Contents.Any(c => c is FunctionCallContent or FunctionResultContent or TestInputRequestContent or TestInputResponseContent)); 219Assert.Contains(resultList, m => m.Contents.Any(c => c is FunctionCallContent fc && fc.CallId == "call2")); 221Assert.DoesNotContain(resultList, m => m.Contents.Any(c => c is FunctionCallContent fc && fc.CallId == "call1"));
Generated\361d1da7f942c932\TestJsonSerializerContext.FunctionCallContent.g.cs (22)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent>? _FunctionCallContent; 19public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent> FunctionCallContent 22get => _FunctionCallContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.FunctionCallContent)); 25private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent> Create_FunctionCallContent(global::System.Text.Json.JsonSerializerOptions options) 27if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.FunctionCallContent>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.FunctionCallContent> jsonTypeInfo)) 29var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.FunctionCallContent> 35ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string), typeof(string), typeof(global::System.Collections.Generic.IDictionary<string, object>)}, modifiers: null), 39jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.FunctionCallContent>(options, objectInfo); 56DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 58Getter = static obj => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).Name, 66AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetProperty("Name", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 77DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 79Getter = static obj => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).Arguments, 80Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).Arguments = value!, 87AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetProperty("Arguments", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.IDictionary<string, object>), global::System.Array.Empty<global::System.Type>(), null), 97DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 117DeclaringType = typeof(global::Microsoft.Extensions.AI.FunctionCallContent), 119Getter = static obj => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).InformationalOnly, 120Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.FunctionCallContent)obj).InformationalOnly = value!, 127AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.FunctionCallContent).GetProperty("InformationalOnly", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
Generated\361d1da7f942c932\TestJsonSerializerContext.GetJsonTypeInfo.g.cs (1)
142if (type == typeof(global::Microsoft.Extensions.AI.FunctionCallContent))
parent\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (5)
38if (expectedItem is FunctionCallContent expectedFunctionCall) 40var chatFunctionCall = (FunctionCallContent)chatItem; 79FunctionCallContent fcc => (fcc.Name, fcc.Arguments), 86FunctionCallContent fcc => (fcc.Name, fcc.Arguments),
Realtime\FunctionInvokingRealtimeClientTests.cs (1)
641var functionCallContent = new FunctionCallContent(callId, functionName, arguments);