Compartir a través de


AnonymousDelegatingChatClient Constructors

Definition

Overloads

AnonymousDelegatingChatClient(IChatClient, AnonymousDelegatingChatClient+GetResponseSharedFunc)

Initializes a new instance of the AnonymousDelegatingChatClient class.

AnonymousDelegatingChatClient(IChatClient, Func<IList<ChatMessage>, ChatOptions,IChatClient,CancellationToken,Task<ChatResponse>>, Func<IList<ChatMessage>,ChatOptions,IChatClient,CancellationToken, IAsyncEnumerable<ChatResponseUpdate>>)

Initializes a new instance of the AnonymousDelegatingChatClient class.

AnonymousDelegatingChatClient(IChatClient, AnonymousDelegatingChatClient+GetResponseSharedFunc)

Initializes a new instance of the AnonymousDelegatingChatClient class.

public:
 AnonymousDelegatingChatClient(Microsoft::Extensions::AI::IChatClient ^ innerClient, Microsoft::Extensions::AI::AnonymousDelegatingChatClient::GetResponseSharedFunc ^ sharedFunc);
public AnonymousDelegatingChatClient(Microsoft.Extensions.AI.IChatClient innerClient, Microsoft.Extensions.AI.AnonymousDelegatingChatClient.GetResponseSharedFunc sharedFunc);
new Microsoft.Extensions.AI.AnonymousDelegatingChatClient : Microsoft.Extensions.AI.IChatClient * Microsoft.Extensions.AI.AnonymousDelegatingChatClient.GetResponseSharedFunc -> Microsoft.Extensions.AI.AnonymousDelegatingChatClient
Public Sub New (innerClient As IChatClient, sharedFunc As AnonymousDelegatingChatClient.GetResponseSharedFunc)

Parameters

innerClient
IChatClient

The inner client.

sharedFunc
AnonymousDelegatingChatClient.GetResponseSharedFunc

A delegate that provides the implementation for both GetResponseAsync(IList<ChatMessage>, ChatOptions, CancellationToken) and GetStreamingResponseAsync(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-processing 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<ChatResponse>>, Func<IList<ChatMessage>,ChatOptions,IChatClient,CancellationToken, IAsyncEnumerable<ChatResponseUpdate>>)

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::ChatResponse ^> ^> ^ getResponseFunc, 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::ChatResponseUpdate ^> ^> ^ getStreamingResponseFunc);
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.ChatResponse>>? getResponseFunc, 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.ChatResponseUpdate>>? getStreamingResponseFunc);
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.ChatResponse>> * 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.ChatResponseUpdate>> -> Microsoft.Extensions.AI.AnonymousDelegatingChatClient
Public Sub New (innerClient As IChatClient, getResponseFunc As Func(Of IList(Of ChatMessage), ChatOptions, IChatClient, CancellationToken, Task(Of ChatResponse)), getStreamingResponseFunc As Func(Of IList(Of ChatMessage), ChatOptions, IChatClient, CancellationToken, IAsyncEnumerable(Of ChatResponseUpdate)))

Parameters

innerClient
IChatClient

The inner client.

getResponseFunc
Func<IList<ChatMessage>,ChatOptions,IChatClient,CancellationToken,Task<ChatResponse>>

A delegate that provides the implementation for GetResponseAsync(IList<ChatMessage>, ChatOptions, CancellationToken). When null, getStreamingResponseFunc must be non-null, and the implementation of GetResponseAsync(IList<ChatMessage>, ChatOptions, CancellationToken) will use getStreamingResponseFunc for the implementation.

getStreamingResponseFunc
Func<IList<ChatMessage>,ChatOptions,IChatClient,CancellationToken,IAsyncEnumerable<ChatResponseUpdate>>

A delegate that provides the implementation for GetStreamingResponseAsync(IList<ChatMessage>, ChatOptions, CancellationToken). When null, getResponseFunc must be non-null, and the implementation of GetStreamingResponseAsync(IList<ChatMessage>, ChatOptions, CancellationToken) will use getResponseFunc for the implementation.

Exceptions

Both getResponseFunc and getStreamingResponseFunc are null.

Applies to