Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .dotnet.azure/src/Custom/Assistants/AzureAssistantClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@ internal partial class AzureAssistantClient : AssistantClient
private readonly Uri _endpoint;
private readonly string _apiVersion;

internal AzureAssistantClient(
ClientPipeline pipeline,
Uri endpoint,
AzureOpenAIClientOptions options)
: base(pipeline, endpoint, options)
internal AzureAssistantClient(ClientPipeline pipeline, Uri endpoint, AzureOpenAIClientOptions options)
: base(pipeline, new OpenAIClientOptions() { Endpoint = endpoint })
{
Argument.AssertNotNull(pipeline, nameof(pipeline));
Argument.AssertNotNull(endpoint, nameof(endpoint));
options ??= new();

_endpoint = endpoint;
_apiVersion = options.Version;
}

protected AzureAssistantClient()
{ }
{
}
}
15 changes: 8 additions & 7 deletions .dotnet.azure/src/Custom/Audio/AzureAudioClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@ internal partial class AzureAudioClient : AudioClient
private readonly Uri _endpoint;
private readonly string _apiVersion;

internal AzureAudioClient(
ClientPipeline pipeline,
string deploymentName,
Uri endpoint,
AzureOpenAIClientOptions options)
: base(pipeline, model: deploymentName, endpoint, options)
internal AzureAudioClient(ClientPipeline pipeline, string deploymentName, Uri endpoint, AzureOpenAIClientOptions options)
: base(pipeline, model: deploymentName, new OpenAIClientOptions() { Endpoint = endpoint })
{
Argument.AssertNotNull(pipeline, nameof(pipeline));
Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName));
Argument.AssertNotNull(endpoint, nameof(endpoint));
options ??= new();

_deploymentName = deploymentName;
_endpoint = endpoint;
_apiVersion = options.Version;
}

protected AzureAudioClient()
{ }
{
}
}
207 changes: 85 additions & 122 deletions .dotnet.azure/src/Custom/AzureOpenAIClient.cs

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions .dotnet.azure/src/Custom/Batch/AzureBatchClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ internal partial class AzureBatchClient : BatchClient
private readonly string _deploymentName;
private readonly string _apiVersion;

internal AzureBatchClient(
ClientPipeline pipeline,
string deploymentName,
Uri endpoint,
AzureOpenAIClientOptions options)
: base(pipeline, endpoint, options)
internal AzureBatchClient(ClientPipeline pipeline, string deploymentName, Uri endpoint, AzureOpenAIClientOptions options)
: base(pipeline, new OpenAIClientOptions() { Endpoint = endpoint })
{
options ??= new();
Argument.AssertNotNull(pipeline, nameof(pipeline));
Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName));
Argument.AssertNotNull(endpoint, nameof(endpoint));
options ??= new();

_deploymentName = deploymentName;
_endpoint = endpoint;
_apiVersion = options.Version;
}

protected AzureBatchClient()
{ }
{
}
}
16 changes: 8 additions & 8 deletions .dotnet.azure/src/Custom/Chat/AzureChatClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ internal partial class AzureChatClient : ChatClient
private readonly Uri _endpoint;
private readonly string _apiVersion;

internal AzureChatClient(
ClientPipeline pipeline,
string deploymentName,
Uri endpoint,
AzureOpenAIClientOptions options)
: base(pipeline, model: deploymentName, endpoint, options)
internal AzureChatClient(ClientPipeline pipeline, string deploymentName, Uri endpoint, AzureOpenAIClientOptions options)
: base(pipeline, model: deploymentName, new OpenAIClientOptions() { Endpoint = endpoint })
{
Argument.AssertNotNull(pipeline, nameof(pipeline));
Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName));
Argument.AssertNotNull(endpoint, nameof(endpoint));
options ??= new();

_deploymentName = deploymentName;
_endpoint = endpoint;
_apiVersion = options.Version;
}

protected AzureChatClient()
{ }
{
}

/// <inheritdoc/>
public override AsyncCollectionResult<StreamingChatCompletionUpdate> CompleteChatStreamingAsync(IEnumerable<ChatMessage> messages, ChatCompletionOptions options = null, CancellationToken cancellationToken = default)
Expand Down
15 changes: 8 additions & 7 deletions .dotnet.azure/src/Custom/Embeddings/AzureEmbeddingClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@ internal partial class AzureEmbeddingClient : EmbeddingClient
private readonly Uri _endpoint;
private readonly string _apiVersion;

internal AzureEmbeddingClient(
ClientPipeline pipeline,
string deploymentName,
Uri endpoint,
AzureOpenAIClientOptions options)
: base(pipeline, model: deploymentName, endpoint, options)
internal AzureEmbeddingClient(ClientPipeline pipeline, string deploymentName, Uri endpoint, AzureOpenAIClientOptions options)
: base(pipeline, model: deploymentName, new OpenAIClientOptions() { Endpoint = endpoint })
{
Argument.AssertNotNull(pipeline, nameof(pipeline));
Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName));
Argument.AssertNotNull(endpoint, nameof(endpoint));
options ??= new();

_deploymentName = deploymentName;
_endpoint = endpoint;
_apiVersion = options.Version;
}

protected AzureEmbeddingClient()
{ }
{
}
}
13 changes: 7 additions & 6 deletions .dotnet.azure/src/Custom/Files/AzureFileClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@ internal partial class AzureFileClient : FileClient
private readonly Uri _endpoint;
private readonly string _apiVersion;

