diff --git a/.changeset/great-students-turn.md b/.changeset/great-students-turn.md new file mode 100644 index 000000000000..af2a95e7123a --- /dev/null +++ b/.changeset/great-students-turn.md @@ -0,0 +1,5 @@ +--- +'ai': patch +--- + +ai/core: Fix openai provider streamObject for gpt-4-turbo diff --git a/packages/core/openai/openai-chat-language-model.ts b/packages/core/openai/openai-chat-language-model.ts index a741f8ed74ab..1e3a5bf0c390 100644 --- a/packages/core/openai/openai-chat-language-model.ts +++ b/packages/core/openai/openai-chat-language-model.ts @@ -126,7 +126,16 @@ export class OpenAIChatLanguageModel implements LanguageModelV1 { return { ...baseArgs, tool_choice: { type: 'function', function: { name: mode.tool.name } }, - tools: [{ type: 'function', function: mode.tool }], + tools: [ + { + type: 'function', + function: { + name: mode.tool.name, + description: mode.tool.description, + parameters: mode.tool.parameters, + }, + }, + ], }; } diff --git a/packages/core/openai/openai-chat-settings.ts b/packages/core/openai/openai-chat-settings.ts index 62f064664fa0..3fe94c05ed10 100644 --- a/packages/core/openai/openai-chat-settings.ts +++ b/packages/core/openai/openai-chat-settings.ts @@ -1,21 +1,20 @@ // https://platform.openai.com/docs/models export type OpenAIChatModelId = - | 'gpt-4' - | 'gpt-4-0314' - | 'gpt-4-0613' + | 'gpt-4-turbo' + | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo-preview' - | 'gpt-4-1106-preview' | 'gpt-4-0125-preview' + | 'gpt-4-1106-preview' | 'gpt-4-vision-preview' + | 'gpt-4' + | 'gpt-4-0613' | 'gpt-4-32k' - | 'gpt-4-32k-0314' | 'gpt-4-32k-0613' - | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-0125' + | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' - | 'gpt-3.5-turbo-0301' - | 'gpt-3.5-turbo-0613' | 'gpt-3.5-turbo-16k' + | 'gpt-3.5-turbo-0613' | 'gpt-3.5-turbo-16k-0613' | (string & {});