85 writes to Tools
Microsoft.Extensions.AI.Abstractions (1)
ChatCompletion\ChatOptions.cs (1)
176options.Tools = new List<AITool>(Tools);
Microsoft.Extensions.AI.Abstractions.Tests (2)
ChatCompletion\ChatOptionsTests.cs (2)
93options.Tools = tools; 164options.Tools =
Microsoft.Extensions.AI.AzureAIInference.Tests (6)
AzureAIInferenceChatClientTests.cs (6)
359Tools = [tool], 443Tools = [tool], 530Tools = [tool], 605Tools = [tool], 1251Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")], 1338Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")],
Microsoft.Extensions.AI.Evaluation.Integration.Tests (1)
AgentQualityEvaluatorTests.cs (1)
43Tools = [AIFunctionFactory.Create(GetOrders), AIFunctionFactory.Create(GetOrderStatus)]
Microsoft.Extensions.AI.Integration.Tests (18)
ChatClientIntegrationTests.cs (17)
237Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")] 253Tools = [AIFunctionFactory.Create((int a, int b) => a * b, "SecretComputation")] 268Tools = [AIFunctionFactory.Create((int a, int b) => a * b, "SecretComputation")] 305Tools = [func] 337Tools = [func] 369Tools = [func] 447Tools = 575Tools = [AIFunctionFactory.Create((string personName) => 607Tools = [tool], 628Tools = [getSecretNumberTool, shieldsUpTool], 726.ConfigureOptions(options => options.Tools = [getTemperature]) 765.ConfigureOptions(options => options.Tools = [getTemperature]) 807.ConfigureOptions(options => options.Tools = [getTemperature]) 888new ChatOptions { Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")] }); 914new ChatOptions { Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")] })) 1068Tools = [AIFunctionFactory.Create((int personId) => 1246var response = await chatClient.GetResponseAsync(messages, new() { Tools = [getWeather] });
PromptBasedFunctionCallingChatClient.cs (1)
52options.Tools = null;
Microsoft.Extensions.AI.OllamaSharp.Integration.Tests (2)
OllamaSharpChatClientIntegrationTests.cs (2)
46Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")], 80Tools = [stockPriceTool, irrelevantTool],
Microsoft.Extensions.AI.OpenAI.Tests (17)
OpenAIAssistantChatClientIntegrationTests.cs (1)
56Tools = [new HostedCodeInterpreterTool()],
OpenAIChatClientTests.cs (8)
331Tools = [AIFunctionFactory.Create(() => 42, "GetPersonAge", "Gets the age of the specified person.")], 410Tools = [tool], 487Tools = [tool], 568Tools = [tool], 642Tools = [tool], 1108Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")], 1192Tools = [new HostedWebSearchTool()], 1292Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")],
OpenAIResponseClientIntegrationTests.cs (4)
31new() { Tools = [new HostedWebSearchTool()] }); 60Tools = [new HostedMcpServerTool("deepwiki", "https://mcp.deepwiki.com/mcp") { ApprovalMode = HostedMcpServerToolApprovalMode.NeverRequire }], 82Tools = [new HostedMcpServerTool("deepwiki", "https://mcp.deepwiki.com/mcp") 122Tools = [new HostedMcpServerTool("deepwiki", "https://mcp.deepwiki.com/mcp")
OpenAIResponseClientTests.cs (4)
532Tools = [AIFunctionFactory.Create(() => 42, "GetPersonAge", "Gets the age of the specified person.")], 702Tools = [tool], 1036Tools = [new HostedMcpServerTool("deepwiki", "https://mcp.deepwiki.com/mcp") 1449Tools = [new HostedMcpServerTool("deepwiki", "https://mcp.deepwiki.com/mcp")
Microsoft.Extensions.AI.Tests (38)
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (14)
31Tools = useAdditionalTools ? null : tools 63Tools = 108Tools = 143Tools = 194Tools = 253Tools = 312Tools = 376Tools = 430Tools = 493Tools = 523Tools = 569Tools = 621Tools = 693Tools =
ChatCompletion\FunctionInvokingChatClientTests.cs (24)
82Tools = 113new() { Tools = [AIFunctionFactory.Create(() => "Shouldn't be invoked", "ChatOptionsFunc")] } : 146Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")] 181Tools = 232Tools = 279Tools = 318Tools = 369Tools = 411Tools = 492Tools = 541Tools = 580Tools = 618Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")] 674Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")] 722Tools = [AIFunctionFactory.Create((string text) => $"Result for {text}", "Func1")] 780Tools = [AIFunctionFactory.Create(() => "doesn't matter", "Func1")] 837Tools = [function], 928var chatOptions = new ChatOptions { Tools = [function] }; 949Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")], 1010Tools = [AIFunctionFactory.Create((IServiceProvider actual) => 1043Tools = [AIFunctionFactory.Create(async (string arg, CancellationToken cancellationToken) => 1071Tools = [AIFunctionFactory.Create((int i) => $"Known: {i}", "KnownFunc")] 1125ChatOptions options = new() { Tools = [declarationOnly] }; 1153Tools = [known, defOnly]
39 references to Tools
Microsoft.Extensions.AI (7)
ChatCompletion\FunctionInvokingChatClient.cs (7)
38/// in <see cref="ChatOptions.Tools"/> (or in <see cref="AdditionalTools"/>), producing a <see cref="FunctionResultContent"/> 236/// <see cref="ChatOptions.Tools" /> unmodified. However, if the inner client requests the invocation of a tool 237/// that was not in <see cref="ChatOptions.Tools" />, this <see cref="AdditionalTools"/> collection will also be consulted 262/// <see cref="ChatOptions.Tools"/> or <see cref="AdditionalTools"/>) but that aren't <see cref="AIFunction"/>s aren't considered 301(Dictionary<string, AITool>? toolMap, bool anyToolsRequireApproval) = CreateToolsMap(AdditionalTools, options?.Tools); // all available tools, indexed by name 441(Dictionary<string, AITool>? toolMap, bool anyToolsRequireApproval) = CreateToolsMap(AdditionalTools, options?.Tools); // all available tools, indexed by name 540(options?.Tools ?? Enumerable.Empty<AITool>())
Microsoft.Extensions.AI.Abstractions (6)
ChatCompletion\ChatOptions.cs (3)
144/// The clone will have the same values for all properties as the original instance. Any collections, like <see cref="Tools"/>, 174if (Tools is not null) 176options.Tools = new List<AITool>(Tools);
ChatCompletion\ChatToolMode.cs (3)
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"/> 52/// but that any tool can be selected. At least one tool must be provided in <see cref="ChatOptions.Tools"/>.
Microsoft.Extensions.AI.Abstractions.Tests (5)
ChatCompletion\ChatOptionsTests.cs (5)
31Assert.Null(options.Tools); 50Assert.Null(clone.Tools); 111Assert.Same(tools, options.Tools); 129Assert.Equal(tools, clone.Tools); 192Assert.Null(deserialized.Tools);
Microsoft.Extensions.AI.AzureAIInference (1)
AzureAIInferenceChatClient.cs (1)
342if (options.Tools is { Count: > 0 } tools)
Microsoft.Extensions.AI.Evaluation.Integration.Tests (5)
AgentQualityEvaluatorTests.cs (5)
120new TaskAdherenceEvaluatorContext(toolDefinitions: _chatOptionsWithTools.Tools!); 123new IntentResolutionEvaluatorContext(toolDefinitions: _chatOptionsWithTools.Tools!); 177new ToolCallAccuracyEvaluatorContext(toolDefinitions: _chatOptionsWithTools.Tools!); 180new TaskAdherenceEvaluatorContext(toolDefinitions: _chatOptionsWithTools.Tools!); 183new IntentResolutionEvaluatorContext(toolDefinitions: _chatOptionsWithTools.Tools!);
Microsoft.Extensions.AI.Evaluation.Quality (9)
IntentResolutionEvaluatorContext.cs (3)
34/// The set of tool definitions (see <see cref="ChatOptions.Tools"/>) that were used when generating the model 53/// The set of tool definitions (see <see cref="ChatOptions.Tools"/>) that were used when generating the model 73/// Gets set of tool definitions (see <see cref="ChatOptions.Tools"/>) that were used when generating the model
TaskAdherenceEvaluatorContext.cs (3)
35/// The set of tool definitions (see <see cref="ChatOptions.Tools"/>) that were used when generating the model 54/// The set of tool definitions (see <see cref="ChatOptions.Tools"/>) that were used when generating the model 74/// Gets set of tool definitions (see <see cref="ChatOptions.Tools"/>) that were used when generating the model
ToolCallAccuracyEvaluatorContext.cs (3)
36/// The set of tool definitions (see <see cref="ChatOptions.Tools"/>) that were used when generating the model 55/// The set of tool definitions (see <see cref="ChatOptions.Tools"/>) that were used when generating the model 75/// Gets set of tool definitions (see <see cref="ChatOptions.Tools"/>) that were used when generating the model
Microsoft.Extensions.AI.Integration.Tests (2)
PromptBasedFunctionCallingChatClient.cs (2)
47if (options?.Tools is { Count: > 0 }) 49List<ChatMessage> chatMessagesList = [CreateToolPrompt(options.Tools), .. chatMessages.Select(m => m.Clone())];
Microsoft.Extensions.AI.OllamaSharp.Integration.Tests (1)
OllamaSharpChatClientIntegrationTests.cs (1)
112Assert.Null(options?.Tools);
Microsoft.Extensions.AI.OpenAI (3)
OpenAIAssistantsChatClient.cs (1)
317if (options.Tools is { Count: > 0 } tools)
OpenAIChatClient.cs (1)
553if (options.Tools is { Count: > 0 } tools)
OpenAIResponsesChatClient.cs (1)
406if (options.Tools is { Count: > 0 } tools)