32 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)
225using var chatClient = new FunctionInvokingChatClient( 249using var chatClient = new FunctionInvokingChatClient(ChatClient); 264using var chatClient = new FunctionInvokingChatClient(ChatClient); 292using var chatClient = new FunctionInvokingChatClient( 324using var chatClient = new FunctionInvokingChatClient( 356using var chatClient = new FunctionInvokingChatClient( 413using var chatClient = new FunctionInvokingChatClient( 570using var chatClient = new FunctionInvokingChatClient(ChatClient); 603using var chatClient = new FunctionInvokingChatClient(ChatClient); 623using var chatClient = new FunctionInvokingChatClient(ChatClient); 1064using var chatClient = new FunctionInvokingChatClient(ChatClient);
Microsoft.Extensions.AI.Tests (20)
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (4)
630Func<ChatClientBuilder, ChatClientBuilder> configurePipeline = b => b.Use(s => new FunctionInvokingChatClient(s)); 703Func<ChatClientBuilder, ChatClientBuilder> configurePipeline = b => b.Use(s => new FunctionInvokingChatClient(s)); 795configurePipeline ??= b => b.Use(s => new FunctionInvokingChatClient(s) { AdditionalTools = additionalTools }); 865configurePipeline ??= b => b.Use(s => new FunctionInvokingChatClient(s) { AdditionalTools = additionalTools });
ChatCompletion\FunctionInvokingChatClientTests.cs (16)
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>())); 678new FunctionInvokingChatClient(new OpenTelemetryChatClient(c, sourceName: sourceName))); 760using var client = new FunctionInvokingChatClient(innerClient); 802using var client = new FunctionInvokingChatClient(innerClient); 923using var chatClient = new FunctionInvokingChatClient(innerChatClient); 1075s => new FunctionInvokingChatClient(s) { TerminateOnUnknownCalls = terminateOnUnknown }); 1138s => new FunctionInvokingChatClient(s) { TerminateOnUnknownCalls = terminateOnUnknown }); 1169Func<ChatClientBuilder, ChatClientBuilder> configure = b => b.Use(s => new FunctionInvokingChatClient(s) { TerminateOnUnknownCalls = false }); 1174configure = b => b.Use(s => new FunctionInvokingChatClient(s) { TerminateOnUnknownCalls = true });
52 references to FunctionInvokingChatClient
Aspire.Azure.AI.OpenAI.Tests (1)
AspireConfigurableOpenAIExtensionsTests.cs (1)
247Assert.IsType<FunctionInvokingChatClient>(chatClient);
Microsoft.Extensions.AI (22)
ChatCompletion\FunctionInvocationContext.cs (1)
70/// The initial request to the client that passes along the chat contents provided to the <see cref="FunctionInvokingChatClient"/>
ChatCompletion\FunctionInvokingChatClient.cs (16)
44/// <see cref="FunctionInvokingChatClient"/> will not attempt to invoke it, and instead allow that <see cref="FunctionCallContent"/> 49/// Further, if a requested function is an <see cref="ApprovalRequiredAIFunction"/>, the <see cref="FunctionInvokingChatClient"/> will not 53/// request. The <see cref="FunctionInvokingChatClient"/> will then process that approval response and invoke the function as appropriate. 62/// A <see cref="FunctionInvokingChatClient"/> instance is thread-safe for concurrent use so long as the 78/// <summary>Gets the <see cref="IServiceProvider"/> specified when constructing the <see cref="FunctionInvokingChatClient"/>, if any.</summary> 95/// Initializes a new instance of the <see cref="FunctionInvokingChatClient"/> class. 103_logger = (ILogger?)loggerFactory?.CreateLogger<FunctionInvokingChatClient>() ?? NullLogger.Instance; 174/// Each request to this <see cref="FunctionInvokingChatClient"/> might end up making 208/// When function invocations fail with an exception, the <see cref="FunctionInvokingChatClient"/> 235/// These will not impact the requests sent by the <see cref="FunctionInvokingChatClient"/>, which will pass through the 246/// that isn't available to the <see cref="FunctionInvokingChatClient"/> is received; <see langword="false"/> to create and send a 251/// When <see langword="false"/>, call requests to any tools that aren't available to the <see cref="FunctionInvokingChatClient"/> 257/// that the <see cref="FunctionInvokingChatClient"/> doesn't know about, it will terminate the function calling loop and return 261/// <see cref="AITool"/>s that the <see cref="FunctionInvokingChatClient"/> is aware of (for example, because they're in 286using Activity? activity = _activitySource?.StartActivity($"{nameof(FunctionInvokingChatClient)}.{nameof(GetResponseAsync)}"); 425using Activity? activity = _activitySource?.StartActivity($"{nameof(FunctionInvokingChatClient)}.{nameof(GetStreamingResponseAsync)}");
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)
225using var chatClient = new FunctionInvokingChatClient( 249using var chatClient = new FunctionInvokingChatClient(ChatClient); 264using var chatClient = new FunctionInvokingChatClient(ChatClient); 292using var chatClient = new FunctionInvokingChatClient( 324using var chatClient = new FunctionInvokingChatClient( 356using var chatClient = new FunctionInvokingChatClient( 413using var chatClient = new FunctionInvokingChatClient( 570using var chatClient = new FunctionInvokingChatClient(ChatClient); 603using var chatClient = new FunctionInvokingChatClient(ChatClient); 623using var chatClient = new FunctionInvokingChatClient(ChatClient); 1064using var chatClient = new FunctionInvokingChatClient(ChatClient);
Microsoft.Extensions.AI.OpenAI.Tests (8)
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>());
OpenAIResponseClientTests.cs (2)
62Assert.NotNull(pipeline.GetService<FunctionInvokingChatClient>()); 68Assert.IsType<FunctionInvokingChatClient>(pipeline.GetService<IChatClient>());
Microsoft.Extensions.AI.Tests (8)
ChatCompletion\FunctionInvokingChatClientTests.cs (8)
34using FunctionInvokingChatClient client = new(innerClient); 48using FunctionInvokingChatClient client = new(innerClient); 760using var client = new FunctionInvokingChatClient(innerClient); 802using var client = new FunctionInvokingChatClient(innerClient); 824var context = FunctionInvokingChatClient.CurrentContext!; 864Assert.Null(FunctionInvokingChatClient.CurrentContext); 901FunctionInvokingChatClient.CurrentContext!.Terminate = true; 923using var chatClient = new FunctionInvokingChatClient(innerChatClient);