175 references to FunctionCallContent
Microsoft.Extensions.AI (1)
ChatCompletion\FunctionInvocationContext.cs (1)
54get => _callContent ??= new(string.Empty, _nopFunction.Name, EmptyReadOnlyDictionary<string, object?>.Instance);
Microsoft.Extensions.AI.Abstractions (1)
Contents\FunctionCallContent.cs (1)
97return new FunctionCallContent(callId, name, arguments)
Microsoft.Extensions.AI.Abstractions.Tests (14)
ChatCompletion\ChatMessageTests.cs (2)
149new FunctionCallContent("callId1", "fc1"), 272new FunctionCallContent("function-id", "plugin-name-function-name", new Dictionary<string, object?> { ["parameter"] = "argument" }),
ChatCompletion\ChatResponseUpdateTests.cs (2)
94new FunctionCallContent("callId1", "fc1"), 123new FunctionCallContent("callId1", "fc1"),
Contents\FunctionApprovalRequestContentTests.cs (3)
14FunctionCallContent functionCall = new("FCC1", "TestFunction"); 29FunctionCallContent functionCall = new("FCC1", "TestFunction"); 43FunctionCallContent functionCall = new("FCC1", "TestFunction");
Contents\FunctionApprovalResponseContentTests.cs (2)
14FunctionCallContent functionCall = new("FCC1", "TestFunction"); 29FunctionCallContent functionCall = new("FCC1", "TestFunction");
Contents\FunctionCallContentTests.cs (4)
21FunctionCallContent c = new("callId1", "name"); 38FunctionCallContent c = new("id", "name", args); 51FunctionCallContent c = new("callId1", "name"); 81var sut = new FunctionCallContent("callId1", "functionName", new Dictionary<string, object?> { ["key"] = "value" }) { Exception = ex };
SpeechToText\SpeechToTextResponseUpdateTests.cs (1)
65new FunctionCallContent("callId1", "fc1"),
Microsoft.Extensions.AI.AzureAIInference.Tests (1)
AzureAIInferenceChatClientTests.cs (1)
990new(ChatRole.Assistant, [new FunctionCallContent("abcd123", "GetMood")]),
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.Tests (12)
OpenAIChatClientTests.cs (2)
1436new FunctionCallContent("12345", "SayHello"), 1437new FunctionCallContent("12346", "SayHi"),
OpenAIConversionTests.cs (10)
95new FunctionCallContent("callid123", "SomeFunction", new Dictionary<string, object?> 161new FunctionCallContent("callid123", "SomeFunction", new Dictionary<string, object?> 364new FunctionCallContent("call123", "TestFunction", new Dictionary<string, object?> { ["param"] = "value" }) 469new FunctionCallContent("process_data", "ProcessComplexData", complexArgs) 652var functionCallContent = new FunctionCallContent("call-123", "GetWeather", new Dictionary<string, object?> 690var functionCall1 = new FunctionCallContent("call-1", "Function1", new Dictionary<string, object?> { ["param1"] = "value1" }); 691var functionCall2 = new FunctionCallContent("call-2", "Function2", new Dictionary<string, object?> { ["param2"] = "value2" }); 724new FunctionCallContent("call-123", "GetWeather", new Dictionary<string, object?> { ["location"] = "Seattle" }), 966new FunctionCallContent("call-123", "TestFunction", new Dictionary<string, object?> { ["param"] = "value" }) 1001new FunctionCallContent("call-456", "GetWeather", new Dictionary<string, object?> { ["location"] = "Seattle" })
Microsoft.Extensions.AI.Tests (145)
ChatCompletion\ChatClientStructuredOutputExtensionsTests.cs (1)
207new FunctionCallContent("callid123", "get_data"),
ChatCompletion\DistributedCachingChatClientTest.cs (4)
51Contents = [new FunctionCallContent("someCallId", "functionName", new Dictionary<string, object?> 254new FunctionCallContent("someCallId", "someFn", new Dictionary<string, object?> { ["arg1"] = "value1" }), 265Contents = [new FunctionCallContent("someCallId", "someFn", new Dictionary<string, object?> { ["arg1"] = "value1" })], 315new() { 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 (84)
41new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 48new FunctionApprovalRequestContent("callId1", new FunctionCallContent("callId1", "Func1")), 49new FunctionApprovalRequestContent("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 FunctionApprovalRequestContent("callId1", new FunctionCallContent("callId1", "Func1")), 85new FunctionApprovalRequestContent("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 121new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 128new FunctionApprovalRequestContent("callId1", new FunctionCallContent("callId1", "Func1")), 129new FunctionApprovalRequestContent("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 155new FunctionApprovalRequestContent("callId1", new FunctionCallContent("callId1", "Func1")), 156new FunctionApprovalRequestContent("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 160new FunctionApprovalResponseContent("callId1", true, new FunctionCallContent("callId1", "Func1")), 161new FunctionApprovalResponseContent("callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 168new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 179new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 206new FunctionApprovalRequestContent("callId1", new FunctionCallContent("callId1", "Func1")), 210new FunctionApprovalRequestContent("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 214new FunctionApprovalResponseContent("callId1", true, new FunctionCallContent("callId1", "Func1")), 218new FunctionApprovalResponseContent("callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 225new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]) { MessageId = "resp1" }, 226new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]) { MessageId = "resp2" }, 237new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]) { MessageId = "resp1" }, 238new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]) { MessageId = "resp2" }, 265new FunctionApprovalRequestContent("callId1", new FunctionCallContent("callId1", "Func1")), 266new FunctionApprovalRequestContent("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 270new FunctionApprovalResponseContent("callId1", false, new FunctionCallContent("callId1", "Func1")), 271new FunctionApprovalResponseContent("callId2", false, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 278new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 293new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 324new FunctionApprovalRequestContent("callId1", new FunctionCallContent("callId1", "Func1")), 325new FunctionApprovalRequestContent("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 329new FunctionApprovalResponseContent("callId1", false, new FunctionCallContent("callId1", "Func1")), 330new FunctionApprovalResponseContent("callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 337new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 349new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 357new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 388new FunctionApprovalRequestContent("callId1", new FunctionCallContent("callId1", "Func1")), 389new FunctionApprovalRequestContent("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 393new FunctionApprovalResponseContent("callId1", true, new FunctionCallContent("callId1", "Func1")), 394new FunctionApprovalResponseContent("callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 401new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 407new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 3 } })]), 412new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 416new FunctionApprovalRequestContent("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 3 } })) 442new FunctionApprovalRequestContent("callId1", new FunctionCallContent("callId1", "Func1")), 443new FunctionApprovalRequestContent("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 447new FunctionApprovalResponseContent("callId1", true, new FunctionCallContent("callId1", "Func1")), 448new FunctionApprovalResponseContent("callId2", true, 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 } })]), 454new FunctionApprovalRequestContent("callId3", new FunctionCallContent("callId3", "Func1")), 458new FunctionApprovalResponseContent("callId3", true, new FunctionCallContent("callId3", "Func1")), 465new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 467new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "Func1")]), 478new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "Func1")]), 505new FunctionApprovalRequestContent("callId1", new FunctionCallContent("callId1", "Func1")), 535new FunctionApprovalResponseContent("callId1", true, new FunctionCallContent("callId1", "Func1")), 536new FunctionApprovalResponseContent("callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 543new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 554new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 581new FunctionApprovalResponseContent("callId1", true, new FunctionCallContent("callId1", "Func1")), 582new FunctionApprovalResponseContent("callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 598new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1"), new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 643yield return new ChatResponseUpdate(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]) { MessageId = messageId }; 649new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }) 720yield return new ChatResponseUpdate(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]) { MessageId = messageId }; 725new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }) 729yield return new ChatResponseUpdate(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func3")]) { MessageId = messageId };
ChatCompletion\FunctionInvokingChatClientTests.cs (50)
93new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 95new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 97new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]), 127new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 129new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 131new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]), 160new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 162new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 164new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]), 193new FunctionCallContent("callId1", "Func1"), 194new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 34 } }), 195new FunctionCallContent("callId3", "Func2", arguments: new Dictionary<string, object?> { { "i", 56 } }), 205new FunctionCallContent("callId4", "Func2", arguments: new Dictionary<string, object?> { { "i", 78 } }), 206new FunctionCallContent("callId5", "Func1") 253new FunctionCallContent("callId1", "Func", arguments: new Dictionary<string, object?> { { "arg", "hello" } }), 254new FunctionCallContent("callId2", "Func", arguments: new Dictionary<string, object?> { { "arg", "world" } }), 297new FunctionCallContent("callId1", "Func", arguments: new Dictionary<string, object?> { { "arg", "hello" } }), 298new FunctionCallContent("callId2", "Func", arguments: new Dictionary<string, object?> { { "arg", "world" } }), 329new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 331new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 333new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]), 378new ChatMessage(ChatRole.Assistant, [new FunctionCallContent($"callId0", "VoidReturn")]), 386plan.Add(new ChatMessage(ChatRole.Assistant, [new FunctionCallContent($"callId{(i + 1)}", "VoidReturn")])); 528assistantMessage.Contents.Add(new FunctionCallContent(callId, "Func", 552new ChatMessage(ChatRole.Assistant, [new TextContent("extra"), new FunctionCallContent("callId1", "Func1"), new TextContent("stuff")]), 554new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]), 556new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } }), new TextContent("more")]), 589new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]), 611new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["arg1"] = "value1" })]), 667new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["arg1"] = "value1" })]), 742new() { Contents = [new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["text"] = "Input 1" })] }, 743new() { Contents = [new FunctionCallContent("callId2", "Func1", new Dictionary<string, object?> { ["text"] = "Input 2" })] } 795new(ChatRole.Assistant, [new FunctionCallContent($"callId{chatContents.Count()}", "Func1")]) : 844new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["i"] = 41 })]), 846new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func1", new Dictionary<string, object?> { ["i"] = 42 })]), 854new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "Func1", new Dictionary<string, object?> { ["i"] = 43 })]), 914new FunctionCallContent("callId1", "Search"), 915new FunctionCallContent("callId2", "Search", new Dictionary<string, object?> { { "result", "birds" } }), 916new FunctionCallContent("callId3", "Search"), 962return new ChatResponse(new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId-abc", "Func1")])) 1000new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["arg1"] = "value1" })]), 1030new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["arg"] = "value1" }), 1031new FunctionCallContent("callId2", "Func1", new Dictionary<string, object?> { ["arg"] = "value2" }), 1083new FunctionCallContent("callId1", "UnknownFunc", new Dictionary<string, object?> { ["i"] = 1 }), 1084new FunctionCallContent("callId2", "KnownFunc", new Dictionary<string, object?> { ["i"] = 2 }) 1102new FunctionCallContent("callId1", "UnknownFunc", new Dictionary<string, object?> { ["i"] = 1 }), 1103new FunctionCallContent("callId2", "KnownFunc", new Dictionary<string, object?> { ["i"] = 2 }) 1130new(ChatRole.Assistant, [new FunctionCallContent("callId1", "DefOnly")]), 1160new FunctionCallContent("callId1", "Known"), 1161new FunctionCallContent("callId2", "DefOnly")
ChatCompletion\OpenTelemetryChatClientTests.cs (1)
109new(ChatRole.Assistant, [new FunctionCallContent("12345", "GetPersonName")]),
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 (1)
95new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("call1", "get_weather", new Dictionary<string, object?> { ["location"] = "Seattle" })]),