Skip to content

Commit 4171dc5

Browse files
authored
Update README.md
1 parent 26ab454 commit 4171dc5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ Use the [OpenAI API](https://openai.com/blog/openai-api/) with Ruby! 🤖❤️
99
Stream text with GPT-4, transcribe and translate audio with Whisper, or create images with DALL·E...
1010

1111
[Ruby AI Builders Discord](https://discord.gg/k4Uc224xVD)
12-
[How to stream ChatGPT with Rails 7 and Hotwire](https://gist.github.com/alexrudall/cb5ee1e109353ef358adb4e66631799d)
12+
13+
[Quick guide to streaming ChatGPT with Rails 7 and Hotwire](https://gist.github.com/alexrudall/cb5ee1e109353ef358adb4e66631799d)
1314

1415
### Bundler
1516

@@ -129,6 +130,8 @@ puts response.dig("choices", 0, "message", "content")
129130

130131
### Streaming ChatGPT
131132

133+
[Quick guide to streaming ChatGPT with Rails 7 and Hotwire](https://gist.github.com/alexrudall/cb5ee1e109353ef358adb4e66631799d)
134+
132135
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) to the `stream` parameter to receive the stream of text 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 pass that to your proc as a Hash.
133136

134137
```ruby

0 commit comments

Comments
 (0)