31 writes to Tools
Microsoft.Extensions.AI (2)
ChatCompletion\FunctionInvokingChatClient.cs (2)
286options.Tools = null; 402options.Tools = null;
Microsoft.Extensions.AI.Abstractions (1)
ChatCompletion\ChatOptions.cs (1)
94options.Tools = new List<AITool>(Tools);
Microsoft.Extensions.AI.Abstractions.Tests (2)
ChatCompletion\ChatOptionsTests.cs (2)
79options.Tools = tools; 139options.Tools =
Microsoft.Extensions.AI.AzureAIInference.Tests (2)
AzureAIInferenceChatClientTests.cs (2)
768Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")], 856Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")],
Microsoft.Extensions.AI.Integration.Tests (7)
ChatClientIntegrationTests.cs (6)
182Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")] 208Tools = [AIFunctionFactory.Create((int a, int b) => a * b, "SecretComputation")] 224Tools = [AIFunctionFactory.Create((int a, int b) => a * b, "SecretComputation")] 252Tools = [AIFunctionFactory.Create((string personName) => 284Tools = [tool], 306Tools = [getSecretNumberTool, shieldsUpTool],
PromptBasedFunctionCallingChatClient.cs (1)
48options.Tools = null;
Microsoft.Extensions.AI.Ollama.Tests (3)
OllamaChatClientIntegrationTests.cs (2)
45Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")], 80Tools = [stockPriceTool, irrelevantTool],
OllamaChatClientTests.cs (1)
367Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")],
Microsoft.Extensions.AI.OpenAI (1)
OpenAIModelMapper.ChatCompletion.cs (1)
204result.Tools ??= [];
Microsoft.Extensions.AI.OpenAI.Tests (2)
OpenAIChatClientTests.cs (2)
746Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")], 849Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")],
Microsoft.Extensions.AI.Tests (11)
ChatCompletion\FunctionInvokingChatClientTests.cs (11)
47Tools = 79Tools = 128Tools = 168Tools = 209Tools = 261Tools = 329Tools = 376ChatOptions options = new() { Tools = [func1, func2] }; 404Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")] 460Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")] 509Tools = [AIFunctionFactory.Create((string text) => $"Result for {text}", "Func1")]
26 references to Tools
Microsoft.Extensions.AI (3)
ChatCompletion\FunctionInvokingChatClient.cs (3)
219|| options.Tools is not { Count: > 0 } 365|| options.Tools is not { Count: > 0 } 539AIFunction? function = options.Tools!.OfType<AIFunction>().FirstOrDefault(t => t.Metadata.Name == functionCallContent.Name);
Microsoft.Extensions.AI.Abstractions (6)
ChatCompletion\ChatOptions.cs (3)
66/// The clone will have the same values for all properties as the original instance. Any collections, like <see cref="Tools"/>, 92if (Tools is not null) 94options.Tools = new List<AITool>(Tools);
ChatCompletion\ChatToolMode.cs (3)
32/// <see cref="ChatOptions.Tools"/> can contain zero or more <see cref="AITool"/> 39/// but that any tool can be selected. At least one tool must be provided in <see cref="ChatOptions.Tools"/>. 46/// must match an entry in <see cref="ChatOptions.Tools"/>.
Microsoft.Extensions.AI.Abstractions.Tests (5)
ChatCompletion\ChatOptionsTests.cs (5)
27Assert.Null(options.Tools); 42Assert.Null(clone.Tools); 93Assert.Same(tools, options.Tools); 108Assert.Equal(tools, clone.Tools); 163Assert.Null(deserialized.Tools);
Microsoft.Extensions.AI.AzureAIInference (1)
AzureAIInferenceChatClient.cs (1)
339if (options.Tools is { Count: > 0 } tools)
Microsoft.Extensions.AI.Integration.Tests (2)
PromptBasedFunctionCallingChatClient.cs (2)
44if (options?.Tools is { Count: > 0 }) 46AddOrUpdateToolPrompt(chatMessages, options.Tools);
Microsoft.Extensions.AI.Ollama (1)
OllamaChatClient.cs (1)
286Tools = options?.Tools is { Count: > 0 } tools ? tools.OfType<AIFunction>().Select(ToOllamaTool) : null,
Microsoft.Extensions.AI.Ollama.Tests (1)
OllamaChatClientIntegrationTests.cs (1)
95Assert.Null(options?.Tools);
Microsoft.Extensions.AI.OpenAI (3)
OpenAIModelMapper.ChatCompletion.cs (3)
92if (options?.Tools is { Count: > 0 }) 205result.Tools.Add(FromOpenAIChatTool(tool)); 302if (options.Tools is { Count: > 0 } tools)
Microsoft.Extensions.AI.OpenAI.Tests (4)
OpenAISerializationTests.cs (4)
44Assert.Null(request.Options.Tools); 77Assert.Null(request.Options.Tools); 337Assert.NotNull(request.Options.Tools); 339AIFunction function = Assert.IsAssignableFrom<AIFunction>(Assert.Single(request.Options.Tools));