60 writes to Tools
Microsoft.Extensions.AI.Abstractions (1)
ChatCompletion\ChatOptions.cs (1)
176options.Tools = new List<AITool>(Tools);
Microsoft.Extensions.AI.Abstractions.Tests (2)
ChatCompletion\ChatOptionsTests.cs (2)
93options.Tools = tools; 164options.Tools =
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)
AgentQualityEvaluatorTests.cs (1)
43Tools = [AIFunctionFactory.Create(GetOrders), AIFunctionFactory.Create(GetOrderStatus)]
Microsoft.Extensions.AI.Integration.Tests (17)
ChatClientIntegrationTests.cs (16)
237Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")] 253Tools = [AIFunctionFactory.Create((int a, int b) => a * b, "SecretComputation")] 268Tools = [AIFunctionFactory.Create((int a, int b) => a * b, "SecretComputation")] 305Tools = [func] 337Tools = [func] 369Tools = [func] 447Tools = 575Tools = [AIFunctionFactory.Create((string personName) => 607Tools = [tool], 628Tools = [getSecretNumberTool, shieldsUpTool], 726.ConfigureOptions(options => options.Tools = [getTemperature]) 765.ConfigureOptions(options => options.Tools = [getTemperature]) 807.ConfigureOptions(options => options.Tools = [getTemperature]) 888new ChatOptions { Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")] }); 914new ChatOptions { Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")] })) 1068Tools = [AIFunctionFactory.Create((int personId) =>
PromptBasedFunctionCallingChatClient.cs (1)
52options.Tools = null;
Microsoft.Extensions.AI.Ollama.Tests (4)
OllamaChatClientIntegrationTests.cs (2)
45Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")], 79Tools = [stockPriceTool, irrelevantTool],
OllamaChatClientTests.cs (2)
376Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")], 473Tools = [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 (10)
OpenAIChatClientTests.cs (8)
333Tools = [AIFunctionFactory.Create(() => 42, "GetPersonAge", "Gets the age of the specified person.")], 412Tools = [tool], 489Tools = [tool], 570Tools = [tool], 644Tools = [tool], 1126Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")], 1210Tools = [new HostedWebSearchTool()], 1310Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")],
OpenAIResponseClientTests.cs (2)
352Tools = [AIFunctionFactory.Create(() => 42, "GetPersonAge", "Gets the age of the specified person.")], 472Tools = [tool],
Microsoft.Extensions.AI.Tests (19)
ChatCompletion\FunctionInvokingChatClientTests.cs (19)
77Tools = 109Tools = 160Tools = 207Tools = 246Tools = 297Tools = 339Tools = 420Tools = 469Tools = 508Tools = 546Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")] 602Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")] 650Tools = [AIFunctionFactory.Create((string text) => $"Result for {text}", "Func1")] 708Tools = [AIFunctionFactory.Create(() => "doesn't matter", "Func1")] 765Tools = [function], 856var chatOptions = new ChatOptions { Tools = [function] }; 877Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")], 938Tools = [AIFunctionFactory.Create((IServiceProvider actual) => 971Tools = [AIFunctionFactory.Create(async (string arg, CancellationToken cancellationToken) =>
39 references to Tools
Microsoft.Extensions.AI (4)
ChatCompletion\FunctionInvokingChatClient.cs (4)
31/// by calling the corresponding <see cref="AIFunction"/> defined in <see cref="ChatOptions.Tools"/>, 253options?.Tools is { Count: > 0 } && 370options?.Tools is not { Count: > 0 } || 704AIFunction? aiFunction = options.Tools!.OfType<AIFunction>().FirstOrDefault(t => t.Name == callContent.Name);
Microsoft.Extensions.AI.Abstractions (7)
ChatCompletion\ChatOptions.cs (3)
144/// The clone will have the same values for all properties as the original instance. Any collections, like <see cref="Tools"/>, 174if (Tools is not null) 176options.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)
31Assert.Null(options.Tools); 50Assert.Null(clone.Tools); 111Assert.Same(tools, options.Tools); 129Assert.Equal(tools, clone.Tools); 192Assert.Null(deserialized.Tools);
Microsoft.Extensions.AI.AzureAIInference (1)
AzureAIInferenceChatClient.cs (1)
341if (options.Tools is { Count: > 0 } tools)
Microsoft.Extensions.AI.Evaluation.Integration.Tests (5)
AgentQualityEvaluatorTests.cs (5)
120new TaskAdherenceEvaluatorContext(toolDefinitions: _chatOptionsWithTools.Tools!); 123new IntentResolutionEvaluatorContext(toolDefinitions: _chatOptionsWithTools.Tools!); 177new ToolCallAccuracyEvaluatorContext(toolDefinitions: _chatOptionsWithTools.Tools!); 180new TaskAdherenceEvaluatorContext(toolDefinitions: _chatOptionsWithTools.Tools!); 183new IntentResolutionEvaluatorContext(toolDefinitions: _chatOptionsWithTools.Tools!);
Microsoft.Extensions.AI.Evaluation.Quality (9)
IntentResolutionEvaluatorContext.cs (3)
34/// The set of tool definitions (see <see cref="ChatOptions.Tools"/>) that were used when generating the model 53/// The set of tool definitions (see <see cref="ChatOptions.Tools"/>) that were used when generating the model 73/// Gets set of tool definitions (see <see cref="ChatOptions.Tools"/>) that were used when generating the model
TaskAdherenceEvaluatorContext.cs (3)
35/// The set of tool definitions (see <see cref="ChatOptions.Tools"/>) that were used when generating the model 54/// The set of tool definitions (see <see cref="ChatOptions.Tools"/>) that were used when generating the model 74/// Gets set of tool definitions (see <see cref="ChatOptions.Tools"/>) that were used when generating the model
ToolCallAccuracyEvaluatorContext.cs (3)
36/// The set of tool definitions (see <see cref="ChatOptions.Tools"/>) that were used when generating the model 55/// The set of tool definitions (see <see cref="ChatOptions.Tools"/>) that were used when generating the model 75/// Gets set of tool definitions (see <see cref="ChatOptions.Tools"/>) that were used when generating the model
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)
326Tools = 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 (4)
OpenAIAssistantChatClient.cs (1)
273if (options.Tools is { Count: > 0 } tools)
OpenAIChatClient.cs (2)
464if (options?.Tools is { Count: > 0 }) 531if (options.Tools is { Count: > 0 } tools)
OpenAIResponseChatClient.cs (1)
391if (options.Tools is { Count: > 0 } tools)