Skip to content

Commit

Permalink
Merge pull request #34 from HassanTaleb90/main
Browse files Browse the repository at this point in the history
Replace organization by organizationId
  • Loading branch information
MarcoDotIO authored Jan 24, 2023
2 parents 689e611 + 4f7de02 commit 4099b7d
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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-ID", apiKey: "INSERT-API-KEY")
let openAI = OpenAI(config)

self.deleteFileResponse = try await openAI.deleteFile(fileId: "INSERT-FILE-ID")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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-ID", apiKey: "INSERT-API-KEY")
let openAI = OpenAI(config)

self.file = try await openAI.retrieveFile(fileId: "INSERT-FILE-ID")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

0 comments on commit 4099b7d

Please sign in to comment.