From edd3f4e3c79f8249b2bfec8c01a7a51b117b6659 Mon Sep 17 00:00:00 2001 From: jamesrochabrun Date: Wed, 22 Jan 2025 23:48:50 -0800 Subject: [PATCH] Added code comments in aiproxy init --- Sources/OpenAI/AIProxy/AIProxyService.swift | 16 ++++++++++++++-- .../Public/Service/OpenAIServiceFactory.swift | 6 +++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Sources/OpenAI/AIProxy/AIProxyService.swift b/Sources/OpenAI/AIProxy/AIProxyService.swift index 6668ecd..3667d5c 100644 --- a/Sources/OpenAI/AIProxy/AIProxyService.swift +++ b/Sources/OpenAI/AIProxy/AIProxyService.swift @@ -30,8 +30,20 @@ struct AIProxyService: OpenAIService { private static let assistantsBetaV2 = "assistants=v2" - /// Your service URL is also provided during the integration process. If you integrated before - /// July 22nd, 2024, you can continue to leave `serviceURL` blank. + /// Initializes an instance of the OpenAI service with the required configurations. + /// + /// - Parameters: + /// - partialKey: Your partial key provided during the integration process at `dashboard.aiproxy.pro`. + /// Refer to the [integration guide](https://www.aiproxy.pro/docs/integration-guide.html) + /// for details on acquiring your partial key. This is required. + /// - serviceURL: Your service URL, also provided during the integration process. If you integrated before + /// July 22nd, 2024, you can leave this parameter blank, and it will default to + /// `"https://api.aiproxy.pro"`. This is optional. + /// - clientID: An optional client ID to annotate requests in the AIProxy developer dashboard. + /// If left blank, AIProxy generates client IDs for you. Most users can safely leave this blank. + /// - organizationID: An optional OpenAI organization ID. Refer to the [organization documentation](https://platform.openai.com/docs/api-reference/organization-optional) + /// for details on its usage. Defaults to `nil`. + /// - debugEnabled: A flag to enable printing request events during DEBUG builds. Set this to `true` for debugging. init( partialKey: String, serviceURL: String? = nil, diff --git a/Sources/OpenAI/Public/Service/OpenAIServiceFactory.swift b/Sources/OpenAI/Public/Service/OpenAIServiceFactory.swift index 1367595..0e5ec24 100644 --- a/Sources/OpenAI/Public/Service/OpenAIServiceFactory.swift +++ b/Sources/OpenAI/Public/Service/OpenAIServiceFactory.swift @@ -53,7 +53,7 @@ public class OpenAIServiceFactory { urlSessionConfiguration: URLSessionConfiguration = .default, decoder: JSONDecoder = .init(), debugEnabled: Bool = false) - -> OpenAIService + -> OpenAIService { DefaultOpenAIAzureService( azureConfiguration: azureConfiguration, @@ -87,7 +87,7 @@ public class OpenAIServiceFactory { aiproxyServiceURL: String? = nil, aiproxyClientID: String? = nil, debugEnabled: Bool = false) - -> OpenAIService + -> OpenAIService { AIProxyService( partialKey: aiproxyPartialKey, @@ -132,7 +132,7 @@ public class OpenAIServiceFactory { /// - apiKey: The optional API key required for authentication. /// - baseURL: The local host URL. e.g "https://api.groq.com" or "https://generativelanguage.googleapis.com" /// - proxyPath: The proxy path e.g `openai` - /// - overrideVersion: The API version. defaults to `V1` + /// - overrideVersion: The API version. defaults to `v1` /// - extraHeaders: Additional headers needed for the request. Do not provide API key in these headers. /// - debugEnabled: If `true` service prints event on DEBUG builds, default to `false`. ///