10 types derived from AITool
Microsoft.Extensions.AI.Abstractions (6)
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)
16public class HostedImageGenerationTool : AITool
Tools\HostedMcpServerTool.cs (1)
16public class HostedMcpServerTool : 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.Integration.Tests (1)
ToolReductionTests.cs (1)
498private sealed class SimpleTool : AITool
Microsoft.Extensions.AI.OpenAI (1)
OpenAIResponsesChatClient.cs (1)
1529internal sealed class ResponseToolAITool(ResponseTool tool) : AITool
Microsoft.Extensions.AI.OpenAI.Tests (1)
OpenAIConversionTests.cs (1)
1741private sealed class UnknownAITool : AITool
126 references to AITool
Microsoft.Extensions.AI (33)
ChatCompletion\FunctionInvokingChatClient.cs (14)
229public IList<AITool>? AdditionalTools { get; set; } 249/// <see cref="AITool"/>s that the <see cref="FunctionInvokingChatClient"/> is aware of (for example, because they're in 517AITool[]? approvalRequiredFunctions = null; // available tools that require approval 562(options?.Tools ?? Enumerable.Empty<AITool>()) 563.Concat(AdditionalTools ?? Enumerable.Empty<AITool>()) 783private static bool AnyToolsRequireApproval(params ReadOnlySpan<IList<AITool>?> toolLists) 806private static AIFunctionDeclaration? FindTool(string name, params ReadOnlySpan<IList<AITool>?> toolLists) 812foreach (AITool tool in toolList) 828private static bool HasAnyTools(params ReadOnlySpan<IList<AITool>?> toolLists) 1023List<AITool>? remainingTools = null; 1024foreach (var tool in options.Tools) 1795AITool[] approvalRequiredFunctions, 1811foreach (var arf in approvalRequiredFunctions) 1854params ReadOnlySpan<IList<AITool>?> toolLists)
ChatCompletion\ImageGeneratingChatClient.cs (6)
252List<AITool>? newTools = null; 256var tool = tools[i]; 282List<AITool> InitializeTools(IList<AITool> existingTools, int toOffsetExclusive) 287AITool[] tools = 295foreach (var tool in tools)
ToolReduction\EmbeddingToolReductionStrategy.cs (12)
31private readonly ConditionalWeakTable<AITool, Embedding<float>> _toolEmbeddingsCache = new(); 35private Func<AITool, string> _toolEmbeddingTextSelector = static t => 80private Func<AITool, bool> _isRequiredTool = static _ => false; 101public Func<AITool, string> ToolEmbeddingTextSelector 138public Func<AITool, bool> IsRequiredTool 152public async Task<IEnumerable<AITool>> SelectToolsForRequestAsync( 225static List<AITool> ToToolList(ReadOnlySpan<AIToolRankingInfo> toolInfo) 227var result = new List<AITool>(capacity: toolInfo.Length); 243Memory<AIToolRankingInfo> toolRankingInfo, IList<AITool> tools, ChatToolMode? toolMode) 251var tool = tools[i]; 313private struct AIToolRankingInfo(AITool tool, int originalIndex) 327public AITool Tool { get; } = tool;
ToolReduction\ToolReducingChatClient.cs (1)
80if (reduced is not IList<AITool> reducedList)
Microsoft.Extensions.AI.Abstractions (13)
ChatCompletion\ChatOptions.cs (1)
166public 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)
54/// Gets or sets additional values to store on the resulting <see cref="AITool.AdditionalProperties" /> property.
ToolReduction\IToolReductionStrategy.cs (2)
35/// A (possibly reduced) enumerable of <see cref="AITool"/> instances. Must never be <see langword="null"/>. 38Task<IEnumerable<AITool>> SelectToolsForRequestAsync(
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 (4)
ChatCompletion\ChatOptionsTests.cs (1)
70List<AITool> tools =
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 (18)
ChatClientIntegrationTests.cs (13)
1442var allTools = new List<AITool> { weatherTool, translateTool, mathTool }; 1444IList<AITool>? firstTurnTools = null; 1445IList<AITool>? secondTurnTools = null; 1518var tools = new List<AITool> { translateTool, weatherTool }; 1520IList<AITool>? captured = null; 1574IList<AITool>? firstTurnTools = null; 1575IList<AITool>? secondTurnTools = null; 1659var allTools = new List<AITool> { weatherTool, translateTool, mathTool }; 1690IList<AITool>? selectedTools = null; 1728public Task<IEnumerable<AITool>> SelectToolsForRequestAsync( 1737return Task.FromResult<IEnumerable<AITool>>(options.Tools); 1741return Task.FromResult<IEnumerable<AITool>>(Array.Empty<AITool>());
PromptBasedFunctionCallingChatClient.cs (1)
167private static ChatMessage CreateToolPrompt(IList<AITool> tools)
ToolReductionTests.cs (4)
367IList<AITool>? observedTools = null; 397IList<AITool>? observedTools = null; 490private static List<AITool> CreateTools(params string[] names) => 491names.Select(n => (AITool)new SimpleTool(n, $"Description about {n}")).ToList();
Microsoft.Extensions.AI.OpenAI (21)
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) => 119/// <summary>Adds the <see cref="ResponseTool"/> to the list of <see cref="AITool"/>s.</summary> 120/// <param name="tools">The list of <see cref="AITool"/>s to which the provided tool should be added.</param> 123/// <see cref="ResponseTool"/> does not derive from <see cref="AITool"/>, so it cannot be added directly to a list of <see cref="AITool"/>s. 124/// Instead, this method wraps the provided <see cref="ResponseTool"/> in an <see cref="AITool"/> and adds that to the list. 128public static void Add(this IList<AITool> tools, ResponseTool tool) 135/// <summary>Creates an <see cref="AITool"/> to represent a raw <see cref="ResponseTool"/>.</summary> 136/// <param name="tool">The tool to wrap as an <see cref="AITool"/>.</param> 137/// <returns>The <paramref name="tool"/> wrapped as an <see cref="AITool"/>.</returns> 145/// When a tool has a corresponding <see cref="AITool"/>-derived type already defined in Microsoft.Extensions.AI, 154public static AITool AsAITool(this ResponseTool tool)
OpenAIAssistantsChatClient.cs (1)
382foreach (AITool tool in tools)
OpenAIChatClient.cs (1)
621foreach (AITool tool in tools)
OpenAIClientExtensions.cs (2)
253/// <summary>Gets the typed property of the specified name from the tool's <see cref="AITool.AdditionalProperties"/>.</summary> 254internal static T? GetProperty<T>(this AITool tool, string name) =>
OpenAIResponsesChatClient.cs (3)
579internal static ResponseTool? ToResponseTool(AITool tool, ChatOptions? options = null) 798foreach (AITool tool in tools) 1528/// <summary>Provides an <see cref="AITool"/> wrapper for a <see cref="ResponseTool"/>.</summary>
Microsoft.Extensions.AI.OpenAI.Tests (5)
OpenAIConversionTests.cs (4)
592Assert.Throws<ArgumentNullException>("tool", () => ((AITool)null!).AsOpenAIResponseTool()); 1702Assert.Throws<ArgumentNullException>("tools", () => ((IList<AITool>)null!).Add(ResponseTool.CreateWebSearchTool())); 1703Assert.Throws<ArgumentNullException>("tool", () => new List<AITool>().Add((ResponseTool)null!)); 1711Tools = new List<AITool> { ResponseTool.CreateWebSearchTool() },
OpenAIResponseClientTests.cs (1)
1772AITool mcpTool = rawTool ?
Microsoft.Extensions.AI.Tests (7)
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (6)
21AITool[] tools = 101AITool[] additionalTools = 1215AITool[]? additionalTools = null) 1232AITool[]? additionalTools = null) 1303AITool[]? additionalTools = null) 1320AITool[]? additionalTools = null)
ChatCompletion\FunctionInvokingChatClientTests.cs (1)
73IList<AITool> additionalTools = [AIFunctionFactory.Create(() => "Additional Tool")];