43 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 (7)
OpenAIResponseClientIntegrationTests.cs (7)
257using var chatClient = new FunctionInvokingChatClient(ChatClient); 351using var chatClient = new FunctionInvokingChatClient(ChatClient); 439using var client = new FunctionInvokingChatClient(ChatClient); 463using var client = new FunctionInvokingChatClient(ChatClient); 487using var client = new FunctionInvokingChatClient(ChatClient); 512using var client = new FunctionInvokingChatClient(ChatClient); 540using var client = new FunctionInvokingChatClient(ChatClient);
Microsoft.Extensions.AI.Tests (24)
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (4)
746Func<ChatClientBuilder, ChatClientBuilder> configurePipeline = b => b.Use(s => new FunctionInvokingChatClient(s)); 819Func<ChatClientBuilder, ChatClientBuilder> configurePipeline = b => b.Use(s => new FunctionInvokingChatClient(s)); 928configurePipeline ??= b => b.Use(s => new FunctionInvokingChatClient(s) { AdditionalTools = additionalTools }); 1016configurePipeline ??= b => b.Use(s => new FunctionInvokingChatClient(s) { AdditionalTools = additionalTools });
ChatCompletion\FunctionInvokingChatClientTests.cs (20)
27Assert.Throws<ArgumentNullException>("innerClient", () => new FunctionInvokingChatClient(null!)); 35using FunctionInvokingChatClient client = new(innerClient); 49using FunctionInvokingChatClient client = new(innerClient); 218s => new FunctionInvokingChatClient(s) { AllowConcurrentInvocation = concurrentInvocation }); 266s => new FunctionInvokingChatClient(s) { AllowConcurrentInvocation = true }); 340s => new FunctionInvokingChatClient(s) 596s => new FunctionInvokingChatClient(s) { IncludeDetailedErrors = detailedErrors }); 623b.Use((c, services) => new FunctionInvokingChatClient(c, services.GetRequiredService<ILoggerFactory>())); 680new FunctionInvokingChatClient(new OpenTelemetryChatClient(c, sourceName: sourceName) { EnableSensitiveData = enableSensitiveData })); 779using var client = new FunctionInvokingChatClient(innerClient); 821using var client = new FunctionInvokingChatClient(innerClient); 942using var chatClient = new FunctionInvokingChatClient(innerChatClient); 1094s => new FunctionInvokingChatClient(s) { TerminateOnUnknownCalls = terminateOnUnknown }); 1157s => new FunctionInvokingChatClient(s) { TerminateOnUnknownCalls = terminateOnUnknown }); 1188Func<ChatClientBuilder, ChatClientBuilder> configure = b => b.Use(s => new FunctionInvokingChatClient(s) { TerminateOnUnknownCalls = false }); 1193configure = b => b.Use(s => new FunctionInvokingChatClient(s) { TerminateOnUnknownCalls = true }); 1221using var chatClient = new FunctionInvokingChatClient(innerChatClient); 1256new FunctionInvokingChatClient(new OpenTelemetryChatClient(c, sourceName: clientSourceName))); 1302new FunctionInvokingChatClient(new OpenTelemetryChatClient(c, sourceName: clientSourceName))); 1423new FunctionInvokingChatClient(new OpenTelemetryChatClient(c, sourceName: clientSourceName)));
59 references to FunctionInvokingChatClient
Aspire.Azure.AI.OpenAI.Tests (1)
AspireConfigurableOpenAIExtensionsTests.cs (1)
247Assert.IsType<FunctionInvokingChatClient>(chatClient);
Microsoft.Extensions.AI (23)
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)
37/// <see cref="FunctionInvokingChatClient"/> will not attempt to invoke it, and instead allow that <see cref="FunctionCallContent"/> 42/// Further, if a requested function is an <see cref="ApprovalRequiredAIFunction"/>, the <see cref="FunctionInvokingChatClient"/> will not 46/// request. The <see cref="FunctionInvokingChatClient"/> will then process that approval response and invoke the function as appropriate. 55/// A <see cref="FunctionInvokingChatClient"/> instance is thread-safe for concurrent use so long as the 71/// <summary>Gets the <see cref="IServiceProvider"/> specified when constructing the <see cref="FunctionInvokingChatClient"/>, if any.</summary> 82/// Initializes a new instance of the <see cref="FunctionInvokingChatClient"/> class. 90_logger = (ILogger?)loggerFactory?.CreateLogger<FunctionInvokingChatClient>() ?? NullLogger.Instance; 161/// Each request to this <see cref="FunctionInvokingChatClient"/> might end up making 195/// When function invocations fail with an exception, the <see cref="FunctionInvokingChatClient"/> 222/// These will not impact the requests sent by the <see cref="FunctionInvokingChatClient"/>, which will pass through the 233/// that isn't available to the <see cref="FunctionInvokingChatClient"/> is received; <see langword="false"/> to create and send a 238/// When <see langword="false"/>, call requests to any tools that aren't available to the <see cref="FunctionInvokingChatClient"/> 244/// that the <see cref="FunctionInvokingChatClient"/> doesn't know about, it will terminate the function calling loop and return 248/// <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);
ChatCompletion\ImageGeneratingChatClient.cs (3)
375var callId = FunctionInvokingChatClient.CurrentContext?.CallContent.CallId; 410var callId = FunctionInvokingChatClient.CurrentContext?.CallContent.CallId; 428var callId = FunctionInvokingChatClient.CurrentContext?.CallContent.CallId;
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 (15)
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 (7)
257using var chatClient = new FunctionInvokingChatClient(ChatClient); 351using var chatClient = new FunctionInvokingChatClient(ChatClient); 439using var client = new FunctionInvokingChatClient(ChatClient); 463using var client = new FunctionInvokingChatClient(ChatClient); 487using var client = new FunctionInvokingChatClient(ChatClient); 512using var client = new FunctionInvokingChatClient(ChatClient); 540using var client = new FunctionInvokingChatClient(ChatClient);
OpenAIResponseClientTests.cs (2)
64Assert.NotNull(pipeline.GetService<FunctionInvokingChatClient>()); 70Assert.IsType<FunctionInvokingChatClient>(pipeline.GetService<IChatClient>());
Microsoft.Extensions.AI.Tests (9)
ChatCompletion\FunctionInvokingChatClientTests.cs (9)
35using FunctionInvokingChatClient client = new(innerClient); 49using FunctionInvokingChatClient client = new(innerClient); 779using var client = new FunctionInvokingChatClient(innerClient); 821using var client = new FunctionInvokingChatClient(innerClient); 843var context = FunctionInvokingChatClient.CurrentContext!; 883Assert.Null(FunctionInvokingChatClient.CurrentContext); 920FunctionInvokingChatClient.CurrentContext!.Terminate = true; 942using var chatClient = new FunctionInvokingChatClient(innerChatClient); 1221using var chatClient = new FunctionInvokingChatClient(innerChatClient);