Skip to content

fix(openai): support fine-tuned models in structured output#958

Open
danielsimkus wants to merge 1 commit intoprism-php:mainfrom
danielsimkus:bug/add-support-for-openai-finetuned-models
Open

fix(openai): support fine-tuned models in structured output#958
danielsimkus wants to merge 1 commit intoprism-php:mainfrom
danielsimkus:bug/add-support-for-openai-finetuned-models

Conversation

@danielsimkus
Copy link

@danielsimkus danielsimkus commented Mar 17, 2026

Description

Fine-tuned OpenAI models (e.g. ft:gpt-4.1-mini-2025-04-14:company:model-name:hash) silently fall back to JSON mode instead of using structured output. The resolver now extracts the base model from fine-tuned identifiers and uses prefix matching to correctly resolve structured output support for dated model variants.

Changes

  • Extract base model from ft: prefixed identifiers before checking support
  • Replace exact in_array matching with prefix matching for structured output support (covers gpt-4o, gpt-4.1, gpt-4.5, gpt-5, chatgpt-4o, and o3-mini families)
  • Add 29 test cases covering all previously supported models and fine-tuned variants (These cover all the previous structured models that were changed to be prefix based)

Allow fine-tuned models (e.g. ft:gpt-4.1-mini-2025-04-14:company:model-name:hash) to use structured output by extracting the base model and using prefix matching for version-dated variants.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@danielsimkus danielsimkus force-pushed the bug/add-support-for-openai-finetuned-models branch from 13c4bae to 979528e Compare March 18, 2026 10:14
@ashleyhindle
Copy link

Yes please 🫡

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants