Skip to content

Commit

Permalink
feat (provider/openai): add o3 reasoning model support (#4240)
Browse files Browse the repository at this point in the history
Co-authored-by: Ankush Agarwal <[email protected]>
  • Loading branch information
lgrammel and ankushagarwal authored Jan 2, 2025
1 parent 81ed334 commit a4241ff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/shaggy-mayflies-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ai-sdk/openai': patch
---

feat (provider/openai): add o3 reasoning model support
7 changes: 6 additions & 1 deletion packages/openai/src/openai-chat-language-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,12 @@ const openaiChatChunkSchema = z.union([
]);

function isReasoningModel(modelId: string) {
return modelId === 'o1' || modelId.startsWith('o1-');
return (
modelId === 'o1' ||
modelId.startsWith('o1-') ||
modelId === 'o3' ||
modelId.startsWith('o3-')
);
}

function isAudioModel(modelId: string) {
Expand Down

0 comments on commit a4241ff

Please sign in to comment.