@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 4.0.0-beta.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [986c6fd]
|
|
8
|
+
- Updated dependencies [493295c]
|
|
9
|
+
- @ai-sdk/provider-utils@5.0.0-beta.8
|
|
10
|
+
|
|
11
|
+
## 4.0.0-beta.17
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 817a1a6: fix(openai): support file-url parts in tool output content
|
|
16
|
+
|
|
3
17
|
## 4.0.0-beta.16
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -141,7 +141,7 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWi
|
|
|
141
141
|
*/
|
|
142
142
|
timezone?: string;
|
|
143
143
|
};
|
|
144
|
-
}>;
|
|
144
|
+
}, {}>;
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
147
|
* A filter used to compare a specified attribute key to a given value using a defined comparison operation.
|
|
@@ -648,7 +648,7 @@ declare const customToolFactory: _ai_sdk_provider_utils.ProviderToolFactory<stri
|
|
|
648
648
|
} | {
|
|
649
649
|
type: "text";
|
|
650
650
|
};
|
|
651
|
-
}>;
|
|
651
|
+
}, {}>;
|
|
652
652
|
|
|
653
653
|
/**
|
|
654
654
|
* Type definitions for the apply_patch operations.
|
|
@@ -695,7 +695,7 @@ declare const openaiTools: {
|
|
|
695
695
|
}, {
|
|
696
696
|
status: "completed" | "failed";
|
|
697
697
|
output?: string;
|
|
698
|
-
}, {}>;
|
|
698
|
+
}, {}, {}>;
|
|
699
699
|
/**
|
|
700
700
|
* Custom tools let callers constrain model output to a grammar (regex or
|
|
701
701
|
* Lark syntax). The model returns a `custom_tool_call` output item whose
|
|
@@ -704,7 +704,7 @@ declare const openaiTools: {
|
|
|
704
704
|
* @param description - An optional description of the tool.
|
|
705
705
|
* @param format - The output format constraint (grammar type, syntax, and definition).
|
|
706
706
|
*/
|
|
707
|
-
customTool: (args: Parameters<typeof customToolFactory>[0]) => _ai_sdk_provider_utils.Tool<string, unknown>;
|
|
707
|
+
customTool: (args: Parameters<typeof customToolFactory>[0]) => _ai_sdk_provider_utils.Tool<string, unknown, {}>;
|
|
708
708
|
/**
|
|
709
709
|
* The Code Interpreter tool allows models to write and run Python code in a
|
|
710
710
|
* sandboxed environment to solve complex problems in domains like data analysis,
|
|
@@ -727,7 +727,7 @@ declare const openaiTools: {
|
|
|
727
727
|
type: "image";
|
|
728
728
|
url: string;
|
|
729
729
|
}> | null;
|
|
730
|
-
}>;
|
|
730
|
+
}, {}>;
|
|
731
731
|
/**
|
|
732
732
|
* File search is a tool available in the Responses API. It enables models to
|
|
733
733
|
* retrieve information in a knowledge base of previously uploaded files through
|
|
@@ -755,7 +755,7 @@ declare const openaiTools: {
|
|
|
755
755
|
scoreThreshold?: number;
|
|
756
756
|
};
|
|
757
757
|
filters?: OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter;
|
|
758
|
-
}>;
|
|
758
|
+
}, {}>;
|
|
759
759
|
/**
|
|
760
760
|
* The image generation tool allows you to generate images using a text prompt,
|
|
761
761
|
* and optionally image inputs. It leverages the GPT Image model,
|
|
@@ -788,7 +788,7 @@ declare const openaiTools: {
|
|
|
788
788
|
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024";
|
|
789
789
|
}) => _ai_sdk_provider_utils.Tool<{}, {
|
|
790
790
|
result: string;
|
|
791
|
-
}>;
|
|
791
|
+
}, {}>;
|
|
792
792
|
/**
|
|
793
793
|
* Local shell is a tool that allows agents to run shell commands locally
|
|
794
794
|
* on a machine you or the user provides.
|
|
@@ -806,7 +806,7 @@ declare const openaiTools: {
|
|
|
806
806
|
};
|
|
807
807
|
}, {
|
|
808
808
|
output: string;
|
|
809
|
-
}, {}>;
|
|
809
|
+
}, {}, {}>;
|
|
810
810
|
/**
|
|
811
811
|
* The shell tool allows the model to interact with your local computer through
|
|
812
812
|
* a controlled command-line interface. The model proposes shell commands; your
|
|
@@ -876,7 +876,7 @@ declare const openaiTools: {
|
|
|
876
876
|
path: string;
|
|
877
877
|
}>;
|
|
878
878
|
};
|
|
879
|
-
}>;
|
|
879
|
+
}, {}>;
|
|
880
880
|
/**
|
|
881
881
|
* Web search allows models to access up-to-date information from the internet
|
|
882
882
|
* and provide answers with sourced citations.
|
|
@@ -905,7 +905,7 @@ declare const openaiTools: {
|
|
|
905
905
|
region?: string;
|
|
906
906
|
timezone?: string;
|
|
907
907
|
};
|
|
908
|
-
}>;
|
|
908
|
+
}, {}>;
|
|
909
909
|
/**
|
|
910
910
|
* Web search allows models to access up-to-date information from the internet
|
|
911
911
|
* and provide answers with sourced citations.
|
|
@@ -933,7 +933,7 @@ declare const openaiTools: {
|
|
|
933
933
|
type: "api";
|
|
934
934
|
name: string;
|
|
935
935
|
}>;
|
|
936
|
-
}>;
|
|
936
|
+
}, {}>;
|
|
937
937
|
/**
|
|
938
938
|
* MCP (Model Context Protocol) allows models to call tools exposed by
|
|
939
939
|
* remote MCP servers or service connectors.
|
|
@@ -970,7 +970,7 @@ declare const openaiTools: {
|
|
|
970
970
|
arguments: string;
|
|
971
971
|
output?: string | null;
|
|
972
972
|
error?: _ai_sdk_provider.JSONValue;
|
|
973
|
-
}>;
|
|
973
|
+
}, {}>;
|
|
974
974
|
/**
|
|
975
975
|
* Tool search allows the model to dynamically search for and load deferred
|
|
976
976
|
* tools into the model's context as needed. This helps reduce overall token
|
|
@@ -989,12 +989,12 @@ declare const openaiTools: {
|
|
|
989
989
|
execution?: "server" | "client";
|
|
990
990
|
description?: string;
|
|
991
991
|
parameters?: Record<string, unknown>;
|
|
992
|
-
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
992
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
993
993
|
arguments?: unknown;
|
|
994
994
|
call_id?: string | null;
|
|
995
995
|
}, {
|
|
996
996
|
tools: Array<_ai_sdk_provider.JSONObject>;
|
|
997
|
-
}>;
|
|
997
|
+
}, {}>;
|
|
998
998
|
};
|
|
999
999
|
|
|
1000
1000
|
type OpenAIResponsesModelId = 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.2-codex' | 'gpt-5.3-chat-latest' | 'gpt-5.3-codex' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | 'o4-mini' | 'o4-mini-2025-04-16' | (string & {});
|
package/dist/index.d.ts
CHANGED
|
@@ -141,7 +141,7 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWi
|
|
|
141
141
|
*/
|
|
142
142
|
timezone?: string;
|
|
143
143
|
};
|
|
144
|
-
}>;
|
|
144
|
+
}, {}>;
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
147
|
* A filter used to compare a specified attribute key to a given value using a defined comparison operation.
|
|
@@ -648,7 +648,7 @@ declare const customToolFactory: _ai_sdk_provider_utils.ProviderToolFactory<stri
|
|
|
648
648
|
} | {
|
|
649
649
|
type: "text";
|
|
650
650
|
};
|
|
651
|
-
}>;
|
|
651
|
+
}, {}>;
|
|
652
652
|
|
|
653
653
|
/**
|
|
654
654
|
* Type definitions for the apply_patch operations.
|
|
@@ -695,7 +695,7 @@ declare const openaiTools: {
|
|
|
695
695
|
}, {
|
|
696
696
|
status: "completed" | "failed";
|
|
697
697
|
output?: string;
|
|
698
|
-
}, {}>;
|
|
698
|
+
}, {}, {}>;
|
|
699
699
|
/**
|
|
700
700
|
* Custom tools let callers constrain model output to a grammar (regex or
|
|
701
701
|
* Lark syntax). The model returns a `custom_tool_call` output item whose
|
|
@@ -704,7 +704,7 @@ declare const openaiTools: {
|
|
|
704
704
|
* @param description - An optional description of the tool.
|
|
705
705
|
* @param format - The output format constraint (grammar type, syntax, and definition).
|
|
706
706
|
*/
|
|
707
|
-
customTool: (args: Parameters<typeof customToolFactory>[0]) => _ai_sdk_provider_utils.Tool<string, unknown>;
|
|
707
|
+
customTool: (args: Parameters<typeof customToolFactory>[0]) => _ai_sdk_provider_utils.Tool<string, unknown, {}>;
|
|
708
708
|
/**
|
|
709
709
|
* The Code Interpreter tool allows models to write and run Python code in a
|
|
710
710
|
* sandboxed environment to solve complex problems in domains like data analysis,
|
|
@@ -727,7 +727,7 @@ declare const openaiTools: {
|
|
|
727
727
|
type: "image";
|
|
728
728
|
url: string;
|
|
729
729
|
}> | null;
|
|
730
|
-
}>;
|
|
730
|
+
}, {}>;
|
|
731
731
|
/**
|
|
732
732
|
* File search is a tool available in the Responses API. It enables models to
|
|
733
733
|
* retrieve information in a knowledge base of previously uploaded files through
|
|
@@ -755,7 +755,7 @@ declare const openaiTools: {
|
|
|
755
755
|
scoreThreshold?: number;
|
|
756
756
|
};
|
|
757
757
|
filters?: OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter;
|
|
758
|
-
}>;
|
|
758
|
+
}, {}>;
|
|
759
759
|
/**
|
|
760
760
|
* The image generation tool allows you to generate images using a text prompt,
|
|
761
761
|
* and optionally image inputs. It leverages the GPT Image model,
|
|
@@ -788,7 +788,7 @@ declare const openaiTools: {
|
|
|
788
788
|
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024";
|
|
789
789
|
}) => _ai_sdk_provider_utils.Tool<{}, {
|
|
790
790
|
result: string;
|
|
791
|
-
}>;
|
|
791
|
+
}, {}>;
|
|
792
792
|
/**
|
|
793
793
|
* Local shell is a tool that allows agents to run shell commands locally
|
|
794
794
|
* on a machine you or the user provides.
|
|
@@ -806,7 +806,7 @@ declare const openaiTools: {
|
|
|
806
806
|
};
|
|
807
807
|
}, {
|
|
808
808
|
output: string;
|
|
809
|
-
}, {}>;
|
|
809
|
+
}, {}, {}>;
|
|
810
810
|
/**
|
|
811
811
|
* The shell tool allows the model to interact with your local computer through
|
|
812
812
|
* a controlled command-line interface. The model proposes shell commands; your
|
|
@@ -876,7 +876,7 @@ declare const openaiTools: {
|
|
|
876
876
|
path: string;
|
|
877
877
|
}>;
|
|
878
878
|
};
|
|
879
|
-
}>;
|
|
879
|
+
}, {}>;
|
|
880
880
|
/**
|
|
881
881
|
* Web search allows models to access up-to-date information from the internet
|
|
882
882
|
* and provide answers with sourced citations.
|
|
@@ -905,7 +905,7 @@ declare const openaiTools: {
|
|
|
905
905
|
region?: string;
|
|
906
906
|
timezone?: string;
|
|
907
907
|
};
|
|
908
|
-
}>;
|
|
908
|
+
}, {}>;
|
|
909
909
|
/**
|
|
910
910
|
* Web search allows models to access up-to-date information from the internet
|
|
911
911
|
* and provide answers with sourced citations.
|
|
@@ -933,7 +933,7 @@ declare const openaiTools: {
|
|
|
933
933
|
type: "api";
|
|
934
934
|
name: string;
|
|
935
935
|
}>;
|
|
936
|
-
}>;
|
|
936
|
+
}, {}>;
|
|
937
937
|
/**
|
|
938
938
|
* MCP (Model Context Protocol) allows models to call tools exposed by
|
|
939
939
|
* remote MCP servers or service connectors.
|
|
@@ -970,7 +970,7 @@ declare const openaiTools: {
|
|
|
970
970
|
arguments: string;
|
|
971
971
|
output?: string | null;
|
|
972
972
|
error?: _ai_sdk_provider.JSONValue;
|
|
973
|
-
}>;
|
|
973
|
+
}, {}>;
|
|
974
974
|
/**
|
|
975
975
|
* Tool search allows the model to dynamically search for and load deferred
|
|
976
976
|
* tools into the model's context as needed. This helps reduce overall token
|
|
@@ -989,12 +989,12 @@ declare const openaiTools: {
|
|
|
989
989
|
execution?: "server" | "client";
|
|
990
990
|
description?: string;
|
|
991
991
|
parameters?: Record<string, unknown>;
|
|
992
|
-
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
992
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
993
993
|
arguments?: unknown;
|
|
994
994
|
call_id?: string | null;
|
|
995
995
|
}, {
|
|
996
996
|
tools: Array<_ai_sdk_provider.JSONObject>;
|
|
997
|
-
}>;
|
|
997
|
+
}, {}>;
|
|
998
998
|
};
|
|
999
999
|
|
|
1000
1000
|
type OpenAIResponsesModelId = 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.2-codex' | 'gpt-5.3-chat-latest' | 'gpt-5.3-codex' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | 'o4-mini' | 'o4-mini-2025-04-16' | (string & {});
|
package/dist/index.js
CHANGED
|
@@ -3156,6 +3156,11 @@ async function convertToOpenAIResponsesInput({
|
|
|
3156
3156
|
filename: (_a2 = item.filename) != null ? _a2 : "data",
|
|
3157
3157
|
file_data: `data:${item.mediaType};base64,${item.data}`
|
|
3158
3158
|
};
|
|
3159
|
+
case "file-url":
|
|
3160
|
+
return {
|
|
3161
|
+
type: "input_file",
|
|
3162
|
+
file_url: item.url
|
|
3163
|
+
};
|
|
3159
3164
|
default:
|
|
3160
3165
|
warnings.push({
|
|
3161
3166
|
type: "other",
|
|
@@ -3214,6 +3219,12 @@ async function convertToOpenAIResponsesInput({
|
|
|
3214
3219
|
file_data: `data:${item.mediaType};base64,${item.data}`
|
|
3215
3220
|
};
|
|
3216
3221
|
}
|
|
3222
|
+
case "file-url": {
|
|
3223
|
+
return {
|
|
3224
|
+
type: "input_file",
|
|
3225
|
+
file_url: item.url
|
|
3226
|
+
};
|
|
3227
|
+
}
|
|
3217
3228
|
default: {
|
|
3218
3229
|
warnings.push({
|
|
3219
3230
|
type: "other",
|
|
@@ -6716,7 +6727,7 @@ var OpenAITranscriptionModel = class {
|
|
|
6716
6727
|
};
|
|
6717
6728
|
|
|
6718
6729
|
// src/version.ts
|
|
6719
|
-
var VERSION = true ? "4.0.0-beta.
|
|
6730
|
+
var VERSION = true ? "4.0.0-beta.18" : "0.0.0-test";
|
|
6720
6731
|
|
|
6721
6732
|
// src/openai-provider.ts
|
|
6722
6733
|
function createOpenAI(options = {}) {
|