Skip to content

Commit

Permalink
Add project field to OpenAIAPIConnection (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldmannak authored Jul 12, 2024
1 parent 14c0be3 commit db18fd8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Sources/CleverBird/OpenAIAPIConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ public class OpenAIAPIConnection {

let apiKey: String
let organization: String?
let project: String?
public let client: APIClient
let requestHeaders: [String:String]

public init(apiKey: String,
organization: String? = nil,
project: String? = nil,
scheme: String = "https",
host: String = "api.openai.com",
port: Int = 443) {
self.apiKey = apiKey
self.organization = organization
self.project = project

var urlComponents = URLComponents()
urlComponents.scheme = scheme
Expand All @@ -37,6 +40,9 @@ public class OpenAIAPIConnection {
if let organization {
requestHeaders["OpenAI-Organization"] = organization
}
if let project {
requestHeaders["OpenAI-Project"] = project
}
self.requestHeaders = requestHeaders
}
}

0 comments on commit db18fd8

Please sign in to comment.