openai-hs icon indicating copy to clipboard operation
openai-hs copied to clipboard

Add support for response_format

Open adinapoli opened this issue 1 year ago • 1 comments

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!

adinapoli avatar Dec 06 '23 07:12 adinapoli

This is great! One small concern is that there's lots of response_format across different APIs. Maybe rename to ChatResponseFormat?

nickhs avatar Mar 23 '24 15:03 nickhs

merged - I'll do a quick rename myself. Thanks @adinapoli!

nickhs avatar Jul 13 '24 15:07 nickhs