31 writes to Tools
Microsoft.Extensions.AI (1)
ChatCompletion\FunctionInvokingChatClient.cs (1)
465options.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)
799Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")], 886Tools = [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)
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")] 278Tools = [AIFunctionFactory.Create((string personName) => 310Tools = [tool], 331Tools = [getSecretNumberTool, shieldsUpTool],
PromptBasedFunctionCallingChatClient.cs (1)
54options.Tools = null;
Microsoft.Extensions.AI.Ollama.Tests (3)
OllamaChatClientIntegrationTests.cs (2)
45Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")], 79Tools = [stockPriceTool, irrelevantTool],
OllamaChatClientTests.cs (1)
374Tools = [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)
247(result.Tools ??= []).Add(convertedTool);
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.")], 874Tools = [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 (12)
ChatCompletion\FunctionInvokingChatClientTests.cs (12)
46Tools = 78Tools = 128Tools = 169Tools = 208Tools = 247Tools = 285Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")] 341Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")] 389Tools = [AIFunctionFactory.Create((string text) => $"Result for {text}", "Func1")] 447Tools = [AIFunctionFactory.Create(() => "doesn't matter", "Func1")] 504Tools = [function], 563Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")],
29 references to Tools
Microsoft.Extensions.AI (4)
ChatCompletion\FunctionInvokingChatClient.cs (4)
29/// by calling the corresponding <see cref="AIFunction"/> defined in <see cref="ChatOptions.Tools"/>, 213options?.Tools is { Count: > 0 } && 307options?.Tools is not { Count: > 0 } || 588AIFunction? function = options.Tools!.OfType<AIFunction>().FirstOrDefault(t => t.Name == callContent.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)
333if (options.Tools is { Count: > 0 } tools)
Microsoft.Extensions.AI.Integration.Tests (2)
PromptBasedFunctionCallingChatClient.cs (2)
50if (options?.Tools is { Count: > 0 }) 52AddOrUpdateToolPrompt(chatMessageList, options.Tools);
Microsoft.Extensions.AI.Ollama (1)
OllamaChatClient.cs (1)
307Tools = 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)
OpenAIAssistantClient.cs (1)
213if (options.Tools is { Count: > 0 } tools)
OpenAIModelMapper.ChatCompletion.cs (2)
128if (options?.Tools is { Count: > 0 }) 366if (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));