From b9e36a173185d1bf6a4447aa39a5c52973977842 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Sun, 28 Jan 2024 23:35:51 -0500 Subject: [PATCH] - Allow the use a fully custom base address --- .../Authentication/OpenAIClientSettings.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/OpenAI-DotNet/Authentication/OpenAIClientSettings.cs b/OpenAI-DotNet/Authentication/OpenAIClientSettings.cs index da1a0fcb..18c08740 100644 --- a/OpenAI-DotNet/Authentication/OpenAIClientSettings.cs +++ b/OpenAI-DotNet/Authentication/OpenAIClientSettings.cs @@ -28,6 +28,21 @@ public OpenAIClientSettings() UseOAuthAuthentication = true; } + /// + /// Creates a new instance of for use with OpenAI. + /// Must specify a full base url such as "https://api.openai.com/v1/". + /// + /// A custom base url. + public OpenAIClientSettings(string baseUrl) + { + ResourceName = string.Empty; + ApiVersion = string.Empty; + DeploymentId = string.Empty; + BaseRequest = string.Empty; + BaseRequestUrlFormat = $"{baseUrl}{{0}}"; + UseOAuthAuthentication = true; + } + /// /// Creates a new instance of for use with OpenAI. ///