runapi-elevenlabs 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +7 -7
- data/lib/runapi/elevenlabs/contract_gen.rb +75 -0
- data/lib/runapi/elevenlabs/resources/isolate_audio.rb +7 -7
- data/lib/runapi/elevenlabs/resources/speech_to_text.rb +7 -7
- data/lib/runapi/elevenlabs/resources/text_to_dialogue.rb +7 -7
- data/lib/runapi/elevenlabs/resources/text_to_sound.rb +7 -7
- data/lib/runapi/elevenlabs/resources/text_to_speech.rb +11 -12
- data/lib/runapi/elevenlabs/types.rb +0 -1
- data/lib/runapi/elevenlabs.rb +1 -0
- metadata +12 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6ca6826a8bff9028eb05ea1e9bd629b04e9351d7180975e850273fad2bee2785
|
|
4
|
+
data.tar.gz: 9be4ec71de7f881583737af7a5badc4961aa57d36c4c20a6d8c764c2a3634b3e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7c8f2a8795d4a78ab60d02c9319e3b85e20905b8a5ae890bb65b3f5641dbf862a90728e16c9b6aee688418a9e0b86ecaea52872503a426ef33d56a163971ac65
|
|
7
|
+
data.tar.gz: 552966e452b88bebabe28bcc213bfbbe444b335c27a900823cd5d12d54c0217bbf04166c623d34dbc1e11478dbefd95a046c2061dea9b433fe9e460ee972a212
|
data/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ElevenLabs Ruby SDK for RunAPI
|
|
2
2
|
|
|
3
|
-
The
|
|
3
|
+
The ElevenLabs Ruby SDK is the language-specific package for ElevenLabs on RunAPI. Use this package for voice, dialogue, transcription, sound effect, and audio cleanup workflows when your application needs request bodies, task status lookup, and consistent RunAPI errors in Ruby.
|
|
4
4
|
|
|
5
|
-
This
|
|
5
|
+
This README is the Ruby package guide inside the public `elevenlabs-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/elevenlabs; for API reference, use https://runapi.ai/docs#elevenlabs; for SDK docs, use https://runapi.ai/docs#sdk-elevenlabs.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -13,13 +13,13 @@ gem install runapi-elevenlabs
|
|
|
13
13
|
## Quick start
|
|
14
14
|
|
|
15
15
|
```ruby
|
|
16
|
-
require "runapi
|
|
16
|
+
require "runapi/elevenlabs"
|
|
17
17
|
|
|
18
18
|
client = RunApi::Elevenlabs::Client.new
|
|
19
|
-
task = client.
|
|
19
|
+
task = client.text_to_speech.create(
|
|
20
20
|
# Pass the ElevenLabs JSON request body from https://runapi.ai/docs#elevenlabs.
|
|
21
21
|
)
|
|
22
|
-
status = client.
|
|
22
|
+
status = client.text_to_speech.get(task.id)
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
Use `create` when you want to submit a task and return quickly, `get` when you need the latest task state, and `run` when a script should create and poll until completion. In web request handlers, prefer `create` plus webhook or later `get` polling so a worker is not held open.
|
|
@@ -28,7 +28,7 @@ RunAPI-generated file URLs are temporary. Download and store generated images, v
|
|
|
28
28
|
|
|
29
29
|
## Language notes
|
|
30
30
|
|
|
31
|
-
Use Ruby keyword arguments and the `RunApi::Elevenlabs` error classes when building audio jobs, Rails workers, or scripts. The available resources
|
|
31
|
+
Use Ruby keyword arguments and the `RunApi::Elevenlabs` error classes when building audio jobs, Rails workers, or scripts. The available resources are `text_to_speech`, `text_to_dialogue`, `text_to_sound`, `speech_to_text`, and `isolate_audio`. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
|
|
32
32
|
|
|
33
33
|
## Links
|
|
34
34
|
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RunApi
|
|
4
|
+
module Elevenlabs
|
|
5
|
+
CONTRACT = {
|
|
6
|
+
"isolate-audio" => {
|
|
7
|
+
"models" => ["audio-isolation"],
|
|
8
|
+
"fields_by_model" => {
|
|
9
|
+
"audio-isolation" => {
|
|
10
|
+
"source_audio_url" => {
|
|
11
|
+
"required" => true
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"speech-to-text" => {
|
|
17
|
+
"models" => ["speech-to-text"],
|
|
18
|
+
"fields_by_model" => {
|
|
19
|
+
"speech-to-text" => {
|
|
20
|
+
"source_audio_url" => {
|
|
21
|
+
"required" => true
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"text-to-dialogue" => {
|
|
27
|
+
"models" => ["text-to-dialogue-v3"],
|
|
28
|
+
"fields_by_model" => {
|
|
29
|
+
"text-to-dialogue-v3" => {
|
|
30
|
+
"dialogue" => {
|
|
31
|
+
"required" => true
|
|
32
|
+
},
|
|
33
|
+
"stability" => {
|
|
34
|
+
"enum" => [0.0, 0.5, 1.0]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"text-to-sound" => {
|
|
40
|
+
"models" => ["sound-effect-v2"],
|
|
41
|
+
"fields_by_model" => {
|
|
42
|
+
"sound-effect-v2" => {
|
|
43
|
+
"output_format" => {
|
|
44
|
+
"enum" => ["mp3_22050_32", "mp3_44100_32", "mp3_44100_64", "mp3_44100_96", "mp3_44100_128", "mp3_44100_192", "pcm_8000", "pcm_16000", "pcm_22050", "pcm_24000", "pcm_44100", "pcm_48000", "ulaw_8000", "alaw_8000", "opus_48000_32", "opus_48000_64", "opus_48000_96", "opus_48000_128", "opus_48000_192"]
|
|
45
|
+
},
|
|
46
|
+
"text" => {
|
|
47
|
+
"required" => true
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"text-to-speech" => {
|
|
53
|
+
"models" => ["text-to-speech-multilingual-v2", "text-to-speech-turbo-v2.5"],
|
|
54
|
+
"fields_by_model" => {
|
|
55
|
+
"text-to-speech-multilingual-v2" => {
|
|
56
|
+
"text" => {
|
|
57
|
+
"required" => true
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"text-to-speech-turbo-v2.5" => {
|
|
61
|
+
"text" => {
|
|
62
|
+
"required" => true
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"rules" => [{
|
|
67
|
+
"when" => {
|
|
68
|
+
"model" => "text-to-speech-multilingual-v2"
|
|
69
|
+
},
|
|
70
|
+
"required" => ["voice"]
|
|
71
|
+
}]
|
|
72
|
+
}
|
|
73
|
+
}.freeze
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -14,19 +14,19 @@ module RunApi
|
|
|
14
14
|
@http = http
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
def run(**params)
|
|
18
|
-
task = create(**params)
|
|
19
|
-
poll_until_complete { get(task.id) }
|
|
17
|
+
def run(options: nil, **params)
|
|
18
|
+
task = create(options: options, **params)
|
|
19
|
+
poll_until_complete { get(task.id, options: options) }
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
def create(**params)
|
|
22
|
+
def create(options: nil, **params)
|
|
23
23
|
params = compact_params(params)
|
|
24
24
|
raise Core::ValidationError, "source_audio_url is required" unless param(params, :source_audio_url)
|
|
25
|
-
request(:post, ENDPOINT, body: params)
|
|
25
|
+
request(:post, ENDPOINT, body: params, options: options)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
def get(id)
|
|
29
|
-
request(:get, "#{ENDPOINT}/#{id}")
|
|
28
|
+
def get(id, options: nil)
|
|
29
|
+
request(:get, "#{ENDPOINT}/#{id}", options: options)
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
|
@@ -14,19 +14,19 @@ module RunApi
|
|
|
14
14
|
@http = http
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
def run(**params)
|
|
18
|
-
task = create(**params)
|
|
19
|
-
poll_until_complete { get(task.id) }
|
|
17
|
+
def run(options: nil, **params)
|
|
18
|
+
task = create(options: options, **params)
|
|
19
|
+
poll_until_complete { get(task.id, options: options) }
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
def create(**params)
|
|
22
|
+
def create(options: nil, **params)
|
|
23
23
|
params = compact_params(params)
|
|
24
24
|
raise Core::ValidationError, "source_audio_url is required" unless param(params, :source_audio_url)
|
|
25
|
-
request(:post, ENDPOINT, body: params)
|
|
25
|
+
request(:post, ENDPOINT, body: params, options: options)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
def get(id)
|
|
29
|
-
request(:get, "#{ENDPOINT}/#{id}")
|
|
28
|
+
def get(id, options: nil)
|
|
29
|
+
request(:get, "#{ENDPOINT}/#{id}", options: options)
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
|
@@ -14,19 +14,19 @@ module RunApi
|
|
|
14
14
|
@http = http
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
def run(**params)
|
|
18
|
-
task = create(**params)
|
|
19
|
-
poll_until_complete { get(task.id) }
|
|
17
|
+
def run(options: nil, **params)
|
|
18
|
+
task = create(options: options, **params)
|
|
19
|
+
poll_until_complete { get(task.id, options: options) }
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
def create(**params)
|
|
22
|
+
def create(options: nil, **params)
|
|
23
23
|
params = compact_params(params)
|
|
24
24
|
raise Core::ValidationError, "dialogue is required" unless param(params, :dialogue)
|
|
25
|
-
request(:post, ENDPOINT, body: params)
|
|
25
|
+
request(:post, ENDPOINT, body: params, options: options)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
def get(id)
|
|
29
|
-
request(:get, "#{ENDPOINT}/#{id}")
|
|
28
|
+
def get(id, options: nil)
|
|
29
|
+
request(:get, "#{ENDPOINT}/#{id}", options: options)
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
|
@@ -14,22 +14,22 @@ module RunApi
|
|
|
14
14
|
@http = http
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
def run(**params)
|
|
18
|
-
task = create(**params)
|
|
19
|
-
poll_until_complete { get(task.id) }
|
|
17
|
+
def run(options: nil, **params)
|
|
18
|
+
task = create(options: options, **params)
|
|
19
|
+
poll_until_complete { get(task.id, options: options) }
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
def create(**params)
|
|
22
|
+
def create(options: nil, **params)
|
|
23
23
|
params = compact_params(params)
|
|
24
24
|
raise Core::ValidationError, "text is required" unless param(params, :text)
|
|
25
25
|
if param(params, :output_format) && !Types::TEXT_TO_SOUND_OUTPUT_FORMATS.include?(param(params, :output_format))
|
|
26
26
|
raise Core::ValidationError, "Invalid output_format"
|
|
27
27
|
end
|
|
28
|
-
request(:post, ENDPOINT, body: params)
|
|
28
|
+
request(:post, ENDPOINT, body: params, options: options)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
def get(id)
|
|
32
|
-
request(:get, "#{ENDPOINT}/#{id}")
|
|
31
|
+
def get(id, options: nil)
|
|
32
|
+
request(:get, "#{ENDPOINT}/#{id}", options: options)
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
end
|
|
@@ -14,29 +14,28 @@ module RunApi
|
|
|
14
14
|
@http = http
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
def run(**params)
|
|
18
|
-
task = create(**params)
|
|
19
|
-
poll_until_complete { get(task.id) }
|
|
17
|
+
def run(options: nil, **params)
|
|
18
|
+
task = create(options: options, **params)
|
|
19
|
+
poll_until_complete { get(task.id, options: options) }
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
def create(**params)
|
|
22
|
+
def create(options: nil, **params)
|
|
23
23
|
params = compact_params(params)
|
|
24
24
|
validate_params!(params)
|
|
25
|
-
request(:post, ENDPOINT, body: params)
|
|
25
|
+
request(:post, ENDPOINT, body: params, options: options)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
def get(id)
|
|
29
|
-
request(:get, "#{ENDPOINT}/#{id}")
|
|
28
|
+
def get(id, options: nil)
|
|
29
|
+
request(:get, "#{ENDPOINT}/#{id}", options: options)
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
private
|
|
33
33
|
|
|
34
34
|
def validate_params!(params)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
raise Core::ValidationError, "voice is required for text-to-speech-multilingual-v2" if model == "text-to-speech-multilingual-v2" && !param(params, :voice)
|
|
35
|
+
validate_contract!(CONTRACT["text-to-speech"], params)
|
|
36
|
+
if param(params, :model) == "text-to-speech-multilingual-v2" && !param(params, :voice)
|
|
37
|
+
raise Core::ValidationError, "voice is required for text-to-speech-multilingual-v2"
|
|
38
|
+
end
|
|
40
39
|
end
|
|
41
40
|
end
|
|
42
41
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module Elevenlabs
|
|
5
5
|
module Types
|
|
6
|
-
TEXT_TO_SPEECH_MODELS = %w[text-to-speech-turbo-v2.5 text-to-speech-multilingual-v2].freeze
|
|
7
6
|
DEFAULT_TEXT_TO_SPEECH_VOICE = "EkK5I93UQWFDigLMpZcX"
|
|
8
7
|
TEXT_TO_SOUND_OUTPUT_FORMATS = %w[
|
|
9
8
|
mp3_22050_32 mp3_44100_32 mp3_44100_64 mp3_44100_96 mp3_44100_128 mp3_44100_192
|
data/lib/runapi/elevenlabs.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runapi-elevenlabs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- RunAPI
|
|
@@ -15,18 +15,18 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.
|
|
18
|
+
version: 0.3.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.
|
|
26
|
-
description: The
|
|
27
|
-
on RunAPI. Use this
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
version: 0.3.0
|
|
26
|
+
description: The ElevenLabs Ruby SDK is the language-specific package for ElevenLabs
|
|
27
|
+
on RunAPI. Use this package for voice, dialogue, transcription, sound effect, and
|
|
28
|
+
audio cleanup workflows when your application needs request bodies, task status
|
|
29
|
+
lookup, and consistent RunAPI errors in Ruby.
|
|
30
30
|
email:
|
|
31
31
|
- contact@runapi.ai
|
|
32
32
|
executables: []
|
|
@@ -39,6 +39,7 @@ files:
|
|
|
39
39
|
- lib/runapi-elevenlabs.rb
|
|
40
40
|
- lib/runapi/elevenlabs.rb
|
|
41
41
|
- lib/runapi/elevenlabs/client.rb
|
|
42
|
+
- lib/runapi/elevenlabs/contract_gen.rb
|
|
42
43
|
- lib/runapi/elevenlabs/resources/isolate_audio.rb
|
|
43
44
|
- lib/runapi/elevenlabs/resources/speech_to_text.rb
|
|
44
45
|
- lib/runapi/elevenlabs/resources/text_to_dialogue.rb
|
|
@@ -49,9 +50,11 @@ homepage: https://runapi.ai/models/elevenlabs
|
|
|
49
50
|
licenses:
|
|
50
51
|
- Apache-2.0
|
|
51
52
|
metadata:
|
|
53
|
+
runapi_slug: elevenlabs
|
|
52
54
|
homepage_uri: https://runapi.ai/models/elevenlabs
|
|
53
55
|
documentation_uri: https://github.com/runapi-ai/elevenlabs-sdk/blob/main/ruby/README.md
|
|
54
56
|
source_code_uri: https://github.com/runapi-ai/elevenlabs-sdk
|
|
57
|
+
bug_tracker_uri: https://github.com/runapi-ai/elevenlabs-sdk/issues
|
|
55
58
|
changelog_uri: https://github.com/runapi-ai/elevenlabs-sdk/blob/main/CHANGELOG.md
|
|
56
59
|
rdoc_options: []
|
|
57
60
|
require_paths:
|
|
@@ -67,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
67
70
|
- !ruby/object:Gem::Version
|
|
68
71
|
version: '0'
|
|
69
72
|
requirements: []
|
|
70
|
-
rubygems_version: 4.0.
|
|
73
|
+
rubygems_version: 4.0.17
|
|
71
74
|
specification_version: 4
|
|
72
|
-
summary:
|
|
75
|
+
summary: ElevenLabs Ruby SDK for RunAPI
|
|
73
76
|
test_files: []
|