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

Handle UtteranceEnd message type #146

Closed
boyswan opened this issue Dec 15, 2023 · 8 comments
Closed

Handle UtteranceEnd message type #146

boyswan opened this issue Dec 15, 2023 · 8 comments

Comments

@boyswan
Copy link
Contributor

boyswan commented Dec 15, 2023

Using the utterance_end_ms parameter for the live api requires handling of { type: UtteranceEnd }. Currently here's no way to handle this in the callback interface.

Perhaps an optional UnhandledResponse method on the callback interface could be an useful escape-hatch for new message types, rather than treating it as an error?

@dvonthenen
Copy link
Contributor

We just discussed this internally. Will expose this parameter shortly.

@dvonthenen
Copy link
Contributor

in the meantime @boyswan , you can expose custom parameter to the Live Client using this example:
#144

This should get you around that problem.

@boyswan
Copy link
Contributor Author

boyswan commented Dec 15, 2023

So this allows me to add the utterance_end_ms parameter, but what I'm referring to is an error from the router:

I1215 16:30:07.641232   96536 router.go:174] UnhandledMessage RAW:
{
  "type": "UtteranceEnd"
}
I1215 16:30:07.641236   96536 router.go:175] -----------------------------------------------


I1215 16:30:07.641253   96536 router.go:162] User callback is undefined
I1215 16:30:07.641257   96536 client.go:244] WebSocketClient::listen: router.Message failed. Err: invalid message type

@dvonthenen
Copy link
Contributor

dvonthenen commented Dec 15, 2023

So this allows me to add the utterance_end_ms header, but what I'm referring to is an error from the router:

I1215 16:30:07.641232   96536 router.go:174] UnhandledMessage RAW:
{
  "type": "UtteranceEnd"
}
I1215 16:30:07.641236   96536 router.go:175] -----------------------------------------------


I1215 16:30:07.641253   96536 router.go:162] User callback is undefined
I1215 16:30:07.641257   96536 client.go:244] WebSocketClient::listen: router.Message failed. Err: invalid message type

Not the header... you want to add as a query parameter. Just this one:

// example on how to send a custom parameter
params := make(map[string][]string, 0)
params["utterance_end_ms"] = []string{"your-value"}
ctx = cfginterfaces.WithCustomParameters(ctx, params)

@dvonthenen
Copy link
Contributor

Didn't mean to close with comment...

@boyswan
Copy link
Contributor Author

boyswan commented Dec 15, 2023

Sorry typo! Meant parameter:

params := make(map[string][]string, 0)
params["utterance_end_ms"] = []string{"2000"}
ctx = cfginterfaces.WithCustomParameters(ctx, params)

If I understand correctly, the router needs to handle the UtteranceEnd type:

@dvonthenen
Copy link
Contributor

dvonthenen commented Dec 15, 2023

Sorry typo! Meant parameter:

params := make(map[string][]string, 0)
params["utterance_end_ms"] = []string{"2000"}
ctx = cfginterfaces.WithCustomParameters(ctx, params)

If I understand correctly, the router needs to handle the UtteranceEnd type:

Ahhhh that's right. There is a new message type that needs to be added. Will need to wait then until the modifications are complete. Forget about the new message type. Trying to juggle too many things right now.

Will add that in a bit.

@dvonthenen
Copy link
Contributor

Released for GA
https://github.com/deepgram/deepgram-go-sdk/releases/tag/v1.0.2

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

2 participants