-
Notifications
You must be signed in to change notification settings - Fork 229
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Feature Description
OpenAI has added support for structured outputs in its API: https://openai.com/index/introducing-structured-outputs-in-the-api/
Ultimately, this means the existing ChatResponseFormat is inadequate. While I could use the class to declare a type of json_schema
in the response format, ultimately I won't be able to actually provide the schema in this fashion.
Problem it Solves
Adding support for this OpenAPI feature.
Proposed Solution
If you don't have time to fully implement this, a simpler and more flexible option would be as follows:
- Make a parent interface for
ChatResponseFormat
that is implemented by the current class. Let's call itGenericChatResponseFormat
, you can decide on a better name. - Make
ChatCompletionRequest.responseFormat
be of this new type (GenericChatResponseFormat
). - Anyone can now implement their own response format.
- Your code just serializes the format and provides it to OpenAI in the request.
Obviously a full implementation of the structured output would be desirable, but this may be an alternative approach to quickly achieve the same thing.
Additional Context
N/A
GuilhermeFreire, Ant00000ny, cvb941, lucasmsoares96, alaegin and 15 more
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request