@khorwood-openai mentioned in another issue possibly replacing the current JS package with a TS version. I think most of the community would prefer that, since it's the only way to guarantee a solid DX and internal consistency, so I went ahead and took a stab at it.
The event types explicitly separate between server events, client events, and the 5 unofficial custom utility events.
It also includes fixes for #3, #11, #12, #14, #17, #29, #34, #35, #37, #43, #44, and likely others.
When porting to TS, there were lots of places where the strong typing resulted in small bug fixes that are not necessarily captured by current issues.
There are a few places where I updated the code to use more modern TS conventions (e.g., one example is using structuredClone(data) instead of JSON.parse(JSON.stringify(data)))
It includes several Node.js demos to make it easier to test the realtime API.
It includes an imported version of OpenAI's Realtime Console, modified to replace @openai/realtime-api-beta with openai-realtime-api. It's a 99% drop-in replacement; I just had to tidy up some types since openai-realtime-api is a bit more strict.
When I started out, I wasn't sure how 1:1 the TS port would be, so I created a new repo versus forking, but it shouldn't be too hard to compare between the two.
Very open to feedback && would love to merge any part of my TS port back upstream. Ideally once the official version of updated to use TS and stronger typing, I can deprecate my package.
cc @Stevenic and @ZJONSSON who both seem active on the TS side of things in addition to the rest of the OpenAI's team.
@khorwood-openai mentioned in another issue possibly replacing the current JS package with a TS version. I think most of the community would prefer that, since it's the only way to guarantee a solid DX and internal consistency, so I went ahead and took a stab at it.
See https://github.com/transitive-bullshit/openai-realtime-api
structuredClone(data)
instead ofJSON.parse(JSON.stringify(data))
)@openai/realtime-api-beta
withopenai-realtime-api
. It's a 99% drop-in replacement; I just had to tidy up some types sinceopenai-realtime-api
is a bit more strict.Very open to feedback && would love to merge any part of my TS port back upstream. Ideally once the official version of updated to use TS and stronger typing, I can deprecate my package.
cc @Stevenic and @ZJONSSON who both seem active on the TS side of things in addition to the rest of the OpenAI's team.