@ai-sdk/openai 4.0.0-beta.16 → 4.0.0-beta.18
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 +14 -0
- package/dist/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -1
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +7 -7
- package/dist/internal/index.d.ts +7 -7
- package/dist/internal/index.js +11 -0
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +11 -0
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +10 -10
- package/package.json +2 -2
- package/src/responses/convert-to-openai-responses-input.ts +12 -0
- package/src/responses/openai-responses-api.ts +1 -0
package/docs/03-openai.mdx
CHANGED
|
@@ -769,7 +769,7 @@ const result = await generateText({
|
|
|
769
769
|
}),
|
|
770
770
|
},
|
|
771
771
|
prompt: 'List the files in my home directory.',
|
|
772
|
-
stopWhen:
|
|
772
|
+
stopWhen: isStepCount(2),
|
|
773
773
|
});
|
|
774
774
|
```
|
|
775
775
|
|
|
@@ -927,7 +927,7 @@ const result = await generateText({
|
|
|
927
927
|
}),
|
|
928
928
|
},
|
|
929
929
|
prompt: 'Use the skill to solve this problem.',
|
|
930
|
-
stopWhen:
|
|
930
|
+
stopWhen: isStepCount(5),
|
|
931
931
|
});
|
|
932
932
|
```
|
|
933
933
|
|
|
@@ -942,7 +942,7 @@ enabling iterative, multi-step code editing workflows.
|
|
|
942
942
|
|
|
943
943
|
```ts
|
|
944
944
|
import { openai } from '@ai-sdk/openai';
|
|
945
|
-
import { generateText,
|
|
945
|
+
import { generateText, isStepCount } from 'ai';
|
|
946
946
|
|
|
947
947
|
const result = await generateText({
|
|
948
948
|
model: openai('gpt-5.1'),
|
|
@@ -954,7 +954,7 @@ const result = await generateText({
|
|
|
954
954
|
}),
|
|
955
955
|
},
|
|
956
956
|
prompt: 'Create a python file that calculates the factorial of a number',
|
|
957
|
-
stopWhen:
|
|
957
|
+
stopWhen: isStepCount(5),
|
|
958
958
|
});
|
|
959
959
|
```
|
|
960
960
|
|
|
@@ -982,13 +982,13 @@ Add `openai.tools.toolSearch()` with no arguments and mark your tools with `defe
|
|
|
982
982
|
|
|
983
983
|
```ts
|
|
984
984
|
import { openai } from '@ai-sdk/openai';
|
|
985
|
-
import { generateText, tool,
|
|
985
|
+
import { generateText, tool, isStepCount } from 'ai';
|
|
986
986
|
import { z } from 'zod';
|
|
987
987
|
|
|
988
988
|
const result = await generateText({
|
|
989
989
|
model: openai.responses('gpt-5.4'),
|
|
990
990
|
prompt: 'What is the weather in San Francisco?',
|
|
991
|
-
stopWhen:
|
|
991
|
+
stopWhen: isStepCount(10),
|
|
992
992
|
tools: {
|
|
993
993
|
toolSearch: openai.tools.toolSearch(),
|
|
994
994
|
|
|
@@ -1033,13 +1033,13 @@ a `description`, `parameters` schema, and an `execute` callback:
|
|
|
1033
1033
|
|
|
1034
1034
|
```ts
|
|
1035
1035
|
import { openai } from '@ai-sdk/openai';
|
|
1036
|
-
import { generateText, tool,
|
|
1036
|
+
import { generateText, tool, isStepCount } from 'ai';
|
|
1037
1037
|
import { z } from 'zod';
|
|
1038
1038
|
|
|
1039
1039
|
const result = await generateText({
|
|
1040
1040
|
model: openai.responses('gpt-5.4'),
|
|
1041
1041
|
prompt: 'What is the weather in San Francisco?',
|
|
1042
|
-
stopWhen:
|
|
1042
|
+
stopWhen: isStepCount(10),
|
|
1043
1043
|
tools: {
|
|
1044
1044
|
toolSearch: openai.tools.toolSearch({
|
|
1045
1045
|
execution: 'client',
|
|
@@ -1113,7 +1113,7 @@ SQL queries, code snippets, or any output that must match a specific pattern.
|
|
|
1113
1113
|
|
|
1114
1114
|
```ts
|
|
1115
1115
|
import { openai } from '@ai-sdk/openai';
|
|
1116
|
-
import { generateText,
|
|
1116
|
+
import { generateText, isStepCount } from 'ai';
|
|
1117
1117
|
|
|
1118
1118
|
const result = await generateText({
|
|
1119
1119
|
model: openai.responses('gpt-5.2-codex'),
|
|
@@ -1134,7 +1134,7 @@ const result = await generateText({
|
|
|
1134
1134
|
},
|
|
1135
1135
|
toolChoice: 'required',
|
|
1136
1136
|
prompt: 'Write a SQL query to get all users older than 25.',
|
|
1137
|
-
stopWhen:
|
|
1137
|
+
stopWhen: isStepCount(3),
|
|
1138
1138
|
});
|
|
1139
1139
|
```
|
|
1140
1140
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/openai",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.18",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@ai-sdk/provider": "4.0.0-beta.5",
|
|
40
|
-
"@ai-sdk/provider-utils": "5.0.0-beta.
|
|
40
|
+
"@ai-sdk/provider-utils": "5.0.0-beta.8"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "20.17.24",
|
|
@@ -740,6 +740,11 @@ export async function convertToOpenAIResponsesInput({
|
|
|
740
740
|
filename: item.filename ?? 'data',
|
|
741
741
|
file_data: `data:${item.mediaType};base64,${item.data}`,
|
|
742
742
|
};
|
|
743
|
+
case 'file-url':
|
|
744
|
+
return {
|
|
745
|
+
type: 'input_file' as const,
|
|
746
|
+
file_url: item.url,
|
|
747
|
+
};
|
|
743
748
|
default:
|
|
744
749
|
warnings.push({
|
|
745
750
|
type: 'other',
|
|
@@ -804,6 +809,13 @@ export async function convertToOpenAIResponsesInput({
|
|
|
804
809
|
};
|
|
805
810
|
}
|
|
806
811
|
|
|
812
|
+
case 'file-url': {
|
|
813
|
+
return {
|
|
814
|
+
type: 'input_file' as const,
|
|
815
|
+
file_url: item.url,
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
|
|
807
819
|
default: {
|
|
808
820
|
warnings.push({
|
|
809
821
|
type: 'other',
|
|
@@ -107,6 +107,7 @@ export type OpenAIResponsesFunctionCallOutput = {
|
|
|
107
107
|
| { type: 'input_text'; text: string }
|
|
108
108
|
| { type: 'input_image'; image_url: string }
|
|
109
109
|
| { type: 'input_file'; filename: string; file_data: string }
|
|
110
|
+
| { type: 'input_file'; file_url: string }
|
|
110
111
|
>;
|
|
111
112
|
};
|
|
112
113
|
|