45 instantiations of FunctionCallContent
Microsoft.Extensions.AI.Abstractions (1)
Microsoft.Extensions.AI.Abstractions.Tests (11)
Microsoft.Extensions.AI.Integration.Tests (1)
Microsoft.Extensions.AI.Ollama (1)
Microsoft.Extensions.AI.Ollama.Tests (1)
Microsoft.Extensions.AI.OpenAI.Tests (2)
Microsoft.Extensions.AI.Tests (28)
ChatCompletion\FunctionInvokingChatClientTests.cs (26)
58new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]),
60new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
62new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]),
91new FunctionCallContent("callId1", "Func1"),
92new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 34 } }),
93new FunctionCallContent("callId3", "Func2", arguments: new Dictionary<string, object?> { { "i", 56 } }),
103new FunctionCallContent("callId4", "Func2", arguments: new Dictionary<string, object?> { { "i", 78 } }),
104new FunctionCallContent("callId5", "Func1")
143new FunctionCallContent("callId1", "Func", arguments: new Dictionary<string, object?> { { "arg", "hello" } }),
144new FunctionCallContent("callId2", "Func", arguments: new Dictionary<string, object?> { { "arg", "world" } }),
186new FunctionCallContent("callId1", "Func", arguments: new Dictionary<string, object?> { { "arg", "hello" } }),
187new FunctionCallContent("callId2", "Func", arguments: new Dictionary<string, object?> { { "arg", "world" } }),
220new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]),
222new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
224new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]),
272new ChatMessage(ChatRole.Assistant, [new TextContent("extra"), new FunctionCallContent("callId1", "Func1"), new TextContent("stuff")]),
274new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
276new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } }), new TextContent("more")]),
295new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]),
297new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
299new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]),
338new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]),
358new(ChatRole.Assistant, [new FunctionCallContent("callId1", func1.Metadata.Name)]),
359new(ChatRole.Assistant, [new FunctionCallContent("callId2", func2.Metadata.Name)]),
397new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["arg1"] = "value1" })]),
453new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["arg1"] = "value1" })]),
76 references to FunctionCallContent
Microsoft.Extensions.AI (14)
ChatCompletion\FunctionInvokingChatClient.cs (13)
25/// When this client receives a <see cref="FunctionCallContent"/> in a chat completion, it responds
138/// When the inner <see cref="IChatClient"/> returns <see cref="FunctionCallContent"/> to the
225FunctionCallContent[] functionCallContents = response.Message.Contents.OfType<FunctionCallContent>().ToArray();
304List<FunctionCallContent> functionCallContents = [];
323functionCallContents.AddRange(update.Contents.OfType<FunctionCallContent>());
331[] : update.Contents.Where(c => c is not FunctionCallContent).ToList();
459IList<ChatMessage> chatMessages, ChatOptions options, IReadOnlyList<FunctionCallContent> functionCallContents, int iteration, CancellationToken cancellationToken)
519IList<ChatMessage> chatMessages, ChatOptions options, FunctionCallContent functionCallContent,
723FunctionCallContent functionCallContent,
735public FunctionCallContent CallContent { get; set; }
774internal FunctionInvocationResult(ContinueMode continueMode, FunctionStatus status, FunctionCallContent callContent, object? result, Exception? exception)
787public FunctionCallContent CallContent { get; }
Microsoft.Extensions.AI.Abstractions (7)
Microsoft.Extensions.AI.Abstractions.Tests (19)
Contents\FunctionCallContentTests..cs (14)
21FunctionCallContent c = new("callId1", "name");
38FunctionCallContent c = new("id", "name", args);
51FunctionCallContent c = new("callId1", "name");
83var sut = new FunctionCallContent("callId1", "functionName", new Dictionary<string, object?> { ["key"] = "value" }) { Exception = ex };
87var deserializedSut = JsonSerializer.Deserialize<FunctionCallContent>(json, TestJsonSerializerContext.Default.Options);
275var content = FunctionCallContent.CreateFromParsedArguments(
320var content = FunctionCallContent.CreateFromParsedArguments(exc, "callId", "functionName", ThrowingParser);
334Assert.Throws<ArgumentNullException>("encodedArguments", () => FunctionCallContent.CreateFromParsedArguments((string)null!, "callId", "functionName", _ => null));
335Assert.Throws<ArgumentNullException>("callId", () => FunctionCallContent.CreateFromParsedArguments("{}", null!, "functionName", _ => null));
336Assert.Throws<ArgumentNullException>("name", () => FunctionCallContent.CreateFromParsedArguments("{}", "callId", null!, _ => null));
337Assert.Throws<ArgumentNullException>("argumentParser", () => FunctionCallContent.CreateFromParsedArguments("{}", "callId", "functionName", null!));
Microsoft.Extensions.AI.AzureAIInference (5)
Microsoft.Extensions.AI.AzureAIInference.Tests (4)
Microsoft.Extensions.AI.Integration.Tests (1)
Microsoft.Extensions.AI.Ollama (1)
Microsoft.Extensions.AI.Ollama.Tests (2)
Microsoft.Extensions.AI.OpenAI (9)
OpenAIChatClient.cs (7)
142var callContent = ParseCallContentFromBinaryData(toolCall.FunctionArguments, toolCall.Id, toolCall.FunctionName);
334var callContent = ParseCallContentFromJsonString(
623if (content is FunctionCallContent { CallId: not null } callRequest)
675private static FunctionCallContent ParseCallContentFromJsonString(string json, string callId, string name) =>
676FunctionCallContent.CreateFromParsedArguments(json, callId, name,
680private static FunctionCallContent ParseCallContentFromBinaryData(BinaryData ut8Json, string callId, string name) =>
681FunctionCallContent.CreateFromParsedArguments(ut8Json, callId, name,
Microsoft.Extensions.AI.OpenAI.Tests (4)
Microsoft.Extensions.AI.Tests (10)