Skip to content

Commit e52b3eb

Browse files
committed
Add ability to change version
1 parent 112764f commit e52b3eb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/ruby/openai/client.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
module OpenAI
22
class Client
33
include HTTParty
4-
base_uri "https://api.openai.com/v1/engines"
4+
base_uri "https://api.openai.com"
55

66
def initialize(access_token: nil)
77
@access_token = access_token || ENV["OPENAI_ACCESS_TOKEN"]
88
end
99

10-
def call(engine:, prompt:, max_tokens:)
10+
def call(engine:, prompt:, max_tokens:, version: "v1")
1111
self.class.post(
12-
"/#{engine}/completions",
12+
"/#{version}/engines/#{engine}/completions",
1313
headers: {
1414
"Content-Type" => "application/json",
1515
"Authorization" => "Bearer #{@access_token}"

0 commit comments

Comments
 (0)