openai_ruby 0.4.4 → 0.5.2

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: f2f23fff1edcd7d6c7a6bc1d605ab251ac74c4aaf29f8c9a3cb3b661cc479bfb
4
- data.tar.gz: 1cb460f0bb06b19e31121017ee63640dff99fbbda07b8a3487bbcf47a933aa54
3
+ metadata.gz: 91361df72462f49209491acf92303a7fb6f47ab9a947303da373b8345b7736c4
4
+ data.tar.gz: 5bb2b48ff21f949605e2fe9072dfd9d324c0ce4803462fc6c3c83a19b8fd2d1a
5
5
  SHA512:
6
- metadata.gz: 3ae36726d144aaec060cad84594e962f4a1689cab2032e1d26ecc00d34229f621b035b072e8d741cadea205c30088fd9244b320b5b3745e6450984a9c893e8dd
7
- data.tar.gz: 3290de2a8a6a290c7a08a11035a30be26180ae4af372b433dcc55d3d53358f33e486b9a787eb5e843e700942f4c033c7e3c287c23c5c3248bebde5126412f7bc
6
+ metadata.gz: cb209a9bafe457eebd91e7467e96e3b87433d6e8807a0b0be2e9427fa4b1b4e7cd782ea8aaea21c6283009188aecf7721b025dd62414cc940bb8d03fe6de8888
7
+ data.tar.gz: '03186808fd04b88f991d53eed795f0fe56ca801d67bb4db7e7eae3f615cafe5473c6c7121d9b4d0d975acf450bd7e3bed587ffff6846dcd72e3a47aa82ea523f'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openai_ruby (0.4.4)
4
+ openai_ruby (0.5.2)
5
5
  event_stream_parser (~> 1.0)
6
6
  faraday (~> 2.7)
7
7
 
@@ -51,6 +51,11 @@ module OpenAI
51
51
  )
52
52
  end
53
53
 
54
+ def create_speech(params = {})
55
+ params.deep_stringify_keys!
56
+ connection.post("/v1/audio/speech", params.to_json)
57
+ end
58
+
54
59
  def images
55
60
  @images ||= OpenAI::Images.new(connection)
56
61
  end
@@ -60,13 +65,13 @@ module OpenAI
60
65
 
61
66
  if session
62
67
  boundary, body = build_multipart_body(sdp_offer, session)
63
- response = Faraday.post(uri) do |req|
68
+ Faraday.post(uri) do |req|
64
69
  req.headers["Authorization"] = "Bearer #{api_key}"
65
70
  req.headers["Content-Type"] = "multipart/form-data; boundary=#{boundary}"
66
71
  req.body = body
67
72
  end
68
73
  else
69
- response = Faraday.post(uri) do |req|
74
+ Faraday.post(uri) do |req|
70
75
  req.headers["Content-Type"] = "application/sdp"
71
76
  req.headers["Authorization"] = "Bearer #{api_key}"
72
77
  req.body = sdp_offer
@@ -83,7 +88,7 @@ module OpenAI
83
88
  def headers
84
89
  {
85
90
  "Content-Type" => "application/json",
86
- "Authorization" => "Bearer #{api_key}",
91
+ "Authorization" => "Bearer #{api_key}"
87
92
  }
88
93
  end
89
94
 
@@ -97,8 +102,9 @@ module OpenAI
97
102
  boundary = "----RubyFormBoundary#{SecureRandom.hex(16)}"
98
103
  parts = [
99
104
  ["--#{boundary}", 'Content-Disposition: form-data; name="sdp"', "Content-Type: application/sdp", "", sdp_offer],
100
- ["--#{boundary}", 'Content-Disposition: form-data; name="session"', "Content-Type: application/json", "", session.to_json],
101
- ["--#{boundary}--"],
105
+ ["--#{boundary}", 'Content-Disposition: form-data; name="session"', "Content-Type: application/json", "",
106
+ session.to_json],
107
+ ["--#{boundary}--"]
102
108
  ]
103
109
 
104
110
  [boundary, parts.flatten.join("\r\n")]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenAI
4
- VERSION = "0.4.4"
4
+ VERSION = "0.5.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openai_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renny Ren
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-12-12 00:00:00.000000000 Z
11
+ date: 2026-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: event_stream_parser