deepgram / deepgram-js-sdk

Official JavaScript SDK for Deepgram's automated speech recognition APIs.
https://developers.deepgram.com
MIT License
138 stars 51 forks source link

Prerecorded transcriptions fail when detect_entities is supplied #102

Closed ShantanuNair closed 1 year ago

ShantanuNair commented 1 year ago

Steps to reproduce

const { Deepgram } = require('@deepgram/sdk');

const deepgramApiKey = <KEY_HERE>;

// Hosted sample file
const audioUrl =
  'https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav';

// Initializes the Deepgram SDK
const deepgram = new Deepgram(deepgramApiKey);

console.log('Requesting transcript...');
deepgram.transcription
  .preRecorded(
    { url: audioUrl },
    {
      times: false,
      diarize: true,
      language: 'en-US',
      punctuate: true,
      detect_entities: true,
    }
  )
  .then((transcription) => {
    console.dir(transcription, { depth: null });
  })
  .catch((err) => {
    console.log(err);
  });

Expected behavior

The transcription runs with the entities returned as well. Or at least the transcript is returned

Please tell us about your environment

Node 16 SDK v1.14.0

We want to make sure the problem isn't specific to your operating system or programming language.

briancbarrow commented 1 year ago

Hi @ShantanuNair. Thanks for reaching out. This feature is still in Beta which is why it isn't documented well. It is still going through some checks before we release it generally. It is available as a production feature but it currently needs to be passed in as detect_entities: "latest". Before we release it out of beta, they way it gets passed in might change back to how you have it above. We'll have it documented though when we do release it.

Because it is still in beta, there will likely still be some bugs/regressions/bad performance occassionally. We are working to get it polished and released soon.

ShantanuNair commented 1 year ago

@briancbarrow Hi Brian, thanks for the update. I'd like to mention thought that the issue was that the job would fail completely if the option was passed it. We had to avoid passing in the option, else all our jobs were failing.

briancbarrow commented 1 year ago

@ShantanuNair correct. Since our API cannot process it when it is passed in incorrectly it throws an error. You would need to set up a try/catch statement to handle potential errors.