openai-function-calling
openai-function-calling copied to clipboard
Add support of `strict: True` for function json schema generation
Overview of Feature
OpenAI API has provided strict parameter months ago, I think it would be nice to support a new parameter when use to_json_schema, like function_name.to_json_schema(strict: True)
https://platform.openai.com/docs/guides/function-calling#function-calling-with-structured-outputs
Why add this feature?
When you enable Structured Outputs by supplying strict: true, the OpenAI API will pre-process your supplied schema on your first request, and then use this artifact to constrain the model to your schema.
@cestivan Added a new strict parameter to the Function constructor. Thank you for the suggestion!