Skip to content

Commit

Permalink
feat(ai): Update OpenAI models supporting structured output
Browse files Browse the repository at this point in the history
  • Loading branch information
planger committed Oct 3, 2024
1 parent ce5e13f commit ac0c246
Showing 1 changed file with 6 additions and 3 deletions.
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

0 comments on commit ac0c246

Please sign in to comment.