@ai-sdk/openai 2.0.53 → 2.0.55
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 +13 -0
- package/dist/index.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -5
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +11 -4
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +11 -4
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 2.0.55
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2f4a59a: feat(openai): add sources in web-search actions
|
|
8
|
+
|
|
9
|
+
## 2.0.54
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [1e05490]
|
|
14
|
+
- @ai-sdk/provider-utils@3.0.13
|
|
15
|
+
|
|
3
16
|
## 2.0.53
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -65,6 +65,13 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFa
|
|
|
65
65
|
*/
|
|
66
66
|
pattern: string;
|
|
67
67
|
};
|
|
68
|
+
/**
|
|
69
|
+
* Optional sources cited by the model for the web search call.
|
|
70
|
+
*/
|
|
71
|
+
sources?: {
|
|
72
|
+
type: "url";
|
|
73
|
+
url: string;
|
|
74
|
+
}[];
|
|
68
75
|
}, {
|
|
69
76
|
/**
|
|
70
77
|
* Filters for the search.
|
|
@@ -302,6 +309,10 @@ declare const openaiTools: {
|
|
|
302
309
|
url: string;
|
|
303
310
|
pattern: string;
|
|
304
311
|
};
|
|
312
|
+
sources?: {
|
|
313
|
+
type: "url";
|
|
314
|
+
url: string;
|
|
315
|
+
}[];
|
|
305
316
|
}>;
|
|
306
317
|
};
|
|
307
318
|
|
package/dist/index.d.ts
CHANGED
|
@@ -65,6 +65,13 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFa
|
|
|
65
65
|
*/
|
|
66
66
|
pattern: string;
|
|
67
67
|
};
|
|
68
|
+
/**
|
|
69
|
+
* Optional sources cited by the model for the web search call.
|
|
70
|
+
*/
|
|
71
|
+
sources?: {
|
|
72
|
+
type: "url";
|
|
73
|
+
url: string;
|
|
74
|
+
}[];
|
|
68
75
|
}, {
|
|
69
76
|
/**
|
|
70
77
|
* Filters for the search.
|
|
@@ -302,6 +309,10 @@ declare const openaiTools: {
|
|
|
302
309
|
url: string;
|
|
303
310
|
pattern: string;
|
|
304
311
|
};
|
|
312
|
+
sources?: {
|
|
313
|
+
type: "url";
|
|
314
|
+
url: string;
|
|
315
|
+
}[];
|
|
305
316
|
}>;
|
|
306
317
|
};
|
|
307
318
|
|
package/dist/index.js
CHANGED
|
@@ -1946,7 +1946,8 @@ var webSearchOutputSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
1946
1946
|
url: import_v413.z.string(),
|
|
1947
1947
|
pattern: import_v413.z.string()
|
|
1948
1948
|
})
|
|
1949
|
-
])
|
|
1949
|
+
]),
|
|
1950
|
+
sources: import_v413.z.array(import_v413.z.object({ type: import_v413.z.literal("url"), url: import_v413.z.string() })).optional()
|
|
1950
1951
|
})
|
|
1951
1952
|
)
|
|
1952
1953
|
);
|
|
@@ -2527,7 +2528,8 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazyValidator)(
|
|
|
2527
2528
|
action: import_v416.z.discriminatedUnion("type", [
|
|
2528
2529
|
import_v416.z.object({
|
|
2529
2530
|
type: import_v416.z.literal("search"),
|
|
2530
|
-
query: import_v416.z.string().nullish()
|
|
2531
|
+
query: import_v416.z.string().nullish(),
|
|
2532
|
+
sources: import_v416.z.array(import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() })).nullish()
|
|
2531
2533
|
}),
|
|
2532
2534
|
import_v416.z.object({
|
|
2533
2535
|
type: import_v416.z.literal("open_page"),
|
|
@@ -2713,7 +2715,8 @@ var openaiResponsesResponseSchema = (0, import_provider_utils21.lazyValidator)(
|
|
|
2713
2715
|
action: import_v416.z.discriminatedUnion("type", [
|
|
2714
2716
|
import_v416.z.object({
|
|
2715
2717
|
type: import_v416.z.literal("search"),
|
|
2716
|
-
query: import_v416.z.string().nullish()
|
|
2718
|
+
query: import_v416.z.string().nullish(),
|
|
2719
|
+
sources: import_v416.z.array(import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() })).nullish()
|
|
2717
2720
|
}),
|
|
2718
2721
|
import_v416.z.object({
|
|
2719
2722
|
type: import_v416.z.literal("open_page"),
|
|
@@ -4073,7 +4076,11 @@ function mapWebSearchOutput(action) {
|
|
|
4073
4076
|
var _a;
|
|
4074
4077
|
switch (action.type) {
|
|
4075
4078
|
case "search":
|
|
4076
|
-
return {
|
|
4079
|
+
return {
|
|
4080
|
+
action: { type: "search", query: (_a = action.query) != null ? _a : void 0 },
|
|
4081
|
+
// include sources when provided by the Responses API (behind include flag)
|
|
4082
|
+
...action.sources != null && { sources: action.sources }
|
|
4083
|
+
};
|
|
4077
4084
|
case "open_page":
|
|
4078
4085
|
return { action: { type: "openPage", url: action.url } };
|
|
4079
4086
|
case "find":
|
|
@@ -4436,7 +4443,7 @@ var OpenAITranscriptionModel = class {
|
|
|
4436
4443
|
};
|
|
4437
4444
|
|
|
4438
4445
|
// src/version.ts
|
|
4439
|
-
var VERSION = true ? "2.0.
|
|
4446
|
+
var VERSION = true ? "2.0.55" : "0.0.0-test";
|
|
4440
4447
|
|
|
4441
4448
|
// src/openai-provider.ts
|
|
4442
4449
|
function createOpenAI(options = {}) {
|