35 instantiations of FunctionInvokingChatClient
Microsoft.Extensions.AI (1)
ChatCompletion\FunctionInvokingChatClientBuilderExtensions.cs (1)
36var chatClient = new FunctionInvokingChatClient(innerClient, loggerFactory, services);
Microsoft.Extensions.AI.Integration.Tests (11)
ChatClientIntegrationTests.cs (11)
234using var chatClient = new FunctionInvokingChatClient( 258using var chatClient = new FunctionInvokingChatClient(ChatClient); 273using var chatClient = new FunctionInvokingChatClient(ChatClient); 301using var chatClient = new FunctionInvokingChatClient( 333using var chatClient = new FunctionInvokingChatClient( 365using var chatClient = new FunctionInvokingChatClient( 422using var chatClient = new FunctionInvokingChatClient( 579using var chatClient = new FunctionInvokingChatClient(ChatClient); 612using var chatClient = new FunctionInvokingChatClient(ChatClient); 632using var chatClient = new FunctionInvokingChatClient(ChatClient); 1073using var chatClient = new FunctionInvokingChatClient(ChatClient);
Microsoft.Extensions.AI.OpenAI.Tests (2)
OpenAIResponseClientIntegrationTests.cs (2)
229using var chatClient = new FunctionInvokingChatClient(ChatClient); 323using var chatClient = new FunctionInvokingChatClient(ChatClient);
Microsoft.Extensions.AI.Tests (21)
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (4)
693Func<ChatClientBuilder, ChatClientBuilder> configurePipeline = b => b.Use(s => new FunctionInvokingChatClient(s)); 766Func<ChatClientBuilder, ChatClientBuilder> configurePipeline = b => b.Use(s => new FunctionInvokingChatClient(s)); 875configurePipeline ??= b => b.Use(s => new FunctionInvokingChatClient(s) { AdditionalTools = additionalTools }); 963configurePipeline ??= b => b.Use(s => new FunctionInvokingChatClient(s) { AdditionalTools = additionalTools });
ChatCompletion\FunctionInvokingChatClientTests.cs (17)
26Assert.Throws<ArgumentNullException>("innerClient", () => new FunctionInvokingChatClient(null!)); 34using FunctionInvokingChatClient client = new(innerClient); 48using FunctionInvokingChatClient client = new(innerClient); 217s => new FunctionInvokingChatClient(s) { AllowConcurrentInvocation = concurrentInvocation }); 265s => new FunctionInvokingChatClient(s) { AllowConcurrentInvocation = true }); 339s => new FunctionInvokingChatClient(s) 595s => new FunctionInvokingChatClient(s) { IncludeDetailedErrors = detailedErrors }); 622b.Use((c, services) => new FunctionInvokingChatClient(c, services.GetRequiredService<ILoggerFactory>())); 679new FunctionInvokingChatClient(new OpenTelemetryChatClient(c, sourceName: sourceName) { EnableSensitiveData = enableSensitiveData })); 778using var client = new FunctionInvokingChatClient(innerClient); 820using var client = new FunctionInvokingChatClient(innerClient); 941using var chatClient = new FunctionInvokingChatClient(innerChatClient); 1093s => new FunctionInvokingChatClient(s) { TerminateOnUnknownCalls = terminateOnUnknown }); 1156s => new FunctionInvokingChatClient(s) { TerminateOnUnknownCalls = terminateOnUnknown }); 1187Func<ChatClientBuilder, ChatClientBuilder> configure = b => b.Use(s => new FunctionInvokingChatClient(s) { TerminateOnUnknownCalls = false }); 1192configure = b => b.Use(s => new FunctionInvokingChatClient(s) { TerminateOnUnknownCalls = true }); 1220using var chatClient = new FunctionInvokingChatClient(innerChatClient);
53 references to FunctionInvokingChatClient
Aspire.Azure.AI.OpenAI.Tests (1)
AspireConfigurableOpenAIExtensionsTests.cs (1)
247Assert.IsType<FunctionInvokingChatClient>(chatClient);
Microsoft.Extensions.AI (20)
ChatCompletion\FunctionInvocationContext.cs (1)
58/// The initial request to the client that passes along the chat contents provided to the <see cref="FunctionInvokingChatClient"/>
ChatCompletion\FunctionInvokingChatClient.cs (14)
36/// <see cref="FunctionInvokingChatClient"/> will not attempt to invoke it, and instead allow that <see cref="FunctionCallContent"/> 41/// Further, if a requested function is an <see cref="ApprovalRequiredAIFunction"/>, the <see cref="FunctionInvokingChatClient"/> will not 45/// request. The <see cref="FunctionInvokingChatClient"/> will then process that approval response and invoke the function as appropriate. 54/// A <see cref="FunctionInvokingChatClient"/> instance is thread-safe for concurrent use so long as the 70/// <summary>Gets the <see cref="IServiceProvider"/> specified when constructing the <see cref="FunctionInvokingChatClient"/>, if any.</summary> 81/// Initializes a new instance of the <see cref="FunctionInvokingChatClient"/> class. 89_logger = (ILogger?)loggerFactory?.CreateLogger<FunctionInvokingChatClient>() ?? NullLogger.Instance; 160/// Each request to this <see cref="FunctionInvokingChatClient"/> might end up making 194/// When function invocations fail with an exception, the <see cref="FunctionInvokingChatClient"/> 221/// These will not impact the requests sent by the <see cref="FunctionInvokingChatClient"/>, which will pass through the 232/// that isn't available to the <see cref="FunctionInvokingChatClient"/> is received; <see langword="false"/> to create and send a 237/// When <see langword="false"/>, call requests to any tools that aren't available to the <see cref="FunctionInvokingChatClient"/> 243/// that the <see cref="FunctionInvokingChatClient"/> doesn't know about, it will terminate the function calling loop and return 247/// <see cref="AITool"/>s that the <see cref="FunctionInvokingChatClient"/> is aware of (for example, because they're in
ChatCompletion\FunctionInvokingChatClientBuilderExtensions.cs (5)
12/// Provides extension methods for attaching a <see cref="FunctionInvokingChatClient"/> to a chat pipeline. 19/// <remarks>This works by adding an instance of <see cref="FunctionInvokingChatClient"/> with default options.</remarks> 22/// <param name="configure">An optional callback that can be used to configure the <see cref="FunctionInvokingChatClient"/> instance.</param> 28Action<FunctionInvokingChatClient>? configure = null) 36var chatClient = new FunctionInvokingChatClient(innerClient, loggerFactory, services);
Microsoft.Extensions.AI.AzureAIInference.Tests (2)
AzureAIInferenceChatClientTests.cs (2)
80Assert.NotNull(pipeline.GetService<FunctionInvokingChatClient>()); 87Assert.IsType<FunctionInvokingChatClient>(pipeline.GetService<IChatClient>());
Microsoft.Extensions.AI.Integration.Tests (11)
ChatClientIntegrationTests.cs (11)
234using var chatClient = new FunctionInvokingChatClient( 258using var chatClient = new FunctionInvokingChatClient(ChatClient); 273using var chatClient = new FunctionInvokingChatClient(ChatClient); 301using var chatClient = new FunctionInvokingChatClient( 333using var chatClient = new FunctionInvokingChatClient( 365using var chatClient = new FunctionInvokingChatClient( 422using var chatClient = new FunctionInvokingChatClient( 579using var chatClient = new FunctionInvokingChatClient(ChatClient); 612using var chatClient = new FunctionInvokingChatClient(ChatClient); 632using var chatClient = new FunctionInvokingChatClient(ChatClient); 1073using var chatClient = new FunctionInvokingChatClient(ChatClient);
Microsoft.Extensions.AI.OpenAI.Tests (10)
OpenAIAssistantChatClientTests.cs (2)
64Assert.NotNull(pipeline.GetService<FunctionInvokingChatClient>()); 70Assert.IsType<FunctionInvokingChatClient>(pipeline.GetService<IChatClient>());
OpenAIChatClientTests.cs (4)
70Assert.NotNull(pipeline.GetService<FunctionInvokingChatClient>()); 76Assert.IsType<FunctionInvokingChatClient>(pipeline.GetService<IChatClient>()); 95Assert.NotNull(pipeline.GetService<FunctionInvokingChatClient>()); 101Assert.IsType<FunctionInvokingChatClient>(pipeline.GetService<IChatClient>());
OpenAIResponseClientIntegrationTests.cs (2)
229using var chatClient = new FunctionInvokingChatClient(ChatClient); 323using var chatClient = new FunctionInvokingChatClient(ChatClient);
OpenAIResponseClientTests.cs (2)
63Assert.NotNull(pipeline.GetService<FunctionInvokingChatClient>()); 69Assert.IsType<FunctionInvokingChatClient>(pipeline.GetService<IChatClient>());
Microsoft.Extensions.AI.Tests (9)
ChatCompletion\FunctionInvokingChatClientTests.cs (9)
34using FunctionInvokingChatClient client = new(innerClient); 48using FunctionInvokingChatClient client = new(innerClient); 778using var client = new FunctionInvokingChatClient(innerClient); 820using var client = new FunctionInvokingChatClient(innerClient); 842var context = FunctionInvokingChatClient.CurrentContext!; 882Assert.Null(FunctionInvokingChatClient.CurrentContext); 919FunctionInvokingChatClient.CurrentContext!.Terminate = true; 941using var chatClient = new FunctionInvokingChatClient(innerChatClient); 1220using var chatClient = new FunctionInvokingChatClient(innerChatClient);