6 types derived from ToolCallContent
Microsoft.Extensions.AI.Abstractions (5)
Contents\CodeInterpreterToolCallContent.cs (1)
15public sealed class CodeInterpreterToolCallContent : ToolCallContent
Contents\FunctionCallContent.cs (1)
17public class FunctionCallContent : ToolCallContent
Contents\ImageGenerationToolCallContent.cs (1)
9public sealed class ImageGenerationToolCallContent : ToolCallContent
Contents\McpServerToolCallContent.cs (1)
20public sealed class McpServerToolCallContent : ToolCallContent
Contents\WebSearchToolCallContent.cs (1)
15public sealed class WebSearchToolCallContent : ToolCallContent
Microsoft.Extensions.AI.Abstractions.Tests (1)
Utilities\AIJsonUtilitiesTests.cs (1)
1925private class DerivedToolCallContent : ToolCallContent
8 instantiations of ToolCallContent
Microsoft.Extensions.AI.Abstractions.Tests (3)
Contents\ToolCallContentTests.cs (3)
16ToolCallContent c = new("callId1"); 26Assert.Throws<ArgumentNullException>("callId", () => new ToolCallContent(null!)); 32ToolCallContent c = new("callId1");
Microsoft.Extensions.AI.OpenAI (5)
OpenAIResponsesChatClient.cs (5)
292message.Contents.Add(new ToolCallContent(outputItem.Id)); 297message.Contents.Add(new ToolCallContent(computerCall.CallId) { RawRepresentation = computerCall }); 305message.Contents.Add(new ToolCallContent(patchCall.CallId) { RawRepresentation = patchCall }); 620var toolCallUpdate = CreateUpdate(new ToolCallContent(outputItemDoneUpdate.Item.Id)); 626yield return CreateUpdate(new ToolCallContent(computerCall.CallId) { RawRepresentation = outputItemDoneUpdate.Item });
55 references to ToolCallContent
Microsoft.AspNetCore.Components.AI (1)
Pipeline\FunctionApprovalHandler.cs (1)
45ToolCallContent toolCall)
Microsoft.Extensions.AI (2)
ChatCompletion\FunctionInvokingChatClient.cs (2)
921/// if there is a matching <see cref="FunctionResultContent"/> with the same <see cref="ToolCallContent.CallId"/> in the same set of messages, 964/// if there is a matching <see cref="FunctionResultContent"/> with the same <see cref="ToolCallContent.CallId"/>, regardless of order.
Microsoft.Extensions.AI.Abstractions (8)
Contents\AIContent.cs (1)
21[JsonDerivedType(typeof(ToolCallContent), typeDiscriminator: "toolCall")]
Contents\ToolApprovalRequestContent.cs (2)
26public ToolApprovalRequestContent(string requestId, ToolCallContent toolCall) 35public ToolCallContent ToolCall { get; }
Contents\ToolApprovalResponseContent.cs (2)
25public ToolApprovalResponseContent(string requestId, bool approved, ToolCallContent toolCall) 40public ToolCallContent ToolCall { get; }
Contents\ToolCallContent.cs (1)
21/// Initializes a new instance of the <see cref="ToolCallContent"/> class.
Contents\ToolResultContent.cs (2)
34/// If this is the result for a <see cref="ToolCallContent"/>, this property should contain the same 35/// <see cref="ToolCallContent.CallId"/> value.
Microsoft.Extensions.AI.Abstractions.Tests (21)
AssertExtensions.cs (2)
75private static void AssertToolCallNameAndArguments(ToolCallContent expected, ToolCallContent actual)
Contents\FunctionCallContentTests.cs (1)
418AssertSerializationRoundtrips<ToolCallContent>(content);
Contents\McpServerToolCallContentTests.cs (1)
71AssertSerializationRoundtrips<ToolCallContent>(content);
Contents\ToolApprovalRequestContentTests.cs (4)
22public static TheoryData<ToolCallContent> ToolCallContentInstances => new() 32public void Constructor_Roundtrips(ToolCallContent toolCall) 43public void CreateResponse_ReturnsExpectedResponse(ToolCallContent toolCall) 80public void Serialization_Roundtrips(ToolCallContent toolCall)
Contents\ToolApprovalResponseContentTests.cs (3)
22public static TheoryData<ToolCallContent> ToolCallContentInstances => new() 32public void Constructor_Roundtrips(ToolCallContent toolCall) 49public void Serialization_Roundtrips(ToolCallContent toolCall)
Contents\ToolCallContentTests.cs (6)
16ToolCallContent c = new("callId1"); 32ToolCallContent c = new("callId1"); 67var deserialized = JsonSerializer.Deserialize<ToolCallContent>(serialized, options); 101var toolCall = Assert.IsType<ToolCallContent>(result);
TestJsonSerializerContext.cs (1)
50[JsonSerializable(typeof(ToolCallContent[]))]
Utilities\AIJsonUtilitiesTests.cs (3)
1368var toolCallTypes = options.GetTypeInfo(typeof(ToolCallContent)).PolymorphismOptions!.DerivedTypes; 1374ToolCallContent tc = new DerivedToolCallContent { CustomValue = 42 }; 1379DerivedToolCallContent deserializedTc = Assert.IsType<DerivedToolCallContent>(JsonSerializer.Deserialize<ToolCallContent>(json, options));
Microsoft.Extensions.AI.OpenAI.Tests (19)
OpenAIConversionTests.cs (10)
1078ToolCallContent? fsToolCall = updates[6].Contents.OfType<ToolCallContent>().FirstOrDefault(); 1089ToolCallContent? cuToolCall = updates[7].Contents.OfType<ToolCallContent>().FirstOrDefault(); 1388ToolCallContent? fileSearchToolCall = message.Contents.OfType<ToolCallContent>().FirstOrDefault(c => c.CallId == "fs_123"); 1397ToolCallContent? computerToolCall = message.Contents.OfType<ToolCallContent>().FirstOrDefault(c => c.CallId == "call_456"); 1407ToolCallContent? applyPatchToolCall = message.Contents.OfType<ToolCallContent>().FirstOrDefault(c => c.CallId == "call_patch_789");
OpenAIResponseClientTests.cs (7)
1016AIContent computerUserItem = Assert.Single(responseMessage.Contents, content => content is ToolCallContent); 1021ToolCallContent computerToolCall = Assert.IsType<ToolCallContent>(computerUserItem); 1119ToolCallContent content = Assert.IsType<ToolCallContent>(Assert.Single(updates[3].Contents)); 7005var toolCall = Assert.Single(message.Contents.OfType<ToolCallContent>());
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (2)
75private static void AssertToolCallNameAndArguments(ToolCallContent expected, ToolCallContent actual)
Microsoft.Extensions.AI.Tests (4)
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (2)
2103new ToolApprovalRequestContent(tarc.RequestId, (ToolCallContent)CloneFcc(tarc.ToolCall)) 2108new ToolApprovalResponseContent(tarc.RequestId, tarc.Approved, (ToolCallContent)CloneFcc(tarc.ToolCall))
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (2)
75private static void AssertToolCallNameAndArguments(ToolCallContent expected, ToolCallContent actual)