Commit db913bd
authored
fix(google): add thought signature to gemini 3 pro image parts (#10462)
## Background
`generateText()` / `streamText()` doesn't pass thought signature for
image parts in response messages. That breaks multi-turn chats with
`gemini-3-pro-image-preview`
## Summary
- Gemini now supports non-PNG images in assistant messages
- Add thought signature to image parts in `response.messages`
- spec update: `LanguageModelV3File#providerMetadata` (optional field)
## Manual Verification
```ts
import { google } from '@ai-sdk/google';
import { generateText } from 'ai';
import 'dotenv/config';
import { presentImages } from '../lib/present-image';
async function main() {
const step1 = await generateText({
model: google('gemini-3-pro-image-preview'),
prompt: 'Create an image of Los Angeles where all car infrastructure has been replaced with bike infrastructure, trains, pedestrian zones, and parks. The image should be photorealistic and vibrant.',
});
await presentImages(step1.files);
const step2 = await generateText({
model: google('gemini-3-pro-image-preview'),
messages: [
...step1.response.messages,
{
role: 'user',
content: 'Now create a variation of the image, but in the style of a watercolor painting.',
},
]
});
await presentImages(step2.files);
}
main().catch(console.error);
```
## Related Issues
Fixes #10441
Closes #79791 parent cd7a224 commit db913bd
File tree
8 files changed
+56
-20
lines changed- .changeset
- examples/ai-core/src/generate-text
- packages
- ai/src/generate-text
- google/src
- provider/src/language-model/v3
8 files changed
+56
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
964 | 964 | | |
965 | 965 | | |
966 | 966 | | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
967 | 970 | | |
968 | 971 | | |
969 | 972 | | |
| |||
Lines changed: 0 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | 326 | | |
340 | 327 | | |
341 | 328 | | |
| |||
Lines changed: 1 addition & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | 110 | | |
118 | 111 | | |
119 | 112 | | |
| |||
126 | 119 | | |
127 | 120 | | |
128 | 121 | | |
| 122 | + | |
129 | 123 | | |
130 | 124 | | |
131 | 125 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1411 | 1411 | | |
1412 | 1412 | | |
1413 | 1413 | | |
| 1414 | + | |
1414 | 1415 | | |
1415 | 1416 | | |
1416 | 1417 | | |
| |||
1421 | 1422 | | |
1422 | 1423 | | |
1423 | 1424 | | |
| 1425 | + | |
1424 | 1426 | | |
1425 | 1427 | | |
1426 | 1428 | | |
| |||
1473 | 1475 | | |
1474 | 1476 | | |
1475 | 1477 | | |
| 1478 | + | |
1476 | 1479 | | |
1477 | 1480 | | |
1478 | 1481 | | |
1479 | 1482 | | |
1480 | 1483 | | |
| 1484 | + | |
1481 | 1485 | | |
1482 | 1486 | | |
1483 | 1487 | | |
| |||
1592 | 1596 | | |
1593 | 1597 | | |
1594 | 1598 | | |
| 1599 | + | |
1595 | 1600 | | |
1596 | 1601 | | |
1597 | 1602 | | |
1598 | 1603 | | |
1599 | 1604 | | |
| 1605 | + | |
1600 | 1606 | | |
1601 | 1607 | | |
1602 | 1608 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
273 | 276 | | |
274 | 277 | | |
275 | 278 | | |
| |||
807 | 810 | | |
808 | 811 | | |
809 | 812 | | |
| 813 | + | |
810 | 814 | | |
811 | 815 | | |
812 | 816 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| 27 | + | |
| 28 | + | |
25 | 29 | | |
0 commit comments