@ai-sdk/openai 4.0.102 → 4.0.103
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 +9 -0
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +87 -1
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +8 -6
- package/dist/internal/index.js.map +1 -1
- package/package.json +2 -2
- package/src/completion/convert-to-openai-completion-prompt.ts +1 -1
- package/src/internal/index.ts +1 -0
- package/src/responses/openai-responses-language-model.ts +1 -0
- package/src/responses/openai-responses-prepare-tools.ts +4 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/openai",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.103",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@ai-sdk/provider": "4.0.34",
|
|
39
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
39
|
+
"@ai-sdk/provider-utils": "5.0.69"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@ai-sdk/test-server": "2.0.4",
|
|
@@ -28,7 +28,7 @@ export function convertToOpenAICompletionPrompt({
|
|
|
28
28
|
switch (role) {
|
|
29
29
|
case 'system': {
|
|
30
30
|
throw new InvalidPromptError({
|
|
31
|
-
message:
|
|
31
|
+
message: `Unexpected system message in prompt: ${content}`,
|
|
32
32
|
prompt,
|
|
33
33
|
});
|
|
34
34
|
}
|
package/src/internal/index.ts
CHANGED
|
@@ -17,5 +17,6 @@ export * from '../tool/code-interpreter';
|
|
|
17
17
|
export * from '../tool/file-search';
|
|
18
18
|
export * from '../tool/image-generation';
|
|
19
19
|
export * from '../tool/programmatic-tool-calling';
|
|
20
|
+
export * from '../tool/tool-search';
|
|
20
21
|
export * from '../tool/web-search';
|
|
21
22
|
export * from '../tool/web-search-preview';
|
|
@@ -413,6 +413,7 @@ export class OpenAIResponsesLanguageModel implements LanguageModelV4 {
|
|
|
413
413
|
customProviderToolNames,
|
|
414
414
|
outputSchemaToolNames,
|
|
415
415
|
supportsAsyncToolCalling: modelCapabilities.supportsAsyncToolCalling,
|
|
416
|
+
providerOptionsName,
|
|
416
417
|
});
|
|
417
418
|
|
|
418
419
|
const configurationUpdateUnsupportedReason =
|
|
@@ -61,6 +61,7 @@ export async function prepareResponsesTools({
|
|
|
61
61
|
customProviderToolNames,
|
|
62
62
|
outputSchemaToolNames,
|
|
63
63
|
supportsAsyncToolCalling = true,
|
|
64
|
+
providerOptionsName = 'openai',
|
|
64
65
|
}: {
|
|
65
66
|
tools: LanguageModelV4CallOptions['tools'];
|
|
66
67
|
toolChoice: LanguageModelV4CallOptions['toolChoice'] | undefined;
|
|
@@ -72,6 +73,7 @@ export async function prepareResponsesTools({
|
|
|
72
73
|
customProviderToolNames?: Set<string>;
|
|
73
74
|
outputSchemaToolNames?: Set<string>;
|
|
74
75
|
supportsAsyncToolCalling?: boolean;
|
|
76
|
+
providerOptionsName?: string;
|
|
75
77
|
}): Promise<{
|
|
76
78
|
tools?: Array<OpenAIResponsesTool>;
|
|
77
79
|
toolChoice?:
|
|
@@ -145,9 +147,8 @@ export async function prepareResponsesTools({
|
|
|
145
147
|
for (const tool of tools) {
|
|
146
148
|
switch (tool.type) {
|
|
147
149
|
case 'function': {
|
|
148
|
-
const openaiOptions = tool.providerOptions?.
|
|
149
|
-
|
|
|
150
|
-
| undefined;
|
|
150
|
+
const openaiOptions = (tool.providerOptions?.[providerOptionsName] ??
|
|
151
|
+
tool.providerOptions?.openai) as OpenAIToolOptions | undefined;
|
|
151
152
|
if (openaiOptions?.outputSchema != null) {
|
|
152
153
|
outputSchemaToolNames?.add(tool.name);
|
|
153
154
|
}
|