OpenAIClient Constructors

Definition

Overloads

OpenAIClient()

Initializes a new instance of OpenAIClient for mocking.

OpenAIClient(String)

Initializes a instance of OpenAIClient for use with the non-Azure OpenAI endpoint.

OpenAIClient(String, OpenAIClientOptions)

Initializes a instance of OpenAIClient for use with the non-Azure OpenAI endpoint.

OpenAIClient(Uri, AzureKeyCredential)

Initializes a instance of OpenAIClient for use with an Azure OpenAI resource.

OpenAIClient(Uri, TokenCredential) Initializes a instance of OpenAIClient for use with an Azure OpenAI resource.
OpenAIClient(Uri, AzureKeyCredential, OpenAIClientOptions)

Initializes a instance of OpenAIClient for use with an Azure OpenAI resource.

OpenAIClient(Uri, TokenCredential, OpenAIClientOptions) Initializes a instance of OpenAIClient for use with an Azure OpenAI resource.

OpenAIClient()

Source:
OpenAIClient.cs

Initializes a new instance of OpenAIClient for mocking.

protected OpenAIClient ();
Protected Sub New ()

Applies to

OpenAIClient(String)

Source:
OpenAIClient.cs

Initializes a instance of OpenAIClient for use with the non-Azure OpenAI endpoint.

public OpenAIClient (string openAIApiKey);
new Azure.AI.OpenAI.OpenAIClient : string -> Azure.AI.OpenAI.OpenAIClient
Public Sub New (openAIApiKey As String)

Parameters

openAIApiKey
String

The API key to use when connecting to the non-Azure OpenAI endpoint.

Exceptions

openAIApiKey is null.

Remarks

OpenAIClient objects initialized with this constructor can only be used with the non-Azure OpenAI inference endpoint. To use OpenAIClient with an Azure OpenAI resource, use a constructor that accepts a resource URI and Azure authentication credential, instead.

Applies to

OpenAIClient(String, OpenAIClientOptions)

Source:
OpenAIClient.cs

Initializes a instance of OpenAIClient for use with the non-Azure OpenAI endpoint.

public OpenAIClient (string openAIApiKey, Azure.AI.OpenAI.OpenAIClientOptions options);
new Azure.AI.OpenAI.OpenAIClient : string * Azure.AI.OpenAI.OpenAIClientOptions -> Azure.AI.OpenAI.OpenAIClient
Public Sub New (openAIApiKey As String, options As OpenAIClientOptions)

Parameters

openAIApiKey
String

The API key to use when connecting to the non-Azure OpenAI endpoint.

options
OpenAIClientOptions

The options for configuring the client.

Exceptions

openAIApiKey is null.

Remarks

OpenAIClient objects initialized with this constructor can only be used with the non-Azure OpenAI inference endpoint. To use OpenAIClient with an Azure OpenAI resource, use a constructor that accepts a resource URI and Azure authentication credential, instead.

Applies to

OpenAIClient(Uri, AzureKeyCredential)

Source:
OpenAIClient.cs

Initializes a instance of OpenAIClient for use with an Azure OpenAI resource.

public OpenAIClient (Uri endpoint, Azure.AzureKeyCredential keyCredential);
new Azure.AI.OpenAI.OpenAIClient : Uri * Azure.AzureKeyCredential -> Azure.AI.OpenAI.OpenAIClient
Public Sub New (endpoint As Uri, keyCredential As AzureKeyCredential)

Parameters

endpoint
Uri

The URI for an Azure OpenAI resource as retrieved from, for example, Azure Portal. This should include protocol and hostname. An example could be: https://my-resource.openai.azure.com .

keyCredential
AzureKeyCredential

A key credential used to authenticate to an Azure OpenAI resource.

Exceptions

endpoint or keyCredential is null.

Remarks

OpenAIClient objects initialized with this constructor can only be used with Azure OpenAI resources. To use OpenAIClient with the non-Azure OpenAI inference endpoint, use a constructor that accepts a non-Azure OpenAI API key, instead.

Applies to

OpenAIClient(Uri, TokenCredential)

Source:
OpenAIClient.cs
Initializes a instance of OpenAIClient for use with an Azure OpenAI resource.
public OpenAIClient (Uri endpoint, Azure.Core.TokenCredential tokenCredential);
new Azure.AI.OpenAI.OpenAIClient : Uri * Azure.Core.TokenCredential -> Azure.AI.OpenAI.OpenAIClient
Public Sub New (endpoint As Uri, tokenCredential As TokenCredential)

Parameters

endpoint
Uri
tokenCredential
TokenCredential

A token credential used to authenticate with an Azure OpenAI resource.

Exceptions

endpoint or tokenCredential is null.

Applies to

OpenAIClient(Uri, AzureKeyCredential, OpenAIClientOptions)

Source:
OpenAIClient.cs

Initializes a instance of OpenAIClient for use with an Azure OpenAI resource.

public OpenAIClient (Uri endpoint, Azure.AzureKeyCredential keyCredential, Azure.AI.OpenAI.OpenAIClientOptions options);
new Azure.AI.OpenAI.OpenAIClient : Uri * Azure.AzureKeyCredential * Azure.AI.OpenAI.OpenAIClientOptions -> Azure.AI.OpenAI.OpenAIClient
Public Sub New (endpoint As Uri, keyCredential As AzureKeyCredential, options As OpenAIClientOptions)

Parameters

endpoint
Uri

The URI for an Azure OpenAI resource as retrieved from, for example, Azure Portal. This should include protocol and hostname. An example could be: https://my-resource.openai.azure.com .

keyCredential
AzureKeyCredential

A key credential used to authenticate to an Azure OpenAI resource.

options
OpenAIClientOptions

The options for configuring the client.

Exceptions

endpoint or keyCredential is null.

Remarks

OpenAIClient objects initialized with this constructor can only be used with Azure OpenAI resources. To use OpenAIClient with the non-Azure OpenAI inference endpoint, use a constructor that accepts a non-Azure OpenAI API key, instead.

Applies to

OpenAIClient(Uri, TokenCredential, OpenAIClientOptions)

Source:
OpenAIClient.cs
Initializes a instance of OpenAIClient for use with an Azure OpenAI resource.
public OpenAIClient (Uri endpoint, Azure.Core.TokenCredential tokenCredential, Azure.AI.OpenAI.OpenAIClientOptions options);
new Azure.AI.OpenAI.OpenAIClient : Uri * Azure.Core.TokenCredential * Azure.AI.OpenAI.OpenAIClientOptions -> Azure.AI.OpenAI.OpenAIClient
Public Sub New (endpoint As Uri, tokenCredential As TokenCredential, options As OpenAIClientOptions)

Parameters

endpoint
Uri
tokenCredential
TokenCredential

A token credential used to authenticate with an Azure OpenAI resource.

Exceptions

endpoint or tokenCredential is null.

Applies to