google-cloud-node icon indicating copy to clipboard operation
google-cloud-node copied to clipboard

V2 adaption > inlinePhraseSet not working

Open designkl opened this issue 1 year ago • 3 comments

Problem you have encountered: We're moving from v1p1beta1 with speechContexts to v2 with adaption and inlinePhraseSet. adapation doesn't seem to work.

What you expected to happen: Use the correct phrase set for translation similar to speechContexts

Steps to reproduce:

Updated the previous working function to the following code:

const client = new speech.v2.SpeechClient(); const phraseSet = { phrases: [ { value: "one", boost: 20 }, { value: "zero", boost: 20 }, { value: "thousand", boost: 20 }, ], }; const adaptation = { phraseSets: [{ inlinePhraseSet: phraseSet }], };

const transcriptionRequest = { recognizer: recognizerName, config: { autoDecodingConfig: {}, adaptation: adaptation, }, content: audiotrack, };

Other information (workarounds you have tried, documentation consulted, etc): Have tried in 6.5.0 and still does not work. There is no documentation for Typescript (only Python) so this is code taken from various websites.

I tired changing the boost to 50 (according to the documentation, you should get an error for any boost value that is not between 0 -20):

phrases: [ { value: "one", boost: 50, }, { value: "zero", boost: 50, }, { value: "thousand", boost: 50, }, ],

There is no error reported in the logs but no response comes back from await client.recognize(transcriptionRequest) so the phrases array must be being passed.

designkl avatar Apr 18 '24 17:04 designkl

Are there any updates?

I see that the same problem is reported in other places like here and here.

@stephenplusplus ?

yoshigev avatar May 12 '25 08:05 yoshigev

Hey @yoshigev, I do not work on this project anymore, so I am out of the loop and cannot provide support. Just from looking briefly, though, it seems this is an upstream issue with the API as opposed to an issue on this library. If that’s the case, the StackOverflow approach is good to get an answer, as well as the others mentioned on the general support page for the API: https://cloud.google.com/speech-to-text/docs/getting-support

Sorry I can’t be more useful. Hope you get this resolved soon!

stephenplusplus avatar May 13 '25 17:05 stephenplusplus

Thanks @stephenplusplus. Understood.

If anyone has a solution, it would be great if it could be posted here.

yoshigev avatar May 13 '25 17:05 yoshigev