@ai-sdk/openai 3.0.7 → 3.0.8
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 +375 -1
- package/dist/index.d.ts +375 -1
- package/dist/index.js +54 -60
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -60
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +406 -32
- package/dist/internal/index.d.ts +406 -32
- package/dist/internal/index.js +53 -59
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +53 -59
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/internal/index.mjs
CHANGED
|
@@ -3248,25 +3248,21 @@ var openaiResponsesChunkSchema = lazySchema14(
|
|
|
3248
3248
|
z16.object({
|
|
3249
3249
|
type: z16.literal("file_citation"),
|
|
3250
3250
|
file_id: z16.string(),
|
|
3251
|
-
filename: z16.string()
|
|
3252
|
-
index: z16.number()
|
|
3253
|
-
start_index: z16.number().nullish(),
|
|
3254
|
-
end_index: z16.number().nullish(),
|
|
3255
|
-
quote: z16.string().nullish()
|
|
3251
|
+
filename: z16.string(),
|
|
3252
|
+
index: z16.number()
|
|
3256
3253
|
}),
|
|
3257
3254
|
z16.object({
|
|
3258
3255
|
type: z16.literal("container_file_citation"),
|
|
3259
3256
|
container_id: z16.string(),
|
|
3260
3257
|
file_id: z16.string(),
|
|
3261
|
-
filename: z16.string()
|
|
3262
|
-
start_index: z16.number()
|
|
3263
|
-
end_index: z16.number()
|
|
3264
|
-
index: z16.number().nullish()
|
|
3258
|
+
filename: z16.string(),
|
|
3259
|
+
start_index: z16.number(),
|
|
3260
|
+
end_index: z16.number()
|
|
3265
3261
|
}),
|
|
3266
3262
|
z16.object({
|
|
3267
3263
|
type: z16.literal("file_path"),
|
|
3268
3264
|
file_id: z16.string(),
|
|
3269
|
-
index: z16.number()
|
|
3265
|
+
index: z16.number()
|
|
3270
3266
|
})
|
|
3271
3267
|
])
|
|
3272
3268
|
}),
|
|
@@ -3363,25 +3359,21 @@ var openaiResponsesResponseSchema = lazySchema14(
|
|
|
3363
3359
|
z16.object({
|
|
3364
3360
|
type: z16.literal("file_citation"),
|
|
3365
3361
|
file_id: z16.string(),
|
|
3366
|
-
filename: z16.string()
|
|
3367
|
-
index: z16.number()
|
|
3368
|
-
start_index: z16.number().nullish(),
|
|
3369
|
-
end_index: z16.number().nullish(),
|
|
3370
|
-
quote: z16.string().nullish()
|
|
3362
|
+
filename: z16.string(),
|
|
3363
|
+
index: z16.number()
|
|
3371
3364
|
}),
|
|
3372
3365
|
z16.object({
|
|
3373
3366
|
type: z16.literal("container_file_citation"),
|
|
3374
3367
|
container_id: z16.string(),
|
|
3375
3368
|
file_id: z16.string(),
|
|
3376
|
-
filename: z16.string()
|
|
3377
|
-
start_index: z16.number()
|
|
3378
|
-
end_index: z16.number()
|
|
3379
|
-
index: z16.number().nullish()
|
|
3369
|
+
filename: z16.string(),
|
|
3370
|
+
start_index: z16.number(),
|
|
3371
|
+
end_index: z16.number()
|
|
3380
3372
|
}),
|
|
3381
3373
|
z16.object({
|
|
3382
3374
|
type: z16.literal("file_path"),
|
|
3383
3375
|
file_id: z16.string(),
|
|
3384
|
-
index: z16.number()
|
|
3376
|
+
index: z16.number()
|
|
3385
3377
|
})
|
|
3386
3378
|
])
|
|
3387
3379
|
)
|
|
@@ -4565,7 +4557,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4565
4557
|
};
|
|
4566
4558
|
}
|
|
4567
4559
|
async doGenerate(options) {
|
|
4568
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y
|
|
4560
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
4569
4561
|
const {
|
|
4570
4562
|
args: body,
|
|
4571
4563
|
warnings,
|
|
@@ -4712,29 +4704,29 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4712
4704
|
sourceType: "document",
|
|
4713
4705
|
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : generateId2(),
|
|
4714
4706
|
mediaType: "text/plain",
|
|
4715
|
-
title:
|
|
4716
|
-
filename:
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4707
|
+
title: annotation.filename,
|
|
4708
|
+
filename: annotation.filename,
|
|
4709
|
+
providerMetadata: {
|
|
4710
|
+
[providerOptionsName]: {
|
|
4711
|
+
type: annotation.type,
|
|
4712
|
+
fileId: annotation.file_id,
|
|
4713
|
+
index: annotation.index
|
|
4722
4714
|
}
|
|
4723
|
-
}
|
|
4715
|
+
}
|
|
4724
4716
|
});
|
|
4725
4717
|
} else if (annotation.type === "container_file_citation") {
|
|
4726
4718
|
content.push({
|
|
4727
4719
|
type: "source",
|
|
4728
4720
|
sourceType: "document",
|
|
4729
|
-
id: (
|
|
4721
|
+
id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : generateId2(),
|
|
4730
4722
|
mediaType: "text/plain",
|
|
4731
|
-
title:
|
|
4732
|
-
filename:
|
|
4723
|
+
title: annotation.filename,
|
|
4724
|
+
filename: annotation.filename,
|
|
4733
4725
|
providerMetadata: {
|
|
4734
4726
|
[providerOptionsName]: {
|
|
4727
|
+
type: annotation.type,
|
|
4735
4728
|
fileId: annotation.file_id,
|
|
4736
|
-
containerId: annotation.container_id
|
|
4737
|
-
...annotation.index != null ? { index: annotation.index } : {}
|
|
4729
|
+
containerId: annotation.container_id
|
|
4738
4730
|
}
|
|
4739
4731
|
}
|
|
4740
4732
|
});
|
|
@@ -4742,14 +4734,15 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4742
4734
|
content.push({
|
|
4743
4735
|
type: "source",
|
|
4744
4736
|
sourceType: "document",
|
|
4745
|
-
id: (
|
|
4737
|
+
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2(),
|
|
4746
4738
|
mediaType: "application/octet-stream",
|
|
4747
4739
|
title: annotation.file_id,
|
|
4748
4740
|
filename: annotation.file_id,
|
|
4749
4741
|
providerMetadata: {
|
|
4750
4742
|
[providerOptionsName]: {
|
|
4743
|
+
type: annotation.type,
|
|
4751
4744
|
fileId: annotation.file_id,
|
|
4752
|
-
|
|
4745
|
+
index: annotation.index
|
|
4753
4746
|
}
|
|
4754
4747
|
}
|
|
4755
4748
|
});
|
|
@@ -4794,7 +4787,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4794
4787
|
break;
|
|
4795
4788
|
}
|
|
4796
4789
|
case "mcp_call": {
|
|
4797
|
-
const toolCallId = part.approval_request_id != null ? (
|
|
4790
|
+
const toolCallId = part.approval_request_id != null ? (_p = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _p : part.id : part.id;
|
|
4798
4791
|
const toolName = `mcp.${part.name}`;
|
|
4799
4792
|
content.push({
|
|
4800
4793
|
type: "tool-call",
|
|
@@ -4828,8 +4821,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4828
4821
|
break;
|
|
4829
4822
|
}
|
|
4830
4823
|
case "mcp_approval_request": {
|
|
4831
|
-
const approvalRequestId = (
|
|
4832
|
-
const dummyToolCallId = (
|
|
4824
|
+
const approvalRequestId = (_q = part.approval_request_id) != null ? _q : part.id;
|
|
4825
|
+
const dummyToolCallId = (_t = (_s = (_r = this.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : generateId2();
|
|
4833
4826
|
const toolName = `mcp.${part.name}`;
|
|
4834
4827
|
content.push({
|
|
4835
4828
|
type: "tool-call",
|
|
@@ -4879,13 +4872,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4879
4872
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
4880
4873
|
result: {
|
|
4881
4874
|
queries: part.queries,
|
|
4882
|
-
results: (
|
|
4875
|
+
results: (_v = (_u = part.results) == null ? void 0 : _u.map((result) => ({
|
|
4883
4876
|
attributes: result.attributes,
|
|
4884
4877
|
fileId: result.file_id,
|
|
4885
4878
|
filename: result.filename,
|
|
4886
4879
|
score: result.score,
|
|
4887
4880
|
text: result.text
|
|
4888
|
-
}))) != null ?
|
|
4881
|
+
}))) != null ? _v : null
|
|
4889
4882
|
}
|
|
4890
4883
|
});
|
|
4891
4884
|
break;
|
|
@@ -4944,10 +4937,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4944
4937
|
content,
|
|
4945
4938
|
finishReason: {
|
|
4946
4939
|
unified: mapOpenAIResponseFinishReason({
|
|
4947
|
-
finishReason: (
|
|
4940
|
+
finishReason: (_w = response.incomplete_details) == null ? void 0 : _w.reason,
|
|
4948
4941
|
hasFunctionCall
|
|
4949
4942
|
}),
|
|
4950
|
-
raw: (
|
|
4943
|
+
raw: (_y = (_x = response.incomplete_details) == null ? void 0 : _x.reason) != null ? _y : void 0
|
|
4951
4944
|
},
|
|
4952
4945
|
usage: convertOpenAIResponsesUsage(usage),
|
|
4953
4946
|
request: { body },
|
|
@@ -5010,7 +5003,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5010
5003
|
controller.enqueue({ type: "stream-start", warnings });
|
|
5011
5004
|
},
|
|
5012
5005
|
transform(chunk, controller) {
|
|
5013
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D
|
|
5006
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
|
|
5014
5007
|
if (options.includeRawChunks) {
|
|
5015
5008
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
5016
5009
|
}
|
|
@@ -5607,29 +5600,29 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5607
5600
|
sourceType: "document",
|
|
5608
5601
|
id: (_x = (_w = (_v = self.config).generateId) == null ? void 0 : _w.call(_v)) != null ? _x : generateId2(),
|
|
5609
5602
|
mediaType: "text/plain",
|
|
5610
|
-
title:
|
|
5611
|
-
filename:
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5603
|
+
title: value.annotation.filename,
|
|
5604
|
+
filename: value.annotation.filename,
|
|
5605
|
+
providerMetadata: {
|
|
5606
|
+
[providerOptionsName]: {
|
|
5607
|
+
type: value.annotation.type,
|
|
5608
|
+
fileId: value.annotation.file_id,
|
|
5609
|
+
index: value.annotation.index
|
|
5617
5610
|
}
|
|
5618
|
-
}
|
|
5611
|
+
}
|
|
5619
5612
|
});
|
|
5620
5613
|
} else if (value.annotation.type === "container_file_citation") {
|
|
5621
5614
|
controller.enqueue({
|
|
5622
5615
|
type: "source",
|
|
5623
5616
|
sourceType: "document",
|
|
5624
|
-
id: (
|
|
5617
|
+
id: (_A = (_z = (_y = self.config).generateId) == null ? void 0 : _z.call(_y)) != null ? _A : generateId2(),
|
|
5625
5618
|
mediaType: "text/plain",
|
|
5626
|
-
title:
|
|
5627
|
-
filename:
|
|
5619
|
+
title: value.annotation.filename,
|
|
5620
|
+
filename: value.annotation.filename,
|
|
5628
5621
|
providerMetadata: {
|
|
5629
5622
|
[providerOptionsName]: {
|
|
5623
|
+
type: value.annotation.type,
|
|
5630
5624
|
fileId: value.annotation.file_id,
|
|
5631
|
-
containerId: value.annotation.container_id
|
|
5632
|
-
...value.annotation.index != null ? { index: value.annotation.index } : {}
|
|
5625
|
+
containerId: value.annotation.container_id
|
|
5633
5626
|
}
|
|
5634
5627
|
}
|
|
5635
5628
|
});
|
|
@@ -5637,14 +5630,15 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5637
5630
|
controller.enqueue({
|
|
5638
5631
|
type: "source",
|
|
5639
5632
|
sourceType: "document",
|
|
5640
|
-
id: (
|
|
5633
|
+
id: (_D = (_C = (_B = self.config).generateId) == null ? void 0 : _C.call(_B)) != null ? _D : generateId2(),
|
|
5641
5634
|
mediaType: "application/octet-stream",
|
|
5642
5635
|
title: value.annotation.file_id,
|
|
5643
5636
|
filename: value.annotation.file_id,
|
|
5644
5637
|
providerMetadata: {
|
|
5645
5638
|
[providerOptionsName]: {
|
|
5639
|
+
type: value.annotation.type,
|
|
5646
5640
|
fileId: value.annotation.file_id,
|
|
5647
|
-
|
|
5641
|
+
index: value.annotation.index
|
|
5648
5642
|
}
|
|
5649
5643
|
}
|
|
5650
5644
|
});
|