lugia19 / elevenlabslib

Full python wrapper for the elevenlabs API.
MIT License
150 stars 27 forks source link

example of stream_audio_v3 #33

Open swaipdev opened 3 hours ago

swaipdev commented 3 hours ago

Hi, and thanks for this good library! I managed to get the audio on the speakers, so I know it works, but I would like to use generationOptions. I cannot find a good example, I'm trying something like :

generation_options = GenerationOptions( latencyOptimizationLevel=1, # Adjusts latency optimization stability=0.5, # Example stability value similarity_boost=0.8, # Example similarity boost style="informative", # Example style use_speaker_boost=True, # Enables speaker boost model='eleven_multilingual_v2', # Specifies the model output_format='mp3_highest', # Sets the output format seed=42, # Random seed for generation language_code='fr-FR', # Language code for the audio pronunciation_dictionaries=None # Optional pronunciation dictionaries )

voice.stream_audio_v3(message, None, generation_options)
but I get 

  File "\venv\lib\site-packages\elevenlabslib\helpers.py", line 295, in __post_init__
if var is not None and (var < 0 or var > 1):

TypeError: '<' not supported between instances of 'str' and 'int'

What am I doing wrong? Thanks in advance

lugia19 commented 3 hours ago

You can check the documentation for the GenerationOptions class for a more in-depth explanation of all the parameters. Style is actually a float value, between 0 and 1 - you can look at elevenlabs' own docs for more information.