From 2e5dfa4585d583f271b50943475c537575418dcc Mon Sep 17 00:00:00 2001 From: Adam Rush Date: Tue, 11 Jul 2023 10:24:54 +0100 Subject: [PATCH 1/2] Renaming function and parameter --- Sources/OpenAISwift/OpenAISwift.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/OpenAISwift/OpenAISwift.swift b/Sources/OpenAISwift/OpenAISwift.swift index 12d542b..a05a3c5 100644 --- a/Sources/OpenAISwift/OpenAISwift.swift +++ b/Sources/OpenAISwift/OpenAISwift.swift @@ -30,12 +30,12 @@ public class OpenAISwift { let session:URLSession let authorizeRequest: (inout URLRequest) -> Void - public static func makeDefultOpenAI(api_key: String) -> Self { + public static func makeDefaultOpenAI(apiKey: String) -> Self { .init(baseURL: "https://api.openai.com", endpointPrivider: OpenAIEndpointProvider(source: .openAI), session: .shared, authorizeRequest: { request in - request.setValue("Bearer \(api_key)", forHTTPHeaderField: "Authorization") + request.setValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization") }) } } From c8070d857773490da0d36f5a96117cef65cbaf1b Mon Sep 17 00:00:00 2001 From: Adam Rush Date: Tue, 11 Jul 2023 10:26:27 +0100 Subject: [PATCH 2/2] Fixing to use correct Endpoint object --- Sources/OpenAISwift/OpenAISwift.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/OpenAISwift/OpenAISwift.swift b/Sources/OpenAISwift/OpenAISwift.swift index a05a3c5..67090ac 100644 --- a/Sources/OpenAISwift/OpenAISwift.swift +++ b/Sources/OpenAISwift/OpenAISwift.swift @@ -242,7 +242,7 @@ extension OpenAISwift { logitBias: [Int: Double]? = nil, onEventReceived: ((Result, OpenAIError>) -> Void)? = nil, onComplete: (() -> Void)? = nil) { - let endpoint = Endpoint.chat + let endpoint = OpenAIEndpointProvider.API.chat let body = ChatConversation(user: user, messages: messages, model: model.modelName,