@ai-sdk/provider-utils 5.0.0-beta.2 → 5.0.0-beta.20
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 +220 -0
- package/dist/index.d.ts +423 -169
- package/dist/index.js +314 -271
- package/dist/index.js.map +1 -1
- package/dist/test/index.js +2 -35
- package/dist/test/index.js.map +1 -1
- package/package.json +8 -10
- package/src/convert-image-model-file-to-data-uri.ts +3 -3
- package/src/create-tool-name-mapping.ts +5 -21
- package/src/get-error-message.ts +1 -1
- package/src/has-required-key.ts +6 -0
- package/src/index.ts +17 -7
- package/src/inject-json-instruction.ts +5 -5
- package/src/is-json-serializable.ts +29 -0
- package/src/is-provider-reference.ts +18 -0
- package/src/load-api-key.ts +1 -1
- package/src/load-setting.ts +1 -1
- package/src/map-reasoning-to-provider.ts +105 -0
- package/src/provider-tool-factory.ts +43 -32
- package/src/resolve-provider-reference.ts +27 -0
- package/src/resolve.ts +15 -0
- package/src/response-handler.ts +1 -1
- package/src/secure-json-parse.ts +1 -1
- package/src/serialize-model-options.ts +63 -0
- package/src/to-json-schema/zod3-to-json-schema/parsers/date.ts +1 -1
- package/src/to-json-schema/zod3-to-json-schema/parsers/intersection.ts +1 -1
- package/src/to-json-schema/zod3-to-json-schema/parsers/record.ts +2 -2
- package/src/types/assistant-model-message.ts +4 -0
- package/src/types/content-part.ts +98 -14
- package/src/types/context.ts +4 -0
- package/src/types/execute-tool.ts +24 -4
- package/src/types/index.ts +10 -9
- package/src/types/infer-tool-context.ts +12 -0
- package/src/types/infer-tool-input.ts +7 -0
- package/src/types/infer-tool-output.ts +7 -0
- package/src/types/infer-tool-set-context.ts +17 -0
- package/src/types/provider-options.ts +2 -2
- package/src/types/provider-reference.ts +10 -0
- package/src/types/tool-set.ts +22 -0
- package/src/types/tool.ts +74 -40
- package/src/types/union-to-intersection.ts +17 -0
- package/src/validate-download-url.ts +7 -2
- package/dist/index.d.mts +0 -1433
- package/dist/index.mjs +0 -2759
- package/dist/index.mjs.map +0 -1
- package/dist/test/index.d.mts +0 -17
- package/dist/test/index.mjs +0 -77
- package/dist/test/index.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,225 @@
|
|
|
1
1
|
# @ai-sdk/provider-utils
|
|
2
2
|
|
|
3
|
+
## 5.0.0-beta.20
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b3976a2: Add workflow serialization support to all provider models.
|
|
8
|
+
|
|
9
|
+
**`@ai-sdk/provider-utils`:** New `serializeModel()` helper that extracts only serializable properties from a model instance, filtering out functions and objects containing functions. Third-party provider authors can use this to add workflow support to their own models.
|
|
10
|
+
|
|
11
|
+
**All providers:** `headers` is now optional in provider config types. This is non-breaking — existing code that passes `headers` continues to work. Custom provider implementations that construct model configs manually can now omit `headers`, which is useful when models are deserialized from a workflow step boundary where auth is provided separately.
|
|
12
|
+
|
|
13
|
+
All provider model classes now include `WORKFLOW_SERIALIZE` and `WORKFLOW_DESERIALIZE` static methods, enabling them to cross workflow step boundaries without serialization errors.
|
|
14
|
+
|
|
15
|
+
- ff5eba1: feat: roll `image-*` tool output types into their equivalent `file-*` types
|
|
16
|
+
- Updated dependencies [ff5eba1]
|
|
17
|
+
- @ai-sdk/provider@4.0.0-beta.12
|
|
18
|
+
|
|
19
|
+
## 5.0.0-beta.19
|
|
20
|
+
|
|
21
|
+
### Major Changes
|
|
22
|
+
|
|
23
|
+
- ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [ef992f8]
|
|
28
|
+
- @ai-sdk/provider@4.0.0-beta.11
|
|
29
|
+
|
|
30
|
+
## 5.0.0-beta.18
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- 90e2d8a: chore: fix unused vars not being flagged by our lint tooling
|
|
35
|
+
|
|
36
|
+
## 5.0.0-beta.17
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- 3ae1786: fix: better context type inference
|
|
41
|
+
|
|
42
|
+
## 5.0.0-beta.16
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- Updated dependencies [176466a]
|
|
47
|
+
- @ai-sdk/provider@4.0.0-beta.10
|
|
48
|
+
|
|
49
|
+
## 5.0.0-beta.15
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- Updated dependencies [e311194]
|
|
54
|
+
- @ai-sdk/provider@4.0.0-beta.9
|
|
55
|
+
|
|
56
|
+
## 5.0.0-beta.14
|
|
57
|
+
|
|
58
|
+
### Patch Changes
|
|
59
|
+
|
|
60
|
+
- Updated dependencies [34bd95d]
|
|
61
|
+
- Updated dependencies [008271d]
|
|
62
|
+
- @ai-sdk/provider@4.0.0-beta.8
|
|
63
|
+
|
|
64
|
+
## 5.0.0-beta.13
|
|
65
|
+
|
|
66
|
+
### Major Changes
|
|
67
|
+
|
|
68
|
+
- 7e26e81: chore: rename experimental_context to context
|
|
69
|
+
|
|
70
|
+
### Patch Changes
|
|
71
|
+
|
|
72
|
+
- b0c2869: chore(ai): remove deprecated `media` type part from `ToolResultOutput`
|
|
73
|
+
|
|
74
|
+
## 5.0.0-beta.12
|
|
75
|
+
|
|
76
|
+
### Patch Changes
|
|
77
|
+
|
|
78
|
+
- 46d1149: chore(provider-utils,google): fix grammar errors in error and warning messages
|
|
79
|
+
|
|
80
|
+
## 5.0.0-beta.11
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- 6fd51c0: fix(provider): preserve error type prefix in getErrorMessage
|
|
85
|
+
- Updated dependencies [6fd51c0]
|
|
86
|
+
- @ai-sdk/provider@4.0.0-beta.7
|
|
87
|
+
|
|
88
|
+
## 5.0.0-beta.10
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- c29a26f: feat(provider): add support for provider references and uploading files as supported per provider
|
|
93
|
+
- Updated dependencies [c29a26f]
|
|
94
|
+
- @ai-sdk/provider@4.0.0-beta.6
|
|
95
|
+
|
|
96
|
+
## 5.0.0-beta.9
|
|
97
|
+
|
|
98
|
+
### Patch Changes
|
|
99
|
+
|
|
100
|
+
- 2e17091: fix(types): move shared tool set utility types into provider-utils
|
|
101
|
+
|
|
102
|
+
Moved `ToolSet`, `InferToolSetContext`, and `UnionToIntersection` into `@ai-sdk/provider-utils` and updated `ai` internals to import them directly from there. This keeps the shared tool typing utilities colocated with the core tool type definitions.
|
|
103
|
+
|
|
104
|
+
## 5.0.0-beta.8
|
|
105
|
+
|
|
106
|
+
### Major Changes
|
|
107
|
+
|
|
108
|
+
- 986c6fd: feat(ai): change type of experimental_context from unknown to generic
|
|
109
|
+
- 493295c: Remove the deprecated `ToolCallOptions` export.
|
|
110
|
+
|
|
111
|
+
Use `ToolExecutionOptions` instead.
|
|
112
|
+
|
|
113
|
+
## 5.0.0-beta.7
|
|
114
|
+
|
|
115
|
+
### Patch Changes
|
|
116
|
+
|
|
117
|
+
- 1f509d4: fix(ai): force template check on 'kind' param
|
|
118
|
+
- Updated dependencies [1f509d4]
|
|
119
|
+
- @ai-sdk/provider@4.0.0-beta.5
|
|
120
|
+
|
|
121
|
+
## 5.0.0-beta.6
|
|
122
|
+
|
|
123
|
+
### Patch Changes
|
|
124
|
+
|
|
125
|
+
- 3887c70: feat(provider): add new top-level reasoning parameter to spec and support it in `generateText` and `streamText`
|
|
126
|
+
- Updated dependencies [3887c70]
|
|
127
|
+
- @ai-sdk/provider@4.0.0-beta.4
|
|
128
|
+
|
|
129
|
+
## 5.0.0-beta.5
|
|
130
|
+
|
|
131
|
+
### Major Changes
|
|
132
|
+
|
|
133
|
+
- 776b617: feat(provider): adding new 'custom' content type
|
|
134
|
+
|
|
135
|
+
### Patch Changes
|
|
136
|
+
|
|
137
|
+
- Updated dependencies [776b617]
|
|
138
|
+
- @ai-sdk/provider@4.0.0-beta.3
|
|
139
|
+
|
|
140
|
+
## 5.0.0-beta.4
|
|
141
|
+
|
|
142
|
+
### Major Changes
|
|
143
|
+
|
|
144
|
+
- 61753c3: ### `@ai-sdk/openai`: remove redundant `name` argument from `openai.tools.customTool()`
|
|
145
|
+
|
|
146
|
+
`openai.tools.customTool()` no longer accepts a `name` field. the tool name is now derived from the sdk tool key (the object key in the `tools` object).
|
|
147
|
+
|
|
148
|
+
migration: remove the `name` property from `customTool()` calls. the object key is now used as the tool name sent to the openai api.
|
|
149
|
+
|
|
150
|
+
before:
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
tools: {
|
|
154
|
+
write_sql: openai.tools.customTool({
|
|
155
|
+
name: 'write_sql',
|
|
156
|
+
description: '...',
|
|
157
|
+
}),
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
after:
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
tools: {
|
|
165
|
+
write_sql: openai.tools.customTool({
|
|
166
|
+
description: '...',
|
|
167
|
+
}),
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### `@ai-sdk/provider-utils`: `createToolNameMapping()` no longer accepts the `resolveProviderToolName` parameter
|
|
172
|
+
|
|
173
|
+
before: tool name can be set dynamically
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
const toolNameMapping = createToolNameMapping({
|
|
177
|
+
tools,
|
|
178
|
+
providerToolNames: {
|
|
179
|
+
"openai.code_interpreter": "code_interpreter",
|
|
180
|
+
"openai.file_search": "file_search",
|
|
181
|
+
"openai.image_generation": "image_generation",
|
|
182
|
+
"openai.local_shell": "local_shell",
|
|
183
|
+
"openai.shell": "shell",
|
|
184
|
+
"openai.web_search": "web_search",
|
|
185
|
+
"openai.web_search_preview": "web_search_preview",
|
|
186
|
+
"openai.mcp": "mcp",
|
|
187
|
+
"openai.apply_patch": "apply_patch",
|
|
188
|
+
},
|
|
189
|
+
resolveProviderToolName: (tool) =>
|
|
190
|
+
tool.id === "openai.custom"
|
|
191
|
+
? (tool.args as { name?: string }).name
|
|
192
|
+
: undefined,
|
|
193
|
+
});
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
after: tool name is static based on `tools` keys
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
const toolNameMapping = createToolNameMapping({
|
|
200
|
+
tools,
|
|
201
|
+
providerToolNames: {
|
|
202
|
+
'openai.code_interpreter': 'code_interpreter',
|
|
203
|
+
'openai.file_search': 'file_search',
|
|
204
|
+
'openai.image_generation': 'image_generation',
|
|
205
|
+
'openai.local_shell': 'local_shell',
|
|
206
|
+
'openai.shell': 'shell',
|
|
207
|
+
'openai.web_search': 'web_search',
|
|
208
|
+
'openai.web_search_preview': 'web_search_preview',
|
|
209
|
+
'openai.mcp': 'mcp',
|
|
210
|
+
'openai.apply_patch': 'apply_patch',
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## 5.0.0-beta.3
|
|
216
|
+
|
|
217
|
+
### Patch Changes
|
|
218
|
+
|
|
219
|
+
- f7d4f01: feat(provider): add support for `reasoning-file` type for files that are part of reasoning
|
|
220
|
+
- Updated dependencies [f7d4f01]
|
|
221
|
+
- @ai-sdk/provider@4.0.0-beta.2
|
|
222
|
+
|
|
3
223
|
## 5.0.0-beta.2
|
|
4
224
|
|
|
5
225
|
### Patch Changes
|