32 writes to Tools
Microsoft.Extensions.AI (1)
ChatCompletion\FunctionInvokingChatClient.cs (1)
456options.Tools = null;
Microsoft.Extensions.AI.Abstractions (1)
ChatCompletion\ChatOptions.cs (1)
129options.Tools = new List<AITool>(Tools);
Microsoft.Extensions.AI.Abstractions.Tests (2)
ChatCompletion\ChatOptionsTests.cs (2)
82options.Tools = tools; 145options.Tools =
Microsoft.Extensions.AI.AzureAIInference.Tests (2)
AzureAIInferenceChatClientTests.cs (2)
771Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")], 859Tools = [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)
369Tools = [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)
245result.Tools ??= [];
Microsoft.Extensions.AI.OpenAI.Tests (2)
OpenAIChatClientTests.cs (2)
770Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")], 875Tools = [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 (13)
ChatCompletion\FunctionInvokingChatClientTests.cs (13)
50Tools = 82Tools = 132Tools = 173Tools = 214Tools = 267Tools = 336Tools = 384ChatOptions options = new() { Tools = [func1, func2] }; 412Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")] 471Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")] 522Tools = [AIFunctionFactory.Create((string text) => $"Result for {text}", "Func1")] 591Tools = [function], 661Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")],
29 references to Tools
Microsoft.Extensions.AI (3)
ChatCompletion\FunctionInvokingChatClient.cs (3)
239|| options.Tools is not { Count: > 0 } 382|| options.Tools is not { Count: > 0 } 558AIFunction? function = options.Tools!.OfType<AIFunction>().FirstOrDefault(t => t.Metadata.Name == functionCallContent.Name);
Microsoft.Extensions.AI.Abstractions (7)
ChatCompletion\ChatOptions.cs (3)
100/// The clone will have the same values for all properties as the original instance. Any collections, like <see cref="Tools"/>, 127if (Tools is not null) 129options.Tools = new List<AITool>(Tools);
ChatCompletion\ChatToolMode.cs (4)
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"/>. 59/// must match an entry in <see cref="ChatOptions.Tools"/>.
Microsoft.Extensions.AI.Abstractions.Tests (5)
ChatCompletion\ChatOptionsTests.cs (5)
28Assert.Null(options.Tools); 44Assert.Null(clone.Tools); 97Assert.Same(tools, options.Tools); 113Assert.Equal(tools, clone.Tools); 170Assert.Null(deserialized.Tools);
Microsoft.Extensions.AI.AzureAIInference (1)
AzureAIInferenceChatClient.cs (1)
337if (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)
301Tools = options?.ToolMode is not NoneChatToolMode && options?.Tools is { Count: > 0 } tools ? tools.OfType<AIFunction>().Select(ToOllamaTool) : null,
Microsoft.Extensions.AI.Ollama.Tests (1)
OllamaChatClientIntegrationTests.cs (1)
113Assert.Null(options?.Tools);
Microsoft.Extensions.AI.OpenAI (4)
OpenAIAssistantClient.cs (1)
211if (options.Tools is { Count: > 0 } tools)
OpenAIModelMapper.ChatCompletion.cs (3)
128if (options?.Tools is { Count: > 0 }) 246result.Tools.Add(FromOpenAIChatTool(tool)); 364if (options.Tools is { Count: > 0 } tools)
Microsoft.Extensions.AI.OpenAI.Tests (5)
OpenAISerializationTests.cs (5)
45Assert.Null(request.Options.Tools); 78Assert.Null(request.Options.Tools); 110Assert.Null(request.Options.Tools); 370Assert.NotNull(request.Options.Tools); 372AIFunction function = Assert.IsAssignableFrom<AIFunction>(Assert.Single(request.Options.Tools));