Skip to content

Commit 4baf155

Browse files
feat(api): manual updates
1 parent 7b54463 commit 4baf155

50 files changed

Lines changed: 3875 additions & 3 deletions

File tree

Some content is hidden

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

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 232
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-2f2e274f51df9ef4e7531b9e5c597bb9cd182fc56bb87ca617e2677a6abda72c.yml
3-
openapi_spec_hash: 051fce676f959b8207e2317225ec4bdc
4-
config_hash: 5238a19104ff62c65ed1cb4b0aa46f4f
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-08cb8ed18dfe4a9fa518e278576d3cfe5710cb5c22789cf80826c900569bcf56.yml
3+
openapi_spec_hash: 20f820c94f54741b75d719f6a7371c12
4+
config_hash: f291a449469edfe61a28424e548899b2

lib/openai.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,22 @@
651651
require_relative "openai/models/realtime/realtime_transcription_session_create_request"
652652
require_relative "openai/models/realtime/realtime_transcription_session_create_response"
653653
require_relative "openai/models/realtime/realtime_transcription_session_turn_detection"
654+
require_relative "openai/models/realtime/realtime_translation_client_event"
655+
require_relative "openai/models/realtime/realtime_translation_client_secret_create_request"
656+
require_relative "openai/models/realtime/realtime_translation_client_secret_create_response"
657+
require_relative "openai/models/realtime/realtime_translation_input_audio_buffer_append_event"
658+
require_relative "openai/models/realtime/realtime_translation_input_transcript_delta_event"
659+
require_relative "openai/models/realtime/realtime_translation_output_audio_delta_event"
660+
require_relative "openai/models/realtime/realtime_translation_output_transcript_delta_event"
661+
require_relative "openai/models/realtime/realtime_translation_server_event"
662+
require_relative "openai/models/realtime/realtime_translation_session"
663+
require_relative "openai/models/realtime/realtime_translation_session_closed_event"
664+
require_relative "openai/models/realtime/realtime_translation_session_close_event"
665+
require_relative "openai/models/realtime/realtime_translation_session_created_event"
666+
require_relative "openai/models/realtime/realtime_translation_session_create_request"
667+
require_relative "openai/models/realtime/realtime_translation_session_updated_event"
668+
require_relative "openai/models/realtime/realtime_translation_session_update_event"
669+
require_relative "openai/models/realtime/realtime_translation_session_update_request"
654670
require_relative "openai/models/realtime/realtime_truncation"
655671
require_relative "openai/models/realtime/realtime_truncation_retention_ratio"
656672
require_relative "openai/models/realtime/response_audio_delta_event"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# frozen_string_literal: true
2+
3+
module OpenAI
4+
module Models
5+
module Realtime
6+
# A Realtime translation client event.
7+
module RealtimeTranslationClientEvent
8+
extend OpenAI::Internal::Type::Union
9+
10+
discriminator :type
11+
12+
# Send this event to update the translation session configuration. Translation
13+
# sessions support updates to `audio.output.language`, `audio.input.transcription`,
14+
# and `audio.input.noise_reduction`.
15+
variant :"session.update", -> { OpenAI::Realtime::RealtimeTranslationSessionUpdateEvent }
16+
17+
# Send this event to append audio bytes to the translation session input audio buffer.
18+
#
19+
# WebSocket translation sessions accept base64-encoded 24 kHz PCM16 mono
20+
# little-endian raw audio bytes. Unsupported websocket audio formats return a
21+
# validation error because lower-quality audio materially degrades translation
22+
# quality.
23+
#
24+
# Translation consumes 200 ms engine frames. For best realtime behavior, append
25+
# audio in 200 ms chunks. If a chunk is shorter, the server buffers it until it
26+
# has enough audio for one frame. If a chunk is longer, the server splits it into
27+
# 200 ms frames and enqueues them back-to-back.
28+
#
29+
# Keep appending silence while the session is active. If a client stops sending
30+
# audio and later resumes, model time treats the resumed audio as contiguous with
31+
# the previous audio rather than as a real-world pause.
32+
variant :"session.input_audio_buffer.append",
33+
-> { OpenAI::Realtime::RealtimeTranslationInputAudioBufferAppendEvent }
34+
35+
# Gracefully close the realtime translation session. The server flushes pending
36+
# input audio and emits any remaining translated output before closing the
37+
# session.
38+
variant :"session.close", -> { OpenAI::Realtime::RealtimeTranslationSessionCloseEvent }
39+
40+
# @!method self.variants
41+
# @return [Array(OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateEvent, OpenAI::Models::Realtime::RealtimeTranslationInputAudioBufferAppendEvent, OpenAI::Models::Realtime::RealtimeTranslationSessionCloseEvent)]
42+
end
43+
end
44+
end
45+
end
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# frozen_string_literal: true
2+
3+
module OpenAI
4+
module Models
5+
module Realtime
6+
class RealtimeTranslationClientSecretCreateRequest < OpenAI::Internal::Type::BaseModel
7+
# @!attribute session
8+
# Realtime translation session configuration. Translation sessions stream source
9+
# audio in and translated audio plus transcript deltas out continuously.
10+
#
11+
# @return [OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest]
12+
required :session, -> { OpenAI::Realtime::RealtimeTranslationSessionCreateRequest }
13+
14+
# @!attribute expires_after
15+
# Configuration for the client secret expiration. Expiration refers to the time
16+
# after which a client secret will no longer be valid for creating sessions. The
17+
# session itself may continue after that time once started. A secret can be used
18+
# to create multiple sessions until it expires.
19+
#
20+
# @return [OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter, nil]
21+
optional :expires_after,
22+
-> { OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter }
23+
24+
# @!method initialize(session:, expires_after: nil)
25+
# Some parameter documentations has been truncated, see
26+
# {OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest} for
27+
# more details.
28+
#
29+
# Create a translation session and client secret for the Realtime API.
30+
#
31+
# @param session [OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest] Realtime translation session configuration. Translation sessions stream source
32+
#
33+
# @param expires_after [OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter] Configuration for the client secret expiration. Expiration refers to the time af
34+
35+
# @see OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest#expires_after
36+
class ExpiresAfter < OpenAI::Internal::Type::BaseModel
37+
# @!attribute anchor
38+
# The anchor point for the client secret expiration, meaning that `seconds` will
39+
# be added to the `created_at` time of the client secret to produce an expiration
40+
# timestamp. Only `created_at` is currently supported.
41+
#
42+
# @return [Symbol, OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::Anchor, nil]
43+
optional :anchor,
44+
enum: -> { OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::Anchor }
45+
46+
# @!attribute seconds
47+
# The number of seconds from the anchor point to the expiration. Select a value
48+
# between `10` and `7200` (2 hours). This default to 600 seconds (10 minutes) if
49+
# not specified.
50+
#
51+
# @return [Integer, nil]
52+
optional :seconds, Integer
53+
54+
# @!method initialize(anchor: nil, seconds: nil)
55+
# Some parameter documentations has been truncated, see
56+
# {OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter}
57+
# for more details.
58+
#
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.
63+
#
64+
# @param anchor [Symbol, OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::Anchor] The anchor point for the client secret expiration, meaning that `seconds` will b
65+
#
66+
# @param seconds [Integer] The number of seconds from the anchor point to the expiration. Select a value be
67+
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.
71+
#
72+
# @see OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter#anchor
73+
module Anchor
74+
extend OpenAI::Internal::Type::Enum
75+
76+
CREATED_AT = :created_at
77+
78+
# @!method self.values
79+
# @return [Array<Symbol>]
80+
end
81+
end
82+
end
83+
end
84+
end
85+
end
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# frozen_string_literal: true
2+
3+
module OpenAI
4+
module Models
5+
module Realtime
6+
class RealtimeTranslationClientSecretCreateResponse < OpenAI::Internal::Type::BaseModel
7+
# @!attribute expires_at
8+
# Expiration timestamp for the client secret, in seconds since epoch.
9+
#
10+
# @return [Integer]
11+
required :expires_at, Integer
12+
13+
# @!attribute session
14+
# A Realtime translation session. Translation sessions continuously translate
15+
# input audio into the configured output language.
16+
#
17+
# @return [OpenAI::Models::Realtime::RealtimeTranslationSession]
18+
required :session, -> { OpenAI::Realtime::RealtimeTranslationSession }
19+
20+
# @!attribute value
21+
# The generated client secret value.
22+
#
23+
# @return [String]
24+
required :value, String
25+
26+
# @!method initialize(expires_at:, session:, value:)
27+
# Some parameter documentations has been truncated, see
28+
# {OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateResponse} for
29+
# more details.
30+
#
31+
# Response from creating a translation session and client secret for the Realtime
32+
# API.
33+
#
34+
# @param expires_at [Integer] Expiration timestamp for the client secret, in seconds since epoch.
35+
#
36+
# @param session [OpenAI::Models::Realtime::RealtimeTranslationSession] A Realtime translation session. Translation sessions continuously translate inpu
37+
#
38+
# @param value [String] The generated client secret value.
39+
end
40+
end
41+
end
42+
end
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# frozen_string_literal: true
2+
3+
module OpenAI
4+
module Models
5+
module Realtime
6+
class RealtimeTranslationInputAudioBufferAppendEvent < OpenAI::Internal::Type::BaseModel
7+
# @!attribute audio
8+
# Base64-encoded 24 kHz PCM16 mono audio bytes.
9+
#
10+
# @return [String]
11+
required :audio, String
12+
13+
# @!attribute type
14+
# The event type, must be `session.input_audio_buffer.append`.
15+
#
16+
# @return [Symbol, :"session.input_audio_buffer.append"]
17+
required :type, const: :"session.input_audio_buffer.append"
18+
19+
# @!attribute event_id
20+
# Optional client-generated ID used to identify this event.
21+
#
22+
# @return [String, nil]
23+
optional :event_id, String
24+
25+
# @!method initialize(audio:, event_id: nil, type: :"session.input_audio_buffer.append")
26+
# Send this event to append audio bytes to the translation session input audio
27+
# buffer.
28+
#
29+
# WebSocket translation sessions accept base64-encoded 24 kHz PCM16 mono
30+
# little-endian raw audio bytes. Unsupported websocket audio formats return a
31+
# validation error because lower-quality audio materially degrades translation
32+
# quality.
33+
#
34+
# Translation consumes 200 ms engine frames. For best realtime behavior, append
35+
# audio in 200 ms chunks. If a chunk is shorter, the server buffers it until it
36+
# has enough audio for one frame. If a chunk is longer, the server splits it into
37+
# 200 ms frames and enqueues them back-to-back.
38+
#
39+
# Keep appending silence while the session is active. If a client stops sending
40+
# audio and later resumes, model time treats the resumed audio as contiguous with
41+
# the previous audio rather than as a real-world pause.
42+
#
43+
# @param audio [String] Base64-encoded 24 kHz PCM16 mono audio bytes.
44+
#
45+
# @param event_id [String] Optional client-generated ID used to identify this event.
46+
#
47+
# @param type [Symbol, :"session.input_audio_buffer.append"] The event type, must be `session.input_audio_buffer.append`.
48+
end
49+
end
50+
end
51+
end
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# frozen_string_literal: true
2+
3+
module OpenAI
4+
module Models
5+
module Realtime
6+
class RealtimeTranslationInputTranscriptDeltaEvent < OpenAI::Internal::Type::BaseModel
7+
# @!attribute delta
8+
# Append-only source-language transcript text.
9+
#
10+
# @return [String]
11+
required :delta, String
12+
13+
# @!attribute event_id
14+
# The unique ID of the server event.
15+
#
16+
# @return [String]
17+
required :event_id, String
18+
19+
# @!attribute type
20+
# The event type, must be `session.input_transcript.delta`.
21+
#
22+
# @return [Symbol, :"session.input_transcript.delta"]
23+
required :type, const: :"session.input_transcript.delta"
24+
25+
# @!attribute elapsed_ms
26+
# Timing metadata for stream alignment, derived from the translation frame when
27+
# available. It advances in 200 ms increments, but multiple transcript deltas may
28+
# share the same `elapsed_ms`. Treat it as alignment metadata, not a unique
29+
# transcript-delta identifier.
30+
#
31+
# @return [Integer, nil]
32+
optional :elapsed_ms, Integer, nil?: true
33+
34+
# @!method initialize(delta:, event_id:, elapsed_ms: nil, type: :"session.input_transcript.delta")
35+
# Some parameter documentations has been truncated, see
36+
# {OpenAI::Models::Realtime::RealtimeTranslationInputTranscriptDeltaEvent} for
37+
# more details.
38+
#
39+
# Returned when optional source-language transcript text is available. This event
40+
# is emitted only when `audio.input.transcription` is configured.
41+
#
42+
# Transcript deltas are append-only text fragments. Clients should not insert
43+
# unconditional spaces between deltas.
44+
#
45+
# @param delta [String] Append-only source-language transcript text.
46+
#
47+
# @param event_id [String] The unique ID of the server event.
48+
#
49+
# @param elapsed_ms [Integer, nil] Timing metadata for stream alignment, derived from the translation frame
50+
#
51+
# @param type [Symbol, :"session.input_transcript.delta"] The event type, must be `session.input_transcript.delta`.
52+
end
53+
end
54+
end
55+
end

0 commit comments

Comments
 (0)