10 types derived from AITool
Microsoft.Extensions.AI.Abstractions (7)
Functions\AIFunctionDeclaration.cs (1)
16public abstract class AIFunctionDeclaration : AITool
Tools\HostedCodeInterpreterTool.cs (1)
13public class HostedCodeInterpreterTool : AITool
Tools\HostedFileSearchTool.cs (1)
13public class HostedFileSearchTool : AITool
Tools\HostedImageGenerationTool.cs (1)
13public class HostedImageGenerationTool : AITool
Tools\HostedMcpServerTool.cs (1)
13public class HostedMcpServerTool : AITool
Tools\HostedToolSearchTool.cs (1)
27public class HostedToolSearchTool : AITool
Tools\HostedWebSearchTool.cs (1)
13public class HostedWebSearchTool : AITool
Microsoft.Extensions.AI.Abstractions.Tests (1)
Tools\AIToolTests.cs (1)
43private sealed class DerivedAITool : AITool;
Microsoft.Extensions.AI.OpenAI (1)
OpenAIResponsesChatClient.cs (1)
2069internal sealed class ResponseToolAITool(ResponseTool tool) : AITool
Microsoft.Extensions.AI.OpenAI.Tests (1)
OpenAIConversionTests.cs (1)
2271private sealed class UnknownAITool : AITool
121 references to AITool
Microsoft.Extensions.AI (33)
ChatCompletion\FunctionInvokingChatClient.cs (17)
239public IList<AITool>? AdditionalTools { get; set; } 259/// <see cref="AITool"/>s that the <see cref="FunctionInvokingChatClient"/> is aware of (for example, because they're in 360(options?.Tools ?? Enumerable.Empty<AITool>()) 361.Concat(AdditionalTools ?? Enumerable.Empty<AITool>()) 537AITool[]? approvalRequiredFunctions = null; // available tools that require approval 582(options?.Tools ?? Enumerable.Empty<AITool>()) 583.Concat(AdditionalTools ?? Enumerable.Empty<AITool>()) 803private static bool AnyToolsRequireApproval(params ReadOnlySpan<IList<AITool>?> toolLists) 826private static AIFunctionDeclaration? FindTool(string name, params ReadOnlySpan<IList<AITool>?> toolLists) 832foreach (AITool tool in toolList) 848private static bool HasAnyTools(params ReadOnlySpan<IList<AITool>?> toolLists) 1063List<AITool>? remainingTools = null; 1064foreach (var tool in options.Tools) 1663AITool[] approvalRequiredFunctions, 1679foreach (var arf in approvalRequiredFunctions) 1699AITool[] approvalRequiredFunctions, 1739AITool[] approvalRequiredFunctions)
ChatCompletion\ImageGeneratingChatClient.cs (6)
252List<AITool>? newTools = null; 256var tool = tools[i]; 282List<AITool> InitializeTools(IList<AITool> existingTools, int toOffsetExclusive) 285ReadOnlySpan<AITool> tools = 295foreach (var tool in tools)
Common\FunctionInvocationProcessor.cs (3)
64Func<string, AITool?> findTool, 108Func<string, AITool?> findTool, 116AITool? tool = findTool(callContent.Name);
Common\OtelMessageParts.cs (2)
91/// <summary>Builds an <see cref="OtelFunction"/> from an <see cref="AITool"/>.</summary> 98public static OtelFunction Create(AITool tool, bool includeOptionalProperties)
Realtime\FunctionInvokingRealtimeClient.cs (1)
111public IList<AITool>? AdditionalTools { get; set; }
Realtime\FunctionInvokingRealtimeClientSession.cs (4)
118private IList<AITool>? AdditionalTools => _client.AdditionalTools; 232private static AIFunctionDeclaration? FindTool(string name, params ReadOnlySpan<IEnumerable<AITool>?> toolLists) 238foreach (AITool tool in toolList) 252private static bool HasAnyTools(params ReadOnlySpan<IEnumerable<AITool>?> toolLists)
Microsoft.Extensions.AI.Abstractions (13)
ChatCompletion\ChatOptions.cs (1)
164public IList<AITool>? Tools { get; set; }
ChatCompletion\ChatToolMode.cs (2)
33/// <see cref="ChatOptions.Tools"/> can contain zero or more <see cref="AITool"/> 42/// <see cref="ChatOptions.Tools"/> can contain zero or more <see cref="AITool"/>
Contents\CitationAnnotation.cs (1)
44/// This might be a function name, such as one from <see cref="AITool.Name"/>, or the name of a built-in tool
Functions\AIFunctionDeclaration.cs (1)
12/// adds the ability to invoke the function. Components can type test <see cref="AITool"/> instances
Functions\AIFunctionFactoryOptions.cs (1)
65/// Gets or sets additional values to store on the resulting <see cref="AITool.AdditionalProperties" /> property.
Realtime\CreateResponseRealtimeClientMessage.cs (1)
124public IList<AITool>? Tools { get; set; }
Realtime\RealtimeSessionOptions.cs (1)
75public IReadOnlyList<AITool>? Tools { get; init; }
Tools\AITool.cs (5)
17/// <summary>Initializes a new instance of the <see cref="AITool"/> class.</summary> 34/// <summary>Asks the <see cref="AITool"/> for an object of the specified type <paramref name="serviceType"/>.</summary> 40/// The purpose of this method is to allow for the retrieval of strongly typed services that might be provided by the <see cref="AITool"/>, 52/// <summary>Asks the <see cref="AITool"/> for an object of type <typeparamref name="TService"/>.</summary> 57/// The purpose of this method is to allow for the retrieval of strongly typed services that may be provided by the <see cref="AITool"/>,
Microsoft.Extensions.AI.Abstractions.Tests (6)
ChatCompletion\ChatOptionsTests.cs (1)
70List<AITool> tools =
Realtime\RealtimeClientMessageTests.cs (1)
144var tools = new List<AITool> { AIFunctionFactory.Create(() => 42) };
Realtime\RealtimeSessionOptionsTests.cs (1)
38List<AITool> tools = [AIFunctionFactory.Create(() => 42)];
Tools\AIToolTests.cs (3)
29Assert.Same(tool, tool.GetService(typeof(AITool))); 33Assert.Same(tool, tool.GetService<AITool>()); 39Assert.Null(tool.GetService<AITool>("key"));
Microsoft.Extensions.AI.Evaluation.Quality (25)
AIToolExtensions.cs (1)
15this IEnumerable<AITool> toolDefinitions,
IntentResolutionEvaluator.cs (1)
28/// defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions that are supplied via
IntentResolutionEvaluatorContext.cs (7)
22/// defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions that are supplied via 39/// are defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions will be ignored. 42public IntentResolutionEvaluatorContext(params AITool[] toolDefinitions) 58/// are defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions will be ignored. 61public IntentResolutionEvaluatorContext(IEnumerable<AITool> toolDefinitions) 84/// are defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions that are supplied via 88public IReadOnlyList<AITool> ToolDefinitions { get; }
TaskAdherenceEvaluator.cs (1)
27/// defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions that are supplied via
TaskAdherenceEvaluatorContext.cs (7)
23/// defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions that are supplied via 40/// are defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions will be ignored. 43public TaskAdherenceEvaluatorContext(params AITool[] toolDefinitions) 59/// are defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions will be ignored. 62public TaskAdherenceEvaluatorContext(IEnumerable<AITool> toolDefinitions) 86/// defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions that are supplied via 90public IReadOnlyList<AITool> ToolDefinitions { get; }
ToolCallAccuracyEvaluator.cs (1)
28/// defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions that are supplied via
ToolCallAccuracyEvaluatorContext.cs (7)
24/// defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions that are supplied via 41/// are defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions will be ignored. 44public ToolCallAccuracyEvaluatorContext(params AITool[] toolDefinitions) 60/// are defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions will be ignored. 63public ToolCallAccuracyEvaluatorContext(IEnumerable<AITool> toolDefinitions) 88/// are defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions that are supplied via 92public IReadOnlyList<AITool> ToolDefinitions { get; }
Microsoft.Extensions.AI.Integration.Tests (1)
PromptBasedFunctionCallingChatClient.cs (1)
167private static ChatMessage CreateToolPrompt(IList<AITool> tools)
Microsoft.Extensions.AI.OpenAI (26)
MicrosoftExtensionsAIResponsesExtensions.cs (14)
27/// <summary>Creates an OpenAI <see cref="ResponseTool"/> from an <see cref="AITool"/>.</summary> 32/// This method is only able to create <see cref="ResponseTool"/>s for <see cref="AITool"/> types 35public static ResponseTool? AsOpenAIResponseTool(this AITool tool) => 123/// <summary>Adds the <see cref="ResponseTool"/> to the list of <see cref="AITool"/>s.</summary> 124/// <param name="tools">The list of <see cref="AITool"/>s to which the provided tool should be added.</param> 127/// <see cref="ResponseTool"/> does not derive from <see cref="AITool"/>, so it cannot be added directly to a list of <see cref="AITool"/>s. 128/// Instead, this method wraps the provided <see cref="ResponseTool"/> in an <see cref="AITool"/> and adds that to the list. 132public static void Add(this IList<AITool> tools, ResponseTool tool) 139/// <summary>Creates an <see cref="AITool"/> to represent a raw <see cref="ResponseTool"/>.</summary> 140/// <param name="tool">The tool to wrap as an <see cref="AITool"/>.</param> 141/// <returns>The <paramref name="tool"/> wrapped as an <see cref="AITool"/>.</returns> 149/// When a tool has a corresponding <see cref="AITool"/>-derived type already defined in Microsoft.Extensions.AI, 158public static AITool AsAITool(this ResponseTool tool)
OpenAIAssistantsChatClient.cs (1)
380foreach (AITool tool in tools)
OpenAIChatClient.cs (1)
635foreach (AITool tool in tools)
OpenAIClientExtensions.cs (2)
303/// <summary>Gets the typed property of the specified name from the tool's <see cref="AITool.AdditionalProperties"/>.</summary> 304internal static T? GetProperty<T>(this AITool tool, string name) =>
OpenAIRealtimeClientSession.cs (3)
278foreach (var tool in responseCreate.Tools) 471foreach (var tool in options.Tools) 535private static Sdk.RealtimeTool? ToRealtimeTool(AITool tool)
OpenAIResponsesChatClient.cs (5)
724internal static ResponseTool? ToResponseTool(AITool tool, ChatOptions? options = null, ToolSearchLookup? toolSearchLookup = null) 1020foreach (AITool tool in tools) 1117public static ToolSearchLookup Create(IList<AITool>? tools) 1146foreach (AITool tool in tools) 2068/// <summary>Provides an <see cref="AITool"/> wrapper for a <see cref="ResponseTool"/>.</summary>
Microsoft.Extensions.AI.OpenAI.Tests (6)
OpenAIConversionTests.cs (4)
677Assert.Throws<ArgumentNullException>("tool", () => ((AITool)null!).AsOpenAIResponseTool()); 2232Assert.Throws<ArgumentNullException>("tools", () => ((IList<AITool>)null!).Add(ResponseTool.CreateWebSearchTool())); 2233Assert.Throws<ArgumentNullException>("tool", () => new List<AITool>().Add((ResponseTool)null!)); 2241Tools = new List<AITool> { ResponseTool.CreateWebSearchTool() },
OpenAIResponseClientTests.cs (2)
1983AITool mcpTool = rawTool ? 2603AITool mcpTool = rawTool ?
Microsoft.Extensions.AI.Tests (11)
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (10)
21AITool[] tools = 104AITool[] additionalTools = 157AITool[] tools = 1723AITool[] tools = 1766AITool[] tools = 1850AITool[] tools = 1938AITool[]? additionalTools = null) 1955AITool[]? additionalTools = null) 2026AITool[]? additionalTools = null) 2043AITool[]? additionalTools = null)
ChatCompletion\FunctionInvokingChatClientTests.cs (1)
73IList<AITool> additionalTools = [AIFunctionFactory.Create(() => "Additional Tool")];