Skip to content
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

TypeScript version: openai-realtime-api #46

Open
transitive-bullshit opened this issue Oct 16, 2024 · 2 comments
Open

TypeScript version: openai-realtime-api #46

transitive-bullshit opened this issue Oct 16, 2024 · 2 comments

Comments

@transitive-bullshit
Copy link

transitive-bullshit commented Oct 16, 2024

@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

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.

@transitive-bullshit transitive-bullshit changed the title TypeScript version: openai-realtime-api package TypeScript version: openai-realtime-api Oct 16, 2024
@Stevenic
Copy link

thanks for contributing this... will definitely take a look

@morrow-lw-dog
Copy link

morrow-lw-dog commented Nov 30, 2024

Hi, @transitive-bullshit

I used your library and found a little problem:

The waitForNext method doesn't work, no matter what the event name is

const client = new RealtimeClient({
  url: "wss://my-relay-server-domain.com",
  sessionConfig: {
    turn_detection: {
      type: "server_vad",
    },
  },
});

// I made up the event name on a whim, so feel free to change it; none seem to take effect anyway.
client.waitForNext("session.update").then(ev => {
   // This line never works. I've checked by setting a breakpoint, 
   // and when dispatch method call, there's no event name registered in your eventHandlers.
   console.log("session.update", ev);
});

client.connect()

I have tried use client.realtime.waitForNext("session.update"), it worked.
So, Either remove the non-effective event names from the set of event names in the function signature of the client.waitForNext method, or make these events effective for client.waitForNext.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants