runapi-openai-transcription 0.1.0 → 0.2.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: 7914f14742c62a4af376c067d9dd9aafaa23e47014fdabbe216c8dfea17b21f7
4
- data.tar.gz: 962a94b3f6c1929f8ba650ec3999a2bda5cef18cbff89d32311141421e06eb28
3
+ metadata.gz: a8d58c023d4a1dc18f3f4f29d0dfac3fbbb62e4371bd9881d706a34d106aa0a3
4
+ data.tar.gz: 60a4942cf6429a83a003859816ca6132bc6b66c552a1302ec618ae03815c61a0
5
5
  SHA512:
6
- metadata.gz: 9a56ba68832fd7dc477c54edb2af09bcda13d1193693c44403c6ffd3470d5b47f5d5c880ce50c19432fc55e434a3c037dcd7162b6c0910f4b5b2d3ebe1f51f7f
7
- data.tar.gz: 1eb165c513f14912570c28ef8b8c092190da40369e2b8346c1aee1118e47aa8f279429388bd83701a516e458a112652ecd092899ccc1c40f3ffd06a0a1996bde
6
+ metadata.gz: dd061861006220bab15d19b66393696031f60c2186f69af00999507db32a71cb25e80dd4b3f22f3efd32d98ad4ac9b1eb9d0cfecb0d0302bc75e3f0d6a63a9f4
7
+ data.tar.gz: 976ed47fc65156da72f737f17451ee0606ef4b408ccb1a8220dd2f0ccd53a927bc3e16c308d039c319b304223b866f0a367cf862e419a681e34d9b98cd3ae210
@@ -13,6 +13,20 @@ module RunApi
13
13
  end
14
14
 
15
15
  def run(file:, options: nil, **params)
16
+ params = compact_params({file:, model: params.delete(:model) || "whisper-1", **params})
17
+ validate_contract!(CONTRACT["speech-to-text"], params)
18
+ fields = params.except(:file, :languages, :keywords, :timestamp_granularities)
19
+ fields["languages[]"] = params[:languages] if params[:languages]
20
+ fields["keywords[]"] = params[:keywords] if params[:keywords]
21
+ fields["timestamp_granularities[]"] = params[:timestamp_granularities] if params[:timestamp_granularities]
22
+ body = RunApi::Core::MultipartBody.new(
23
+ fields:,
24
+ files: {file: RunApi::Core::MultipartFile.new(path: file, filename: File.basename(file), content_type: content_type(file))}
25
+ )
26
+ run_hybrid(ENDPOINT, body:, options: options, response_class: nil)
27
+ end
28
+
29
+ def subscribe(file:, options: nil, **params)
16
30
  params = compact_params({file:, model: params.delete(:model) || "whisper-1", **params})
17
31
  validate_contract!(CONTRACT["speech-to-text"], params)
18
32
  fields = params.except(:file, :languages, :keywords, :timestamp_granularities)
@@ -23,8 +37,7 @@ module RunApi
23
37
  fields:,
24
38
  files: {file: RunApi::Core::MultipartFile.new(path: file, filename: File.basename(file), content_type: content_type(file))}
25
39
  )
26
- response = @http.request(:post, ENDPOINT, body:, **(options ? {options:} : {}))
27
- response.is_a?(RunApi::Core::Response) ? response.body : response
40
+ subscribe_hybrid(ENDPOINT, body:, options: options, response_class: nil)
28
41
  end
29
42
 
30
43
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runapi-openai-transcription
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.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.3.3
18
+ version: 0.5.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.3.3
25
+ version: 0.5.0
26
26
  description: OpenAI-compatible audio transcription through RunAPI.
27
27
  email:
28
28
  - contact@runapi.ai