Partilhar via


ChatCompletionServiceExtensions.AsChatCompletionService Method

Definition

Creates an IChatCompletionService for the specified IChatClient.

public static Microsoft.SemanticKernel.ChatCompletion.IChatCompletionService AsChatCompletionService(this Microsoft.Extensions.AI.IChatClient client, IServiceProvider? serviceProvider = default);
static member AsChatCompletionService : Microsoft.Extensions.AI.IChatClient * IServiceProvider -> Microsoft.SemanticKernel.ChatCompletion.IChatCompletionService
<Extension()>
Public Function AsChatCompletionService (client As IChatClient, Optional serviceProvider As IServiceProvider = Nothing) As IChatCompletionService

Parameters

client
IChatClient

The chat client to be represented as a chat completion service.

serviceProvider
IServiceProvider

An optional IServiceProvider that can be used to resolve services to use in the instance.

Returns

The IChatCompletionService. If client is an IChatCompletionService, client will be returned. Otherwise, a new IChatCompletionService will be created that wraps client.

Applies to