Skip to content

Commit 038a81f

Browse files
committed
Tweak docs
1 parent bf29da4 commit 038a81f

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ puts response.dig("choices", 0, "message", "content")
180180

181181
[Quick guide to streaming Chat with Rails 7 and Hotwire](https://gist.github.com/alexrudall/cb5ee1e109353ef358adb4e66631799d)
182182

183-
You can stream from the API in realtime, which can be much faster and used to create a more engaging user experience. Pass a [Proc](https://ruby-doc.org/core-2.6/Proc.html) (or any object with a `#call` method) to the `stream` parameter to receive the stream of completion chunks as they are generated. Each time one or more chunks is received, the proc will be called once with each chunk, parsed as a Hash. If OpenAI returns an error, `ruby-openai` will raise an error.
183+
You can stream from the API in realtime, which can be much faster and used to create a more engaging user experience. Pass a [Proc](https://ruby-doc.org/core-2.6/Proc.html) (or any object with a `#call` method) to the `stream` parameter to receive the stream of completion chunks as they are generated. Each time one or more chunks is received, the proc will be called once with each chunk, parsed as a Hash. If OpenAI returns an error, `ruby-openai` will raise a Faraday error.
184184

185185
```ruby
186186
client.chat(

lib/openai/http.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ def to_json(string)
5050
# For each chunk, the inner user_proc is called giving it the JSON object. The JSON object could
5151
# be a data object or an error object as described in the OpenAI API documentation.
5252
#
53-
# If the JSON object for a given data or error message is invalid, it is ignored.
54-
#
5553
# @param user_proc [Proc] The inner proc to call for each JSON object in the chunk.
5654
# @return [Proc] An outer proc that iterates over a raw stream, converting it to JSON.
5755
def to_json_stream(user_proc:)

0 commit comments

Comments
 (0)