diff --git a/packages/openai-compatible/src/convert-to-openai-compatible-chat-messages.test.ts b/packages/openai-compatible/src/convert-to-openai-compatible-chat-messages.test.ts index 8821f161ee97..54b8a9a71cf6 100644 --- a/packages/openai-compatible/src/convert-to-openai-compatible-chat-messages.test.ts +++ b/packages/openai-compatible/src/convert-to-openai-compatible-chat-messages.test.ts @@ -428,7 +428,8 @@ describe('complex part-level transformations', () => { const result = convertToOpenAICompatibleChatMessages([ { role: 'tool', - providerMetadata: { // this just gets omitted as we prioritize content-level metadata + providerMetadata: { + // this just gets omitted as we prioritize content-level metadata openaiCompatible: { responseTier: 'detailed' }, }, content: [ diff --git a/packages/openai-compatible/src/convert-to-openai-compatible-chat-messages.ts b/packages/openai-compatible/src/convert-to-openai-compatible-chat-messages.ts index 3f6addf67fbf..95a262648868 100644 --- a/packages/openai-compatible/src/convert-to-openai-compatible-chat-messages.ts +++ b/packages/openai-compatible/src/convert-to-openai-compatible-chat-messages.ts @@ -6,7 +6,9 @@ import { import { convertUint8ArrayToBase64 } from '@ai-sdk/provider-utils'; import { OpenAICompatibleChatPrompt } from './openai-compatible-api-types'; -function getOpenAIMetadata(message: { providerMetadata?: LanguageModelV1ProviderMetadata }) { +function getOpenAIMetadata(message: { + providerMetadata?: LanguageModelV1ProviderMetadata; +}) { return message?.providerMetadata?.openaiCompatible ?? {}; } @@ -24,7 +26,11 @@ export function convertToOpenAICompatibleChatMessages( case 'user': { if (content.length === 1 && content[0].type === 'text') { - messages.push({ role: 'user', content: content[0].text, ...getOpenAIMetadata(content[0]) }); + messages.push({ + role: 'user', + content: content[0].text, + ...getOpenAIMetadata(content[0]), + }); break; } @@ -43,8 +49,9 @@ export function convertToOpenAICompatibleChatMessages( url: part.image instanceof URL ? part.image.toString() - : `data:${part.mimeType ?? 'image/jpeg' - };base64,${convertUint8ArrayToBase64(part.image)}`, + : `data:${ + part.mimeType ?? 'image/jpeg' + };base64,${convertUint8ArrayToBase64(part.image)}`, }, ...partMetadata, };