42 instantiations of FunctionCallContent
Microsoft.Extensions.AI.Abstractions (1)
Microsoft.Extensions.AI.Abstractions.Tests (15)
ChatCompletion\ChatMessageTests.cs (5)
128new FunctionCallContent("callId1", "fc1"),
131new FunctionResultContent(new FunctionCallContent("callId1", "fc2"), "result"),
167new FunctionCallContent("callId1", "fc1"),
293new FunctionCallContent("function-id", "plugin-name-function-name", new Dictionary<string, object?> { ["parameter"] = "argument" }),
294new FunctionResultContent(new FunctionCallContent("function-id", "plugin-name-function-name"), "function-result"),
Microsoft.Extensions.AI.Integration.Tests (1)
Microsoft.Extensions.AI.Ollama (1)
Microsoft.Extensions.AI.Ollama.Tests (1)
Microsoft.Extensions.AI.Tests (23)
ChatCompletion\FunctionInvokingChatClientTests.cs (21)
42new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]),
44new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
46new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]),
67new FunctionCallContent("callId1", "Func1"),
68new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 34 } }),
69new FunctionCallContent("callId3", "Func2", arguments: new Dictionary<string, object?> { { "i", 56 } }),
77new FunctionCallContent("callId4", "Func2", arguments: new Dictionary<string, object?> { { "i", 78 } }),
78new FunctionCallContent("callId5", "Func1")]),
105new FunctionCallContent("callId1", "Func", arguments: new Dictionary<string, object?> { { "arg", "hello" } }),
106new FunctionCallContent("callId2", "Func", arguments: new Dictionary<string, object?> { { "arg", "world" } }),
138new FunctionCallContent("callId1", "Func", arguments: new Dictionary<string, object?> { { "arg", "hello" } }),
139new FunctionCallContent("callId2", "Func", arguments: new Dictionary<string, object?> { { "arg", "world" } }),
169new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]),
171new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
173new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } })]),
216new ChatMessage(ChatRole.Assistant, [new TextContent("extra"), new FunctionCallContent("callId1", "Func1"), new TextContent("stuff")]),
218new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })]),
220new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } }), new TextContent("more")]),
261new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId1", "Func1")]),
281new(ChatRole.Assistant, [new FunctionCallContent("callId1", func1.Metadata.Name)]),
282new(ChatRole.Assistant, [new FunctionCallContent("callId2", func2.Metadata.Name)]),
68 references to FunctionCallContent
Microsoft.Extensions.AI (14)
ChatCompletion\FunctionInvokingChatClient.cs (13)
21/// When this client receives a <see cref="FunctionCallContent"/> in a chat completion, it responds
120/// When the inner <see cref="IChatClient"/> returns <see cref="FunctionCallContent"/> to the
207FunctionCallContent[] functionCallContents = response.Message.Contents.OfType<FunctionCallContent>().ToArray();
283List<FunctionCallContent>? functionCallContents = null;
290foreach (var item in chunk.Contents.OfType<FunctionCallContent>())
399IList<ChatMessage> chatMessages, ChatOptions options, IReadOnlyList<FunctionCallContent> functionCallContents, int iteration, CancellationToken cancellationToken)
459IList<ChatMessage> chatMessages, ChatOptions options, FunctionCallContent functionCallContent,
581FunctionCallContent functionCallContent,
593public FunctionCallContent CallContent { get; set; }
632internal FunctionInvocationResult(ContinueMode continueMode, FunctionStatus status, FunctionCallContent callContent, object? result, Exception? exception)
645public FunctionCallContent CallContent { get; }
Microsoft.Extensions.AI.Abstractions (8)
Microsoft.Extensions.AI.Abstractions.Tests (18)
Contents\FunctionCallContentTests..cs (14)
21FunctionCallContent c = new("callId1", "name");
39FunctionCallContent c = new("id", "name", args);
53FunctionCallContent c = new("callId1", "name");
89var sut = new FunctionCallContent("callId1", "functionName", new Dictionary<string, object?> { ["key"] = "value" }) { Exception = ex };
93var deserializedSut = JsonSerializer.Deserialize<FunctionCallContent>(json, TestJsonSerializerContext.Default.Options);
281var content = FunctionCallContent.CreateFromParsedArguments(
326FunctionCallContent content = FunctionCallContent.CreateFromParsedArguments(exc, "callId", "functionName", ThrowingParser);
340Assert.Throws<ArgumentNullException>(() => FunctionCallContent.CreateFromParsedArguments((string)null!, "callId", "functionName", _ => null));
341Assert.Throws<ArgumentNullException>(() => FunctionCallContent.CreateFromParsedArguments("{}", null!, "functionName", _ => null));
342Assert.Throws<ArgumentNullException>(() => FunctionCallContent.CreateFromParsedArguments("{}", "callId", null!, _ => null));
343Assert.Throws<ArgumentNullException>(() => 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 (7)
OpenAIChatClient.cs (7)
127var callContent = ParseCallContentFromBinaryData(toolCall.FunctionArguments, toolCall.Id, toolCall.FunctionName);
321var callContent = ParseCallContentFromJsonString(
629if (content is FunctionCallContent callRequest && callRequest.CallId is not null && toolCalls?.ContainsKey(callRequest.CallId) is not true)
654private static FunctionCallContent ParseCallContentFromJsonString(string json, string callId, string name) =>
655FunctionCallContent.CreateFromParsedArguments(json, callId, name,
658private static FunctionCallContent ParseCallContentFromBinaryData(BinaryData ut8Json, string callId, string name) =>
659FunctionCallContent.CreateFromParsedArguments(ut8Json, callId, name,
Microsoft.Extensions.AI.OpenAI.Tests (4)
Microsoft.Extensions.AI.Tests (4)