152 writes to Tools
Aspire.Dashboard (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 (54)
ChatClientIntegrationTests.cs (23)
246Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")]
262Tools = [AIFunctionFactory.Create((int a, int b) => a * b, "SecretComputation")]
277Tools = [AIFunctionFactory.Create((int a, int b) => a * b, "SecretComputation")]
314Tools = [func]
346Tools = [func]
378Tools = [func]
456Tools =
584Tools = [AIFunctionFactory.Create((string personName) =>
616Tools = [tool],
637Tools = [getSecretNumberTool, shieldsUpTool],
735.ConfigureOptions(options => options.Tools = [getTemperature])
774.ConfigureOptions(options => options.Tools = [getTemperature])
816.ConfigureOptions(options => options.Tools = [getTemperature])
897new ChatOptions { Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")] });
923new ChatOptions { Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")] }))
1077Tools = [AIFunctionFactory.Create((int personId) =>
1256var response = await chatClient.GetResponseAsync(messages, new() { Tools = [getWeather] });
1472var firstResponse = await client.GetResponseAsync(history, new ChatOptions { Tools = allTools });
1481var secondResponse = await client.GetResponseAsync(history, new ChatOptions { Tools = allTools });
1540Tools = tools,
1603Tools = [weatherTool],
1616Tools = [weatherTool]
1707var response = await client.GetResponseAsync(history, new ChatOptions { Tools = allTools });
Microsoft.Extensions.AI.OllamaSharp.Integration.Tests (2)
Microsoft.Extensions.AI.OpenAI.Tests (37)
OpenAIChatClientTests.cs (9)
332Tools = [AIFunctionFactory.Create(() => 42, "GetPersonAge", "Gets the age of the specified person.")],
411Tools = [tool],
488Tools = [tool],
569Tools = [tool],
643Tools = [tool],
729Tools = [AIFunctionFactory.Create((string name) => 42, "GetPersonAge")],
1141Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")],
1225Tools = [new HostedWebSearchTool()],
1325Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")],
OpenAIResponseClientIntegrationTests.cs (13)
32Tools = [new HostedCodeInterpreterTool()],
76new() { Tools = [new HostedWebSearchTool()] });
105Tools = [new HostedMcpServerTool("deepwiki", new Uri("https://mcp.deepwiki.com/mcp")) { ApprovalMode = HostedMcpServerToolApprovalMode.NeverRequire }],
127Tools = [new HostedMcpServerTool("deepwiki", new Uri("https://mcp.deepwiki.com/mcp"))
167Tools = [new HostedMcpServerTool("deepwiki", new Uri("https://mcp.deepwiki.com/mcp"))
262Tools = [AIFunctionFactory.Create(() => { callCount++; return "5:43"; }, new AIFunctionFactoryOptions { Name = "GetCurrentTime" })]
356Tools = [AIFunctionFactory.Create(() => { callCount++; return "5:43"; }, new AIFunctionFactoryOptions { Name = "GetCurrentTime" })]
389Tools = [new HostedMcpServerTool("calendar", "connector_googlecalendar")
436Tools = [AIFunctionFactory.Create((int a, int b) => new TextContent($"The sum is {a + b}"), "AddNumbers", "Adds two numbers together")]
456Tools = [AIFunctionFactory.Create((string city) => new List<AIContent>
484Tools = [AIFunctionFactory.Create(() => new DataContent(ImageDataUri.GetImageDataUri(), "image/png"), "GetDotnetLogo", "Returns the .NET logo image")]
509Tools = [AIFunctionFactory.Create(() => new DataContent(ImageDataUri.GetPdfDataUri(), "application/pdf") { Name = "document.pdf" }, "GetDocument", "Returns a PDF document")]
532Tools = [AIFunctionFactory.Create(() => new List<AIContent>
OpenAIResponseClientTests.cs (12)
700Tools = [ResponseTool.CreateComputerTool(ComputerToolEnvironment.Browser, 1024, 768).AsAITool()],
788Tools = [ResponseTool.CreateComputerTool(ComputerToolEnvironment.Browser, 1024, 768).AsAITool()],
890Tools = [AIFunctionFactory.Create(() => 42, "GetPersonAge", "Gets the age of the specified person.")],
1060Tools = [tool],
1287Tools = [new HostedMcpServerTool("deepwiki", new Uri("https://mcp.deepwiki.com/mcp"))]
1670Tools = [mcpTool],
2078Tools = [new HostedMcpServerTool("deepwiki", new Uri("https://mcp.deepwiki.com/mcp"))
2699Tools = [new HostedCodeInterpreterTool()],
2918Tools = [new HostedCodeInterpreterTool()],
5185Tools = [imageTool]
5286Tools = [imageTool]
5404Tools = [imageTool]
Microsoft.Extensions.AI.Tests (52)
ChatCompletion\FunctionInvokingChatClientTests.cs (29)
83Tools =
114new() { Tools = [AIFunctionFactory.Create(() => "Shouldn't be invoked", "ChatOptionsFunc")] } :
147Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")]
182Tools =
233Tools =
280Tools =
319Tools =
370Tools =
412Tools =
493Tools =
542Tools =
581Tools =
619Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")]
676Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")]
741Tools = [AIFunctionFactory.Create((string text) => $"Result for {text}", "Func1")]
799Tools = [AIFunctionFactory.Create(() => "doesn't matter", "Func1")]
856Tools = [function],
947var chatOptions = new ChatOptions { Tools = [function] };
968Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")],
1029Tools = [AIFunctionFactory.Create((IServiceProvider actual) =>
1062Tools = [AIFunctionFactory.Create(async (string arg, CancellationToken cancellationToken) =>
1090Tools = [AIFunctionFactory.Create((int i) => $"Known: {i}", "KnownFunc")]
1144ChatOptions options = new() { Tools = [declarationOnly] };
1172Tools = [known, defOnly]
1225Tools = [AIFunctionFactory.Create(() => { }, "Func1")],
1252Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")]
1298Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")]
1347Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")]
1419Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")]
ChatCompletion\OpenTelemetryChatClientTests.cs (1)
133Tools =
84 references to Tools
Microsoft.Extensions.AI (17)
ChatCompletion\FunctionInvokingChatClient.cs (7)
31/// in <see cref="ChatOptions.Tools"/> (or in <see cref="AdditionalTools"/>), producing a <see cref="FunctionResultContent"/>
223/// <see cref="ChatOptions.Tools" /> unmodified. However, if the inner client requests the invocation of a tool
224/// that was not in <see cref="ChatOptions.Tools" />, this <see cref="AdditionalTools"/> collection will also be consulted
249/// <see cref="ChatOptions.Tools"/> or <see cref="AdditionalTools"/>) but that aren't <see cref="AIFunction"/>s aren't considered
289(Dictionary<string, AITool>? toolMap, bool anyToolsRequireApproval) = CreateToolsMap(AdditionalTools, options?.Tools); // all available tools, indexed by name
430(Dictionary<string, AITool>? toolMap, bool anyToolsRequireApproval) = CreateToolsMap(AdditionalTools, options?.Tools); // all available tools, indexed by name
529(options?.Tools ?? Enumerable.Empty<AITool>())
Microsoft.Extensions.AI.Abstractions (8)
Microsoft.Extensions.AI.Abstractions.Tests (5)
Microsoft.Extensions.AI.Evaluation.Integration.Tests (5)
Microsoft.Extensions.AI.Evaluation.Quality (9)
Microsoft.Extensions.AI.Integration.Tests (13)
Microsoft.Extensions.AI.OllamaSharp.Integration.Tests (1)
Microsoft.Extensions.AI.OpenAI (3)
Microsoft.Extensions.AI.OpenAI.Tests (7)
Microsoft.Extensions.AI.Tests (16)