Skip to content

Commit dcd7757

Browse files
committed
Fix example
1 parent b7ef7b9 commit dcd7757

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

README.md

+11-3
Original file line numberDiff line numberDiff line change
@@ -219,16 +219,24 @@ puts response.dig("choices", 0, "message", "content")
219219

220220
#### JSON Mode
221221

222-
You can set the response_format to ask for responses in JSON:
222+
You can set the response_format to ask for responses in JSON (at least for `gpt-3.5-turbo-1106`):
223223

224224
```ruby
225225
response = client.chat(
226226
parameters: {
227-
model: "gpt-3.5-turbo",
227+
model: "gpt-3.5-turbo-1106",
228228
response_format: { type: "json_object" },
229-
messages: [{ role: "user", content: "Hello!"}],
229+
messages: [{ role: "user", content: "Hello! Give me some JSON please."}],
230230
temperature: 0.7,
231231
})
232+
puts response.dig("choices", 0, "message", "content")
233+
{
234+
"name": "John",
235+
"age": 30,
236+
"city": "New York",
237+
"hobbies": ["reading", "traveling", "hiking"],
238+
"isStudent": false
239+
}
232240
```
233241

234242
### Functions

0 commit comments

Comments
 (0)