Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ai): Update OpenAI models supporting structured output #14247

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions packages/ai-openai/src/node/openai-language-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,12 @@ export class OpenAiModel implements LanguageModel {
}

protected supportsStructuredOutput(): boolean {
// currently only the lastest 4o and 4o-mini models support structured output
// see https://platform.openai.com/docs/guides/structured-outputs
return this.model === 'gpt-4o-2024-08-06' || this.model === 'gpt-4o-mini';
// see https://platform.openai.com/docs/models/gpt-4o
return [
'gpt-4o',
'gpt-4o-2024-08-06',
'gpt-4o-mini'
].includes(this.model);
}

protected async handleStructuredOutputRequest(openai: OpenAI, request: LanguageModelRequest): Promise<LanguageModelParsedResponse> {
Expand Down
Loading