Skip to content

Commit 2f8a956

Browse files
feat(api): ship the RealtimeGA API shape
Updates types to use the GA shape for Realtime API
1 parent 21313f0 commit 2f8a956

File tree

154 files changed

+12051
-10313
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+12051
-10313
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 118
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-51afd6abbcb18c3086f62993f9379c18443b9e516cbc0548ddfb932e835657f8.yml
3-
openapi_spec_hash: dae6afeaefa15cb8700c7a870531e06f
4-
config_hash: b854932c0ea24b400bdd64e4376936bd
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-7807ec6037efcee1af7decbfd3974a42b761fb6c6a71b4050fe43484d7fcbac4.yml
3+
openapi_spec_hash: da6851e3891ad2659a50ed6a736fd32a
4+
config_hash: 74d955cdc2377213f5268ea309090f6c

lib/openai.rb

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@
380380
require_relative "openai/models/moderation_multi_modal_input"
381381
require_relative "openai/models/moderation_text_input"
382382
require_relative "openai/models/other_file_chunking_strategy_object"
383+
require_relative "openai/models/realtime/audio_transcription"
383384
require_relative "openai/models/realtime/client_secret_create_params"
384385
require_relative "openai/models/realtime/client_secret_create_response"
385386
require_relative "openai/models/realtime/conversation_created_event"
@@ -410,11 +411,16 @@
410411
require_relative "openai/models/realtime/mcp_list_tools_completed"
411412
require_relative "openai/models/realtime/mcp_list_tools_failed"
412413
require_relative "openai/models/realtime/mcp_list_tools_in_progress"
414+
require_relative "openai/models/realtime/models"
415+
require_relative "openai/models/realtime/noise_reduction_type"
413416
require_relative "openai/models/realtime/output_audio_buffer_clear_event"
414417
require_relative "openai/models/realtime/rate_limits_updated_event"
415418
require_relative "openai/models/realtime/realtime_audio_config"
419+
require_relative "openai/models/realtime/realtime_audio_config_input"
420+
require_relative "openai/models/realtime/realtime_audio_config_output"
421+
require_relative "openai/models/realtime/realtime_audio_formats"
422+
require_relative "openai/models/realtime/realtime_audio_input_turn_detection"
416423
require_relative "openai/models/realtime/realtime_client_event"
417-
require_relative "openai/models/realtime/realtime_client_secret_config"
418424
require_relative "openai/models/realtime/realtime_conversation_item_assistant_message"
419425
require_relative "openai/models/realtime/realtime_conversation_item_function_call"
420426
require_relative "openai/models/realtime/realtime_conversation_item_function_call_output"
@@ -430,20 +436,32 @@
430436
require_relative "openai/models/realtime/realtime_mcp_tool_call"
431437
require_relative "openai/models/realtime/realtime_mcp_tool_execution_error"
432438
require_relative "openai/models/realtime/realtime_response"
439+
require_relative "openai/models/realtime/realtime_response_create_audio_output"
440+
require_relative "openai/models/realtime/realtime_response_create_mcp_tool"
441+
require_relative "openai/models/realtime/realtime_response_create_params"
433442
require_relative "openai/models/realtime/realtime_response_status"
434443
require_relative "openai/models/realtime/realtime_response_usage"
435444
require_relative "openai/models/realtime/realtime_response_usage_input_token_details"
436445
require_relative "openai/models/realtime/realtime_response_usage_output_token_details"
437446
require_relative "openai/models/realtime/realtime_server_event"
438447
require_relative "openai/models/realtime/realtime_session"
448+
require_relative "openai/models/realtime/realtime_session_client_secret"
439449
require_relative "openai/models/realtime/realtime_session_create_request"
440450
require_relative "openai/models/realtime/realtime_session_create_response"
441451
require_relative "openai/models/realtime/realtime_tool_choice_config"
442452
require_relative "openai/models/realtime/realtime_tools_config"
443453
require_relative "openai/models/realtime/realtime_tools_config_union"
444454
require_relative "openai/models/realtime/realtime_tracing_config"
455+
require_relative "openai/models/realtime/realtime_transcription_session_audio"
456+
require_relative "openai/models/realtime/realtime_transcription_session_audio_input"
457+
require_relative "openai/models/realtime/realtime_transcription_session_audio_input_turn_detection"
458+
require_relative "openai/models/realtime/realtime_transcription_session_client_secret"
445459
require_relative "openai/models/realtime/realtime_transcription_session_create_request"
460+
require_relative "openai/models/realtime/realtime_transcription_session_create_response"
461+
require_relative "openai/models/realtime/realtime_transcription_session_input_audio_transcription"
462+
require_relative "openai/models/realtime/realtime_transcription_session_turn_detection"
446463
require_relative "openai/models/realtime/realtime_truncation"
464+
require_relative "openai/models/realtime/realtime_truncation_retention_ratio"
447465
require_relative "openai/models/realtime/response_audio_delta_event"
448466
require_relative "openai/models/realtime/response_audio_done_event"
449467
require_relative "openai/models/realtime/response_audio_transcript_delta_event"
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# frozen_string_literal: true
2+
3+
module OpenAI
4+
module Models
5+
module Realtime
6+
class AudioTranscription < OpenAI::Internal::Type::BaseModel
7+
# @!attribute language
8+
# The language of the input audio. Supplying the input language in
9+
# [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
10+
# format will improve accuracy and latency.
11+
#
12+
# @return [String, nil]
13+
optional :language, String
14+
15+
# @!attribute model
16+
# The model to use for transcription. Current options are `whisper-1`,
17+
# `gpt-4o-transcribe-latest`, `gpt-4o-mini-transcribe`, and `gpt-4o-transcribe`.
18+
#
19+
# @return [Symbol, OpenAI::Models::Realtime::AudioTranscription::Model, nil]
20+
optional :model, enum: -> { OpenAI::Realtime::AudioTranscription::Model }
21+
22+
# @!attribute prompt
23+
# An optional text to guide the model's style or continue a previous audio
24+
# segment. For `whisper-1`, the
25+
# [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting).
26+
# For `gpt-4o-transcribe` models, the prompt is a free text string, for example
27+
# "expect words related to technology".
28+
#
29+
# @return [String, nil]
30+
optional :prompt, String
31+
32+
# @!method initialize(language: nil, model: nil, prompt: nil)
33+
# Some parameter documentations has been truncated, see
34+
# {OpenAI::Models::Realtime::AudioTranscription} for more details.
35+
#
36+
# @param language [String] The language of the input audio. Supplying the input language in
37+
#
38+
# @param model [Symbol, OpenAI::Models::Realtime::AudioTranscription::Model] The model to use for transcription. Current options are `whisper-1`, `gpt-4o-tra
39+
#
40+
# @param prompt [String] An optional text to guide the model's style or continue a previous audio
41+
42+
# The model to use for transcription. Current options are `whisper-1`,
43+
# `gpt-4o-transcribe-latest`, `gpt-4o-mini-transcribe`, and `gpt-4o-transcribe`.
44+
#
45+
# @see OpenAI::Models::Realtime::AudioTranscription#model
46+
module Model
47+
extend OpenAI::Internal::Type::Enum
48+
49+
WHISPER_1 = :"whisper-1"
50+
GPT_4O_TRANSCRIBE_LATEST = :"gpt-4o-transcribe-latest"
51+
GPT_4O_MINI_TRANSCRIBE = :"gpt-4o-mini-transcribe"
52+
GPT_4O_TRANSCRIBE = :"gpt-4o-transcribe"
53+
54+
# @!method self.values
55+
# @return [Array<Symbol>]
56+
end
57+
end
58+
end
59+
end
60+
end

