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.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)
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) =>
1255var response = await chatClient.GetResponseAsync(messages, new() { Tools = [getWeather] });
1471var firstResponse = await client.GetResponseAsync(history, new ChatOptions { Tools = allTools });
1480var secondResponse = await client.GetResponseAsync(history, new ChatOptions { Tools = allTools });
1539Tools = tools,
1602Tools = [weatherTool],
1615Tools = [weatherTool]
1706var response = await client.GetResponseAsync(history, new ChatOptions { Tools = allTools });
Microsoft.Extensions.AI.OllamaSharp.Integration.Tests (2)
Microsoft.Extensions.AI.OpenAI.Tests (35)
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>
Microsoft.Extensions.AI.Tests (48)
ChatCompletion\FunctionInvokingChatClientTests.cs (25)
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")]
675Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")]
740Tools = [AIFunctionFactory.Create((string text) => $"Result for {text}", "Func1")]
798Tools = [AIFunctionFactory.Create(() => "doesn't matter", "Func1")]
855Tools = [function],
946var chatOptions = new ChatOptions { Tools = [function] };
967Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")],
1028Tools = [AIFunctionFactory.Create((IServiceProvider actual) =>
1061Tools = [AIFunctionFactory.Create(async (string arg, CancellationToken cancellationToken) =>
1089Tools = [AIFunctionFactory.Create((int i) => $"Known: {i}", "KnownFunc")]
1143ChatOptions options = new() { Tools = [declarationOnly] };
1171Tools = [known, defOnly]
1224Tools = [AIFunctionFactory.Create(() => { }, "Func1")],
ChatCompletion\OpenTelemetryChatClientTests.cs (1)
133Tools =
85 references to Tools
Microsoft.Extensions.AI (17)
ChatCompletion\FunctionInvokingChatClient.cs (7)
30/// in <see cref="ChatOptions.Tools"/> (or in <see cref="AdditionalTools"/>), producing a <see cref="FunctionResultContent"/>
222/// <see cref="ChatOptions.Tools" /> unmodified. However, if the inner client requests the invocation of a tool
223/// that was not in <see cref="ChatOptions.Tools" />, this <see cref="AdditionalTools"/> collection will also be consulted
248/// <see cref="ChatOptions.Tools"/> or <see cref="AdditionalTools"/>) but that aren't <see cref="AIFunction"/>s aren't considered
287(Dictionary<string, AITool>? toolMap, bool anyToolsRequireApproval) = CreateToolsMap(AdditionalTools, options?.Tools); // all available tools, indexed by name
427(Dictionary<string, AITool>? toolMap, bool anyToolsRequireApproval) = CreateToolsMap(AdditionalTools, options?.Tools); // all available tools, indexed by name
526(options?.Tools ?? Enumerable.Empty<AITool>())
Microsoft.Extensions.AI.Abstractions (8)
Microsoft.Extensions.AI.Abstractions.Tests (5)
Microsoft.Extensions.AI.AzureAIInference (1)
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)