@ai-sdk/google-vertex 4.0.0-beta.99 → 4.0.0
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 +528 -0
- package/dist/anthropic/edge/index.d.mts +4 -0
- package/dist/anthropic/edge/index.d.ts +4 -0
- package/dist/anthropic/edge/index.js +5 -2
- package/dist/anthropic/edge/index.js.map +1 -1
- package/dist/anthropic/edge/index.mjs +5 -2
- package/dist/anthropic/edge/index.mjs.map +1 -1
- package/dist/anthropic/index.d.mts +4 -0
- package/dist/anthropic/index.d.ts +4 -0
- package/dist/anthropic/index.js +4 -1
- package/dist/anthropic/index.js.map +1 -1
- package/dist/anthropic/index.mjs +4 -1
- package/dist/anthropic/index.mjs.map +1 -1
- package/dist/edge/index.d.mts +35 -3
- package/dist/edge/index.d.ts +35 -3
- package/dist/edge/index.js +154 -18
- package/dist/edge/index.js.map +1 -1
- package/dist/edge/index.mjs +159 -21
- package/dist/edge/index.mjs.map +1 -1
- package/dist/index.d.mts +58 -7
- package/dist/index.d.ts +58 -7
- package/dist/index.js +154 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +157 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,533 @@
|
|
|
1
1
|
# @ai-sdk/google-vertex
|
|
2
2
|
|
|
3
|
+
## 4.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- dee8b05: ai SDK 6 beta
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- 78928cb: release: start 5.1 beta
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 0c3b58b: fix(provider): add specificationVersion to ProviderV3
|
|
16
|
+
- 47a88a1: Remove duplicate gemini-1.0-pro-001 model ID
|
|
17
|
+
- 8d9e8ad: chore(provider): remove generics from EmbeddingModelV3
|
|
18
|
+
|
|
19
|
+
Before
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
model.textEmbeddingModel('my-model-id');
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
After
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
model.embeddingModel('my-model-id');
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- 32a6c13: Add Google Maps grounding tool support for location-aware Gemini responses
|
|
32
|
+
- 95f65c2: chore: use import \* from zod/v4
|
|
33
|
+
- 0b92881: Add Google Vertex RAG Engine grounding provider tool
|
|
34
|
+
- 544d4e8: chore(specification): rename v3 provider defined tool to provider tool
|
|
35
|
+
- 0c4822d: feat: `EmbeddingModelV3`
|
|
36
|
+
- f8c981f: Fix adding google search along with url context in vertex ai
|
|
37
|
+
- 00dfa76: feat(provider/google-vertex): Add support for the imageSize provider option
|
|
38
|
+
- 0e29b86: Add claude-opus-4-5@20251101 to Google Vertex Anthropic models
|
|
39
|
+
- e8109d3: feat: tool execution approval
|
|
40
|
+
- 87db851: fix(vertex/anthropic): passing beta header only for structured outputs
|
|
41
|
+
- ed329cb: feat: `Provider-V3`
|
|
42
|
+
- 3bd2689: feat: extended token usage
|
|
43
|
+
- 1cad0ab: feat: add provider version to user-agent header
|
|
44
|
+
- 024e778: feat(provider/vertext): add express mode support
|
|
45
|
+
- 8dac895: feat: `LanguageModelV3`
|
|
46
|
+
- 82ceb49: Add claude sonnet 4.5 in google vertex anthropic provider
|
|
47
|
+
- 457318b: chore(provider,ai): switch to SharedV3Warning and unified warnings
|
|
48
|
+
- 0ad470b: feat(provider/google): add enterpriseWebSearch tool
|
|
49
|
+
- 9061dc0: feat: image editing
|
|
50
|
+
- ee8cd23: fix(vertex): allow 'vertex' as a key for providerOptions
|
|
51
|
+
- 366f50b: chore(provider): add deprecated textEmbeddingModel and textEmbedding aliases
|
|
52
|
+
- 2825757: Add Google File search tool
|
|
53
|
+
- 4616b86: chore: update zod peer depenedency version
|
|
54
|
+
- 33d9327: add `gemini-3-pro-preview` and `gemini-3-pro-image-preview` model IDs
|
|
55
|
+
- 88b2c7e: feat(provider/amazon-bedrock,provider/google-vertex-anthropic): add support for tool calling with structured output
|
|
56
|
+
|
|
57
|
+
Added support for combining tool calling with structured outputs in both Amazon Bedrock and Google Vertex Anthropic providers. This allows developers to use tools (like weather lookups, web search, etc.) alongside structured JSON output schemas, enabling multi-step agentic workflows with structured final outputs.
|
|
58
|
+
|
|
59
|
+
**Amazon Bedrock Changes:**
|
|
60
|
+
|
|
61
|
+
- Removed incorrect warning that prevented using tools with JSON response format
|
|
62
|
+
- Updated tool choice to use `{ type: 'required' }` instead of specific tool selection when using structured outputs
|
|
63
|
+
- Added `isJsonResponseFromTool` parameter to finish reason mapping
|
|
64
|
+
- JSON tool responses are correctly converted to text content and finish reason is mapped from `tool_use` to `stop`
|
|
65
|
+
- Added comprehensive test coverage for combining tools with structured outputs
|
|
66
|
+
- Added example files demonstrating the feature
|
|
67
|
+
|
|
68
|
+
**Google Vertex Anthropic Changes:**
|
|
69
|
+
|
|
70
|
+
- Inherits support from underlying Anthropic provider implementation
|
|
71
|
+
- Added test coverage to verify the feature works correctly
|
|
72
|
+
- Added example files demonstrating the feature
|
|
73
|
+
|
|
74
|
+
This brings Anthropic provider's structured output capabilities to the Amazon Bedrock and Google Vertex Anthropic providers.
|
|
75
|
+
|
|
76
|
+
- 522f6b8: feat: `ImageModelV3`
|
|
77
|
+
- 870297d: feat(google): gemini-3-flash
|
|
78
|
+
- cdb463a: update google-auth-library to ^10.5.0
|
|
79
|
+
- 10c1322: fix: moved dependency `@ai-sdk/test-server` to devDependencies
|
|
80
|
+
- 4d2e88e: fix(google,google-vertex): update known model IDs
|
|
81
|
+
- e833473: chore (provider/google): Add preview modelIds for gemini 2.5 flash and lite
|
|
82
|
+
- Updated dependencies [0c3b58b]
|
|
83
|
+
- Updated dependencies [0adc679]
|
|
84
|
+
- Updated dependencies [50b70d6]
|
|
85
|
+
- Updated dependencies [d1bdadb]
|
|
86
|
+
- Updated dependencies [b8ea36e]
|
|
87
|
+
- Updated dependencies [ed537e1]
|
|
88
|
+
- Updated dependencies [2109385]
|
|
89
|
+
- Updated dependencies [dee8b05]
|
|
90
|
+
- Updated dependencies [9be07c8]
|
|
91
|
+
- Updated dependencies [fd788ce]
|
|
92
|
+
- Updated dependencies [046aa3b]
|
|
93
|
+
- Updated dependencies [7c4328e]
|
|
94
|
+
- Updated dependencies [8d9e8ad]
|
|
95
|
+
- Updated dependencies [f33a018]
|
|
96
|
+
- Updated dependencies [78928cb]
|
|
97
|
+
- Updated dependencies [b2dbfbf]
|
|
98
|
+
- Updated dependencies [dce03c4]
|
|
99
|
+
- Updated dependencies [2625a04]
|
|
100
|
+
- Updated dependencies [37c58a0]
|
|
101
|
+
- Updated dependencies [11e4abe]
|
|
102
|
+
- Updated dependencies [7728ac5]
|
|
103
|
+
- Updated dependencies [3b1d015]
|
|
104
|
+
- Updated dependencies [2b0caef]
|
|
105
|
+
- Updated dependencies [f13958c]
|
|
106
|
+
- Updated dependencies [9a728c8]
|
|
107
|
+
- Updated dependencies [afb00e3]
|
|
108
|
+
- Updated dependencies [32a6c13]
|
|
109
|
+
- Updated dependencies [95f65c2]
|
|
110
|
+
- Updated dependencies [016b111]
|
|
111
|
+
- Updated dependencies [e300a3b]
|
|
112
|
+
- Updated dependencies [58920e0]
|
|
113
|
+
- Updated dependencies [218bba1]
|
|
114
|
+
- Updated dependencies [954c356]
|
|
115
|
+
- Updated dependencies [0b92881]
|
|
116
|
+
- Updated dependencies [9e35785]
|
|
117
|
+
- Updated dependencies [544d4e8]
|
|
118
|
+
- Updated dependencies [a5f77a6]
|
|
119
|
+
- Updated dependencies [ca07285]
|
|
120
|
+
- Updated dependencies [0c4822d]
|
|
121
|
+
- Updated dependencies [f8c981f]
|
|
122
|
+
- Updated dependencies [6078060]
|
|
123
|
+
- Updated dependencies [bb28cac]
|
|
124
|
+
- Updated dependencies [fff8d59]
|
|
125
|
+
- Updated dependencies [a5a8db4]
|
|
126
|
+
- Updated dependencies [521c537]
|
|
127
|
+
- Updated dependencies [1742445]
|
|
128
|
+
- Updated dependencies [4c44a5b]
|
|
129
|
+
- Updated dependencies [e8109d3]
|
|
130
|
+
- Updated dependencies [87db851]
|
|
131
|
+
- Updated dependencies [03849b0]
|
|
132
|
+
- Updated dependencies [f6603b7]
|
|
133
|
+
- Updated dependencies [ed329cb]
|
|
134
|
+
- Updated dependencies [e06565c]
|
|
135
|
+
- Updated dependencies [32d8dbb]
|
|
136
|
+
- Updated dependencies [53f3368]
|
|
137
|
+
- Updated dependencies [d116b4b]
|
|
138
|
+
- Updated dependencies [3bd2689]
|
|
139
|
+
- Updated dependencies [293a6b7]
|
|
140
|
+
- Updated dependencies [703459a]
|
|
141
|
+
- Updated dependencies [1cad0ab]
|
|
142
|
+
- Updated dependencies [bb36798]
|
|
143
|
+
- Updated dependencies [83e5744]
|
|
144
|
+
- Updated dependencies [7e32fea]
|
|
145
|
+
- Updated dependencies [2049c5b]
|
|
146
|
+
- Updated dependencies [3ed5519]
|
|
147
|
+
- Updated dependencies [4c5a6be]
|
|
148
|
+
- Updated dependencies [9b17031]
|
|
149
|
+
- Updated dependencies [9e1e758]
|
|
150
|
+
- Updated dependencies [589a4ee]
|
|
151
|
+
- Updated dependencies [8dac895]
|
|
152
|
+
- Updated dependencies [ee50cc5]
|
|
153
|
+
- Updated dependencies [6f845b4]
|
|
154
|
+
- Updated dependencies [a755db5]
|
|
155
|
+
- Updated dependencies [cbb1d35]
|
|
156
|
+
- Updated dependencies [9354297]
|
|
157
|
+
- Updated dependencies [475189e]
|
|
158
|
+
- Updated dependencies [03849b0]
|
|
159
|
+
- Updated dependencies [0ae783e]
|
|
160
|
+
- Updated dependencies [457318b]
|
|
161
|
+
- Updated dependencies [b681d7d]
|
|
162
|
+
- Updated dependencies [eb56fc6]
|
|
163
|
+
- Updated dependencies [0ad470b]
|
|
164
|
+
- Updated dependencies [db913bd]
|
|
165
|
+
- Updated dependencies [9061dc0]
|
|
166
|
+
- Updated dependencies [fa35e95]
|
|
167
|
+
- Updated dependencies [32223c8]
|
|
168
|
+
- Updated dependencies [8370068]
|
|
169
|
+
- Updated dependencies [c1efac4]
|
|
170
|
+
- Updated dependencies [ee8cd23]
|
|
171
|
+
- Updated dependencies [7dea60e]
|
|
172
|
+
- Updated dependencies [80894b3]
|
|
173
|
+
- Updated dependencies [366f50b]
|
|
174
|
+
- Updated dependencies [81d4308]
|
|
175
|
+
- Updated dependencies [6fc35cb]
|
|
176
|
+
- Updated dependencies [8ee8edc]
|
|
177
|
+
- Updated dependencies [2825757]
|
|
178
|
+
- Updated dependencies [f4db7b5]
|
|
179
|
+
- Updated dependencies [6c38080]
|
|
180
|
+
- Updated dependencies [4616b86]
|
|
181
|
+
- Updated dependencies [33d9327]
|
|
182
|
+
- Updated dependencies [81d4308]
|
|
183
|
+
- Updated dependencies [0cfae4c]
|
|
184
|
+
- Updated dependencies [9549c9e]
|
|
185
|
+
- Updated dependencies [dedf206]
|
|
186
|
+
- Updated dependencies [09ba2dd]
|
|
187
|
+
- Updated dependencies [32a8c82]
|
|
188
|
+
- Updated dependencies [af3780b]
|
|
189
|
+
- Updated dependencies [4f16c37]
|
|
190
|
+
- Updated dependencies [983e394]
|
|
191
|
+
- Updated dependencies [81e29ab]
|
|
192
|
+
- Updated dependencies [0e38a79]
|
|
193
|
+
- Updated dependencies [166b6d7]
|
|
194
|
+
- Updated dependencies [cf4e2a9]
|
|
195
|
+
- Updated dependencies [f4e4a95]
|
|
196
|
+
- Updated dependencies [522f6b8]
|
|
197
|
+
- Updated dependencies [6306603]
|
|
198
|
+
- Updated dependencies [21f378c]
|
|
199
|
+
- Updated dependencies [599a97f]
|
|
200
|
+
- Updated dependencies [c5440c5]
|
|
201
|
+
- Updated dependencies [fca786b]
|
|
202
|
+
- Updated dependencies [1d15673]
|
|
203
|
+
- Updated dependencies [763d04a]
|
|
204
|
+
- Updated dependencies [49e2b6a]
|
|
205
|
+
- Updated dependencies [9cff587]
|
|
206
|
+
- Updated dependencies [d129d89]
|
|
207
|
+
- Updated dependencies [10d819b]
|
|
208
|
+
- Updated dependencies [3794514]
|
|
209
|
+
- Updated dependencies [e1e2821]
|
|
210
|
+
- Updated dependencies [cbf52cd]
|
|
211
|
+
- Updated dependencies [870297d]
|
|
212
|
+
- Updated dependencies [e9e157f]
|
|
213
|
+
- Updated dependencies [10c1322]
|
|
214
|
+
- Updated dependencies [c8003fb]
|
|
215
|
+
- Updated dependencies [d08308b]
|
|
216
|
+
- Updated dependencies [05d5b9a]
|
|
217
|
+
- Updated dependencies [960ec8f]
|
|
218
|
+
- Updated dependencies [4d2e88e]
|
|
219
|
+
- Updated dependencies [1bd7d32]
|
|
220
|
+
- Updated dependencies [83aaad8]
|
|
221
|
+
- Updated dependencies [e833473]
|
|
222
|
+
- Updated dependencies [f0b2157]
|
|
223
|
+
- Updated dependencies [95f65c2]
|
|
224
|
+
- @ai-sdk/anthropic@3.0.0
|
|
225
|
+
- @ai-sdk/provider@3.0.0
|
|
226
|
+
- @ai-sdk/google@3.0.0
|
|
227
|
+
- @ai-sdk/provider-utils@4.0.0
|
|
228
|
+
|
|
229
|
+
## 4.0.0-beta.135
|
|
230
|
+
|
|
231
|
+
### Patch Changes
|
|
232
|
+
|
|
233
|
+
- Updated dependencies [218bba1]
|
|
234
|
+
- @ai-sdk/google@3.0.0-beta.90
|
|
235
|
+
|
|
236
|
+
## 4.0.0-beta.134
|
|
237
|
+
|
|
238
|
+
### Patch Changes
|
|
239
|
+
|
|
240
|
+
- Updated dependencies [2049c5b]
|
|
241
|
+
- @ai-sdk/anthropic@3.0.0-beta.98
|
|
242
|
+
|
|
243
|
+
## 4.0.0-beta.133
|
|
244
|
+
|
|
245
|
+
### Patch Changes
|
|
246
|
+
|
|
247
|
+
- Updated dependencies [475189e]
|
|
248
|
+
- @ai-sdk/provider@3.0.0-beta.32
|
|
249
|
+
- @ai-sdk/anthropic@3.0.0-beta.97
|
|
250
|
+
- @ai-sdk/google@3.0.0-beta.89
|
|
251
|
+
- @ai-sdk/provider-utils@4.0.0-beta.59
|
|
252
|
+
|
|
253
|
+
## 4.0.0-beta.132
|
|
254
|
+
|
|
255
|
+
### Patch Changes
|
|
256
|
+
|
|
257
|
+
- Updated dependencies [2625a04]
|
|
258
|
+
- @ai-sdk/anthropic@3.0.0-beta.96
|
|
259
|
+
- @ai-sdk/provider@3.0.0-beta.31
|
|
260
|
+
- @ai-sdk/google@3.0.0-beta.88
|
|
261
|
+
- @ai-sdk/provider-utils@4.0.0-beta.58
|
|
262
|
+
|
|
263
|
+
## 4.0.0-beta.131
|
|
264
|
+
|
|
265
|
+
### Patch Changes
|
|
266
|
+
|
|
267
|
+
- Updated dependencies [cbf52cd]
|
|
268
|
+
- @ai-sdk/anthropic@3.0.0-beta.95
|
|
269
|
+
- @ai-sdk/provider@3.0.0-beta.30
|
|
270
|
+
- @ai-sdk/google@3.0.0-beta.87
|
|
271
|
+
- @ai-sdk/provider-utils@4.0.0-beta.57
|
|
272
|
+
|
|
273
|
+
## 4.0.0-beta.130
|
|
274
|
+
|
|
275
|
+
### Patch Changes
|
|
276
|
+
|
|
277
|
+
- Updated dependencies [9549c9e]
|
|
278
|
+
- @ai-sdk/provider@3.0.0-beta.29
|
|
279
|
+
- @ai-sdk/anthropic@3.0.0-beta.94
|
|
280
|
+
- @ai-sdk/google@3.0.0-beta.86
|
|
281
|
+
- @ai-sdk/provider-utils@4.0.0-beta.56
|
|
282
|
+
|
|
283
|
+
## 4.0.0-beta.129
|
|
284
|
+
|
|
285
|
+
### Patch Changes
|
|
286
|
+
|
|
287
|
+
- Updated dependencies [50b70d6]
|
|
288
|
+
- @ai-sdk/provider-utils@4.0.0-beta.55
|
|
289
|
+
- @ai-sdk/anthropic@3.0.0-beta.93
|
|
290
|
+
- @ai-sdk/google@3.0.0-beta.85
|
|
291
|
+
|
|
292
|
+
## 4.0.0-beta.128
|
|
293
|
+
|
|
294
|
+
### Patch Changes
|
|
295
|
+
|
|
296
|
+
- Updated dependencies [fd788ce]
|
|
297
|
+
- @ai-sdk/google@3.0.0-beta.84
|
|
298
|
+
|
|
299
|
+
## 4.0.0-beta.127
|
|
300
|
+
|
|
301
|
+
### Patch Changes
|
|
302
|
+
|
|
303
|
+
- Updated dependencies [166b6d7]
|
|
304
|
+
- @ai-sdk/google@3.0.0-beta.83
|
|
305
|
+
|
|
306
|
+
## 4.0.0-beta.126
|
|
307
|
+
|
|
308
|
+
### Patch Changes
|
|
309
|
+
|
|
310
|
+
- 9061dc0: feat: image editing
|
|
311
|
+
- Updated dependencies [9061dc0]
|
|
312
|
+
- @ai-sdk/provider-utils@4.0.0-beta.54
|
|
313
|
+
- @ai-sdk/provider@3.0.0-beta.28
|
|
314
|
+
- @ai-sdk/google@3.0.0-beta.82
|
|
315
|
+
- @ai-sdk/anthropic@3.0.0-beta.92
|
|
316
|
+
|
|
317
|
+
## 4.0.0-beta.125
|
|
318
|
+
|
|
319
|
+
### Patch Changes
|
|
320
|
+
|
|
321
|
+
- 0ad470b: feat(provider/google): add enterpriseWebSearch tool
|
|
322
|
+
- Updated dependencies [0ad470b]
|
|
323
|
+
- @ai-sdk/google@3.0.0-beta.81
|
|
324
|
+
|
|
325
|
+
## 4.0.0-beta.124
|
|
326
|
+
|
|
327
|
+
### Patch Changes
|
|
328
|
+
|
|
329
|
+
- Updated dependencies [d129d89]
|
|
330
|
+
- @ai-sdk/anthropic@3.0.0-beta.91
|
|
331
|
+
|
|
332
|
+
## 4.0.0-beta.123
|
|
333
|
+
|
|
334
|
+
### Patch Changes
|
|
335
|
+
|
|
336
|
+
- 870297d: feat(google): gemini-3-flash
|
|
337
|
+
- Updated dependencies [870297d]
|
|
338
|
+
- @ai-sdk/google@3.0.0-beta.80
|
|
339
|
+
|
|
340
|
+
## 4.0.0-beta.122
|
|
341
|
+
|
|
342
|
+
### Patch Changes
|
|
343
|
+
|
|
344
|
+
- 366f50b: chore(provider): add deprecated textEmbeddingModel and textEmbedding aliases
|
|
345
|
+
- Updated dependencies [366f50b]
|
|
346
|
+
- @ai-sdk/anthropic@3.0.0-beta.90
|
|
347
|
+
- @ai-sdk/provider@3.0.0-beta.27
|
|
348
|
+
- @ai-sdk/google@3.0.0-beta.79
|
|
349
|
+
- @ai-sdk/provider-utils@4.0.0-beta.53
|
|
350
|
+
|
|
351
|
+
## 4.0.0-beta.121
|
|
352
|
+
|
|
353
|
+
### Patch Changes
|
|
354
|
+
|
|
355
|
+
- Updated dependencies [763d04a]
|
|
356
|
+
- @ai-sdk/provider-utils@4.0.0-beta.52
|
|
357
|
+
- @ai-sdk/anthropic@3.0.0-beta.89
|
|
358
|
+
- @ai-sdk/google@3.0.0-beta.78
|
|
359
|
+
|
|
360
|
+
## 4.0.0-beta.120
|
|
361
|
+
|
|
362
|
+
### Patch Changes
|
|
363
|
+
|
|
364
|
+
- 87db851: fix(vertex/anthropic): passing beta header only for structured outputs
|
|
365
|
+
- Updated dependencies [87db851]
|
|
366
|
+
- @ai-sdk/anthropic@3.0.0-beta.88
|
|
367
|
+
|
|
368
|
+
## 4.0.0-beta.119
|
|
369
|
+
|
|
370
|
+
### Patch Changes
|
|
371
|
+
|
|
372
|
+
- 32a6c13: Add Google Maps grounding tool support for location-aware Gemini responses
|
|
373
|
+
- Updated dependencies [32a6c13]
|
|
374
|
+
- @ai-sdk/google@3.0.0-beta.77
|
|
375
|
+
|
|
376
|
+
## 4.0.0-beta.118
|
|
377
|
+
|
|
378
|
+
### Patch Changes
|
|
379
|
+
|
|
380
|
+
- Updated dependencies [c1efac4]
|
|
381
|
+
- @ai-sdk/provider-utils@4.0.0-beta.51
|
|
382
|
+
- @ai-sdk/anthropic@3.0.0-beta.87
|
|
383
|
+
- @ai-sdk/google@3.0.0-beta.76
|
|
384
|
+
|
|
385
|
+
## 4.0.0-beta.117
|
|
386
|
+
|
|
387
|
+
### Patch Changes
|
|
388
|
+
|
|
389
|
+
- Updated dependencies [32223c8]
|
|
390
|
+
- @ai-sdk/provider-utils@4.0.0-beta.50
|
|
391
|
+
- @ai-sdk/anthropic@3.0.0-beta.86
|
|
392
|
+
- @ai-sdk/google@3.0.0-beta.75
|
|
393
|
+
|
|
394
|
+
## 4.0.0-beta.116
|
|
395
|
+
|
|
396
|
+
### Patch Changes
|
|
397
|
+
|
|
398
|
+
- Updated dependencies [83e5744]
|
|
399
|
+
- @ai-sdk/provider-utils@4.0.0-beta.49
|
|
400
|
+
- @ai-sdk/anthropic@3.0.0-beta.85
|
|
401
|
+
- @ai-sdk/google@3.0.0-beta.74
|
|
402
|
+
|
|
403
|
+
## 4.0.0-beta.115
|
|
404
|
+
|
|
405
|
+
### Patch Changes
|
|
406
|
+
|
|
407
|
+
- Updated dependencies [960ec8f]
|
|
408
|
+
- @ai-sdk/provider-utils@4.0.0-beta.48
|
|
409
|
+
- @ai-sdk/anthropic@3.0.0-beta.84
|
|
410
|
+
- @ai-sdk/google@3.0.0-beta.73
|
|
411
|
+
|
|
412
|
+
## 4.0.0-beta.114
|
|
413
|
+
|
|
414
|
+
### Patch Changes
|
|
415
|
+
|
|
416
|
+
- 47a88a1: Remove duplicate gemini-1.0-pro-001 model ID
|
|
417
|
+
|
|
418
|
+
## 4.0.0-beta.113
|
|
419
|
+
|
|
420
|
+
### Patch Changes
|
|
421
|
+
|
|
422
|
+
- Updated dependencies [6c38080]
|
|
423
|
+
- @ai-sdk/anthropic@3.0.0-beta.83
|
|
424
|
+
|
|
425
|
+
## 4.0.0-beta.112
|
|
426
|
+
|
|
427
|
+
### Patch Changes
|
|
428
|
+
|
|
429
|
+
- ee8cd23: fix(vertex): allow 'vertex' as a key for providerOptions
|
|
430
|
+
- Updated dependencies [ee8cd23]
|
|
431
|
+
- @ai-sdk/google@3.0.0-beta.72
|
|
432
|
+
|
|
433
|
+
## 4.0.0-beta.111
|
|
434
|
+
|
|
435
|
+
### Patch Changes
|
|
436
|
+
|
|
437
|
+
- Updated dependencies [49e2b6a]
|
|
438
|
+
- @ai-sdk/google@3.0.0-beta.71
|
|
439
|
+
|
|
440
|
+
## 4.0.0-beta.110
|
|
441
|
+
|
|
442
|
+
### Patch Changes
|
|
443
|
+
|
|
444
|
+
- Updated dependencies [e9e157f]
|
|
445
|
+
- @ai-sdk/provider-utils@4.0.0-beta.47
|
|
446
|
+
- @ai-sdk/anthropic@3.0.0-beta.82
|
|
447
|
+
- @ai-sdk/google@3.0.0-beta.70
|
|
448
|
+
|
|
449
|
+
## 4.0.0-beta.109
|
|
450
|
+
|
|
451
|
+
### Patch Changes
|
|
452
|
+
|
|
453
|
+
- Updated dependencies [81e29ab]
|
|
454
|
+
- @ai-sdk/provider-utils@4.0.0-beta.46
|
|
455
|
+
- @ai-sdk/anthropic@3.0.0-beta.81
|
|
456
|
+
- @ai-sdk/google@3.0.0-beta.69
|
|
457
|
+
|
|
458
|
+
## 4.0.0-beta.108
|
|
459
|
+
|
|
460
|
+
### Patch Changes
|
|
461
|
+
|
|
462
|
+
- Updated dependencies [05d5b9a]
|
|
463
|
+
- @ai-sdk/anthropic@3.0.0-beta.80
|
|
464
|
+
|
|
465
|
+
## 4.0.0-beta.107
|
|
466
|
+
|
|
467
|
+
### Patch Changes
|
|
468
|
+
|
|
469
|
+
- 024e778: feat(provider/vertext): add express mode support
|
|
470
|
+
|
|
471
|
+
## 4.0.0-beta.106
|
|
472
|
+
|
|
473
|
+
### Patch Changes
|
|
474
|
+
|
|
475
|
+
- 3bd2689: feat: extended token usage
|
|
476
|
+
- Updated dependencies [3bd2689]
|
|
477
|
+
- @ai-sdk/anthropic@3.0.0-beta.79
|
|
478
|
+
- @ai-sdk/provider@3.0.0-beta.26
|
|
479
|
+
- @ai-sdk/google@3.0.0-beta.68
|
|
480
|
+
- @ai-sdk/provider-utils@4.0.0-beta.45
|
|
481
|
+
|
|
482
|
+
## 4.0.0-beta.105
|
|
483
|
+
|
|
484
|
+
### Patch Changes
|
|
485
|
+
|
|
486
|
+
- Updated dependencies [9e1e758]
|
|
487
|
+
- @ai-sdk/anthropic@3.0.0-beta.78
|
|
488
|
+
|
|
489
|
+
## 4.0.0-beta.104
|
|
490
|
+
|
|
491
|
+
### Patch Changes
|
|
492
|
+
|
|
493
|
+
- 4d2e88e: fix(google,google-vertex): update known model IDs
|
|
494
|
+
- Updated dependencies [4d2e88e]
|
|
495
|
+
- @ai-sdk/google@3.0.0-beta.67
|
|
496
|
+
|
|
497
|
+
## 4.0.0-beta.103
|
|
498
|
+
|
|
499
|
+
### Patch Changes
|
|
500
|
+
|
|
501
|
+
- Updated dependencies [b2dbfbf]
|
|
502
|
+
- @ai-sdk/anthropic@3.0.0-beta.77
|
|
503
|
+
|
|
504
|
+
## 4.0.0-beta.102
|
|
505
|
+
|
|
506
|
+
### Patch Changes
|
|
507
|
+
|
|
508
|
+
- Updated dependencies [53f3368]
|
|
509
|
+
- @ai-sdk/provider@3.0.0-beta.25
|
|
510
|
+
- @ai-sdk/anthropic@3.0.0-beta.76
|
|
511
|
+
- @ai-sdk/google@3.0.0-beta.66
|
|
512
|
+
- @ai-sdk/provider-utils@4.0.0-beta.44
|
|
513
|
+
|
|
514
|
+
## 4.0.0-beta.101
|
|
515
|
+
|
|
516
|
+
### Patch Changes
|
|
517
|
+
|
|
518
|
+
- Updated dependencies [0ae783e]
|
|
519
|
+
- @ai-sdk/anthropic@3.0.0-beta.75
|
|
520
|
+
|
|
521
|
+
## 4.0.0-beta.100
|
|
522
|
+
|
|
523
|
+
### Patch Changes
|
|
524
|
+
|
|
525
|
+
- Updated dependencies [dce03c4]
|
|
526
|
+
- @ai-sdk/provider-utils@4.0.0-beta.43
|
|
527
|
+
- @ai-sdk/anthropic@3.0.0-beta.74
|
|
528
|
+
- @ai-sdk/provider@3.0.0-beta.24
|
|
529
|
+
- @ai-sdk/google@3.0.0-beta.65
|
|
530
|
+
|
|
3
531
|
## 4.0.0-beta.99
|
|
4
532
|
|
|
5
533
|
### Patch Changes
|
|
@@ -35,6 +35,10 @@ interface GoogleVertexAnthropicProvider extends ProviderV3 {
|
|
|
35
35
|
Anthropic-specific computer use tool.
|
|
36
36
|
*/
|
|
37
37
|
tools: typeof anthropicTools;
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated Use `embeddingModel` instead.
|
|
40
|
+
*/
|
|
41
|
+
textEmbeddingModel(modelId: string): never;
|
|
38
42
|
}
|
|
39
43
|
interface GoogleVertexAnthropicProviderSettings$1 {
|
|
40
44
|
/**
|
|
@@ -35,6 +35,10 @@ interface GoogleVertexAnthropicProvider extends ProviderV3 {
|
|
|
35
35
|
Anthropic-specific computer use tool.
|
|
36
36
|
*/
|
|
37
37
|
tools: typeof anthropicTools;
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated Use `embeddingModel` instead.
|
|
40
|
+
*/
|
|
41
|
+
textEmbeddingModel(modelId: string): never;
|
|
38
42
|
}
|
|
39
43
|
interface GoogleVertexAnthropicProviderSettings$1 {
|
|
40
44
|
/**
|
|
@@ -32,7 +32,7 @@ var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
|
32
32
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
33
33
|
|
|
34
34
|
// src/version.ts
|
|
35
|
-
var VERSION = true ? "4.0.0
|
|
35
|
+
var VERSION = true ? "4.0.0" : "0.0.0-test";
|
|
36
36
|
|
|
37
37
|
// src/edge/google-vertex-auth-edge.ts
|
|
38
38
|
var loadCredentials = async () => {
|
|
@@ -170,7 +170,9 @@ function createVertexAnthropic(options = {}) {
|
|
|
170
170
|
};
|
|
171
171
|
},
|
|
172
172
|
// Google Vertex Anthropic doesn't support URL sources, force download and base64 conversion
|
|
173
|
-
supportedUrls: () => ({})
|
|
173
|
+
supportedUrls: () => ({}),
|
|
174
|
+
// force the use of JSON tool fallback for structured outputs since beta header isn't supported
|
|
175
|
+
supportsNativeStructuredOutput: false
|
|
174
176
|
});
|
|
175
177
|
};
|
|
176
178
|
const provider = function(modelId) {
|
|
@@ -188,6 +190,7 @@ function createVertexAnthropic(options = {}) {
|
|
|
188
190
|
provider.embeddingModel = (modelId) => {
|
|
189
191
|
throw new import_provider.NoSuchModelError({ modelId, modelType: "embeddingModel" });
|
|
190
192
|
};
|
|
193
|
+
provider.textEmbeddingModel = provider.embeddingModel;
|
|
191
194
|
provider.imageModel = (modelId) => {
|
|
192
195
|
throw new import_provider.NoSuchModelError({ modelId, modelType: "imageModel" });
|
|
193
196
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/anthropic/edge/index.ts","../../../src/anthropic/edge/google-vertex-anthropic-provider-edge.ts","../../../src/edge/google-vertex-auth-edge.ts","../../../src/version.ts","../../../src/anthropic/google-vertex-anthropic-provider.ts"],"sourcesContent":["export {\n createVertexAnthropic,\n vertexAnthropic,\n} from './google-vertex-anthropic-provider-edge';\nexport type {\n GoogleVertexAnthropicProviderSettings,\n GoogleVertexAnthropicProvider,\n} from './google-vertex-anthropic-provider-edge';\n","import { resolve } from '@ai-sdk/provider-utils';\nimport {\n generateAuthToken,\n GoogleCredentials,\n} from '../../edge/google-vertex-auth-edge';\nimport {\n createVertexAnthropic as createVertexAnthropicOriginal,\n GoogleVertexAnthropicProvider,\n GoogleVertexAnthropicProviderSettings as GoogleVertexAnthropicProviderSettingsOriginal,\n} from '../google-vertex-anthropic-provider';\n\nexport type { GoogleVertexAnthropicProvider };\n\nexport interface GoogleVertexAnthropicProviderSettings\n extends GoogleVertexAnthropicProviderSettingsOriginal {\n /**\n * Optional. The Google credentials for the Google Cloud service account. If\n * not provided, the Google Vertex provider will use environment variables to\n * load the credentials.\n */\n googleCredentials?: GoogleCredentials;\n}\n\nexport function createVertexAnthropic(\n options: GoogleVertexAnthropicProviderSettings = {},\n): GoogleVertexAnthropicProvider {\n return createVertexAnthropicOriginal({\n ...options,\n headers: async () => ({\n Authorization: `Bearer ${await generateAuthToken(\n options.googleCredentials,\n )}`,\n ...(await resolve(options.headers)),\n }),\n });\n}\n\n/**\n * Default Google Vertex AI Anthropic provider instance.\n */\nexport const vertexAnthropic = createVertexAnthropic();\n","import {\n loadOptionalSetting,\n loadSetting,\n withUserAgentSuffix,\n getRuntimeEnvironmentUserAgent,\n} from '@ai-sdk/provider-utils';\nimport { VERSION } from '../version';\n\nexport interface GoogleCredentials {\n /**\n * The client email for the Google Cloud service account. Defaults to the\n * value of the `GOOGLE_CLIENT_EMAIL` environment variable.\n */\n clientEmail: string;\n\n /**\n * The private key for the Google Cloud service account. Defaults to the\n * value of the `GOOGLE_PRIVATE_KEY` environment variable.\n */\n privateKey: string;\n\n /**\n * Optional. The private key ID for the Google Cloud service account. Defaults\n * to the value of the `GOOGLE_PRIVATE_KEY_ID` environment variable.\n */\n privateKeyId?: string;\n}\n\nconst loadCredentials = async (): Promise<GoogleCredentials> => {\n try {\n return {\n clientEmail: loadSetting({\n settingValue: undefined,\n settingName: 'clientEmail',\n environmentVariableName: 'GOOGLE_CLIENT_EMAIL',\n description: 'Google client email',\n }),\n privateKey: loadSetting({\n settingValue: undefined,\n settingName: 'privateKey',\n environmentVariableName: 'GOOGLE_PRIVATE_KEY',\n description: 'Google private key',\n }),\n privateKeyId: loadOptionalSetting({\n settingValue: undefined,\n environmentVariableName: 'GOOGLE_PRIVATE_KEY_ID',\n }),\n };\n } catch (error: any) {\n throw new Error(`Failed to load Google credentials: ${error.message}`);\n }\n};\n\n// Convert a string to base64url\nconst base64url = (str: string) => {\n return btoa(str).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n};\nconst importPrivateKey = async (pemKey: string) => {\n const pemHeader = '-----BEGIN PRIVATE KEY-----';\n const pemFooter = '-----END PRIVATE KEY-----';\n\n // Remove header, footer, and any whitespace/newlines\n const pemContents = pemKey\n .replace(pemHeader, '')\n .replace(pemFooter, '')\n .replace(/\\s/g, '');\n\n // Decode base64 to binary\n const binaryString = atob(pemContents);\n\n // Convert binary string to Uint8Array\n const binaryData = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n binaryData[i] = binaryString.charCodeAt(i);\n }\n\n return await crypto.subtle.importKey(\n 'pkcs8',\n binaryData,\n { name: 'RSASSA-PKCS1-v1_5', hash: 'SHA-256' },\n true,\n ['sign'],\n );\n};\n\nconst buildJwt = async (credentials: GoogleCredentials) => {\n const now = Math.floor(Date.now() / 1000);\n\n // Only include kid in header if privateKeyId is provided\n const header: { alg: string; typ: string; kid?: string } = {\n alg: 'RS256',\n typ: 'JWT',\n };\n\n if (credentials.privateKeyId) {\n header.kid = credentials.privateKeyId;\n }\n\n const payload = {\n iss: credentials.clientEmail,\n scope: 'https://www.googleapis.com/auth/cloud-platform',\n aud: 'https://oauth2.googleapis.com/token',\n exp: now + 3600,\n iat: now,\n };\n\n const privateKey = await importPrivateKey(credentials.privateKey);\n\n const signingInput = `${base64url(JSON.stringify(header))}.${base64url(\n JSON.stringify(payload),\n )}`;\n const encoder = new TextEncoder();\n const data = encoder.encode(signingInput);\n\n const signature = await crypto.subtle.sign(\n 'RSASSA-PKCS1-v1_5',\n privateKey,\n data,\n );\n\n const signatureBase64 = base64url(\n String.fromCharCode(...new Uint8Array(signature)),\n );\n\n return `${base64url(JSON.stringify(header))}.${base64url(\n JSON.stringify(payload),\n )}.${signatureBase64}`;\n};\n\n/**\n * Generate an authentication token for Google Vertex AI in a manner compatible\n * with the Edge runtime.\n */\nexport async function generateAuthToken(credentials?: GoogleCredentials) {\n try {\n const creds = credentials || (await loadCredentials());\n const jwt = await buildJwt(creds);\n\n const response = await fetch('https://oauth2.googleapis.com/token', {\n method: 'POST',\n headers: withUserAgentSuffix(\n { 'Content-Type': 'application/x-www-form-urlencoded' },\n `ai-sdk/google-vertex/${VERSION}`,\n getRuntimeEnvironmentUserAgent(),\n ),\n body: new URLSearchParams({\n grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',\n assertion: jwt,\n }),\n });\n\n if (!response.ok) {\n throw new Error(`Token request failed: ${response.statusText}`);\n }\n\n const data = await response.json();\n return data.access_token;\n } catch (error) {\n throw error;\n }\n}\n","// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n","import {\n LanguageModelV3,\n NoSuchModelError,\n ProviderV3,\n} from '@ai-sdk/provider';\nimport {\n FetchFunction,\n Resolvable,\n loadOptionalSetting,\n withoutTrailingSlash,\n} from '@ai-sdk/provider-utils';\nimport {\n anthropicTools,\n AnthropicMessagesLanguageModel,\n} from '@ai-sdk/anthropic/internal';\nimport { GoogleVertexAnthropicMessagesModelId } from './google-vertex-anthropic-messages-options';\nexport interface GoogleVertexAnthropicProvider extends ProviderV3 {\n /**\nCreates a model for text generation.\n*/\n (modelId: GoogleVertexAnthropicMessagesModelId): LanguageModelV3;\n\n /**\nCreates a model for text generation.\n*/\n languageModel(modelId: GoogleVertexAnthropicMessagesModelId): LanguageModelV3;\n\n /**\nAnthropic-specific computer use tool.\n */\n tools: typeof anthropicTools;\n}\n\nexport interface GoogleVertexAnthropicProviderSettings {\n /**\n * Google Cloud project ID. Defaults to the value of the `GOOGLE_VERTEX_PROJECT` environment variable.\n */\n project?: string;\n\n /**\n * Google Cloud region. Defaults to the value of the `GOOGLE_VERTEX_LOCATION` environment variable.\n */\n location?: string;\n\n /**\nUse a different URL prefix for API calls, e.g. to use proxy servers.\nThe default prefix is `https://api.anthropic.com/v1`.\n */\n baseURL?: string;\n\n /**\nCustom headers to include in the requests.\n */\n headers?: Resolvable<Record<string, string | undefined>>;\n\n /**\nCustom fetch implementation. You can use it as a middleware to intercept requests,\nor to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\n/**\nCreate a Google Vertex Anthropic provider instance.\n */\nexport function createVertexAnthropic(\n options: GoogleVertexAnthropicProviderSettings = {},\n): GoogleVertexAnthropicProvider {\n const location = loadOptionalSetting({\n settingValue: options.location,\n environmentVariableName: 'GOOGLE_VERTEX_LOCATION',\n });\n const project = loadOptionalSetting({\n settingValue: options.project,\n environmentVariableName: 'GOOGLE_VERTEX_PROJECT',\n });\n\n const baseURL =\n withoutTrailingSlash(options.baseURL) ??\n `https://${location === 'global' ? '' : location + '-'}aiplatform.googleapis.com/v1/projects/${project}/locations/${location}/publishers/anthropic/models`;\n\n const createChatModel = (modelId: GoogleVertexAnthropicMessagesModelId) =>\n new AnthropicMessagesLanguageModel(modelId, {\n provider: 'vertex.anthropic.messages',\n baseURL,\n headers: options.headers ?? {},\n fetch: options.fetch,\n\n buildRequestUrl: (baseURL, isStreaming) =>\n `${baseURL}/${modelId}:${\n isStreaming ? 'streamRawPredict' : 'rawPredict'\n }`,\n transformRequestBody: args => {\n // Remove model from args and add anthropic version\n const { model, ...rest } = args;\n return {\n ...rest,\n anthropic_version: 'vertex-2023-10-16',\n };\n },\n // Google Vertex Anthropic doesn't support URL sources, force download and base64 conversion\n supportedUrls: () => ({}),\n });\n\n const provider = function (modelId: GoogleVertexAnthropicMessagesModelId) {\n if (new.target) {\n throw new Error(\n 'The Anthropic model function cannot be called with the new keyword.',\n );\n }\n\n return createChatModel(modelId);\n };\n\n provider.specificationVersion = 'v3' as const;\n provider.languageModel = createChatModel;\n provider.chat = createChatModel;\n provider.messages = createChatModel;\n\n provider.embeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n };\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n\n provider.tools = anthropicTools;\n\n return provider;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;;;ACAA,IAAAC,yBAAwB;;;ACAxB,4BAKO;;;ACHA,IAAM,UACX,OACI,kBACA;;;ADuBN,IAAM,kBAAkB,YAAwC;AAC9D,MAAI;AACF,WAAO;AAAA,MACL,iBAAa,mCAAY;AAAA,QACvB,cAAc;AAAA,QACd,aAAa;AAAA,QACb,yBAAyB;AAAA,QACzB,aAAa;AAAA,MACf,CAAC;AAAA,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;AACT;;;AH1GO,SAASC,uBACd,UAAiD,CAAC,GACnB;AAC/B,SAAO,sBAA8B;AAAA,IACnC,GAAG;AAAA,IACH,SAAS,aAAa;AAAA,MACpB,eAAe,UAAU,MAAM;AAAA,QAC7B,QAAQ;AAAA,MACV,CAAC;AAAA,MACD,GAAI,UAAM,gCAAQ,QAAQ,OAAO;AAAA,IACnC;AAAA,EACF,CAAC;AACH;AAKO,IAAM,kBAAkBA,uBAAsB;","names":["createVertexAnthropic","import_provider_utils","import_provider_utils","_a","baseURL","createVertexAnthropic"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/anthropic/edge/index.ts","../../../src/anthropic/edge/google-vertex-anthropic-provider-edge.ts","../../../src/edge/google-vertex-auth-edge.ts","../../../src/version.ts","../../../src/anthropic/google-vertex-anthropic-provider.ts"],"sourcesContent":["export {\n createVertexAnthropic,\n vertexAnthropic,\n} from './google-vertex-anthropic-provider-edge';\nexport type {\n GoogleVertexAnthropicProviderSettings,\n GoogleVertexAnthropicProvider,\n} from './google-vertex-anthropic-provider-edge';\n","import { resolve } from '@ai-sdk/provider-utils';\nimport {\n generateAuthToken,\n GoogleCredentials,\n} from '../../edge/google-vertex-auth-edge';\nimport {\n createVertexAnthropic as createVertexAnthropicOriginal,\n GoogleVertexAnthropicProvider,\n GoogleVertexAnthropicProviderSettings as GoogleVertexAnthropicProviderSettingsOriginal,\n} from '../google-vertex-anthropic-provider';\n\nexport type { GoogleVertexAnthropicProvider };\n\nexport interface GoogleVertexAnthropicProviderSettings\n extends GoogleVertexAnthropicProviderSettingsOriginal {\n /**\n * Optional. The Google credentials for the Google Cloud service account. If\n * not provided, the Google Vertex provider will use environment variables to\n * load the credentials.\n */\n googleCredentials?: GoogleCredentials;\n}\n\nexport function createVertexAnthropic(\n options: GoogleVertexAnthropicProviderSettings = {},\n): GoogleVertexAnthropicProvider {\n return createVertexAnthropicOriginal({\n ...options,\n headers: async () => ({\n Authorization: `Bearer ${await generateAuthToken(\n options.googleCredentials,\n )}`,\n ...(await resolve(options.headers)),\n }),\n });\n}\n\n/**\n * Default Google Vertex AI Anthropic provider instance.\n */\nexport const vertexAnthropic = createVertexAnthropic();\n","import {\n loadOptionalSetting,\n loadSetting,\n withUserAgentSuffix,\n getRuntimeEnvironmentUserAgent,\n} from '@ai-sdk/provider-utils';\nimport { VERSION } from '../version';\n\nexport interface GoogleCredentials {\n /**\n * The client email for the Google Cloud service account. Defaults to the\n * value of the `GOOGLE_CLIENT_EMAIL` environment variable.\n */\n clientEmail: string;\n\n /**\n * The private key for the Google Cloud service account. Defaults to the\n * value of the `GOOGLE_PRIVATE_KEY` environment variable.\n */\n privateKey: string;\n\n /**\n * Optional. The private key ID for the Google Cloud service account. Defaults\n * to the value of the `GOOGLE_PRIVATE_KEY_ID` environment variable.\n */\n privateKeyId?: string;\n}\n\nconst loadCredentials = async (): Promise<GoogleCredentials> => {\n try {\n return {\n clientEmail: loadSetting({\n settingValue: undefined,\n settingName: 'clientEmail',\n environmentVariableName: 'GOOGLE_CLIENT_EMAIL',\n description: 'Google client email',\n }),\n privateKey: loadSetting({\n settingValue: undefined,\n settingName: 'privateKey',\n environmentVariableName: 'GOOGLE_PRIVATE_KEY',\n description: 'Google private key',\n }),\n privateKeyId: loadOptionalSetting({\n settingValue: undefined,\n environmentVariableName: 'GOOGLE_PRIVATE_KEY_ID',\n }),\n };\n } catch (error: any) {\n throw new Error(`Failed to load Google credentials: ${error.message}`);\n }\n};\n\n// Convert a string to base64url\nconst base64url = (str: string) => {\n return btoa(str).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n};\nconst importPrivateKey = async (pemKey: string) => {\n const pemHeader = '-----BEGIN PRIVATE KEY-----';\n const pemFooter = '-----END PRIVATE KEY-----';\n\n // Remove header, footer, and any whitespace/newlines\n const pemContents = pemKey\n .replace(pemHeader, '')\n .replace(pemFooter, '')\n .replace(/\\s/g, '');\n\n // Decode base64 to binary\n const binaryString = atob(pemContents);\n\n // Convert binary string to Uint8Array\n const binaryData = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n binaryData[i] = binaryString.charCodeAt(i);\n }\n\n return await crypto.subtle.importKey(\n 'pkcs8',\n binaryData,\n { name: 'RSASSA-PKCS1-v1_5', hash: 'SHA-256' },\n true,\n ['sign'],\n );\n};\n\nconst buildJwt = async (credentials: GoogleCredentials) => {\n const now = Math.floor(Date.now() / 1000);\n\n // Only include kid in header if privateKeyId is provided\n const header: { alg: string; typ: string; kid?: string } = {\n alg: 'RS256',\n typ: 'JWT',\n };\n\n if (credentials.privateKeyId) {\n header.kid = credentials.privateKeyId;\n }\n\n const payload = {\n iss: credentials.clientEmail,\n scope: 'https://www.googleapis.com/auth/cloud-platform',\n aud: 'https://oauth2.googleapis.com/token',\n exp: now + 3600,\n iat: now,\n };\n\n const privateKey = await importPrivateKey(credentials.privateKey);\n\n const signingInput = `${base64url(JSON.stringify(header))}.${base64url(\n JSON.stringify(payload),\n )}`;\n const encoder = new TextEncoder();\n const data = encoder.encode(signingInput);\n\n const signature = await crypto.subtle.sign(\n 'RSASSA-PKCS1-v1_5',\n privateKey,\n data,\n );\n\n const signatureBase64 = base64url(\n String.fromCharCode(...new Uint8Array(signature)),\n );\n\n return `${base64url(JSON.stringify(header))}.${base64url(\n JSON.stringify(payload),\n )}.${signatureBase64}`;\n};\n\n/**\n * Generate an authentication token for Google Vertex AI in a manner compatible\n * with the Edge runtime.\n */\nexport async function generateAuthToken(credentials?: GoogleCredentials) {\n try {\n const creds = credentials || (await loadCredentials());\n const jwt = await buildJwt(creds);\n\n const response = await fetch('https://oauth2.googleapis.com/token', {\n method: 'POST',\n headers: withUserAgentSuffix(\n { 'Content-Type': 'application/x-www-form-urlencoded' },\n `ai-sdk/google-vertex/${VERSION}`,\n getRuntimeEnvironmentUserAgent(),\n ),\n body: new URLSearchParams({\n grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',\n assertion: jwt,\n }),\n });\n\n if (!response.ok) {\n throw new Error(`Token request failed: ${response.statusText}`);\n }\n\n const data = await response.json();\n return data.access_token;\n } catch (error) {\n throw error;\n }\n}\n","// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n","import {\n LanguageModelV3,\n NoSuchModelError,\n ProviderV3,\n} from '@ai-sdk/provider';\nimport {\n FetchFunction,\n Resolvable,\n loadOptionalSetting,\n withoutTrailingSlash,\n} from '@ai-sdk/provider-utils';\nimport {\n anthropicTools,\n AnthropicMessagesLanguageModel,\n} from '@ai-sdk/anthropic/internal';\nimport { GoogleVertexAnthropicMessagesModelId } from './google-vertex-anthropic-messages-options';\nexport interface GoogleVertexAnthropicProvider extends ProviderV3 {\n /**\nCreates a model for text generation.\n*/\n (modelId: GoogleVertexAnthropicMessagesModelId): LanguageModelV3;\n\n /**\nCreates a model for text generation.\n*/\n languageModel(modelId: GoogleVertexAnthropicMessagesModelId): LanguageModelV3;\n\n /**\nAnthropic-specific computer use tool.\n */\n tools: typeof anthropicTools;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n}\n\nexport interface GoogleVertexAnthropicProviderSettings {\n /**\n * Google Cloud project ID. Defaults to the value of the `GOOGLE_VERTEX_PROJECT` environment variable.\n */\n project?: string;\n\n /**\n * Google Cloud region. Defaults to the value of the `GOOGLE_VERTEX_LOCATION` environment variable.\n */\n location?: string;\n\n /**\nUse a different URL prefix for API calls, e.g. to use proxy servers.\nThe default prefix is `https://api.anthropic.com/v1`.\n */\n baseURL?: string;\n\n /**\nCustom headers to include in the requests.\n */\n headers?: Resolvable<Record<string, string | undefined>>;\n\n /**\nCustom fetch implementation. You can use it as a middleware to intercept requests,\nor to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\n/**\nCreate a Google Vertex Anthropic provider instance.\n */\nexport function createVertexAnthropic(\n options: GoogleVertexAnthropicProviderSettings = {},\n): GoogleVertexAnthropicProvider {\n const location = loadOptionalSetting({\n settingValue: options.location,\n environmentVariableName: 'GOOGLE_VERTEX_LOCATION',\n });\n const project = loadOptionalSetting({\n settingValue: options.project,\n environmentVariableName: 'GOOGLE_VERTEX_PROJECT',\n });\n\n const baseURL =\n withoutTrailingSlash(options.baseURL) ??\n `https://${location === 'global' ? '' : location + '-'}aiplatform.googleapis.com/v1/projects/${project}/locations/${location}/publishers/anthropic/models`;\n\n const createChatModel = (modelId: GoogleVertexAnthropicMessagesModelId) =>\n new AnthropicMessagesLanguageModel(modelId, {\n provider: 'vertex.anthropic.messages',\n baseURL,\n headers: options.headers ?? {},\n fetch: options.fetch,\n\n buildRequestUrl: (baseURL, isStreaming) =>\n `${baseURL}/${modelId}:${\n isStreaming ? 'streamRawPredict' : 'rawPredict'\n }`,\n transformRequestBody: args => {\n // Remove model from args and add anthropic version\n const { model, ...rest } = args;\n return {\n ...rest,\n anthropic_version: 'vertex-2023-10-16',\n };\n },\n // Google Vertex Anthropic doesn't support URL sources, force download and base64 conversion\n supportedUrls: () => ({}),\n // force the use of JSON tool fallback for structured outputs since beta header isn't supported\n supportsNativeStructuredOutput: false,\n });\n\n const provider = function (modelId: GoogleVertexAnthropicMessagesModelId) {\n if (new.target) {\n throw new Error(\n 'The Anthropic model function cannot be called with the new keyword.',\n );\n }\n\n return createChatModel(modelId);\n };\n\n provider.specificationVersion = 'v3' as const;\n provider.languageModel = createChatModel;\n provider.chat = createChatModel;\n provider.messages = createChatModel;\n\n provider.embeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n };\n provider.textEmbeddingModel = provider.embeddingModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n\n provider.tools = anthropicTools;\n\n return provider;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAA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gBAAgB;AACzB,WAAS,OAAO;AAChB,WAAS,WAAW;AAEpB,WAAS,iBAAiB,CAAC,YAAoB;AAC7C,UAAM,IAAI,iCAAiB,EAAE,SAAS,WAAW,iBAAiB,CAAC;AAAA,EACrE;AACA,WAAS,qBAAqB,SAAS;AACvC,WAAS,aAAa,CAAC,YAAoB;AACzC,UAAM,IAAI,iCAAiB,EAAE,SAAS,WAAW,aAAa,CAAC;AAAA,EACjE;AAEA,WAAS,QAAQ;AAEjB,SAAO;AACT;;;AHlHO,SAASC,uBACd,UAAiD,CAAC,GACnB;AAC/B,SAAO,sBAA8B;AAAA,IACnC,GAAG;AAAA,IACH,SAAS,aAAa;AAAA,MACpB,eAAe,UAAU,MAAM;AAAA,QAC7B,QAAQ;AAAA,MACV,CAAC;AAAA,MACD,GAAI,UAAM,gCAAQ,QAAQ,OAAO;AAAA,IACnC;AAAA,EACF,CAAC;AACH;AAKO,IAAM,kBAAkBA,uBAAsB;","names":["createVertexAnthropic","import_provider_utils","import_provider_utils","_a","baseURL","createVertexAnthropic"]}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "@ai-sdk/provider-utils";
|
|
11
11
|
|
|
12
12
|
// src/version.ts
|
|
13
|
-
var VERSION = true ? "4.0.0
|
|
13
|
+
var VERSION = true ? "4.0.0" : "0.0.0-test";
|
|
14
14
|
|
|
15
15
|
// src/edge/google-vertex-auth-edge.ts
|
|
16
16
|
var loadCredentials = async () => {
|
|
@@ -156,7 +156,9 @@ function createVertexAnthropic(options = {}) {
|
|
|
156
156
|
};
|
|
157
157
|
},
|
|
158
158
|
// Google Vertex Anthropic doesn't support URL sources, force download and base64 conversion
|
|
159
|
-
supportedUrls: () => ({})
|
|
159
|
+
supportedUrls: () => ({}),
|
|
160
|
+
// force the use of JSON tool fallback for structured outputs since beta header isn't supported
|
|
161
|
+
supportsNativeStructuredOutput: false
|
|
160
162
|
});
|
|
161
163
|
};
|
|
162
164
|
const provider = function(modelId) {
|
|
@@ -174,6 +176,7 @@ function createVertexAnthropic(options = {}) {
|
|
|
174
176
|
provider.embeddingModel = (modelId) => {
|
|
175
177
|
throw new NoSuchModelError({ modelId, modelType: "embeddingModel" });
|
|
176
178
|
};
|
|
179
|
+
provider.textEmbeddingModel = provider.embeddingModel;
|
|
177
180
|
provider.imageModel = (modelId) => {
|
|
178
181
|
throw new NoSuchModelError({ modelId, modelType: "imageModel" });
|
|
179
182
|
};
|