@ai-sdk/openai 3.0.112 → 3.0.114
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 +12 -0
- package/dist/index.js +24 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -3
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +23 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +23 -2
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +2 -1
- package/package.json +1 -1
- package/src/responses/convert-to-openai-responses-input.ts +28 -0
- package/src/responses/openai-responses-api.ts +10 -0
- package/src/responses/openai-responses-language-model.ts +4 -0
package/docs/03-openai.mdx
CHANGED
|
@@ -53,7 +53,8 @@ You can use the following optional settings to customize the OpenAI provider ins
|
|
|
53
53
|
- **baseURL** _string_
|
|
54
54
|
|
|
55
55
|
Use a different URL prefix for API calls, e.g. to use proxy servers.
|
|
56
|
-
|
|
56
|
+
It defaults to the `OPENAI_BASE_URL` environment variable, and then to
|
|
57
|
+
`https://api.openai.com/v1`.
|
|
57
58
|
The default OpenAI model factory (`openai('model-id')`) uses the Responses
|
|
58
59
|
API. If your custom base URL only supports the Chat Completions API, create
|
|
59
60
|
chat models with `openai.chat('model-id')` instead, or use the
|
package/package.json
CHANGED
|
@@ -122,6 +122,34 @@ async function convertFunctionToolResultOutput({
|
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
case 'file-id': {
|
|
126
|
+
return {
|
|
127
|
+
type: 'input_file' as const,
|
|
128
|
+
file_id:
|
|
129
|
+
typeof item.fileId === 'string'
|
|
130
|
+
? item.fileId
|
|
131
|
+
: item.fileId[providerOptionsName],
|
|
132
|
+
...(promptCacheBreakpoint != null && {
|
|
133
|
+
prompt_cache_breakpoint: promptCacheBreakpoint,
|
|
134
|
+
}),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
case 'image-file-id': {
|
|
139
|
+
return {
|
|
140
|
+
type: 'input_image' as const,
|
|
141
|
+
file_id:
|
|
142
|
+
typeof item.fileId === 'string'
|
|
143
|
+
? item.fileId
|
|
144
|
+
: item.fileId[providerOptionsName],
|
|
145
|
+
detail:
|
|
146
|
+
item.providerOptions?.[providerOptionsName]?.imageDetail,
|
|
147
|
+
...(promptCacheBreakpoint != null && {
|
|
148
|
+
prompt_cache_breakpoint: promptCacheBreakpoint,
|
|
149
|
+
}),
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
125
153
|
case 'file-data': {
|
|
126
154
|
return {
|
|
127
155
|
type: 'input_file' as const,
|
|
@@ -204,6 +204,11 @@ export type OpenAIResponsesFunctionCallOutput = {
|
|
|
204
204
|
image_url: string;
|
|
205
205
|
prompt_cache_breakpoint?: { mode: 'explicit' };
|
|
206
206
|
}
|
|
207
|
+
| {
|
|
208
|
+
type: 'input_image';
|
|
209
|
+
file_id: string;
|
|
210
|
+
prompt_cache_breakpoint?: { mode: 'explicit' };
|
|
211
|
+
}
|
|
207
212
|
| {
|
|
208
213
|
type: 'input_file';
|
|
209
214
|
filename: string;
|
|
@@ -215,6 +220,11 @@ export type OpenAIResponsesFunctionCallOutput = {
|
|
|
215
220
|
file_url: string;
|
|
216
221
|
prompt_cache_breakpoint?: { mode: 'explicit' };
|
|
217
222
|
}
|
|
223
|
+
| {
|
|
224
|
+
type: 'input_file';
|
|
225
|
+
file_id: string;
|
|
226
|
+
prompt_cache_breakpoint?: { mode: 'explicit' };
|
|
227
|
+
}
|
|
218
228
|
>;
|
|
219
229
|
};
|
|
220
230
|
|
|
@@ -1105,6 +1105,8 @@ export class OpenAIResponsesLanguageModel implements LanguageModelV3 {
|
|
|
1105
1105
|
}
|
|
1106
1106
|
|
|
1107
1107
|
case 'apply_patch_call': {
|
|
1108
|
+
hasFunctionCall = true;
|
|
1109
|
+
|
|
1108
1110
|
content.push({
|
|
1109
1111
|
type: 'tool-call',
|
|
1110
1112
|
toolCallId: part.call_id,
|
|
@@ -1934,6 +1936,8 @@ export class OpenAIResponsesLanguageModel implements LanguageModelV3 {
|
|
|
1934
1936
|
|
|
1935
1937
|
// Emit the final tool-call with complete diff when status is 'completed'
|
|
1936
1938
|
if (toolCall && value.item.status === 'completed') {
|
|
1939
|
+
hasFunctionCall = true;
|
|
1940
|
+
|
|
1937
1941
|
controller.enqueue({
|
|
1938
1942
|
type: 'tool-call',
|
|
1939
1943
|
toolCallId: toolCall.toolCallId,
|