@ai-sdk/google 4.0.84 → 4.0.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/index.d.ts +766 -744
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7840 -9512
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +559 -551
- package/dist/internal/index.d.ts.map +1 -0
- package/dist/internal/index.js +5313 -6233
- package/dist/internal/index.js.map +1 -1
- package/docs/15-google.mdx +19 -14
- package/package.json +8 -8
- package/src/google-provider.ts +1 -1
package/docs/15-google.mdx
CHANGED
|
@@ -135,10 +135,9 @@ The following optional provider options are available for Google models:
|
|
|
135
135
|
|
|
136
136
|
Optional. Enable structured output. Default is true.
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
structured outputs if you need to.
|
|
138
|
+
You can disable structured outputs when a schema is not supported or exceeds
|
|
139
|
+
Google's schema complexity limits. The model will still be instructed to
|
|
140
|
+
return JSON, but the schema will not be sent to Google.
|
|
142
141
|
|
|
143
142
|
See [Troubleshooting: Schema Limitations](#schema-limitations) for more details.
|
|
144
143
|
|
|
@@ -728,7 +727,7 @@ With the URL context tool, you will also get the `groundingMetadata`.
|
|
|
728
727
|
"groundingChunkIndices": [
|
|
729
728
|
0
|
|
730
729
|
]
|
|
731
|
-
}
|
|
730
|
+
}
|
|
732
731
|
]
|
|
733
732
|
}
|
|
734
733
|
```
|
|
@@ -995,14 +994,21 @@ Example response excerpt:
|
|
|
995
994
|
|
|
996
995
|
#### Schema Limitations
|
|
997
996
|
|
|
998
|
-
The Google Generative AI API
|
|
999
|
-
|
|
1000
|
-
|
|
997
|
+
The Google Generative AI API supports a subset of JSON Schema. Google notes that
|
|
998
|
+
[very large or deeply nested schemas may be rejected](https://ai.google.dev/gemini-api/docs/structured-output#limitations).
|
|
999
|
+
When a schema exceeds Google's complexity limit, the API may return the following
|
|
1000
|
+
generic error:
|
|
1001
1001
|
|
|
1002
|
-
`
|
|
1002
|
+
`Request contains an invalid argument.`
|
|
1003
|
+
|
|
1004
|
+
You can work around this by simplifying the schema sent to Google. For example,
|
|
1005
|
+
remove unnecessary constraints or reduce nesting while preserving the fields
|
|
1006
|
+
and types the model needs to generate. If you need stricter client-side
|
|
1007
|
+
validation than the schema sent to Google, use [`jsonSchema`](/docs/reference/ai-sdk-core/json-schema)
|
|
1008
|
+
with a custom validation function or validate the generated output separately.
|
|
1003
1009
|
|
|
1004
1010
|
By default, structured outputs are enabled (and for tool calling they are required).
|
|
1005
|
-
You can disable structured outputs for object generation
|
|
1011
|
+
You can also disable provider-enforced structured outputs for object generation:
|
|
1006
1012
|
|
|
1007
1013
|
```ts highlight="3,8"
|
|
1008
1014
|
const { output } = await generateText({
|
|
@@ -1032,10 +1038,9 @@ const { output } = await generateText({
|
|
|
1032
1038
|
});
|
|
1033
1039
|
```
|
|
1034
1040
|
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
- `z.record`
|
|
1041
|
+
When `structuredOutputs` is `false`, Google still receives the JSON response MIME type
|
|
1042
|
+
but not the schema. Describe the required schema in your prompt. AI SDK
|
|
1043
|
+
will still validate the response against the schema in `Output.object`.
|
|
1039
1044
|
|
|
1040
1045
|
### Model Capabilities
|
|
1041
1046
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/google",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.86",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@ai-sdk/provider": "4.0.
|
|
39
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
38
|
+
"@ai-sdk/provider": "4.0.20",
|
|
39
|
+
"@ai-sdk/provider-utils": "5.0.52"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@ai-sdk/test-server": "2.0.
|
|
42
|
+
"@ai-sdk/test-server": "2.0.3",
|
|
43
43
|
"@types/node": "22.19.19",
|
|
44
44
|
"@vercel/ai-tsconfig": "0.0.0",
|
|
45
|
-
"
|
|
45
|
+
"tsdown": "^0.23.0",
|
|
46
46
|
"typescript": "5.8.3",
|
|
47
47
|
"zod": "3.25.76"
|
|
48
48
|
},
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
"ai"
|
|
70
70
|
],
|
|
71
71
|
"scripts": {
|
|
72
|
-
"build": "pnpm clean &&
|
|
73
|
-
"build:watch": "pnpm clean &&
|
|
74
|
-
"clean": "del-cli
|
|
72
|
+
"build": "pnpm clean && tsdown",
|
|
73
|
+
"build:watch": "pnpm clean && tsdown --watch",
|
|
74
|
+
"clean": "del-cli docs *.tsbuildinfo",
|
|
75
75
|
"type-check": "tsc --build",
|
|
76
76
|
"test": "pnpm test:node && pnpm test:edge",
|
|
77
77
|
"test:update": "pnpm test:node -u",
|