From b15e7e8342fe17b8170b75a75a90782893dad1ba Mon Sep 17 00:00:00 2001 From: Hassan Taleb <49780321+HassanTaleb90@users.noreply.github.com> Date: Tue, 24 Jan 2023 09:21:26 +0200 Subject: [PATCH 1/2] According to: https://beta.openai.com/account/org-settings There is an organization name and an organization ID. So to avoid confusion, I've replaced organization by organizationId --- .../iOS_Example/Content Policy/ContentPolicyExample.swift | 2 +- .../iOS_Example/Embeddings/CreateEmbeddingsExample.swift | 2 +- .../iOS_Example/iOS_Example/File/DeleteFileExample.swift | 2 +- .../iOS_Example/iOS_Example/File/ListFilesExample.swift | 2 +- .../iOS_Example/File/RetrieveFileContentsExample.swift | 2 +- .../iOS_Example/File/RetrieveFileExample.swift | 2 +- .../iOS_Example/iOS_Example/File/UploadFileExample.swift | 2 +- .../iOS_Example/Finetunes/CancelFinetuneExample.swift | 2 +- .../iOS_Example/Finetunes/CreateFinetuneExample.swift | 2 +- .../iOS_Example/Finetunes/DeleteFinetuneExample.swift | 2 +- .../iOS_Example/Finetunes/ListFinetuneEventsExample.swift | 2 +- .../iOS_Example/Finetunes/RetrieveFinetuneExample.swift | 2 +- .../iOS_Example/Model/RetrieveModelExample.swift | 2 +- README.md | 2 +- .../Types/Structs/Schemas/OpenAI/Configuration.swift | 8 ++++---- 15 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Examples/iOS_Example/iOS_Example/Content Policy/ContentPolicyExample.swift b/Examples/iOS_Example/iOS_Example/Content Policy/ContentPolicyExample.swift index 9b92231..080370f 100644 --- a/Examples/iOS_Example/iOS_Example/Content Policy/ContentPolicyExample.swift +++ b/Examples/iOS_Example/iOS_Example/Content Policy/ContentPolicyExample.swift @@ -49,7 +49,7 @@ struct ContentPolicyExample: View { Task { do { - let openAI = OpenAI(Configuration(organization: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY")) + let openAI = OpenAI(Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY")) let contentParameter = ContentPolicyParameters(input: input) let contentResult = try await openAI.checkContentPolicy(parameters: contentParameter) diff --git a/Examples/iOS_Example/iOS_Example/Embeddings/CreateEmbeddingsExample.swift b/Examples/iOS_Example/iOS_Example/Embeddings/CreateEmbeddingsExample.swift index 496f39a..462888e 100644 --- a/Examples/iOS_Example/iOS_Example/Embeddings/CreateEmbeddingsExample.swift +++ b/Examples/iOS_Example/iOS_Example/Embeddings/CreateEmbeddingsExample.swift @@ -63,7 +63,7 @@ struct CreateEmbeddingsExample: View { Task { do { - let config = Configuration(organization: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") + let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") let openAI = OpenAI(config) let embeddingsParam = EmbeddingsParameters(model: "text-similarity-babbage-001", input: input) diff --git a/Examples/iOS_Example/iOS_Example/File/DeleteFileExample.swift b/Examples/iOS_Example/iOS_Example/File/DeleteFileExample.swift index 22bbe3b..a7cbc6d 100644 --- a/Examples/iOS_Example/iOS_Example/File/DeleteFileExample.swift +++ b/Examples/iOS_Example/iOS_Example/File/DeleteFileExample.swift @@ -50,7 +50,7 @@ struct DeleteFileExample: View { Task { do { - let config = Configuration(organization: "INSERT-ORGANIZATION-NAME", apiKey: "INSERT-API-KEY") + let config = Configuration(organizationId: "INSERT-ORGANIZATION-NAME", apiKey: "INSERT-API-KEY") let openAI = OpenAI(config) self.deleteFileResponse = try await openAI.deleteFile(fileId: "INSERT-FILE-ID") diff --git a/Examples/iOS_Example/iOS_Example/File/ListFilesExample.swift b/Examples/iOS_Example/iOS_Example/File/ListFilesExample.swift index f720d61..32dfc2d 100644 --- a/Examples/iOS_Example/iOS_Example/File/ListFilesExample.swift +++ b/Examples/iOS_Example/iOS_Example/File/ListFilesExample.swift @@ -53,7 +53,7 @@ struct ListFilesExample: View { Task { do { - let config = Configuration(organization: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") + let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") let openAI = OpenAI(config) let filesResponse = try await openAI.listFiles() diff --git a/Examples/iOS_Example/iOS_Example/File/RetrieveFileContentsExample.swift b/Examples/iOS_Example/iOS_Example/File/RetrieveFileContentsExample.swift index 7b5d342..29960dc 100644 --- a/Examples/iOS_Example/iOS_Example/File/RetrieveFileContentsExample.swift +++ b/Examples/iOS_Example/iOS_Example/File/RetrieveFileContentsExample.swift @@ -52,7 +52,7 @@ struct RetrieveFileContentsExample: View { Task { do { - let config = Configuration(organization: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") + let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") let openAI = OpenAI(config) self.fineTunes = try await openAI.retrieveFileContent(fileId: "INSERT-FILE-ID") diff --git a/Examples/iOS_Example/iOS_Example/File/RetrieveFileExample.swift b/Examples/iOS_Example/iOS_Example/File/RetrieveFileExample.swift index 87661a3..e4b03b3 100644 --- a/Examples/iOS_Example/iOS_Example/File/RetrieveFileExample.swift +++ b/Examples/iOS_Example/iOS_Example/File/RetrieveFileExample.swift @@ -53,7 +53,7 @@ struct RetrieveFileExample: View { Task { do { - let config = Configuration(organization: "INSERT-ORGANIZATION-NAME", apiKey: "INSERT-API-KEY") + let config = Configuration(organizationId: "INSERT-ORGANIZATION-NAME", apiKey: "INSERT-API-KEY") let openAI = OpenAI(config) self.file = try await openAI.retrieveFile(fileId: "INSERT-FILE-ID") diff --git a/Examples/iOS_Example/iOS_Example/File/UploadFileExample.swift b/Examples/iOS_Example/iOS_Example/File/UploadFileExample.swift index a416e2f..095c0c8 100644 --- a/Examples/iOS_Example/iOS_Example/File/UploadFileExample.swift +++ b/Examples/iOS_Example/iOS_Example/File/UploadFileExample.swift @@ -53,7 +53,7 @@ struct UploadFileExample: View { Task { do { - let config = Configuration(organization: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") + let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") let openAI = OpenAI(config) guard let urlFile = Bundle.main.url( diff --git a/Examples/iOS_Example/iOS_Example/Finetunes/CancelFinetuneExample.swift b/Examples/iOS_Example/iOS_Example/Finetunes/CancelFinetuneExample.swift index 5b41505..8bd749b 100644 --- a/Examples/iOS_Example/iOS_Example/Finetunes/CancelFinetuneExample.swift +++ b/Examples/iOS_Example/iOS_Example/Finetunes/CancelFinetuneExample.swift @@ -47,7 +47,7 @@ struct CancelFinetuneExample: View { Task { do { - let config = Configuration(organization: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") + let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") let openAI = OpenAI(config) self.fineTune = try await openAI.cancelFineTune(fineTune: "INSERT-FINE-TUNE-ID") diff --git a/Examples/iOS_Example/iOS_Example/Finetunes/CreateFinetuneExample.swift b/Examples/iOS_Example/iOS_Example/Finetunes/CreateFinetuneExample.swift index 259daa4..574fe34 100644 --- a/Examples/iOS_Example/iOS_Example/Finetunes/CreateFinetuneExample.swift +++ b/Examples/iOS_Example/iOS_Example/Finetunes/CreateFinetuneExample.swift @@ -47,7 +47,7 @@ struct CreateFinetuneExample: View { Task { do { - let config = Configuration(organization: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") + let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") let openAI = OpenAI(config) let createFineTuneParam = CreateFineTuneParameters(trainingFile: "INSERT-TRAINING-FILE-ID") diff --git a/Examples/iOS_Example/iOS_Example/Finetunes/DeleteFinetuneExample.swift b/Examples/iOS_Example/iOS_Example/Finetunes/DeleteFinetuneExample.swift index 8077329..d66d21a 100644 --- a/Examples/iOS_Example/iOS_Example/Finetunes/DeleteFinetuneExample.swift +++ b/Examples/iOS_Example/iOS_Example/Finetunes/DeleteFinetuneExample.swift @@ -50,7 +50,7 @@ struct DeleteFinetuneExample: View { Task { do { - let config = Configuration(organization: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") + let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") let openAI = OpenAI(config) self.deleted = try await openAI.deleteFineTuneModel(model: modelName) diff --git a/Examples/iOS_Example/iOS_Example/Finetunes/ListFinetuneEventsExample.swift b/Examples/iOS_Example/iOS_Example/Finetunes/ListFinetuneEventsExample.swift index c188691..63bc800 100644 --- a/Examples/iOS_Example/iOS_Example/Finetunes/ListFinetuneEventsExample.swift +++ b/Examples/iOS_Example/iOS_Example/Finetunes/ListFinetuneEventsExample.swift @@ -60,7 +60,7 @@ struct ListFinetuneEventsExample: View { Task { do { - let config = Configuration(organization: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") + let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") let openAI = OpenAI(config) let listFineTuneEventResponse = try await openAI.listFineTuneEvents(fineTune: fineTuneId) diff --git a/Examples/iOS_Example/iOS_Example/Finetunes/RetrieveFinetuneExample.swift b/Examples/iOS_Example/iOS_Example/Finetunes/RetrieveFinetuneExample.swift index 0978f5f..9a5fc0e 100644 --- a/Examples/iOS_Example/iOS_Example/Finetunes/RetrieveFinetuneExample.swift +++ b/Examples/iOS_Example/iOS_Example/Finetunes/RetrieveFinetuneExample.swift @@ -47,7 +47,7 @@ struct RetrieveFinetuneExample: View { Task { do { - let config = Configuration(organization: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") + let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") let openAI = OpenAI(config) self.fineTune = try await openAI.retrieveFineTune(fineTune: "INSERT-FINE-TUNE-ID") diff --git a/Examples/iOS_Example/iOS_Example/Model/RetrieveModelExample.swift b/Examples/iOS_Example/iOS_Example/Model/RetrieveModelExample.swift index 155904e..b68caf1 100644 --- a/Examples/iOS_Example/iOS_Example/Model/RetrieveModelExample.swift +++ b/Examples/iOS_Example/iOS_Example/Model/RetrieveModelExample.swift @@ -69,7 +69,7 @@ struct RetrieveModelExample: View { Task { do { - let config = Configuration(organization: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") + let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") let openAI = OpenAI(config) self.model = try await openAI.retrieveModel(modelId: "text-davinci-001") diff --git a/README.md b/README.md index 5866b3b..d750fc3 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ import OpenAIKit // An API key and Organization ID is required to use the API library. // Note: It's recommended to load the API Key through a .plist dictionary, rather than hard coding it in a String. -let config = Configuration(organization: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") +let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") // Create an `OpenAI` object using the Configuration object. let openAI = OpenAI(config) diff --git a/Sources/OpenAIKit/Types/Structs/Schemas/OpenAI/Configuration.swift b/Sources/OpenAIKit/Types/Structs/Schemas/OpenAI/Configuration.swift index 1fb2428..18e223b 100644 --- a/Sources/OpenAIKit/Types/Structs/Schemas/OpenAI/Configuration.swift +++ b/Sources/OpenAIKit/Types/Structs/Schemas/OpenAI/Configuration.swift @@ -25,14 +25,14 @@ /// The configuration object used for the OpenAIKit object to represent the organization of the user. public struct Configuration { - /// The organization name of the user. - public let organization: String + /// The organization ID of the user. + public let organizationId: String /// The API key associated with the user. let apiKey: String - public init(organization: String, apiKey: String) { - self.organization = organization + public init(organizationId: String, apiKey: String) { + self.organizationId = organizationId self.apiKey = apiKey } } From 4f7de0226f3b42f6788fa48ca3ca669fbff24409 Mon Sep 17 00:00:00 2001 From: Hassan Taleb Date: Tue, 24 Jan 2023 11:55:27 +0200 Subject: [PATCH 2/2] replace INSERT-ORGANIZATION-NAME by INSERT-ORGANIZATION-ID --- Examples/iOS_Example/iOS_Example/File/DeleteFileExample.swift | 2 +- Examples/iOS_Example/iOS_Example/File/RetrieveFileExample.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Examples/iOS_Example/iOS_Example/File/DeleteFileExample.swift b/Examples/iOS_Example/iOS_Example/File/DeleteFileExample.swift index a7cbc6d..260d483 100644 --- a/Examples/iOS_Example/iOS_Example/File/DeleteFileExample.swift +++ b/Examples/iOS_Example/iOS_Example/File/DeleteFileExample.swift @@ -50,7 +50,7 @@ struct DeleteFileExample: View { Task { do { - let config = Configuration(organizationId: "INSERT-ORGANIZATION-NAME", apiKey: "INSERT-API-KEY") + let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") let openAI = OpenAI(config) self.deleteFileResponse = try await openAI.deleteFile(fileId: "INSERT-FILE-ID") diff --git a/Examples/iOS_Example/iOS_Example/File/RetrieveFileExample.swift b/Examples/iOS_Example/iOS_Example/File/RetrieveFileExample.swift index e4b03b3..85ad9e9 100644 --- a/Examples/iOS_Example/iOS_Example/File/RetrieveFileExample.swift +++ b/Examples/iOS_Example/iOS_Example/File/RetrieveFileExample.swift @@ -53,7 +53,7 @@ struct RetrieveFileExample: View { Task { do { - let config = Configuration(organizationId: "INSERT-ORGANIZATION-NAME", apiKey: "INSERT-API-KEY") + let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") let openAI = OpenAI(config) self.file = try await openAI.retrieveFile(fileId: "INSERT-FILE-ID")