You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Quick guide to streaming Chat with Rails 7 and Hotwire](https://gist.github.com/alexrudall/cb5ee1e109353ef358adb4e66631799d)
180
180
@@ -195,6 +195,28 @@ client.chat(
195
195
196
196
Note: OpenAPI currently does not report token usage for streaming responses. To count tokens while streaming, try `OpenAI.rough_token_count` or [tiktoken_ruby](https://github.com/IAPark/tiktoken_ruby). We think that each call to the stream proc corresponds to a single token, so you can also try counting the number of calls to the proc to get the completion token count.
197
197
198
+
#### Vision
199
+
200
+
You can use the GPT-4 Vision model to generate a description of an image:
201
+
202
+
```ruby
203
+
messages = [
204
+
{ "type": "text", "text": "What’s in this image?"},
# => "The image depicts a serene natural landscape featuring a long wooden boardwalk extending straight ahead"
218
+
```
219
+
198
220
### Functions
199
221
200
222
You can describe and pass in functions and the model will intelligently choose to output a JSON object containing arguments to call those them. For example, if you want the model to use your method `get_current_weather` to get the current weather in a given location:
0 commit comments