@ai-sdk/openai 2.0.54 → 2.0.56
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.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +28 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -7
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +27 -6
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +27 -6
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 2.0.56
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b82d23b: feat(openai): preserve file_id when converting file citations
|
|
8
|
+
|
|
9
|
+
## 2.0.55
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 2f4a59a: feat(openai): add sources in web-search actions
|
|
14
|
+
|
|
3
15
|
## 2.0.54
|
|
4
16
|
|
|
5
17
|
### 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"),
|
|
@@ -3395,7 +3398,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3395
3398
|
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils24.generateId)(),
|
|
3396
3399
|
mediaType: "text/plain",
|
|
3397
3400
|
title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
|
|
3398
|
-
filename: (_l = annotation.filename) != null ? _l : annotation.file_id
|
|
3401
|
+
filename: (_l = annotation.filename) != null ? _l : annotation.file_id,
|
|
3402
|
+
...annotation.file_id ? {
|
|
3403
|
+
providerMetadata: {
|
|
3404
|
+
openai: {
|
|
3405
|
+
fileId: annotation.file_id
|
|
3406
|
+
}
|
|
3407
|
+
}
|
|
3408
|
+
} : {}
|
|
3399
3409
|
});
|
|
3400
3410
|
}
|
|
3401
3411
|
}
|
|
@@ -3973,7 +3983,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3973
3983
|
id: (_s = (_r = (_q = self.config).generateId) == null ? void 0 : _r.call(_q)) != null ? _s : (0, import_provider_utils24.generateId)(),
|
|
3974
3984
|
mediaType: "text/plain",
|
|
3975
3985
|
title: (_u = (_t = value.annotation.quote) != null ? _t : value.annotation.filename) != null ? _u : "Document",
|
|
3976
|
-
filename: (_v = value.annotation.filename) != null ? _v : value.annotation.file_id
|
|
3986
|
+
filename: (_v = value.annotation.filename) != null ? _v : value.annotation.file_id,
|
|
3987
|
+
...value.annotation.file_id ? {
|
|
3988
|
+
providerMetadata: {
|
|
3989
|
+
openai: {
|
|
3990
|
+
fileId: value.annotation.file_id
|
|
3991
|
+
}
|
|
3992
|
+
}
|
|
3993
|
+
} : {}
|
|
3977
3994
|
});
|
|
3978
3995
|
}
|
|
3979
3996
|
} else if (isErrorChunk(value)) {
|
|
@@ -4073,7 +4090,11 @@ function mapWebSearchOutput(action) {
|
|
|
4073
4090
|
var _a;
|
|
4074
4091
|
switch (action.type) {
|
|
4075
4092
|
case "search":
|
|
4076
|
-
return {
|
|
4093
|
+
return {
|
|
4094
|
+
action: { type: "search", query: (_a = action.query) != null ? _a : void 0 },
|
|
4095
|
+
// include sources when provided by the Responses API (behind include flag)
|
|
4096
|
+
...action.sources != null && { sources: action.sources }
|
|
4097
|
+
};
|
|
4077
4098
|
case "open_page":
|
|
4078
4099
|
return { action: { type: "openPage", url: action.url } };
|
|
4079
4100
|
case "find":
|
|
@@ -4436,7 +4457,7 @@ var OpenAITranscriptionModel = class {
|
|
|
4436
4457
|
};
|
|
4437
4458
|
|
|
4438
4459
|
// src/version.ts
|
|
4439
|
-
var VERSION = true ? "2.0.
|
|
4460
|
+
var VERSION = true ? "2.0.56" : "0.0.0-test";
|
|
4440
4461
|
|
|
4441
4462
|
// src/openai-provider.ts
|
|
4442
4463
|
function createOpenAI(options = {}) {
|