openai-function-calling icon indicating copy to clipboard operation
openai-function-calling copied to clipboard

Add support of `strict: True` for function json schema generation

Open cestivan opened this issue 2 years ago • 1 comments

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 avatar Nov 12 '24 06:11 cestivan

@cestivan Added a new strict parameter to the Function constructor. Thank you for the suggestion!

jakecyr avatar Mar 07 '25 01:03 jakecyr