AnonymousDelegatingChatClient Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
AnonymousDelegatingChatClient(IChatClient, AnonymousDelegatingChatClient+CompleteSharedFunc)
Initializes a new instance of the AnonymousDelegatingChatClient class.
public:
AnonymousDelegatingChatClient(Microsoft::Extensions::AI::IChatClient ^ innerClient, Microsoft::Extensions::AI::AnonymousDelegatingChatClient::CompleteSharedFunc ^ sharedFunc);
public AnonymousDelegatingChatClient (Microsoft.Extensions.AI.IChatClient innerClient, Microsoft.Extensions.AI.AnonymousDelegatingChatClient.CompleteSharedFunc sharedFunc);
new Microsoft.Extensions.AI.AnonymousDelegatingChatClient : Microsoft.Extensions.AI.IChatClient * Microsoft.Extensions.AI.AnonymousDelegatingChatClient.CompleteSharedFunc -> Microsoft.Extensions.AI.AnonymousDelegatingChatClient
Public Sub New (innerClient As IChatClient, sharedFunc As AnonymousDelegatingChatClient.CompleteSharedFunc)
Parameters
- innerClient
- IChatClient
The inner client.
A delegate that provides the implementation for both CompleteAsync(IList<ChatMessage>, ChatOptions, CancellationToken) and CompleteStreamingAsync(IList<ChatMessage>, ChatOptions, CancellationToken). In addition to the arguments for the operation, it's provided with a delegate to the inner client that should be used to perform the operation on the inner client. It will handle both the non-streaming and streaming cases.
Exceptions
sharedFunc
is null
.
Remarks
This overload may be used when the anonymous implementation needs to provide pre- and/or post-processing, but doesn't need to interact with the results of the operation, which will come from the inner client.
Applies to
AnonymousDelegatingChatClient(IChatClient, Func<IList<ChatMessage>, ChatOptions,IChatClient,CancellationToken,Task<ChatCompletion>>, Func<IList<ChatMessage>,ChatOptions,IChatClient,CancellationToken, IAsyncEnumerable<StreamingChatCompletionUpdate>>)
Initializes a new instance of the AnonymousDelegatingChatClient class.
public:
AnonymousDelegatingChatClient(Microsoft::Extensions::AI::IChatClient ^ innerClient, Func<System::Collections::Generic::IList<Microsoft::Extensions::AI::ChatMessage ^> ^, Microsoft::Extensions::AI::ChatOptions ^, Microsoft::Extensions::AI::IChatClient ^, System::Threading::CancellationToken, System::Threading::Tasks::Task<Microsoft::Extensions::AI::ChatCompletion ^> ^> ^ completeFunc, Func<System::Collections::Generic::IList<Microsoft::Extensions::AI::ChatMessage ^> ^, Microsoft::Extensions::AI::ChatOptions ^, Microsoft::Extensions::AI::IChatClient ^, System::Threading::CancellationToken, System::Collections::Generic::IAsyncEnumerable<Microsoft::Extensions::AI::StreamingChatCompletionUpdate ^> ^> ^ completeStreamingFunc);
public AnonymousDelegatingChatClient (Microsoft.Extensions.AI.IChatClient innerClient, Func<System.Collections.Generic.IList<Microsoft.Extensions.AI.ChatMessage>,Microsoft.Extensions.AI.ChatOptions?,Microsoft.Extensions.AI.IChatClient,System.Threading.CancellationToken,System.Threading.Tasks.Task<Microsoft.Extensions.AI.ChatCompletion>>? completeFunc, Func<System.Collections.Generic.IList<Microsoft.Extensions.AI.ChatMessage>,Microsoft.Extensions.AI.ChatOptions?,Microsoft.Extensions.AI.IChatClient,System.Threading.CancellationToken,System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.StreamingChatCompletionUpdate>>? completeStreamingFunc);
new Microsoft.Extensions.AI.AnonymousDelegatingChatClient : Microsoft.Extensions.AI.IChatClient * Func<System.Collections.Generic.IList<Microsoft.Extensions.AI.ChatMessage>, Microsoft.Extensions.AI.ChatOptions, Microsoft.Extensions.AI.IChatClient, System.Threading.CancellationToken, System.Threading.Tasks.Task<Microsoft.Extensions.AI.ChatCompletion>> * Func<System.Collections.Generic.IList<Microsoft.Extensions.AI.ChatMessage>, Microsoft.Extensions.AI.ChatOptions, Microsoft.Extensions.AI.IChatClient, System.Threading.CancellationToken, System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.StreamingChatCompletionUpdate>> -> Microsoft.Extensions.AI.AnonymousDelegatingChatClient
Public Sub New (innerClient As IChatClient, completeFunc As Func(Of IList(Of ChatMessage), ChatOptions, IChatClient, CancellationToken, Task(Of ChatCompletion)), completeStreamingFunc As Func(Of IList(Of ChatMessage), ChatOptions, IChatClient, CancellationToken, IAsyncEnumerable(Of StreamingChatCompletionUpdate)))
Parameters
- innerClient
- IChatClient
The inner client.
- completeFunc
- Func<IList<ChatMessage>,ChatOptions,IChatClient,CancellationToken,Task<ChatCompletion>>
A delegate that provides the implementation for CompleteAsync(IList<ChatMessage>, ChatOptions, CancellationToken). When null
,
completeStreamingFunc
must be non-null, and the implementation of CompleteAsync(IList<ChatMessage>, ChatOptions, CancellationToken)
will use completeStreamingFunc
for the implementation.
- completeStreamingFunc
- Func<IList<ChatMessage>,ChatOptions,IChatClient,CancellationToken,IAsyncEnumerable<StreamingChatCompletionUpdate>>
A delegate that provides the implementation for CompleteStreamingAsync(IList<ChatMessage>, ChatOptions, CancellationToken). When null
,
completeFunc
must be non-null, and the implementation of CompleteStreamingAsync(IList<ChatMessage>, ChatOptions, CancellationToken)
will use completeFunc
for the implementation.
Exceptions
Both completeFunc
and completeStreamingFunc
are null
.
Applies to
.NET