-
Notifications
You must be signed in to change notification settings - Fork 2.7k
fix: #1880 fix a bug where OpenAI Realtime API tracing does not work for realtime agents #1940
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
Conversation
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.
comments for reviewers
|
||
headers: dict[str, str] = {} | ||
if options.get("headers") is not None: | ||
subprotocols: list[Subprotocol] = [ |
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.
This is not a fundamental change for the issue, but having these is generally recommended and aligning with TS SDK.
if api_key.startswith("ek_"): | ||
ephemeral_key = api_key | ||
else: | ||
ephemeral_key = await self._maybe_create_client_secret(api_key, self.model) |
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.
creating an ephemeral key for establishing a WS connection is the recommended way while both still work in terms of realtime capabilities. Going with an ephemeral key resolves the tracing feature issue.
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.
using an ephemeral key for server <-> server communication seems like unnecessary overhead to me.
…for realtime agents
9040bf9
to
6f74eae
Compare
if api_key.startswith("ek_"): | ||
ephemeral_key = api_key | ||
else: | ||
ephemeral_key = await self._maybe_create_client_secret(api_key, self.model) |
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.
using an ephemeral key for server <-> server communication seems like unnecessary overhead to me.
Update: this PR applies a workaround on the client SDK side, but the realtime API server team is going to resolve this issue soon. This means this PR's changes won't be necessary. |
This pull request resolves #1880; Realtime API accepts sk-proj-... token for starting a WebSocket connection, but with this way, the Realtime API's server side tracing no longer works. This pattern may be supported again, but as a quick fix for affected users, this SDK migrates to the new way to establish a WebSocket connection.