61 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.OllamaSharp.Integration.Tests (2)
OllamaSharpChatClientIntegrationTests.cs (2)
46Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")], 80Tools = [stockPriceTool, irrelevantTool],
Microsoft.Extensions.AI.OpenAI.Tests (11)
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.")],
OpenAIResponseClientIntegrationTests.cs (1)
31new() { Tools = [new HostedWebSearchTool()] });
OpenAIResponseClientTests.cs (2)
352Tools = [AIFunctionFactory.Create(() => 42, "GetPersonAge", "Gets the age of the specified person.")], 472Tools = [tool],
Microsoft.Extensions.AI.Tests (21)
ChatCompletion\FunctionInvokingChatClientTests.cs (21)
83Tools = 114new() { Tools = [AIFunctionFactory.Create(() => "Shouldn't be invoked", "ChatOptionsFunc")] } : 147Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")] 182Tools = 233Tools = 280Tools = 319Tools = 370Tools = 412Tools = 493Tools = 542Tools = 581Tools = 619Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")] 675Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")] 723Tools = [AIFunctionFactory.Create((string text) => $"Result for {text}", "Func1")] 781Tools = [AIFunctionFactory.Create(() => "doesn't matter", "Func1")] 838Tools = [function], 929var chatOptions = new ChatOptions { Tools = [function] }; 950Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")], 1011Tools = [AIFunctionFactory.Create((IServiceProvider actual) => 1044Tools = [AIFunctionFactory.Create(async (string arg, CancellationToken cancellationToken) =>
39 references to Tools
Microsoft.Extensions.AI (6)
ChatCompletion\FunctionInvokingChatClient.cs (6)
31/// by calling the corresponding <see cref="AIFunction"/> defined in <see cref="ChatOptions.Tools"/>, 211/// <see cref="ChatOptions.Tools" /> unmodified. However, if the inner client requests the invocation of a tool 212/// that was not in <see cref="ChatOptions.Tools" />, this <see cref="AdditionalTools"/> collection will also be consulted 263(options?.Tools is { Count: > 0 } || AdditionalTools is { Count: > 0 }) && 380(options?.Tools is not { Count: > 0 } && AdditionalTools is not { Count: > 0 }) || 721AIFunction? aiFunction = FindAIFunction(options?.Tools, callContent.Name) ?? FindAIFunction(AdditionalTools, 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)
342if (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.OllamaSharp.Integration.Tests (1)
OllamaSharpChatClientIntegrationTests.cs (1)
112Assert.Null(options?.Tools);
Microsoft.Extensions.AI.OpenAI (3)
OpenAIAssistantsChatClient.cs (1)
313if (options.Tools is { Count: > 0 } tools)
OpenAIChatClient.cs (1)
562if (options.Tools is { Count: > 0 } tools)
OpenAIResponsesChatClient.cs (1)
416if (options.Tools is { Count: > 0 } tools)