Skip to content

Commit

Permalink
OpenAI-DotNet 8.4.0
Browse files Browse the repository at this point in the history
- Add realtime support
- Added o1, o1-mini, gpt-4o-mini, and gpt-4o-realtime model convenience properties
  • Loading branch information
StephenHodgson committed Oct 13, 2024
1 parent b1aba5d commit eaf06a2
Show file tree
Hide file tree
Showing 12 changed files with 811 additions and 5 deletions.
14 changes: 13 additions & 1 deletion OpenAI-DotNet/Authentication/OpenAIClientSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ namespace OpenAI
/// </summary>
public sealed class OpenAIClientSettings
{
internal const string WS = "ws://";
internal const string WSS = "wss://";
internal const string Http = "http://";
internal const string Https = "https://";
internal const string OpenAIDomain = "api.openai.com";
internal const string DefaultOpenAIApiVersion = "v1";
Expand All @@ -26,6 +29,7 @@ public OpenAIClientSettings()
DeploymentId = string.Empty;
BaseRequest = $"/{ApiVersion}/";
BaseRequestUrlFormat = $"{Https}{ResourceName}{BaseRequest}{{0}}";
BaseWebSocketUrlFormat = $"{WSS}{ResourceName}{BaseRequest}{{0}}";
UseOAuthAuthentication = true;
}

Expand All @@ -52,11 +56,16 @@ public OpenAIClientSettings(string domain, string apiVersion = DefaultOpenAIApiV
apiVersion = DefaultOpenAIApiVersion;
}

ResourceName = domain.Contains("http") ? domain : $"{Https}{domain}";
ResourceName = domain.Contains(Http)
? domain
: $"{Https}{domain}";
ApiVersion = apiVersion;
DeploymentId = string.Empty;
BaseRequest = $"/{ApiVersion}/";
BaseRequestUrlFormat = $"{ResourceName}{BaseRequest}{{0}}";
BaseWebSocketUrlFormat = ResourceName.Contains(Https)
? $"{WSS}{ResourceName}{BaseRequest}{{0}}"
: $"{WS}{ResourceName}{BaseRequest}{{0}}";
UseOAuthAuthentication = true;
}

Expand Down Expand Up @@ -99,6 +108,7 @@ public OpenAIClientSettings(string resourceName, string deploymentId, string api
ApiVersion = apiVersion;
BaseRequest = "/openai/";
BaseRequestUrlFormat = $"{Https}{ResourceName}.{AzureOpenAIDomain}{BaseRequest}{{0}}";
BaseWebSocketUrlFormat = $"{WSS}{ResourceName}.{AzureOpenAIDomain}{BaseRequest}{{0}}";
defaultQueryParameters.Add("api-version", ApiVersion);
UseOAuthAuthentication = useActiveDirectoryAuthentication;
}
Expand All @@ -113,6 +123,8 @@ public OpenAIClientSettings(string resourceName, string deploymentId, string api

internal string BaseRequestUrlFormat { get; }

internal string BaseWebSocketUrlFormat { get; }

internal bool UseOAuthAuthentication { get; }

[Obsolete("Use IsAzureOpenAI")]
Expand Down
Loading

0 comments on commit eaf06a2

Please sign in to comment.