-
Notifications
You must be signed in to change notification settings - Fork 56
feat(api): support backend-mediated Realtime WebRTC calls #531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| schema_version: 1 | ||
| generation_id: 8def2c80-1858-4c9d-9b9b-dc3c6676fea6 | ||
| generation_id: 65ac1096-1b69-42d4-af23-93b0e7162026 | ||
| openapi_spec_hash: b2c62b342b04685226037c980f2b5a7a | ||
| openapi_transformed_spec_hash: ba44bf31326f01a1d886b7510dd9da8a | ||
| config_hash: 1e11a5becf7bc1c2e9e07b8654872dc4 | ||
| codegen_sha: 5f2f7e6d049ccc5916ffd6fea8e0794ae3c0cbd9 | ||
| codegen_hash: 663402af14642770c879417eb667124b7f3d9737fd077e484448afc7a3962e78 | ||
| public_codegen_sha: 285ffa3e3e167b59861e8c5d88e9030b1ca6c9d4 | ||
| config_hash: 4fbbbcf377bcc17646cccb9fcfbac14a | ||
| codegen_sha: 32f76782eedd98393c94fd2cd5bed4107dc87e5e | ||
| codegen_hash: be1aa8c106030d90566a9da15b7103ad484d28b79b102e764fdc757e60330835 | ||
| public_codegen_sha: 676d0f7a10c647c011d998f6c603e47791af8261 |
This file contains hidden or 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 hidden or 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,32 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module OpenAI | ||
| module Models | ||
| module Realtime | ||
| # @see OpenAI::Resources::Realtime::Calls#create | ||
| class CallCreateParams < OpenAI::Internal::Type::BaseModel | ||
| extend OpenAI::Internal::Type::RequestParameters::Converter | ||
| include OpenAI::Internal::Type::RequestParameters | ||
|
|
||
| # @!attribute sdp | ||
| # WebRTC Session Description Protocol (SDP) offer generated by the caller. | ||
| # | ||
| # @return [String] | ||
| required :sdp, String | ||
|
|
||
| # @!attribute session | ||
| # Realtime session object configuration. | ||
| # | ||
| # @return [OpenAI::Models::Realtime::RealtimeSessionCreateRequest, nil] | ||
| optional :session, -> { OpenAI::Realtime::RealtimeSessionCreateRequest } | ||
|
|
||
| # @!method initialize(sdp:, session: nil, request_options: {}) | ||
| # @param sdp [String] WebRTC Session Description Protocol (SDP) offer generated by the caller. | ||
| # | ||
| # @param session [OpenAI::Models::Realtime::RealtimeSessionCreateRequest] Realtime session object configuration. | ||
| # | ||
| # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] | ||
| end | ||
| end | ||
| end | ||
| end |
This file contains hidden or 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 hidden or 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,71 @@ | ||
| # typed: strong | ||
|
|
||
| module OpenAI | ||
| module Models | ||
|
|
||
| module Realtime | ||
|
|
||
| class CallCreateParams < OpenAI::Internal::Type::BaseModel | ||
|
|
||
| extend OpenAI::Internal::Type::RequestParameters::Converter | ||
| include OpenAI::Internal::Type::RequestParameters | ||
|
|
||
| OrHash = T.type_alias do | ||
| T.any( | ||
| OpenAI::Realtime::CallCreateParams, | ||
| OpenAI::Internal::AnyHash | ||
| ) | ||
| end | ||
|
|
||
| # WebRTC Session Description Protocol (SDP) offer generated by the caller. | ||
| sig { returns(String) } | ||
| attr_accessor :sdp | ||
|
|
||
| # Realtime session object configuration. | ||
| sig { returns(T.nilable(OpenAI::Realtime::RealtimeSessionCreateRequest)) } | ||
| attr_reader :session | ||
|
|
||
| sig { params(session: OpenAI::Realtime::RealtimeSessionCreateRequest::OrHash).void } | ||
| attr_writer :session | ||
|
|
||
| sig do | ||
| params( | ||
|
|
||
| sdp: String, | ||
|
|
||
| session: OpenAI::Realtime::RealtimeSessionCreateRequest::OrHash, | ||
|
|
||
| request_options: OpenAI::RequestOptions::OrHash | ||
| ) | ||
| .returns(T.attached_class) | ||
| end | ||
| def self.new( | ||
|
|
||
| # WebRTC Session Description Protocol (SDP) offer generated by the caller. | ||
| sdp:, | ||
|
|
||
| # Realtime session object configuration. | ||
| session: nil, | ||
|
|
||
| request_options: {} | ||
| ) | ||
| end | ||
|
|
||
| sig do | ||
| override.returns( | ||
| { | ||
| sdp: String, | ||
| session: OpenAI::Realtime::RealtimeSessionCreateRequest, | ||
| request_options: OpenAI::RequestOptions | ||
| } | ||
| ) | ||
| end | ||
| def to_hash | ||
| end | ||
|
|
||
| end | ||
|
|
||
| end | ||
|
|
||
| end | ||
| end |
This file contains hidden or 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 hidden or 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,34 @@ | ||
| module OpenAI | ||
| module Models | ||
| module Realtime | ||
| type call_create_params = | ||
| { sdp: String, session: OpenAI::Realtime::RealtimeSessionCreateRequest } | ||
| & OpenAI::Internal::Type::request_parameters | ||
|
|
||
| class CallCreateParams < OpenAI::Internal::Type::BaseModel | ||
| extend OpenAI::Internal::Type::RequestParameters::Converter | ||
| include OpenAI::Internal::Type::RequestParameters | ||
|
|
||
| attr_accessor sdp: String | ||
|
|
||
| attr_reader session: OpenAI::Realtime::RealtimeSessionCreateRequest? | ||
|
|
||
| def session=: ( | ||
| OpenAI::Realtime::RealtimeSessionCreateRequest | ||
| ) -> OpenAI::Realtime::RealtimeSessionCreateRequest | ||
|
|
||
| def initialize: ( | ||
| sdp: String, | ||
| ?session: OpenAI::Realtime::RealtimeSessionCreateRequest, | ||
| ?request_options: OpenAI::request_opts | ||
| ) -> void | ||
|
|
||
| def to_hash: -> { | ||
| sdp: String, | ||
| session: OpenAI::Realtime::RealtimeSessionCreateRequest, | ||
| request_options: OpenAI::RequestOptions | ||
| } | ||
| end | ||
| end | ||
| end | ||
| end |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a backend needs to monitor or terminate the newly created WebRTC call, the API supplies its call ID in the
Locationresponse header, but this request returns only the decodedStringIO;BaseClient#parse_responseattaches response metadata only toBaseModelinstances, and there is no raw-response accessor for this value. Consequently, after a successfulcreate, callers cannot obtain the identifier required byhangupor monitoring endpoints. Return a response type or wrapper that retains the headers, and cover that behavior in the focused endpoint test.AGENTS.md reference: AGENTS.md:L48-L52
Useful? React with 👍 / 👎.