Skip to content

Commit 3ba2dbb

Browse files
committed
Follow OpenAI naming convention
1 parent b75165c commit 3ba2dbb

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,17 +1658,17 @@ File.binwrite('demo.mp3', response)
16581658
# => mp3 file that plays: "This is a speech test!"
16591659
```
16601660

1661-
### Real-Time
1661+
### Realtime
16621662

1663-
The Real-Time API allows you to create a real-time session with an OpenAI model. It responds with a session object, plus a client_secret key which contains a usable ephemeral API token that can be used to authenticate browser clients for the Realtime API.
1663+
The Realtime API allows you to create a live speech-to-speech session with an OpenAI model. It responds with a session object, plus a client_secret key which contains a usable ephemeral API token that can be used to authenticate browser clients for the Realtime API.
16641664

16651665
```ruby
1666-
response = client.real_time.create(parameters: { model: "gpt-4o-realtime-preview-2024-12-17" })
1666+
response = client.realtime.create(parameters: { model: "gpt-4o-realtime-preview-2024-12-17" })
16671667
puts "ephemeral key: #{response.dig('client_secret', 'value')}"
16681668
# => "ephemeral key: ek_abc123"
16691669
```
16701670

1671-
Then in the client-side application, make a POST request to the Real-Time API with the ephemeral key and the SDP offer.
1671+
Then in the client-side Javascript application, make a POST request to the Real-Time API with the ephemeral key and the SDP offer.
16721672

16731673
```js
16741674
const OPENAI_REALTIME_URL = 'https://api.openai.com/v1/realtime/sessions'

lib/openai.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
require_relative "openai/assistants"
1111
require_relative "openai/threads"
1212
require_relative "openai/messages"
13-
require_relative "openai/real_time"
13+
require_relative "openai/realtime"
1414
require_relative "openai/runs"
1515
require_relative "openai/run_steps"
1616
require_relative "openai/vector_stores"

lib/openai/client.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ def batches
9393
@batches ||= OpenAI::Batches.new(client: self)
9494
end
9595

96-
def real_time
97-
@real_time ||= OpenAI::RealTime.new(client: self)
96+
def realtime
97+
@realtime ||= OpenAI::Realtime.new(client: self)
9898
end
9999

100100
def moderations(parameters: {})

lib/openai/real_time.rb renamed to lib/openai/realtime.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module OpenAI
2-
class RealTime
2+
class Realtime
33
DEFAULT_REALTIME_MODEL = "gpt-4o-realtime-preview-2024-12-17".freeze
44

55
def initialize(client:)

spec/openai/client/real_time_spec.rb renamed to spec/openai/client/realtime_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
RSpec.describe OpenAI::RealTime do
1+
RSpec.describe OpenAI::Realtime do
22
let(:client) { OpenAI::Client.new }
3-
let(:realtime) { client.real_time }
3+
let(:realtime) { client.realtime }
44

55
describe "#create" do
66
context "when no model is specified" do
77
it "uses the default model" do
88
VCR.use_cassette("realtime_session_create_default") do
99
response = realtime.create
10-
expect(response["model"]).to eq(OpenAI::RealTime::DEFAULT_REALTIME_MODEL)
10+
expect(response["model"]).to eq(OpenAI::Realtime::DEFAULT_REALTIME_MODEL)
1111
end
1212
end
1313
end

0 commit comments

Comments
 (0)