runapi-fish-audio 0.3.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7787228caf6e8b7f36cde94f0930290801d93ae6fb7d613a948ca44013d3959e
4
- data.tar.gz: '087c22f1cb69cdf5223f51b6448a966747e98352cecd52207bc00f04dda9ac82'
3
+ metadata.gz: f69dd7bac500e867eaeafa2127d95922d416e0c8722c4c50ae47ed7d55602ff7
4
+ data.tar.gz: 1a22451d02f8c8f8a4bb344ab0615b0d76430f717305ec847798d1fa4fec05c1
5
5
  SHA512:
6
- metadata.gz: 75e4e995715cca713106a0924f13589d64abe674cc490789bef0b2759563a22f1fa706ceb314302e04fcf811d7fd71659639c5917a3071ecb37555410442cda5
7
- data.tar.gz: 7ca414ef2c860949a2de6fcfd981e6b0e6f93b306025b0f90a392394a3c47e55b1c409ba1d8753ab98b5bb9e49cd9863533588a367c2a4e54e84555ab2d63015
6
+ metadata.gz: d879e3f251bf8552df1a4008295936878f96b1c3737f63fa36dff418e6a089ae13fc1b4da946b893626abf71ba288a927cae478d2f7fecff9e0b0f1e899dc917
7
+ data.tar.gz: b9c4590438f124f2959acffbb04752899fcd42cd78b2f610b3ad8ca9758ed9880155e58169849848ba59480de53b1ec9cda66070b4f4f286317adecef65bc675
@@ -16,8 +16,12 @@ 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
- request(:post, ENDPOINT, body: params, options: options)
19
+ run_hybrid(ENDPOINT, body: params, options: options, response_class: RESPONSE_CLASS)
20
+ end
21
+
22
+ def subscribe(options: nil, **params)
23
+ params = compact_params(params)
24
+ subscribe_hybrid(ENDPOINT, body: params, options: options, response_class: RESPONSE_CLASS)
21
25
  end
22
26
  end
23
27
  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,28 +16,12 @@ 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
- request(:post, ENDPOINT, body: params, options: options)
19
+ run_hybrid(ENDPOINT, body: params, options: options, response_class: RESPONSE_CLASS)
22
20
  end
23
21
 
24
- private
25
-
26
- def validate_references!(references)
27
- return if references.nil?
28
- raise Core::ValidationError, "references must be an array" unless references.is_a?(Array)
29
-
30
- references.each_with_index do |reference, index|
31
- raise Core::ValidationError, "references[#{index}] must be an object" unless reference.respond_to?(:key?)
32
-
33
- %i[audio text].each do |field|
34
- value = reference[field] || reference[field.to_s]
35
- if value.nil? || (value.is_a?(String) && value.strip.empty?)
36
- raise Core::ValidationError, "references[#{index}].#{field} is required"
37
- end
38
- raise Core::ValidationError, "references[#{index}].#{field} must be a string" unless value.is_a?(String)
39
- end
40
- end
22
+ def subscribe(options: nil, **params)
23
+ params = compact_params(params)
24
+ subscribe_hybrid(ENDPOINT, body: params, options: options, response_class: RESPONSE_CLASS)
41
25
  end
42
26
  end
43
27
  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.
@@ -2,7 +2,6 @@
2
2
 
3
3
  require "runapi/core"
4
4
  require_relative "fish_audio/types"
5
- require_relative "fish_audio/contract_gen"
6
5
  require_relative "fish_audio/resources/create_voice"
7
6
  require_relative "fish_audio/resources/list_voices"
8
7
  require_relative "fish_audio/resources/get_voice"
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.3.0
4
+ version: 0.5.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.4.0
18
+ version: 0.6.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.4.0
25
+ version: 0.6.0
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
@@ -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