lib/openai/models/realtime/client_secret_create_params.rb

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ class ClientSecretCreateParams < OpenAI::Internal::Type::BaseModel
99
include OpenAI::Internal::Type::RequestParameters
1010

1111
# @!attribute expires_after
12-
# Configuration for the ephemeral token expiration.
12+
# Configuration for the client secret expiration. Expiration refers to the time
13+
# after which a client secret will no longer be valid for creating sessions. The
14+
# session itself may continue after that time once started. A secret can be used
15+
# to create multiple sessions until it expires.
1316
#
1417
# @return [OpenAI::Models::Realtime::ClientSecretCreateParams::ExpiresAfter, nil]
1518
optional :expires_after, -> { OpenAI::Realtime::ClientSecretCreateParams::ExpiresAfter }
@@ -25,23 +28,25 @@ class ClientSecretCreateParams < OpenAI::Internal::Type::BaseModel
2528
# Some parameter documentations has been truncated, see
2629
# {OpenAI::Models::Realtime::ClientSecretCreateParams} for more details.
2730
#
28-
# @param expires_after [OpenAI::Models::Realtime::ClientSecretCreateParams::ExpiresAfter] Configuration for the ephemeral token expiration.
31+
# @param expires_after [OpenAI::Models::Realtime::ClientSecretCreateParams::ExpiresAfter] Configuration for the client secret expiration. Expiration refers to the time af
2932
#
3033
# @param session [OpenAI::Models::Realtime::RealtimeSessionCreateRequest, OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateRequest] Session configuration to use for the client secret. Choose either a realtime
3134
#
3235
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
3336

