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

Issue submitting image query with base64 data #1555

Closed
sambecker opened this issue May 10, 2024 · 7 comments
Closed

Issue submitting image query with base64 data #1555

sambecker opened this issue May 10, 2024 · 7 comments

Comments

@sambecker
Copy link

sambecker commented May 10, 2024

Description

Getting errors when submitting a base64-encoded image as part of a StreamUI query.

Code example

Old SDK call, which still works:

render({
  provider,
  model: 'gpt-4-vision-preview',
  messages: [{
    'role': 'user',
    'content': [
      {
        'type': 'text',
        'text': query,
      }, {
        'type': 'image_url',
        'image_url': {
          'url': imageBase64,
        },
      },
    ],
  }],
});

New SDK call, which errors:

const { textStream } = await streamText({
  model: openai('gpt-4-vision-preview'),
  messages: [{
    'role': 'user',
    'content': [
      {
        'type': 'text',
        'text': query,
      }, {
        'type': 'image',
        'image': imageBase64,
      },
    ],
  }],
});

Error:

DOMException [InvalidCharacterError]: Invalid character
    at new DOMException (node:internal/per_context/domexception:53:5)
    at __node_internal_ (node:internal/util:695:10)
    at atob (node:buffer:1330:13)
    at convertBase64ToUint8Array (webpack-internal:///(action-browser)/./node_modules/.pnpm/@ai-sdk+provider-utils@0.0.6_zod@3.23.4/node_modules/@ai-sdk/provider-utils/dist/index.mjs:401:35)
    at convertDataContentToUint8Array (webpack-internal:///(action-browser)/./node_modules/.pnpm/ai@3.1.5_openai@4.44.0_react@18.3.1_solid-js@1.8.17_svelte@4.2.15_vue@3.4.25_typescript@5.4.5__zod@3.23.4/node_modules/ai/dist/index.mjs:128:93)
    at eval (webpack-internal:///(action-browser)/./node_modules/.pnpm/ai@3.1.5_openai@4.44.0_react@18.3.1_solid-js@1.8.17_svelte@4.2.15_vue@3.4.25_typescript@5.4.5__zod@3.23.4/node_modules/ai/dist/index.mjs:181:44)
    at Array.map (<anonymous>)
    at eval (webpack-internal:///(action-browser)/./node_modules/.pnpm/ai@3.1.5_openai@4.44.0_react@18.3.1_solid-js@1.8.17_svelte@4.2.15_vue@3.4.25_typescript@5.4.5__zod@3.23.4/node_modules/ai/dist/index.mjs:166:42)
    at Array.map (<anonymous>)
    at convertToLanguageModelPrompt (webpack-internal:///(action-browser)/./node_modules/.pnpm/ai@3.1.5_openai@4.44.0_react@18.3.1_solid-js@1.8.17_svelte@4.2.15_vue@3.4.25_typescript@5.4.5__zod@3.23.4/node_modules/ai/dist/index.mjs:152:28)
    at eval (webpack-internal:///(action-browser)/./node_modules/.pnpm/ai@3.1.5_openai@4.44.0_react@18.3.1_solid-js@1.8.17_svelte@4.2.15_vue@3.4.25_typescript@5.4.5__zod@3.23.4/node_modules/ai/dist/index.mjs:1455:15)
    at _retryWithExponentialBackoff (webpack-internal:///(action-browser)/./node_modules/.pnpm/ai@3.1.5_openai@4.44.0_react@18.3.1_solid-js@1.8.17_svelte@4.2.15_vue@3.4.25_typescript@5.4.5__zod@3.23.4/node_modules/ai/dist/index.mjs:379:18)
    at eval (webpack-internal:///(action-browser)/./node_modules/.pnpm/ai@3.1.5_openai@4.44.0_react@18.3.1_solid-js@1.8.17_svelte@4.2.15_vue@3.4.25_typescript@5.4.5__zod@3.23.4/node_modules/ai/dist/index.mjs:368:25)
    at streamText (webpack-internal:///(action-browser)/./node_modules/.pnpm/ai@3.1.5_openai@4.44.0_react@18.3.1_solid-js@1.8.17_svelte@4.2.15_vue@3.4.25_typescript@5.4.5__zod@3.23.4/node_modules/ai/dist/index.mjs:1442:51)
    at eval (webpack-internal:///(action-browser)/./src/services/openai.ts:57:92)
    at eval (webpack-internal:///(action-browser)/./src/services/openai.ts:81:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Additional context

Base64 data:

data:image/jpeg;base64,/9j/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEB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KtpStVQ1G9PVKpFyOquL+Vx3GA7zB4+XyOWrdkUkX+mM6jM6mNCjVc8cV76RIyoT62Pf3xEkrKvnC0tRySN2aQgE+2E5QmwKiQOBRNzORTp0mkZ47X1KrH9uv84MUvE1VPQx0OZZemd5ZCbIlQrCWEeiSg609dNyvtgMKuRgBzpLgddZxHBaOpWWNpFqFvYrck7bn3xHtD3luPBsOdRxy8LVhmqHsDk1e4jq1Y9o2uEmH00t6riuSwz5fUyU+YPBTTI2mSCoQu6Editrg+xtgdJHZ2cay97nFsg47hzSnjy/i6gfOoIV5MdYJAlfTDtolN9YH+WTUOwK4Qao2m+squYGkjrIZsq+IpJFSzyxsVuxFiVAN1BBItc4CGAQi6rcDYW7fbFtqqbhZUf4WTPJHtcFkhFvqA38YAytQK7nmVjxbkHQokB9PmscRsbNyRdhUES2c36n6WOFidJFl0yl0mqpQRu3LW4+o1YWI6h3GYgFjY2uQLYdgB2Ym9j0OFhYIRjHxU6TZECEdwTiVTqHGogkn3wsLByOS6iD4fT5rqQNgLYeghR6NpgLFGAIJvfCwsHBmDStUFmIUabCwGNueG2XwcGeGebeJEUa1ee0uZRZVliyqOXRSuhc1VjfW6gWUGwUnVuQMLCwoQmr5qp8wrnkqHeV5HaSSRmu7sbksWN7knfGai8hL+c2tcjCwsKDIgmLOSRe+JSyaELBRdR6YWFhR5i1UVqLnVe1rq2k4kKto+2/thYWFFIiw+WNtXViLW9Lf74YqJJHqjSq/LATWXA3Pt7YWFhjFPfIqr5NUg/wDUYkk/rh6ROZCyknbCwsPGg4yFbWvf64ymkLoL99+vTCwsMYUjNOyiw223I6n64ZlbmAk31et8LCw0UjmZlFrkj3OGpptS2Ki/+bvhYWIzCkOY7LqFyR1GxwsLCwMMT//Z
@lucasishuman
Copy link

#1544

@lgrammel
Copy link
Collaborator

@sambecker the AI SDK automatically injects the data:image/jpeg;base64, part (which is technically not part of the base 64 image). Can you try removing it?

@lgrammel
Copy link
Collaborator

@lucasishuman this error is a [InvalidCharacterError]: Invalid character, which is different from #1544

@sambecker
Copy link
Author

Can you try removing it?

Removing it got it working!

Might be nice to make the API resilient to those prefixes given that they're supported in older versions of the spec? And expected in other instances like in <img /> tags?

@bernaferrari
Copy link

Probably similar: #1505

@lgrammel
Copy link
Collaborator

string data urls are support with 3.1.35+: https://sdk.vercel.ai/docs/ai-sdk-core/prompts#multi-modal-messages

@bernaferrari
Copy link

Hehehe I told you that was controversial! Glad to see it solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants