MacPaw / OpenAI

Swift community driven package for OpenAI public API
MIT License
2.11k stars 357 forks source link

Feat: Structured Outputs for function calling #226

Closed neelvirdy closed 1 month ago

neelvirdy commented 2 months ago

What

Support the optional strict parameter in function definitions, which was released with Structured Outputs.

When strict is provided, the API requires additionalProperties to be provided in the parameters object of the function definition as well.

The earliest models that support this feature are gpt-4o-2024-08-06 and gpt-4o-mini-2024-07-18.

This does NOT include support for the json_schema response_format for Structured Outputs outside of function definitions.

Why

This parameter improves the model's adherence to JSON schemas during function calls. See more

Affected Areas

Non-breaking change to decoder, since only optional parameters were added.

sonarcloud[bot] commented 2 months ago

Quality Gate Failed Quality Gate failed

Failed conditions
21.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud