lib/elevenlabs/client.rb in elevenlabs-rb-0.1.0 vs lib/elevenlabs/client.rb in elevenlabs-rb-0.2.0
- old
+ new
@@ -6,26 +6,28 @@
module Elevenlabs
class Client
ELEVENLABS_FQDN = 'https://api.elevenlabs.io'
DEFAULT_STABILITY = 0.5
+ DEFAULT_STYLE = 0.5
DEFAULT_MODEL = 'eleven_monolingual_v1'
attr_accessor :api_key
class Error < StandardError; end
def initialize(api_key:)
@api_key = api_key
end
- def text_to_speech(voice_id:, optimize_streaming_latency: 0, text:, stability: DEFAULT_STABILITY, model: DEFAULT_MODEL, stream: false)
+ def text_to_speech(voice_id:, optimize_streaming_latency: 0, text:, style: DEFAULT_STYLE, stability: DEFAULT_STABILITY, model: DEFAULT_MODEL, stream: false)
body = {
text: text,
model_id: model,
voice_settings: {
stability: stability,
- similarity_boost: 0
+ similarity_boost: 0,
+ style: style
}
}
url_path = stream ? "#{ELEVENLABS_FQDN}/v1/text-to-speech/#{voice_id}/stream" : "#{ELEVENLABS_FQDN}/v1/text-to-speech/#{voice_id}"
authorized_http_client.post(url_path, :params => {optimize_streaming_latency: optimize_streaming_latency}, json: body).to_s
end
\ No newline at end of file