215 writes to Tools
Microsoft.AspNetCore.Components.AI (1)
Microsoft.Extensions.AI (2)
Microsoft.Extensions.AI.Abstractions (1)
Microsoft.Extensions.AI.Abstractions.Tests (2)
Microsoft.Extensions.AI.Evaluation.Integration.Tests (1)
Microsoft.Extensions.AI.Integration.Tests (25)
ChatClientIntegrationTests.cs (17)
236Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")]
252Tools = [AIFunctionFactory.Create((int a, int b) => a * b, "SecretComputation")]
267Tools = [AIFunctionFactory.Create((int a, int b) => a * b, "SecretComputation")]
304Tools = [func]
336Tools = [func]
368Tools = [func]
446Tools =
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) =>
1247var response = await chatClient.GetResponseAsync(messages, new() { Tools = [getWeather] });
Microsoft.Extensions.AI.OllamaSharp.Integration.Tests (2)
Microsoft.Extensions.AI.OpenAI.Tests (72)
OpenAIChatClientTests.cs (9)
366Tools = [AIFunctionFactory.Create(() => 42, "GetPersonAge", "Gets the age of the specified person.")],
445Tools = [tool],
522Tools = [tool],
603Tools = [tool],
677Tools = [tool],
763Tools = [AIFunctionFactory.Create((string name) => 42, "GetPersonAge")],
1175Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")],
1260Tools = [new HostedWebSearchTool()],
1360Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")],
OpenAIResponseClientIntegrationTests.cs (21)
40Tools = [new HostedCodeInterpreterTool()],
86Tools = [new HostedWebSearchTool()],
147Tools =
193Tools = [new HostedMcpServerTool("deepwiki", new Uri("https://mcp.deepwiki.com/mcp")) { ApprovalMode = HostedMcpServerToolApprovalMode.NeverRequire }],
215Tools = [new HostedMcpServerTool("deepwiki", new Uri("https://mcp.deepwiki.com/mcp"))
255Tools = [new HostedMcpServerTool("deepwiki", new Uri("https://mcp.deepwiki.com/mcp"))
324Tools =
391Tools = [AIFunctionFactory.Create(() => { callCount++; return "5:43"; }, new AIFunctionFactoryOptions { Name = "GetCurrentTime" })]
485Tools = [AIFunctionFactory.Create(() => { callCount++; return "5:43"; }, new AIFunctionFactoryOptions { Name = "GetCurrentTime" })]
519Tools = [new HostedMcpServerTool("calendar", "connector_googlecalendar")
567Tools = [AIFunctionFactory.Create((int a, int b) => new TextContent($"The sum is {a + b}"), "AddNumbers", "Adds two numbers together")]
587Tools = [AIFunctionFactory.Create((string city) => new List<AIContent>
615Tools = [AIFunctionFactory.Create(() => new DataContent(ImageDataUri.GetImageDataUri(), "image/png"), "GetDotnetLogo", "Returns the .NET logo image")]
640Tools = [AIFunctionFactory.Create(() => new DataContent(ImageDataUri.GetPdfDataUri(), "application/pdf") { Name = "document.pdf" }, "GetDocument", "Returns a PDF document")]
663Tools = [AIFunctionFactory.Create(() => new List<AIContent>
866Tools =
901Tools = [new HostedToolSearchTool()],
921Tools =
948Tools =
970Tools =
1013Tools =
OpenAIResponseClientTests.cs (36)
995Tools = [ResponseTool.CreateComputerTool(ComputerToolEnvironment.Browser, 1024, 768).AsAITool()],
1090Tools = [ResponseTool.CreateComputerTool(ComputerToolEnvironment.Browser, 1024, 768).AsAITool()],
1196Tools = [AIFunctionFactory.Create(() => 42, "GetPersonAge", "Gets the age of the specified person.")],
1366Tools = [tool],
1593Tools = [new HostedMcpServerTool("deepwiki", new Uri("https://mcp.deepwiki.com/mcp"))]
2098Tools = [mcpTool],
2504Tools = [new HostedMcpServerTool("deepwiki", new Uri("https://mcp.deepwiki.com/mcp"))
2718Tools = [mcpTool],
2830var response = await client.GetResponseAsync("hello", new ChatOptions { Tools = [mcpTool] });
2920var response = await client.GetResponseAsync("hello", new ChatOptions { Tools = [mcpTool] });
3492Tools = [new HostedCodeInterpreterTool()],
3712Tools = [new HostedCodeInterpreterTool()],
3800Tools = [new HostedCodeInterpreterTool()],
6521Tools = [imageTool]
6622Tools = [imageTool]
6740Tools = [imageTool]
6998Tools = [new ApplyPatchTool().AsAITool()],
7280Tools = [new HostedWebSearchTool()],
7408Tools = [new HostedWebSearchTool()],
7517Tools = [new HostedToolSearchTool()],
7604Tools =
7696Tools =
7763Tools =
7873Tools =
7973Tools =
8078Tools =
8178Tools =
8265Tools =
8356Tools =
8442Tools =
8555Tools =
8654Tools =
8758Tools =
8871Tools =
8989new ChatOptions { Tools = [tool] });
9083new ChatOptions { Tools = [tool] }))
Microsoft.Extensions.AI.Tests (109)
ChatCompletion\FunctionInvokingChatClientTests.cs (65)
83Tools =
114new() { Tools = [AIFunctionFactory.Create(() => "Shouldn't be invoked", "ChatOptionsFunc")] } :
147Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")]
182Tools =
233Tools =
280Tools =
319Tools =
366Tools =
447Tools =
528Tools =
628Tools =
680Tools = [AIFunctionFactory.Create(() => "Result", "Func1")],
724Tools = [AIFunctionFactory.Create(() => "Result", "Func1")],
777Tools = [AIFunctionFactory.Create(() => "Result", "Func1"), hostedTool],
817Tools = [originalTool],
843Tools =
924Tools =
973Tools =
1012Tools =
1050Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")]
1107Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")]
1172Tools = [AIFunctionFactory.Create((string text) => $"Result for {text}", "Func1")]
1230Tools = [AIFunctionFactory.Create(() => "doesn't matter", "Func1")]
1287Tools = [function],
1378var chatOptions = new ChatOptions { Tools = [function] };
1399Tools =
1434Tools =
1476Tools =
1519Tools =
1552Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")],
1613Tools = [AIFunctionFactory.Create((IServiceProvider actual) =>
1646Tools = [AIFunctionFactory.Create(async (string arg, CancellationToken cancellationToken) =>
1674Tools = [AIFunctionFactory.Create((int i) => $"Known: {i}", "KnownFunc")]
1728ChatOptions options = new() { Tools = [declarationOnly] };
1756Tools = [known, defOnly]
1809Tools = [AIFunctionFactory.Create(() => { }, "Func1")],
1842Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")]
1907Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")]
1953Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")]
1995Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")]
2045Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")]
2117Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")]
2153Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")]
2182Tools = [AIFunctionFactory.Create(() => { functionInvokedCount++; return "Result 1"; }, "Func1")]
2230Tools =
2300Tools = [AIFunctionFactory.Create(() => { functionInvokedCount++; return "Result 1"; }, "Func1")]
2527Tools = [functionA]
2621Tools = [functionA, functionB]
2729Tools = [functionA, originalFunctionB]
2827Tools = [functionA]
2931Tools = [functionA]
3028Tools = [functionA]
3107Tools = [functionA, functionB]
3208Tools = [functionA]
3314Tools = [functionA, originalFunctionB]
3405Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")]
3435Tools = [declarationOnly]
3466Tools = [AIFunctionFactory.Create(() =>
3499Tools = [AIFunctionFactory.Create(string () =>
3532Tools = [approvalFunc]
3576var options = new ChatOptions { Tools = [approvalFunc] };
3613var options = new ChatOptions { Tools = [approvalFunc] };
3649Tools = [AIFunctionFactory.Create(() => { functionInvokedCount++; return "Result 1"; }, "Func1")]
3704Tools =
3780Tools = [AIFunctionFactory.Create(() => { functionInvokedCount++; return "Local Result"; }, "Func1")]
ChatCompletion\OpenTelemetryChatClientTests.cs (1)
140Tools =
99 references to Tools
Microsoft.AspNetCore.Components.AI (2)
Microsoft.Extensions.AI (20)
ChatCompletion\FunctionInvokingChatClient.cs (14)
32/// in <see cref="ChatOptions.Tools"/> (or in <see cref="AdditionalTools"/>), producing a <see cref="FunctionResultContent"/>
234/// <see cref="ChatOptions.Tools" /> unmodified. However, if the inner client requests the invocation of a tool
235/// that was not in <see cref="ChatOptions.Tools" />, this <see cref="AdditionalTools"/> collection will also be consulted
260/// <see cref="ChatOptions.Tools"/> or <see cref="AdditionalTools"/>) but that aren't <see cref="AIFunction"/>s aren't considered
356anyToolsRequireApproval = AnyToolsRequireApproval(options?.Tools, AdditionalTools);
360(options?.Tools ?? Enumerable.Empty<AITool>())
535anyToolsRequireApproval = AnyToolsRequireApproval(options?.Tools, AdditionalTools);
582(options?.Tools ?? Enumerable.Empty<AITool>())
1057if (options?.Tools is not { Count: > 0 })
1064foreach (var tool in options.Tools)
1075if (remainingCount < options.Tools.Count)
1099if (!HasAnyTools(options?.Tools, AdditionalTools))
1120AIFunctionDeclaration? tool = FindTool(fcc.Name, options?.Tools, AdditionalTools);
1176name => FindTool(name, options?.Tools, AdditionalTools),
Microsoft.Extensions.AI.Abstractions (6)
Microsoft.Extensions.AI.Abstractions.Tests (5)
Microsoft.Extensions.AI.Evaluation.Integration.Tests (5)
Microsoft.Extensions.AI.Evaluation.Quality (9)
Microsoft.Extensions.AI.Integration.Tests (2)
Microsoft.Extensions.AI.OllamaSharp.Integration.Tests (1)
Microsoft.Extensions.AI.OpenAI (4)
Microsoft.Extensions.AI.OpenAI.Tests (7)
Microsoft.Extensions.AI.Tests (38)