AttributeError: 'generator' object has no attribute 'stream' in
from deepgram import DeepgramClient
client = DeepgramClient(api_key = "my key")
response = client.speak.v1.audio.generate(
text="Hello, this is a sample text to speech conversion."
)
# Save the audio file
with open("output.mp3", "wb") as audio_file:
audio_file.write(response.stream.getvalue())
^^^^^^
from deepgram import DeepgramClient
client = DeepgramClient(api_key = "secret stuff")
response = client.speak.v1.audio.generate(
text="Hello, this is a sample text to speech conversion."
)
# Save the audio file
with open("output.mp3", "wb") as audio_file:
for a in response:
audio_file.write(a)
Affected page or section
readme.md
What is unclear or wrong?
Suggested change
from deepgram import DeepgramClient client = DeepgramClient(api_key = "secret stuff") response = client.speak.v1.audio.generate( text="Hello, this is a sample text to speech conversion." ) # Save the audio file with open("output.mp3", "wb") as audio_file: for a in response: audio_file.write(a)Example code (if any)
SDK parity (if relevant)
Session ID (optional)
No response
Project ID (optional)
No response
Request ID (optional)
No response