We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 468d2c8 + 667ebf4 commit 1ded4b7Copy full SHA for 1ded4b7
lib/openai/http.rb
@@ -8,9 +8,11 @@ def get(path:)
8
9
def json_post(path:, parameters:)
10
to_json(conn.post(uri(path: path)) do |req|
11
- if parameters[:stream].is_a?(Proc)
+ if parameters[:stream].respond_to?(:call)
12
req.options.on_data = to_json_stream(user_proc: parameters[:stream])
13
parameters[:stream] = true # Necessary to tell OpenAI to stream.
14
+ elsif parameters[:stream]
15
+ raise ArgumentError, "stream must be callable"
16
end
17
18
req.headers = headers
0 commit comments