Share via


OpenAIServiceCollectionExtensions.AddOpenAIChatCompletion Method

Definition

Overloads

AddOpenAIChatCompletion(IKernelBuilder, String, String, String, String, HttpClient)

Adds the OpenAI chat completion service to the list.

AddOpenAIChatCompletion(IKernelBuilder, String, Uri, String, String, String, HttpClient)

Adds the Custom Endpoint OpenAI chat completion service to the list.

AddOpenAIChatCompletion(IServiceCollection, String, Uri, String, String, String)

Adds the Custom OpenAI chat completion service to the list.

AddOpenAIChatCompletion(IKernelBuilder, String, OpenAIClient, String)

Adds the OpenAI chat completion service to the list.

AddOpenAIChatCompletion(IServiceCollection, String, OpenAIClient, String)

Adds the OpenAI chat completion service to the list.

AddOpenAIChatCompletion(IServiceCollection, String, String, String, String)

Adds the OpenAI chat completion service to the list.

AddOpenAIChatCompletion(IKernelBuilder, String, String, String, String, HttpClient)

Adds the OpenAI chat completion service to the list.

public static Microsoft.SemanticKernel.IKernelBuilder AddOpenAIChatCompletion (this Microsoft.SemanticKernel.IKernelBuilder builder, string modelId, string apiKey, string? orgId = default, string? serviceId = default, System.Net.Http.HttpClient? httpClient = default);
static member AddOpenAIChatCompletion : Microsoft.SemanticKernel.IKernelBuilder * string * string * string * string * System.Net.Http.HttpClient -> Microsoft.SemanticKernel.IKernelBuilder
<Extension()>
Public Function AddOpenAIChatCompletion (builder As IKernelBuilder, modelId As String, apiKey As String, Optional orgId As String = Nothing, Optional serviceId As String = Nothing, Optional httpClient As HttpClient = Nothing) As IKernelBuilder

Parameters

builder
IKernelBuilder

The IKernelBuilder instance to augment.

modelId
String

OpenAI model name, see https://platform.openai.com/docs/models

orgId
String

OpenAI organization id. This is usually optional unless your account belongs to multiple organizations.

serviceId
String

A local identifier for the given AI service

httpClient
HttpClient

The HttpClient to use with this service.

Returns

The same instance as builder.

Applies to

AddOpenAIChatCompletion(IKernelBuilder, String, Uri, String, String, String, HttpClient)

Adds the Custom Endpoint OpenAI chat completion service to the list.

public static Microsoft.SemanticKernel.IKernelBuilder AddOpenAIChatCompletion (this Microsoft.SemanticKernel.IKernelBuilder builder, string modelId, Uri endpoint, string? apiKey, string? orgId = default, string? serviceId = default, System.Net.Http.HttpClient? httpClient = default);
static member AddOpenAIChatCompletion : Microsoft.SemanticKernel.IKernelBuilder * string * Uri * string * string * string * System.Net.Http.HttpClient -> Microsoft.SemanticKernel.IKernelBuilder
<Extension()>
Public Function AddOpenAIChatCompletion (builder As IKernelBuilder, modelId As String, endpoint As Uri, apiKey As String, Optional orgId As String = Nothing, Optional serviceId As String = Nothing, Optional httpClient As HttpClient = Nothing) As IKernelBuilder

Parameters

builder
IKernelBuilder

The IKernelBuilder instance to augment.

modelId
String

OpenAI model name, see https://platform.openai.com/docs/models

endpoint
Uri

Custom OpenAI Compatible Message API endpoint

orgId
String

OpenAI organization id. This is usually optional unless your account belongs to multiple organizations.

serviceId
String

A local identifier for the given AI service

httpClient
HttpClient

The HttpClient to use with this service.

Returns

The same instance as builder.

Applies to

AddOpenAIChatCompletion(IServiceCollection, String, Uri, String, String, String)

