39 writes to Tools
Microsoft.Extensions.AI.Abstractions (1)
ChatCompletion\ChatOptions.cs (1)
139options.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)
778Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")], 865Tools = [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 (10)
ChatClientIntegrationTests.cs (9)
210Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")] 235Tools = [AIFunctionFactory.Create((int a, int b) => a * b, "SecretComputation")] 250Tools = [AIFunctionFactory.Create((int a, int b) => a * b, "SecretComputation")] 287Tools = [func] 328Tools = [func] 364Tools = 406Tools = [AIFunctionFactory.Create((string personName) => 438Tools = [tool], 459Tools = [getSecretNumberTool, shieldsUpTool],
PromptBasedFunctionCallingChatClient.cs (1)
52options.Tools = null;
Microsoft.Extensions.AI.Ollama.Tests (3)
OllamaChatClientIntegrationTests.cs (2)
45Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")], 79Tools = [stockPriceTool, irrelevantTool],
OllamaChatClientTests.cs (1)
376Tools = [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.Tests (3)
OpenAIChatClientTests.cs (3)
743Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")], 830Tools = [new HostedWebSearchTool()], 934Tools = [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 (18)
ChatCompletion\FunctionInvokingChatClientTests.cs (18)
47Tools = 79Tools = 130Tools = 177Tools = 224Tools = 266Tools = 347Tools = 396Tools = 435Tools = 473Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")] 529Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")] 577Tools = [AIFunctionFactory.Create((string text) => $"Result for {text}", "Func1")] 635Tools = [AIFunctionFactory.Create(() => "doesn't matter", "Func1")] 692Tools = [function], 783var chatOptions = new ChatOptions { Tools = [function] }; 806Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")], 867Tools = [AIFunctionFactory.Create((IServiceProvider actual) => 900Tools = [AIFunctionFactory.Create(async (string arg, CancellationToken cancellationToken) =>
24 references to Tools
Microsoft.Extensions.AI (4)
ChatCompletion\FunctionInvokingChatClient.cs (4)
30/// by calling the corresponding <see cref="AIFunction"/> defined in <see cref="ChatOptions.Tools"/>, 243options?.Tools is { Count: > 0 } && 360options?.Tools is not { Count: > 0 } || 679AIFunction? function = options.Tools!.OfType<AIFunction>().FirstOrDefault(t => t.Name == callContent.Name);
Microsoft.Extensions.AI.Abstractions (7)
ChatCompletion\ChatOptions.cs (3)
110/// The clone will have the same values for all properties as the original instance. Any collections, like <see cref="Tools"/>, 137if (Tools is not null) 139options.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)
326if (options.Tools is { Count: > 0 } tools)
Microsoft.Extensions.AI.Integration.Tests (2)
PromptBasedFunctionCallingChatClient.cs (2)
47if (options?.Tools is { Count: > 0 }) 49List<ChatMessage> chatMessagesList = [CreateToolPrompt(options.Tools), .. chatMessages.Select(m => m.Clone())];
Microsoft.Extensions.AI.Ollama (1)
OllamaChatClient.cs (1)
311Tools = 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)
111Assert.Null(options?.Tools);
Microsoft.Extensions.AI.OpenAI (3)
OpenAIChatClient.cs (2)
435if (options?.Tools is { Count: > 0 }) 575if (options.Tools is { Count: > 0 } tools)
OpenAIResponseChatClient.cs (1)
359if (options.Tools is { Count: > 0 } tools)