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

Deepgram timeouts #151

Closed
swethmandava opened this issue Oct 9, 2023 · 13 comments
Closed

Deepgram timeouts #151

swethmandava opened this issue Oct 9, 2023 · 13 comments
Labels
question Further information is requested

Comments

@swethmandava
Copy link

Exception: DG: 408, message='Request Timeout', url=URL('https://api.deepgram.com/v1/listen?smart_format=true&utterances=true&summarize=v2&model=video&diarize=true')

Worked fine till a few hours ago.

@SandraRodgers
Copy link
Contributor

Hi @swethmandava ,

I've just tested this using the Python SDK and I didn't encounter a problem. Can you verify that you were using this Python SDK to make the request? I tested it using the prerecorded example file in the examples folder of this project.

@swethmandava
Copy link
Author

swethmandava commented Oct 9, 2023

deepgram.transcription.prerecorded(
        source,
        options,
       timeout = 300
    )

Increasing timeout fixes the issue.

@swethmandava
Copy link
Author

even without timeout = 3000, it fails sometimes for videos of length < 1 hr. what do you recommend?

@swethmandava swethmandava reopened this Oct 18, 2023
@jpvajda
Copy link
Contributor

jpvajda commented Oct 27, 2023

@swethmandava timeouts can happen for a lot of reasons but it might all come down to the file size of what you are trying to send to us to transcribe.

so I'd recommend setting the timeout value to 300 seconds (5 minutes) when making a request to Deepgram.

Also I noticed you used our video model which part of our Base tier, you can try a few different tier model combinations to see if it performs better. Our newest Nova models are the fastest, so I recommend trying that depending on the language needs of the file.

Here are some Docs that can help you determine a model:

https://developers.deepgram.com/docs/model
https://developers.deepgram.com/docs/models-overview

@jpvajda jpvajda closed this as completed Oct 27, 2023
@jpvajda jpvajda added the question Further information is requested label Oct 27, 2023
@swethmandava
Copy link
Author

I still get timeout errors occasionally. What's the recommended way to retry / upload large files without timeouts?

@dvonthenen
Copy link
Contributor

dvonthenen commented Dec 11, 2023

I still get timeout errors occasionally. What's the recommended way to retry / upload large files without timeouts?

The best way of you are dealing with potential unstable internet connections would be to upload to some publicly accessible S3 bucket and use the transcription via URL method.

https://developers.deepgram.com/reference/pre-recorded

@JoelLederman
Copy link

I am trying to transcribe an mp3 on my computer of about 1 hour and a half and it keeps timing out. I trying using the parameter timeout = 300 but it said this was invalid syntax. Does anyone know how to fix this?

@dvonthenen
Copy link
Contributor

dvonthenen commented Jan 29, 2024

I am trying to transcribe an mp3 on my computer of about 1 hour and a half and it keeps timing out. I trying using the parameter timeout = 300 but it said this was invalid syntax. Does anyone know how to fix this?

@JoelLederman It's probably because the syntax is invalid (the parameter you are using is not valid). Can you post your code OR how you are calling the function with the parameter declarations here?

@JoelLederman
Copy link

This is the part of the code that I specify timeout settings:
options = PrerecordedOptions(
model="nova",
smart_format=True,
summarize="v2",
diarize=True,
timeout = 300
)

@dvonthenen
Copy link
Contributor

yea, there isn't a timeout parameter in the transcription options class. it's on the function:
https://github.com/deepgram/deepgram-python-sdk/blob/main/deepgram/clients/abstract_sync_client.py#L91-L105

For transcribe_file (URL is the same way):

myTimeout = httpx.Timeout(30.0, connect=10.0)
response = deepgram.listen.prerecorded.v("1").transcribe_file(payload, options, timeout=myTimeout)

@JoelLederman
Copy link

Ok that worked thanks so much!
Just one more question, the output I get is in this format: =2, speaker_confidence=0.7495117), Word(word='be', start=4066.395, end=4066.635, confidence=1.0, punctuated_word='be', speaker=2, speaker_confidence=0.7495117).
Is there any way to just get the transcription out as if I was using the API playground. I just want a transcription with speaker diarization as my output.

@dvonthenen
Copy link
Contributor

I would understand how dot notation works. Here is an article:
https://builtin.com/data-science/dot-notation#:~:text=Dot%20Notation%20Explained,dot%5D%5Battribute%20or%20method%5D%20.

The structure for what the prerecorded result looks like is here:
https://github.com/deepgram/deepgram-python-sdk/blob/main/deepgram/clients/prerecorded/v1/response.py

The Prerecorded Object is VASTLY different from the Live Response object, but it might give you a clue on how you want to format your transcription and how to use the dot notation:
https://github.com/deepgram/deepgram-python-sdk/blob/main/examples/streaming/microphone/main.py#L34-L37

@JoelLederman
Copy link

Ok thanks so much you have been an amazing help!

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

No branches or pull requests

5 participants