OpenAI result_format JSON
Is your feature request related to a problem? Please describe.
OpenAI now provides a JSON response format! https://community.openai.com/t/how-do-i-use-the-new-json-mode/475890/14
Since OpenAI does not support enforced grammar, this is a big deal.
Describe the solution you'd like
The json grammar should trigger this functionality in the OpenAIChatEngine
Relevant lines of code:
https://github.com/guidance-ai/guidance/blob/7c71e90ece97c879d4b3a1e2b33ecd6a522a25dd/guidance/models/_openai.py#L243-L251
https://github.com/guidance-ai/guidance/blob/7c71e90ece97c879d4b3a1e2b33ecd6a522a25dd/guidance/library/_json.py#L204-L211
Need to upgrade openai to 1.1 based on https://github.com/openai/openai-python/compare/v1.0.1...v1.1.0
Relevant api link https://platform.openai.com/docs/api-reference/chat/create#chat-create-response_format
Related PR's https://github.com/guidance-ai/guidance/pull/699 https://github.com/guidance-ai/guidance/pull/724