internal AzureFileClient(
ClientPipeline pipeline,
Uri endpoint,
AzureOpenAIClientOptions options)
: base(pipeline, endpoint, options)
internal AzureFileClient(ClientPipeline pipeline, Uri endpoint, AzureOpenAIClientOptions options)
: base(pipeline, new OpenAIClientOptions() { Endpoint = endpoint })
{
Argument.AssertNotNull(pipeline, nameof(pipeline));
Argument.AssertNotNull(endpoint, nameof(endpoint));
options ??= new();

_endpoint = endpoint;
_apiVersion = options.Version;
}

protected AzureFileClient()
{ }
{
}

/// <inheritdoc />
public override ClientResult<OpenAIFileInfo> UploadFile(Stream file, string filename, FileUploadPurpose purpose, CancellationToken cancellationToken = default)
Expand Down
13 changes: 7 additions & 6 deletions .dotnet.azure/src/Custom/FineTuning/AzureFineTuningClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@ internal partial class AzureFineTuningClient : FineTuningClient
private readonly Uri _endpoint;
private readonly string _apiVersion;

internal AzureFineTuningClient(
ClientPipeline pipeline,
Uri endpoint,
AzureOpenAIClientOptions options)
: base(pipeline, endpoint, options)
internal AzureFineTuningClient(ClientPipeline pipeline, Uri endpoint, AzureOpenAIClientOptions options)
: base(pipeline, new OpenAIClientOptions() { Endpoint = endpoint })
{
Argument.AssertNotNull(pipeline, nameof(pipeline));
Argument.AssertNotNull(endpoint, nameof(endpoint));
options ??= new();

_endpoint = endpoint;
_apiVersion = options.Version;
}

protected AzureFineTuningClient()
{ }
{
}
}
15 changes: 8 additions & 7 deletions .dotnet.azure/src/Custom/Images/AzureImageClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@ internal partial class AzureImageClient : ImageClient
private readonly Uri _endpoint;
private readonly string _apiVersion;

internal AzureImageClient(
ClientPipeline pipeline,
string deploymentName,
Uri endpoint,
AzureOpenAIClientOptions options)
: base(pipeline, model: deploymentName, endpoint, options)
internal AzureImageClient(ClientPipeline pipeline, string deploymentName, Uri endpoint, AzureOpenAIClientOptions options)
: base(pipeline, model: deploymentName, new OpenAIClientOptions() { Endpoint = endpoint })
{
Argument.AssertNotNull(pipeline, nameof(pipeline));
Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName));
Argument.AssertNotNull(endpoint, nameof(endpoint));
options ??= new();

_deploymentName = deploymentName;
_endpoint = endpoint;
_apiVersion = options.Version;
}

protected AzureImageClient()
{}
{
}
}
13 changes: 7 additions & 6 deletions .dotnet.azure/src/Custom/VectorStores/AzureVectorStoreClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ internal partial class AzureVectorStoreClient : VectorStoreClient
private readonly Uri _endpoint;
private readonly string _apiVersion;

internal AzureVectorStoreClient(
ClientPipeline pipeline,
Uri endpoint,
AzureOpenAIClientOptions options)
: base(pipeline, endpoint, options)
internal AzureVectorStoreClient(ClientPipeline pipeline, Uri endpoint, AzureOpenAIClientOptions options)
: base(pipeline, new OpenAIClientOptions() { Endpoint = endpoint })
{
Argument.AssertNotNull(pipeline, nameof(pipeline));
Argument.AssertNotNull(endpoint, nameof(endpoint));
options ??= new();

_endpoint = endpoint;
_apiVersion = options.Version;
}

protected AzureVectorStoreClient()
{ }
{
}
}
17 changes: 11 additions & 6 deletions .dotnet/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@
### Features Added

- Added the following model factories (static classes that can be used to instantiate OpenAI models for mocking in non-live test scenarios):
- `OpenAIAudioModelFactory` in the `OpenAI.Audio` namespace
- `OpenAIEmbeddingsModelFactory` in the `OpenAI.Embeddings` namespace
- `OpenAIFilesModelFactory` in the `OpenAI.Files` namespace
- `OpenAIImagesModelFactory` in the `OpenAI.Images` namespace
- `OpenAIModelsModelFactory` in the `OpenAI.Models` namespace
- `OpenAIModerationsModelFactory` in the `OpenAI.Moderations` namespace
- `OpenAIAudioModelFactory` in the `OpenAI.Audio` namespace (commit_hash)
- `OpenAIEmbeddingsModelFactory` in the `OpenAI.Embeddings` namespace (commit_hash)
- `OpenAIFilesModelFactory` in the `OpenAI.Files` namespace (commit_hash)
- `OpenAIImagesModelFactory` in the `OpenAI.Images` namespace (commit_hash)
- `OpenAIModelsModelFactory` in the `OpenAI.Models` namespace (commit_hash)
- `OpenAIModerationsModelFactory` in the `OpenAI.Moderations` namespace (commit_hash)

### Breaking Changes

- Removed client constructors that do not explicitly take an API key parameter or an endpoint via an `OpenAIClientOptions` parameter, making it clearer how to appropriately instantiate a client. (commit_hash)
- Removed the endpoint parameter from all client constructors, making it clearer that an alternative endpoint must be specified via the `OpenAIClientOptions` parameter. (commit_hash)
- Removed `OpenAIClient`'s `Endpoint` `protected` property. (commit_hash)
- Made `OpenAIClient`'s constructor that takes a `ClientPipeline` parameter `protected internal` instead of just `protected`. (commit_hash)

### Bugs Fixed

### Other Changes
Expand Down
Loading