openai_ruby 0.5.6 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84416f248ba1af3cd564bdf72b9b125fe5995a10fea0c3b273115ed42123d1dd
4
- data.tar.gz: 77228baf14fd26b1f85f843ea25da388d2d0d20e4f65ff53541f543fb9f6e30f
3
+ metadata.gz: a95f09a2242c8a67613fb0589cc480d8fd36f17b4fbf42d52a4f7969626e0427
4
+ data.tar.gz: e8be0ae8f3cffc9e163f47768d6e70750972f38af1b1aaae08b0f518d0c7c52e
5
5
  SHA512:
6
- metadata.gz: 1c9a04302598fcb7926064079cca7b95517c07c46de1c0c29b23c132ac44f5cb36689add98691e2921f7adcc21039e9310772f7f1f273c1dc2c61fa78ef0f6f6
7
- data.tar.gz: 34964a45e000c84fe68b3ad03a4ab49419cf49bfc39c8bff344c1a83a76bceac8c0cee3168691d94b52c38a1ff7630f539c09bb2fdbee8c4470041e37bf913a8
6
+ metadata.gz: 29fb10ed072c4b71cc5cd159903fa2a17c1cff924327837a9aabdd3e59c7733c72c19383a4b5a1a91ce2ae1824abcfde98a2de1738ac633efdca5b6cbd9d8e37
7
+ data.tar.gz: 4e799005b2565d0c51795ae4e0fec54658df56b962d065200f33044a06f2f7e22bb90288e0544247e1c140a284bed60462b716ca65d01f240a1cdce6456eec74
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.6.0] - 2026-08-20
4
+
5
+ - Add non-streaming and SSE streaming support for the Responses API through `OpenAI::Client#create_response`.
6
+
3
7
  ## [0.5.6] - 2026-08-15
4
8
 
5
9
  - Preserve complete error response bodies when streamed HTTP errors arrive in multiple chunks.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openai_ruby (0.5.6)
4
+ openai_ruby (0.6.0)
5
5
  event_stream_parser (~> 1.0)
6
6
  faraday (~> 2.7)
7
7
  faraday-multipart (~> 1.1)
data/README.md CHANGED
@@ -76,6 +76,21 @@ res = client.create_chat_completion(params) do |data|
76
76
  end
77
77
  ```
78
78
 
79
+ ### Responses
80
+
81
+ Use `create_response` for the Responses API. When `stream` is true, the block receives each parsed SSE event:
82
+
83
+ ```ruby
84
+ res = client.create_response(
85
+ model: "gpt-5.6-terra",
86
+ input: "Explain why the answer is correct.",
87
+ store: false,
88
+ stream: true
89
+ ) do |event|
90
+ print event["delta"] if event["type"] == "response.output_text.delta"
91
+ end
92
+ ```
93
+
79
94
  ### Edit
80
95
 
81
96
  https://platform.openai.com/docs/api-reference/edits
@@ -23,7 +23,13 @@ module OpenAI
23
23
  def create_chat_completion(params = {}, &block)
24
24
  return connection.post("/v1/chat/completions", params.to_json) unless streaming?(params)
25
25
 
26
- create_streaming_chat_completion(params, &block)
26
+ create_streaming_request("/v1/chat/completions", params, &block)
27
+ end
28
+
29
+ def create_response(params = {}, &block)
30
+ return connection.post("/v1/responses", params.to_json) unless streaming?(params)
31
+
32
+ create_streaming_request("/v1/responses", params, &block)
27
33
  end
28
34
 
29
35
  def create_edit(params = {})
@@ -84,10 +90,10 @@ module OpenAI
84
90
  params[:stream] || params["stream"]
85
91
  end
86
92
 
87
- def create_streaming_chat_completion(params, &block)
93
+ def create_streaming_request(path, params, &block)
88
94
  parser = EventStreamParser::Parser.new
89
95
  error_body = +""
90
- response = connection.post("/v1/chat/completions") do |req|
96
+ response = connection.post(path) do |req|
91
97
  req.body = params.to_json
92
98
  req.options.on_data = proc do |chunk, _overall_received_bytes, env|
93
99
  handle_streaming_chunk(parser, error_body, chunk, env, &block)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenAI
4
- VERSION = "0.5.6"
4
+ VERSION = "0.6.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openai_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renny Ren