-
-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from alexrudall/remove-legacy-engine-calls
Deprecate Engine
- Loading branch information
Showing
31 changed files
with
3,316 additions
and
2,312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module OpenAI | ||
class Engines | ||
include HTTParty | ||
base_uri "https://api.openai.com" | ||
|
||
def initialize(access_token: nil) | ||
@access_token = access_token || ENV.fetch("OPENAI_ACCESS_TOKEN") | ||
end | ||
|
||
def list(version: default_version) | ||
self.class.get( | ||
"/#{version}/engines", | ||
headers: { | ||
"Content-Type" => "application/json", | ||
"Authorization" => "Bearer #{@access_token}" | ||
} | ||
) | ||
end | ||
|
||
def retrieve(id:, version: default_version) | ||
self.class.get( | ||
"/#{version}/engines/#{id}", | ||
headers: { | ||
"Content-Type" => "application/json", | ||
"Authorization" => "Bearer #{@access_token}" | ||
} | ||
) | ||
end | ||
|
||
private | ||
|
||
def default_version | ||
"v1".freeze | ||
end | ||
end | ||
end |
Oops, something went wrong.