openai-hs
openai-hs copied to clipboard
Add support for response_format
Morning @agrafix 😉
Recent versions of OpenAI added JSON mode.
Passing a response_format
object in a chat completion request ensures that OpenAI will try to respond with valid JSON.
I have extended a ChatCompletionRequest
with this field which is optional anyway (as per documentation), so these changes are all backward compatibile.
Thanks!
This is great! One small concern is that there's lots of response_format
across different APIs. Maybe rename to ChatResponseFormat
?
merged - I'll do a quick rename myself. Thanks @adinapoli!