From a8c62f6042688b933f1af074e49c4939e73ed615 Mon Sep 17 00:00:00 2001 From: Ronald Mannak Date: Sun, 4 Feb 2024 07:02:02 -0800 Subject: [PATCH 1/2] Add support for custom URL --- Sources/CleverBird/OpenAIAPIConnection.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Sources/CleverBird/OpenAIAPIConnection.swift b/Sources/CleverBird/OpenAIAPIConnection.swift index 51f966a..cbfa700 100644 --- a/Sources/CleverBird/OpenAIAPIConnection.swift +++ b/Sources/CleverBird/OpenAIAPIConnection.swift @@ -10,13 +10,18 @@ public class OpenAIAPIConnection { let client: APIClient let requestHeaders: [String:String] - public init(apiKey: String, organization: String? = nil) { + public init(apiKey: String, + organization: String? = nil, + scheme: String = "https", + host: String = "api.openai.com", + port: Int = 443) { self.apiKey = apiKey self.organization = organization var urlComponents = URLComponents() - urlComponents.scheme = "https" - urlComponents.host = "api.openai.com" + urlComponents.scheme = scheme + urlComponents.host = host + urlComponents.port = port let openAIAPIURL = urlComponents.url let clientConfiguration = APIClient.Configuration(baseURL: openAIAPIURL) From 4dfd0d13ce6d1b2339860a541b3ab6ff75f45f3b Mon Sep 17 00:00:00 2001 From: Ronald Mannak Date: Sun, 4 Feb 2024 08:07:38 -0800 Subject: [PATCH 2/2] public client Enabling client access simplifies the process of connecting to authentication endpoints on an OpenAI proxy server --- Sources/CleverBird/OpenAIAPIConnection.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/CleverBird/OpenAIAPIConnection.swift b/Sources/CleverBird/OpenAIAPIConnection.swift index cbfa700..9b0616d 100644 --- a/Sources/CleverBird/OpenAIAPIConnection.swift +++ b/Sources/CleverBird/OpenAIAPIConnection.swift @@ -7,7 +7,7 @@ public class OpenAIAPIConnection { let apiKey: String let organization: String? - let client: APIClient + public let client: APIClient let requestHeaders: [String:String] public init(apiKey: String,