@ai-sdk/openai 3.0.30 → 3.0.31
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 +6 -0
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +12 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -6
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +3 -3
- package/dist/internal/index.d.ts +3 -3
- package/dist/internal/index.js +11 -5
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +11 -5
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +91 -38
- package/package.json +1 -1
- package/src/responses/openai-responses-api.ts +53 -46
- package/src/responses/openai-responses-language-model.ts +5 -1
- package/src/tool/web-search-preview.ts +18 -16
- package/src/tool/web-search.ts +18 -16
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -49,7 +49,7 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWi
|
|
|
49
49
|
* An object describing the specific action taken in this web search call.
|
|
50
50
|
* Includes details on how the model used the web (search, open_page, find_in_page).
|
|
51
51
|
*/
|
|
52
|
-
action
|
|
52
|
+
action?: {
|
|
53
53
|
/**
|
|
54
54
|
* Action type "search" - Performs a web search query.
|
|
55
55
|
*/
|
|
@@ -346,7 +346,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
346
346
|
type: "web_search_call";
|
|
347
347
|
id: string;
|
|
348
348
|
status: string;
|
|
349
|
-
action
|
|
349
|
+
action?: {
|
|
350
350
|
type: "search";
|
|
351
351
|
query?: string | null | undefined;
|
|
352
352
|
sources?: ({
|
|
@@ -363,7 +363,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
363
363
|
type: "find_in_page";
|
|
364
364
|
url?: string | null | undefined;
|
|
365
365
|
pattern?: string | null | undefined;
|
|
366
|
-
};
|
|
366
|
+
} | null | undefined;
|
|
367
367
|
} | {
|
|
368
368
|
type: "file_search_call";
|
|
369
369
|
id: string;
|
|
@@ -780,7 +780,7 @@ declare const openaiTools: {
|
|
|
780
780
|
* @param userLocation - The user location to use for the web search.
|
|
781
781
|
*/
|
|
782
782
|
webSearchPreview: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
783
|
-
action
|
|
783
|
+
action?: {
|
|
784
784
|
type: "search";
|
|
785
785
|
query?: string;
|
|
786
786
|
} | {
|
|
@@ -810,7 +810,7 @@ declare const openaiTools: {
|
|
|
810
810
|
* @param userLocation - The user location to use for the web search.
|
|
811
811
|
*/
|
|
812
812
|
webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
813
|
-
action
|
|
813
|
+
action?: {
|
|
814
814
|
type: "search";
|
|
815
815
|
query?: string;
|
|
816
816
|
} | {
|
package/dist/index.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWi
|
|
|
49
49
|
* An object describing the specific action taken in this web search call.
|
|
50
50
|
* Includes details on how the model used the web (search, open_page, find_in_page).
|
|
51
51
|
*/
|
|
52
|
-
action
|
|
52
|
+
action?: {
|
|
53
53
|
/**
|
|
54
54
|
* Action type "search" - Performs a web search query.
|
|
55
55
|
*/
|
|
@@ -346,7 +346,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
346
346
|
type: "web_search_call";
|
|
347
347
|
id: string;
|
|
348
348
|
status: string;
|
|
349
|
-
action
|
|
349
|
+
action?: {
|
|
350
350
|
type: "search";
|
|
351
351
|
query?: string | null | undefined;
|
|
352
352
|
sources?: ({
|
|
@@ -363,7 +363,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
363
363
|
type: "find_in_page";
|
|
364
364
|
url?: string | null | undefined;
|
|
365
365
|
pattern?: string | null | undefined;
|
|
366
|
-
};
|
|
366
|
+
} | null | undefined;
|
|
367
367
|
} | {
|
|
368
368
|
type: "file_search_call";
|
|
369
369
|
id: string;
|
|
@@ -780,7 +780,7 @@ declare const openaiTools: {
|
|
|
780
780
|
* @param userLocation - The user location to use for the web search.
|
|
781
781
|
*/
|
|
782
782
|
webSearchPreview: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
783
|
-
action
|
|
783
|
+
action?: {
|
|
784
784
|
type: "search";
|
|
785
785
|
query?: string;
|
|
786
786
|
} | {
|
|
@@ -810,7 +810,7 @@ declare const openaiTools: {
|
|
|
810
810
|
* @param userLocation - The user location to use for the web search.
|
|
811
811
|
*/
|
|
812
812
|
webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
813
|
-
action
|
|
813
|
+
action?: {
|
|
814
814
|
type: "search";
|
|
815
815
|
query?: string;
|
|
816
816
|
} | {
|
package/dist/index.js
CHANGED
|
@@ -2285,7 +2285,7 @@ var webSearchOutputSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
2285
2285
|
url: import_v415.z.string().nullish(),
|
|
2286
2286
|
pattern: import_v415.z.string().nullish()
|
|
2287
2287
|
})
|
|
2288
|
-
]),
|
|
2288
|
+
]).optional(),
|
|
2289
2289
|
sources: import_v415.z.array(
|
|
2290
2290
|
import_v415.z.discriminatedUnion("type", [
|
|
2291
2291
|
import_v415.z.object({ type: import_v415.z.literal("url"), url: import_v415.z.string() }),
|
|
@@ -2339,7 +2339,7 @@ var webSearchPreviewOutputSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
2339
2339
|
url: import_v416.z.string().nullish(),
|
|
2340
2340
|
pattern: import_v416.z.string().nullish()
|
|
2341
2341
|
})
|
|
2342
|
-
])
|
|
2342
|
+
]).optional()
|
|
2343
2343
|
})
|
|
2344
2344
|
)
|
|
2345
2345
|
);
|
|
@@ -3240,7 +3240,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
3240
3240
|
url: import_v419.z.string().nullish(),
|
|
3241
3241
|
pattern: import_v419.z.string().nullish()
|
|
3242
3242
|
})
|
|
3243
|
-
])
|
|
3243
|
+
]).nullish()
|
|
3244
3244
|
}),
|
|
3245
3245
|
import_v419.z.object({
|
|
3246
3246
|
type: import_v419.z.literal("file_search_call"),
|
|
@@ -3556,7 +3556,10 @@ var openaiResponsesResponseSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
3556
3556
|
sources: import_v419.z.array(
|
|
3557
3557
|
import_v419.z.discriminatedUnion("type", [
|
|
3558
3558
|
import_v419.z.object({ type: import_v419.z.literal("url"), url: import_v419.z.string() }),
|
|
3559
|
-
import_v419.z.object({
|
|
3559
|
+
import_v419.z.object({
|
|
3560
|
+
type: import_v419.z.literal("api"),
|
|
3561
|
+
name: import_v419.z.string()
|
|
3562
|
+
})
|
|
3560
3563
|
])
|
|
3561
3564
|
).nullish()
|
|
3562
3565
|
}),
|
|
@@ -3569,7 +3572,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
3569
3572
|
url: import_v419.z.string().nullish(),
|
|
3570
3573
|
pattern: import_v419.z.string().nullish()
|
|
3571
3574
|
})
|
|
3572
|
-
])
|
|
3575
|
+
]).nullish()
|
|
3573
3576
|
}),
|
|
3574
3577
|
import_v419.z.object({
|
|
3575
3578
|
type: import_v419.z.literal("file_search_call"),
|
|
@@ -5680,6 +5683,9 @@ function isErrorChunk(chunk) {
|
|
|
5680
5683
|
}
|
|
5681
5684
|
function mapWebSearchOutput(action) {
|
|
5682
5685
|
var _a;
|
|
5686
|
+
if (action == null) {
|
|
5687
|
+
return {};
|
|
5688
|
+
}
|
|
5683
5689
|
switch (action.type) {
|
|
5684
5690
|
case "search":
|
|
5685
5691
|
return {
|
|
@@ -6056,7 +6062,7 @@ var OpenAITranscriptionModel = class {
|
|
|
6056
6062
|
};
|
|
6057
6063
|
|
|
6058
6064
|
// src/version.ts
|
|
6059
|
-
var VERSION = true ? "3.0.
|
|
6065
|
+
var VERSION = true ? "3.0.31" : "0.0.0-test";
|
|
6060
6066
|
|
|
6061
6067
|
// src/openai-provider.ts
|
|
6062
6068
|
function createOpenAI(options = {}) {
|