3437
class ExpiresAfter < OpenAI::Internal::Type::BaseModel
3538
# @!attribute anchor
36-
# The anchor point for the ephemeral token expiration. Only `created_at` is
37-
# currently supported.
39+
# The anchor point for the client secret expiration, meaning that `seconds` will
40+
# be added to the `created_at` time of the client secret to produce an expiration
41+
# timestamp. Only `created_at` is currently supported.
3842
#
3943
# @return [Symbol, OpenAI::Models::Realtime::ClientSecretCreateParams::ExpiresAfter::Anchor, nil]
4044
optional :anchor, enum: -> { OpenAI::Realtime::ClientSecretCreateParams::ExpiresAfter::Anchor }
4145

4246
# @!attribute seconds
4347
# The number of seconds from the anchor point to the expiration. Select a value
44-
# between `10` and `7200`.
48+
# between `10` and `7200` (2 hours). This default to 600 seconds (10 minutes) if
49+
# not specified.
4550
#
4651
# @return [Integer, nil]
4752
optional :seconds, Integer
@@ -51,14 +56,18 @@ class ExpiresAfter < OpenAI::Internal::Type::BaseModel
5156
# {OpenAI::Models::Realtime::ClientSecretCreateParams::ExpiresAfter} for more
5257
# details.
5358
#
54-
# Configuration for the ephemeral token expiration.
59+
# Configuration for the client secret expiration. Expiration refers to the time
60+
# after which a client secret will no longer be valid for creating sessions. The
61+
# session itself may continue after that time once started. A secret can be used
62+
# to create multiple sessions until it expires.
5563
#
56-
# @param anchor [Symbol, OpenAI::Models::Realtime::ClientSecretCreateParams::ExpiresAfter::Anchor] The anchor point for the ephemeral token expiration. Only `created_at` is curren
64+
# @param anchor [Symbol, OpenAI::Models::Realtime::ClientSecretCreateParams::ExpiresAfter::Anchor] The anchor point for the client secret expiration, meaning that `seconds` will b
5765
#
5866
# @param seconds [Integer] The number of seconds from the anchor point to the expiration. Select a value be
5967

60-
# The anchor point for the ephemeral token expiration. Only `created_at` is
61-
# currently supported.
68+
# The anchor point for the client secret expiration, meaning that `seconds` will
69+
# be added to the `created_at` time of the client secret to produce an expiration
70+
# timestamp. Only `created_at` is currently supported.
6271
#
6372
# @see OpenAI::Models::Realtime::ClientSecretCreateParams::ExpiresAfter#anchor
6473
module Anchor

0 commit comments

Comments
 (0)