JSON mode
andrius opened this issue · comments
Actually this is not a bug. I want to get a plain JSON from the OpenAI, recently they have introduced the JSON mode: https://platform.openai.com/docs/guides/text-generation/json-mode
It is possible to call it somehow?
Hello, sure is
response = client.chat(
parameters: {
model: "gpt-3.5-turbo-1106",
response_format: { type: "json_object" },
messages: [{ role: "user", content: "Hello! Give me some JSON please."}],
temperature: 0.7,
})
puts response.dig("choices", 0, "message", "content")
Added it to the README https://github.com/alexrudall/ruby-openai#json-mode
Recently groq too added, but when I give the option it fails! Any ideas?