runapi-fish-audio 0.4.0 → 0.6.0
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 -1
- data/lib/runapi/fish_audio/resources/create_voice.rb +0 -2
- data/lib/runapi/fish_audio/resources/get_voice.rb +0 -2
- data/lib/runapi/fish_audio/resources/list_voices.rb +0 -1
- data/lib/runapi/fish_audio/resources/text_to_speech.rb +0 -23
- data/lib/runapi/fish_audio/types.rb +0 -2
- data/lib/runapi/fish_audio.rb +0 -1
- metadata +4 -5
- data/lib/runapi/fish_audio/contract_gen.rb +0 -131
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 37ad7a253dec28b23ac6123464181e157ff34d6d6c3e4dd5f25a2c1e08bd3f9e
|
|
4
|
+
data.tar.gz: dcdffb7b22ce9dd666b2f2d9fc4610133fa52c1d1c18fa91d9b19e5197c67ad1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 67a1cd8094dd340085048000c998d2411a36fccd3088361320352a3155bc19d76dd2d037569c5aabfc07b3be2bb2f834e80b5e67ee13051823cfd70af357ee62
|
|
7
|
+
data.tar.gz: 71f706e16580499e6d16a0a34c05bdf0b175efc841fa10737987e82e7d221a8da4b5506c39e4e135828677dc3625083243b9dc27f032068d59e7b92f8d6205df
|
data/README.md
CHANGED
|
@@ -9,7 +9,7 @@ raise "Voice is #{voice.voice.state}" unless voice.voice.state == "trained"
|
|
|
9
9
|
result = client.text_to_speech.run(model: "s2.1-pro", text: "Hello [excited]", voice_id: created.voice.voice_id, output_format: "wav", sample_rate_hz: 44_100)
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
Pass optional `references` entries with
|
|
12
|
+
Pass optional `references` entries with a publicly accessible HTTPS audio URL and exact transcripts for request-scoped voice matching.
|
|
13
13
|
|
|
14
14
|
Use `list_voices` and `get_voice` to inspect account-owned voice resources. Only `trained` voices can be submitted for speech generation; a returned `voice_id` is a best-effort reference and may stop working later. Update, delete, revoke, or voice-library management methods are not provided; voice retention is not promised.
|
|
15
15
|
|
|
@@ -18,3 +18,9 @@ The output defaults to MP3. Select WAV with `output_format`; `bitrate_kbps` appl
|
|
|
18
18
|
Model details and pricing: https://runapi.ai/models/fish-audio/s2.1-pro
|
|
19
19
|
|
|
20
20
|
Licensed under the Apache License, Version 2.0.
|
|
21
|
+
|
|
22
|
+
## Temporary voice matching
|
|
23
|
+
|
|
24
|
+
For `s1`, `s2-pro`, and `s2.1-pro`, supply at most one `references` item containing a publicly accessible HTTPS audio URL in `audio` and a nonempty, verbatim transcript in `text`. Do not send `voice_id` with a reference. Omit `references` when selecting an existing voice. The transcript is forwarded unchanged; callers must ensure it matches the audio.
|
|
25
|
+
|
|
26
|
+
For local audio or Base64, first upload through `POST /api/v1/files`, then use the returned `url` as `references[0].audio`. Keep only one sample and remove `voice_id`. The URL must remain valid while the request waits and the audio is fetched. Files URLs expire by default after one hour; storing a reference does not extend that lifetime. For longer waits, use an external HTTPS URL with enough validity. If a URL expires, upload again and submit a new request.
|
|
@@ -16,13 +16,11 @@ module RunApi
|
|
|
16
16
|
|
|
17
17
|
def run(options: nil, **params)
|
|
18
18
|
params = compact_params(params)
|
|
19
|
-
validate_contract!(CONTRACT["create-voice"], params)
|
|
20
19
|
run_hybrid(ENDPOINT, body: params, options: options, response_class: RESPONSE_CLASS)
|
|
21
20
|
end
|
|
22
21
|
|
|
23
22
|
def subscribe(options: nil, **params)
|
|
24
23
|
params = compact_params(params)
|
|
25
|
-
validate_contract!(CONTRACT["create-voice"], params)
|
|
26
24
|
subscribe_hybrid(ENDPOINT, body: params, options: options, response_class: RESPONSE_CLASS)
|
|
27
25
|
end
|
|
28
26
|
end
|
|
@@ -15,8 +15,6 @@ module RunApi
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def run(voice_id:, options: nil)
|
|
18
|
-
params = compact_params(voice_id: voice_id)
|
|
19
|
-
validate_contract!(CONTRACT["get-voice"], params)
|
|
20
18
|
path = "#{ENDPOINT}/#{URI.encode_uri_component(voice_id)}"
|
|
21
19
|
request(:get, path, options: options)
|
|
22
20
|
end
|
|
@@ -16,7 +16,6 @@ module RunApi
|
|
|
16
16
|
|
|
17
17
|
def run(options: nil, **params)
|
|
18
18
|
params = compact_params(params)
|
|
19
|
-
validate_contract!(CONTRACT["list-voices"], params)
|
|
20
19
|
query = URI.encode_www_form(params)
|
|
21
20
|
path = query.empty? ? ENDPOINT : "#{ENDPOINT}?#{query}"
|
|
22
21
|
request(:get, path, options: options)
|
|
@@ -16,36 +16,13 @@ module RunApi
|
|
|
16
16
|
|
|
17
17
|
def run(options: nil, **params)
|
|
18
18
|
params = compact_params(params)
|
|
19
|
-
validate_contract!(CONTRACT["text-to-speech"], params)
|
|
20
|
-
validate_references!(params[:references])
|
|
21
19
|
run_hybrid(ENDPOINT, body: params, options: options, response_class: RESPONSE_CLASS)
|
|
22
20
|
end
|
|
23
21
|
|
|
24
22
|
def subscribe(options: nil, **params)
|
|
25
23
|
params = compact_params(params)
|
|
26
|
-
validate_contract!(CONTRACT["text-to-speech"], params)
|
|
27
|
-
validate_references!(params[:references])
|
|
28
24
|
subscribe_hybrid(ENDPOINT, body: params, options: options, response_class: RESPONSE_CLASS)
|
|
29
25
|
end
|
|
30
|
-
|
|
31
|
-
private
|
|
32
|
-
|
|
33
|
-
def validate_references!(references)
|
|
34
|
-
return if references.nil?
|
|
35
|
-
raise Core::ValidationError, "references must be an array" unless references.is_a?(Array)
|
|
36
|
-
|
|
37
|
-
references.each_with_index do |reference, index|
|
|
38
|
-
raise Core::ValidationError, "references[#{index}] must be an object" unless reference.respond_to?(:key?)
|
|
39
|
-
|
|
40
|
-
%i[audio text].each do |field|
|
|
41
|
-
value = reference[field] || reference[field.to_s]
|
|
42
|
-
if value.nil? || (value.is_a?(String) && value.strip.empty?)
|
|
43
|
-
raise Core::ValidationError, "references[#{index}].#{field} is required"
|
|
44
|
-
end
|
|
45
|
-
raise Core::ValidationError, "references[#{index}].#{field} must be a string" unless value.is_a?(String)
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
26
|
end
|
|
50
27
|
end
|
|
51
28
|
end
|
|
@@ -13,7 +13,6 @@ module RunApi
|
|
|
13
13
|
# Response containing one reusable voice.
|
|
14
14
|
class VoiceResponse < RunApi::Core::BaseModel
|
|
15
15
|
required :voice, -> { Voice }
|
|
16
|
-
required :billing, RunApi::Core::TaskBillingFacts
|
|
17
16
|
end
|
|
18
17
|
|
|
19
18
|
# Paginated response containing account-owned reusable voices.
|
|
@@ -22,7 +21,6 @@ module RunApi
|
|
|
22
21
|
required :total, Integer
|
|
23
22
|
required :page_number, Integer
|
|
24
23
|
required :page_size, Integer
|
|
25
|
-
required :billing, RunApi::Core::TaskBillingFacts
|
|
26
24
|
end
|
|
27
25
|
|
|
28
26
|
# A RunAPI-managed audio result.
|
data/lib/runapi/fish_audio.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runapi-fish-audio
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- RunAPI
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.
|
|
18
|
+
version: 0.6.1
|
|
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.
|
|
25
|
+
version: 0.6.1
|
|
26
26
|
description: Install `runapi-fish-audio` and create a `RunApi::FishAudio::Client`.
|
|
27
27
|
email:
|
|
28
28
|
- contact@runapi.ai
|
|
@@ -36,7 +36,6 @@ files:
|
|
|
36
36
|
- lib/runapi-fish_audio.rb
|
|
37
37
|
- lib/runapi/fish_audio.rb
|
|
38
38
|
- lib/runapi/fish_audio/client.rb
|
|
39
|
-
- lib/runapi/fish_audio/contract_gen.rb
|
|
40
39
|
- lib/runapi/fish_audio/resources/create_voice.rb
|
|
41
40
|
- lib/runapi/fish_audio/resources/get_voice.rb
|
|
42
41
|
- lib/runapi/fish_audio/resources/list_voices.rb
|
|
@@ -66,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
66
65
|
- !ruby/object:Gem::Version
|
|
67
66
|
version: '0'
|
|
68
67
|
requirements: []
|
|
69
|
-
rubygems_version: 4.0.
|
|
68
|
+
rubygems_version: 4.0.10
|
|
70
69
|
specification_version: 4
|
|
71
70
|
summary: Fish Audio Ruby SDK for RunAPI
|
|
72
71
|
test_files: []
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module RunApi
|
|
4
|
-
module FishAudio
|
|
5
|
-
CONTRACT = {
|
|
6
|
-
"create-voice" => {
|
|
7
|
-
"models" => [],
|
|
8
|
-
"fields_by_model" => {
|
|
9
|
-
"_" => {
|
|
10
|
-
"name" => {
|
|
11
|
-
"required" => true
|
|
12
|
-
},
|
|
13
|
-
"source_audio_url" => {
|
|
14
|
-
"required" => true
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"get-voice" => {
|
|
20
|
-
"models" => [],
|
|
21
|
-
"fields_by_model" => {
|
|
22
|
-
"_" => {
|
|
23
|
-
"voice_id" => {
|
|
24
|
-
"required" => true
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"list-voices" => {
|
|
30
|
-
"models" => [],
|
|
31
|
-
"fields_by_model" => {
|
|
32
|
-
"_" => {
|
|
33
|
-
"page_number" => {
|
|
34
|
-
"min" => 1,
|
|
35
|
-
"type" => "integer"
|
|
36
|
-
},
|
|
37
|
-
"page_size" => {
|
|
38
|
-
"min" => 1,
|
|
39
|
-
"max" => 100,
|
|
40
|
-
"type" => "integer"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"text-to-speech" => {
|
|
46
|
-
"models" => ["s1", "s2-pro", "s2.1-pro"],
|
|
47
|
-
"fields_by_model" => {
|
|
48
|
-
"s1" => {
|
|
49
|
-
"bitrate_kbps" => {
|
|
50
|
-
"enum" => [64, 128, 192],
|
|
51
|
-
"type" => "integer"
|
|
52
|
-
},
|
|
53
|
-
"model" => {
|
|
54
|
-
"required" => true
|
|
55
|
-
},
|
|
56
|
-
"output_format" => {
|
|
57
|
-
"enum" => ["mp3", "wav"]
|
|
58
|
-
},
|
|
59
|
-
"sample_rate_hz" => {
|
|
60
|
-
"enum" => [8000, 16000, 24000, 32000, 44100],
|
|
61
|
-
"type" => "integer"
|
|
62
|
-
},
|
|
63
|
-
"text" => {
|
|
64
|
-
"required" => true
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
"s2-pro" => {
|
|
68
|
-
"bitrate_kbps" => {
|
|
69
|
-
"enum" => [64, 128, 192],
|
|
70
|
-
"type" => "integer"
|
|
71
|
-
},
|
|
72
|
-
"model" => {
|
|
73
|
-
"required" => true
|
|
74
|
-
},
|
|
75
|
-
"output_format" => {
|
|
76
|
-
"enum" => ["mp3", "wav"]
|
|
77
|
-
},
|
|
78
|
-
"sample_rate_hz" => {
|
|
79
|
-
"enum" => [8000, 16000, 24000, 32000, 44100],
|
|
80
|
-
"type" => "integer"
|
|
81
|
-
},
|
|
82
|
-
"text" => {
|
|
83
|
-
"required" => true
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
"s2.1-pro" => {
|
|
87
|
-
"bitrate_kbps" => {
|
|
88
|
-
"enum" => [64, 128, 192],
|
|
89
|
-
"type" => "integer"
|
|
90
|
-
},
|
|
91
|
-
"model" => {
|
|
92
|
-
"required" => true
|
|
93
|
-
},
|
|
94
|
-
"output_format" => {
|
|
95
|
-
"enum" => ["mp3", "wav"]
|
|
96
|
-
},
|
|
97
|
-
"sample_rate_hz" => {
|
|
98
|
-
"enum" => [8000, 16000, 24000, 32000, 44100],
|
|
99
|
-
"type" => "integer"
|
|
100
|
-
},
|
|
101
|
-
"text" => {
|
|
102
|
-
"required" => true
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
"rules" => [{
|
|
107
|
-
"when" => {
|
|
108
|
-
"output_format" => "wav"
|
|
109
|
-
},
|
|
110
|
-
"forbidden" => ["bitrate_kbps"]
|
|
111
|
-
}, {
|
|
112
|
-
"enum" => {
|
|
113
|
-
"sample_rate_hz" => [32000, 44100]
|
|
114
|
-
},
|
|
115
|
-
"when" => {
|
|
116
|
-
"output_format" => "mp3"
|
|
117
|
-
}
|
|
118
|
-
}, {
|
|
119
|
-
"enum" => {
|
|
120
|
-
"sample_rate_hz" => [32000, 44100]
|
|
121
|
-
},
|
|
122
|
-
"when" => {
|
|
123
|
-
"output_format" => {
|
|
124
|
-
"present" => false
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}]
|
|
128
|
-
}
|
|
129
|
-
}.freeze
|
|
130
|
-
end
|
|
131
|
-
end
|