-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[5/n] OpenAI realtime transport impl #1072
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
Similar to the TS version. - Config is the things you can set on the session - Items are similar to responses items. I'm using an abstraction instead of reusing the ones in the openai SDK, to reduce the amount of work for other providers --- [//]: # (BEGIN SAPLING FOOTER) * #1074 * #1073 * #1072 * #1071 * __->__ #1070 * #1069 * #1068
9904b08
to
572eb7d
Compare
model: NotRequired[str] | ||
"""The model to use.""" | ||
|
||
url: NotRequired[str] |
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 seems a bit too specific to OpenAI to be a part of abstraction. Or should be documented differently.
pass | ||
|
||
@abc.abstractmethod | ||
async def send_event(self, event: RealtimeClientMessage) -> None: |
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.
Why is this method public? I assume the message is very specific to the underlying transport.
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.
so that you can send events that aren't necessarily public. Helps with custom implementations, as well as with our own realtime evolving quickly
|
||
await self._cancel_response() | ||
|
||
elapsed_time_ms = (datetime.now() - self._audio_start_time).total_seconds() * 1000 |
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.
Why round to seconds here?
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.
it's not rounding. python mostly uses seconds for everything (it's stored as a float not an int so doesnt lose precision)
Uses the openai realtime impl over websockets. Unlike the TS version, only supports websockets - no in browser stuff.