@ai-sdk/provider 4.0.0-beta.3 → 4.0.0-beta.5
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 +25 -13
- package/dist/index.d.mts +9 -4
- package/dist/index.d.ts +9 -4
- package/package.json +2 -4
- package/src/language-model/v4/language-model-v4-call-options.ts +13 -0
- package/src/language-model/v4/language-model-v4-custom-content.ts +2 -2
- package/src/language-model/v4/language-model-v4-prompt.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/provider
|
|
2
2
|
|
|
3
|
+
## 4.0.0-beta.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1f509d4: fix(ai): force template check on 'kind' param
|
|
8
|
+
|
|
9
|
+
## 4.0.0-beta.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 3887c70: feat(provider): add new top-level reasoning parameter to spec and support it in `generateText` and `streamText`
|
|
14
|
+
|
|
3
15
|
## 4.0.0-beta.3
|
|
4
16
|
|
|
5
17
|
### Major Changes
|
|
@@ -93,13 +105,13 @@
|
|
|
93
105
|
Before
|
|
94
106
|
|
|
95
107
|
```ts
|
|
96
|
-
model.textEmbeddingModel(
|
|
108
|
+
model.textEmbeddingModel("my-model-id");
|
|
97
109
|
```
|
|
98
110
|
|
|
99
111
|
After
|
|
100
112
|
|
|
101
113
|
```ts
|
|
102
|
-
model.embeddingModel(
|
|
114
|
+
model.embeddingModel("my-model-id");
|
|
103
115
|
```
|
|
104
116
|
|
|
105
117
|
- dce03c4: feat: tool input examples
|
|
@@ -219,13 +231,13 @@
|
|
|
219
231
|
Before
|
|
220
232
|
|
|
221
233
|
```ts
|
|
222
|
-
model.textEmbeddingModel(
|
|
234
|
+
model.textEmbeddingModel("my-model-id");
|
|
223
235
|
```
|
|
224
236
|
|
|
225
237
|
After
|
|
226
238
|
|
|
227
239
|
```ts
|
|
228
|
-
model.embeddingModel(
|
|
240
|
+
model.embeddingModel("my-model-id");
|
|
229
241
|
```
|
|
230
242
|
|
|
231
243
|
## 3.0.0-beta.18
|
|
@@ -412,13 +424,13 @@
|
|
|
412
424
|
Before
|
|
413
425
|
|
|
414
426
|
```ts
|
|
415
|
-
import { convertUint8ArrayToBase64 } from
|
|
427
|
+
import { convertUint8ArrayToBase64 } from "@ai-sdk/provider-utils";
|
|
416
428
|
|
|
417
429
|
// Had to manually convert binary data to base64
|
|
418
430
|
const fileData = new Uint8Array([0, 1, 2, 3]);
|
|
419
431
|
const filePart = {
|
|
420
|
-
type:
|
|
421
|
-
mediaType:
|
|
432
|
+
type: "file",
|
|
433
|
+
mediaType: "application/pdf",
|
|
422
434
|
data: convertUint8ArrayToBase64(fileData), // Required conversion
|
|
423
435
|
};
|
|
424
436
|
```
|
|
@@ -429,8 +441,8 @@
|
|
|
429
441
|
// Can use binary data directly
|
|
430
442
|
const fileData = new Uint8Array([0, 1, 2, 3]);
|
|
431
443
|
const filePart = {
|
|
432
|
-
type:
|
|
433
|
-
mediaType:
|
|
444
|
+
type: "file",
|
|
445
|
+
mediaType: "application/pdf",
|
|
434
446
|
data: fileData, // Direct Uint8Array support
|
|
435
447
|
};
|
|
436
448
|
```
|
|
@@ -446,10 +458,10 @@
|
|
|
446
458
|
The `experimental_generateImage` method from the `ai` package now returnes revised prompts for OpenAI's image models.
|
|
447
459
|
|
|
448
460
|
```js
|
|
449
|
-
const prompt =
|
|
461
|
+
const prompt = "Santa Claus driving a Cadillac";
|
|
450
462
|
|
|
451
463
|
const { providerMetadata } = await experimental_generateImage({
|
|
452
|
-
model: openai.image(
|
|
464
|
+
model: openai.image("dall-e-3"),
|
|
453
465
|
prompt,
|
|
454
466
|
});
|
|
455
467
|
|
|
@@ -608,10 +620,10 @@
|
|
|
608
620
|
The `experimental_generateImage` method from the `ai` package now returnes revised prompts for OpenAI's image models.
|
|
609
621
|
|
|
610
622
|
```js
|
|
611
|
-
const prompt =
|
|
623
|
+
const prompt = "Santa Claus driving a Cadillac";
|
|
612
624
|
|
|
613
625
|
const { providerMetadata } = await experimental_generateImage({
|
|
614
|
-
model: openai.image(
|
|
626
|
+
model: openai.image("dall-e-3"),
|
|
615
627
|
prompt,
|
|
616
628
|
});
|
|
617
629
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1629,9 +1629,9 @@ interface LanguageModelV4ReasoningFilePart {
|
|
|
1629
1629
|
interface LanguageModelV4CustomPart {
|
|
1630
1630
|
type: 'custom';
|
|
1631
1631
|
/**
|
|
1632
|
-
* The kind of custom content, in the format `{provider}
|
|
1632
|
+
* The kind of custom content, in the format `{provider}.{provider-type}`.
|
|
1633
1633
|
*/
|
|
1634
|
-
kind: string
|
|
1634
|
+
kind: `${string}.${string}`;
|
|
1635
1635
|
/**
|
|
1636
1636
|
* Additional provider-specific options. They are passed through
|
|
1637
1637
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -2040,6 +2040,11 @@ type LanguageModelV4CallOptions = {
|
|
|
2040
2040
|
* Only applicable for HTTP-based providers.
|
|
2041
2041
|
*/
|
|
2042
2042
|
headers?: Record<string, string | undefined>;
|
|
2043
|
+
/**
|
|
2044
|
+
* Reasoning effort level for the model. Controls how much reasoning
|
|
2045
|
+
* the model performs before generating a response. Defaults to 'provider-default'.
|
|
2046
|
+
*/
|
|
2047
|
+
reasoning?: 'provider-default' | 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
2043
2048
|
/**
|
|
2044
2049
|
* Additional provider-specific options. They are passed through
|
|
2045
2050
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -2055,9 +2060,9 @@ type LanguageModelV4CallOptions = {
|
|
|
2055
2060
|
type LanguageModelV4CustomContent = {
|
|
2056
2061
|
type: 'custom';
|
|
2057
2062
|
/**
|
|
2058
|
-
* The kind of custom content, in the format `{provider}
|
|
2063
|
+
* The kind of custom content, in the format `{provider}.{provider-type}`.
|
|
2059
2064
|
*/
|
|
2060
|
-
kind: string
|
|
2065
|
+
kind: `${string}.${string}`;
|
|
2061
2066
|
/**
|
|
2062
2067
|
* Additional provider-specific options. They are passed through
|
|
2063
2068
|
* to the provider from the AI SDK and enable provider-specific
|
package/dist/index.d.ts
CHANGED
|
@@ -1629,9 +1629,9 @@ interface LanguageModelV4ReasoningFilePart {
|
|
|
1629
1629
|
interface LanguageModelV4CustomPart {
|
|
1630
1630
|
type: 'custom';
|
|
1631
1631
|
/**
|
|
1632
|
-
* The kind of custom content, in the format `{provider}
|
|
1632
|
+
* The kind of custom content, in the format `{provider}.{provider-type}`.
|
|
1633
1633
|
*/
|
|
1634
|
-
kind: string
|
|
1634
|
+
kind: `${string}.${string}`;
|
|
1635
1635
|
/**
|
|
1636
1636
|
* Additional provider-specific options. They are passed through
|
|
1637
1637
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -2040,6 +2040,11 @@ type LanguageModelV4CallOptions = {
|
|
|
2040
2040
|
* Only applicable for HTTP-based providers.
|
|
2041
2041
|
*/
|
|
2042
2042
|
headers?: Record<string, string | undefined>;
|
|
2043
|
+
/**
|
|
2044
|
+
* Reasoning effort level for the model. Controls how much reasoning
|
|
2045
|
+
* the model performs before generating a response. Defaults to 'provider-default'.
|
|
2046
|
+
*/
|
|
2047
|
+
reasoning?: 'provider-default' | 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
2043
2048
|
/**
|
|
2044
2049
|
* Additional provider-specific options. They are passed through
|
|
2045
2050
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -2055,9 +2060,9 @@ type LanguageModelV4CallOptions = {
|
|
|
2055
2060
|
type LanguageModelV4CustomContent = {
|
|
2056
2061
|
type: 'custom';
|
|
2057
2062
|
/**
|
|
2058
|
-
* The kind of custom content, in the format `{provider}
|
|
2063
|
+
* The kind of custom content, in the format `{provider}.{provider-type}`.
|
|
2059
2064
|
*/
|
|
2060
|
-
kind: string
|
|
2065
|
+
kind: `${string}.${string}`;
|
|
2061
2066
|
/**
|
|
2062
2067
|
* Additional provider-specific options. They are passed through
|
|
2063
2068
|
* to the provider from the AI SDK and enable provider-specific
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/provider",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.5",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -56,8 +56,6 @@
|
|
|
56
56
|
"build": "pnpm clean && tsup --tsconfig tsconfig.build.json",
|
|
57
57
|
"build:watch": "pnpm clean && tsup --watch",
|
|
58
58
|
"clean": "del-cli dist *.tsbuildinfo",
|
|
59
|
-
"
|
|
60
|
-
"type-check": "tsc --build",
|
|
61
|
-
"prettier-check": "prettier --check \"./**/*.ts*\""
|
|
59
|
+
"type-check": "tsc --build"
|
|
62
60
|
}
|
|
63
61
|
}
|
|
@@ -116,6 +116,19 @@ export type LanguageModelV4CallOptions = {
|
|
|
116
116
|
*/
|
|
117
117
|
headers?: Record<string, string | undefined>;
|
|
118
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Reasoning effort level for the model. Controls how much reasoning
|
|
121
|
+
* the model performs before generating a response. Defaults to 'provider-default'.
|
|
122
|
+
*/
|
|
123
|
+
reasoning?:
|
|
124
|
+
| 'provider-default'
|
|
125
|
+
| 'none'
|
|
126
|
+
| 'minimal'
|
|
127
|
+
| 'low'
|
|
128
|
+
| 'medium'
|
|
129
|
+
| 'high'
|
|
130
|
+
| 'xhigh';
|
|
131
|
+
|
|
119
132
|
/**
|
|
120
133
|
* Additional provider-specific options. They are passed through
|
|
121
134
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -8,9 +8,9 @@ export type LanguageModelV4CustomContent = {
|
|
|
8
8
|
type: 'custom';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* The kind of custom content, in the format `{provider}
|
|
11
|
+
* The kind of custom content, in the format `{provider}.{provider-type}`.
|
|
12
12
|
*/
|
|
13
|
-
kind: string
|
|
13
|
+
kind: `${string}.${string}`;
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Additional provider-specific options. They are passed through
|
|
@@ -126,9 +126,9 @@ export interface LanguageModelV4CustomPart {
|
|
|
126
126
|
type: 'custom';
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
|
-
* The kind of custom content, in the format `{provider}
|
|
129
|
+
* The kind of custom content, in the format `{provider}.{provider-type}`.
|
|
130
130
|
*/
|
|
131
|
-
kind: string
|
|
131
|
+
kind: `${string}.${string}`;
|
|
132
132
|
|
|
133
133
|
/**
|
|
134
134
|
* Additional provider-specific options. They are passed through
|