Adds the Custom OpenAI chat completion service to the list.

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddOpenAIChatCompletion (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string modelId, Uri endpoint, string? apiKey = default, string? orgId = default, string? serviceId = default);
static member AddOpenAIChatCompletion : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Uri * string * string * string -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddOpenAIChatCompletion (services As IServiceCollection, modelId As String, endpoint As Uri, Optional apiKey As String = Nothing, Optional orgId As String = Nothing, Optional serviceId As String = Nothing) As IServiceCollection

Parameters

services
IServiceCollection

The IServiceCollection instance to augment.

modelId
String

OpenAI model name, see https://platform.openai.com/docs/models

endpoint
Uri

A Custom Message API compatible endpoint.

orgId
String

OpenAI organization id. This is usually optional unless your account belongs to multiple organizations.

serviceId
String

A local identifier for the given AI service

Returns

The same instance as services.

Applies to

AddOpenAIChatCompletion(IKernelBuilder, String, OpenAIClient, String)

Adds the OpenAI chat completion service to the list.

public static Microsoft.SemanticKernel.IKernelBuilder AddOpenAIChatCompletion (this Microsoft.SemanticKernel.IKernelBuilder builder, string modelId, Azure.AI.OpenAI.OpenAIClient? openAIClient = default, string? serviceId = default);
static member AddOpenAIChatCompletion : Microsoft.SemanticKernel.IKernelBuilder * string * Azure.AI.OpenAI.OpenAIClient * string -> Microsoft.SemanticKernel.IKernelBuilder
<Extension()>
Public Function AddOpenAIChatCompletion (builder As IKernelBuilder, modelId As String, Optional openAIClient As OpenAIClient = Nothing, Optional serviceId As String = Nothing) As IKernelBuilder

Parameters

builder
IKernelBuilder

The IKernelBuilder instance to augment.

modelId
String

OpenAI model id

openAIClient
Azure.AI.OpenAI.OpenAIClient

Azure.AI.OpenAI.OpenAIClient to use for the service. If null, one must be available in the service provider when this service is resolved.

serviceId
String

A local identifier for the given AI service

Returns

The same instance as builder.

Applies to

AddOpenAIChatCompletion(IServiceCollection, String, OpenAIClient, String)

Adds the OpenAI chat completion service to the list.

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddOpenAIChatCompletion (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string modelId, Azure.AI.OpenAI.OpenAIClient? openAIClient = default, string? serviceId = default);
static member AddOpenAIChatCompletion : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Azure.AI.OpenAI.OpenAIClient * string -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddOpenAIChatCompletion (services As IServiceCollection, modelId As String, Optional openAIClient As OpenAIClient = Nothing, Optional serviceId As String = Nothing) As IServiceCollection

Parameters

services
IServiceCollection

The IServiceCollection instance to augment.

modelId
String

OpenAI model id

openAIClient
Azure.AI.OpenAI.OpenAIClient

Azure.AI.OpenAI.OpenAIClient to use for the service. If null, one must be available in the service provider when this service is resolved.

serviceId
String

A local identifier for the given AI service

Returns

The same instance as services.

Applies to

AddOpenAIChatCompletion(IServiceCollection, String, String, String, String)

Adds the OpenAI chat completion service to the list.

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddOpenAIChatCompletion (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string modelId, string apiKey, string? orgId = default, string? serviceId = default);
static member AddOpenAIChatCompletion : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * string * string * string -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddOpenAIChatCompletion (services As IServiceCollection, modelId As String, apiKey As String, Optional orgId As String = Nothing, Optional serviceId As String = Nothing) As IServiceCollection

Parameters

services
IServiceCollection

The IServiceCollection instance to augment.

modelId
String

OpenAI model name, see https://platform.openai.com/docs/models

orgId
String

OpenAI organization id. This is usually optional unless your account belongs to multiple organizations.

serviceId
String

A local identifier for the given AI service

Returns

The same instance as services.

Applies to