@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/index.mjs
CHANGED
|
@@ -3304,25 +3304,21 @@ var openaiResponsesChunkSchema = lazySchema17(
|
|
|
3304
3304
|
z19.object({
|
|
3305
3305
|
type: z19.literal("file_citation"),
|
|
3306
3306
|
file_id: z19.string(),
|
|
3307
|
-
filename: z19.string()
|
|
3308
|
-
index: z19.number()
|
|
3309
|
-
start_index: z19.number().nullish(),
|
|
3310
|
-
end_index: z19.number().nullish(),
|
|
3311
|
-
quote: z19.string().nullish()
|
|
3307
|
+
filename: z19.string(),
|
|
3308
|
+
index: z19.number()
|
|
3312
3309
|
}),
|
|
3313
3310
|
z19.object({
|
|
3314
3311
|
type: z19.literal("container_file_citation"),
|
|
3315
3312
|
container_id: z19.string(),
|
|
3316
3313
|
file_id: z19.string(),
|
|
3317
|
-
filename: z19.string()
|
|
3318
|
-
start_index: z19.number()
|
|
3319
|
-
end_index: z19.number()
|
|
3320
|
-
index: z19.number().nullish()
|
|
3314
|
+
filename: z19.string(),
|
|
3315
|
+
start_index: z19.number(),
|
|
3316
|
+
end_index: z19.number()
|
|
3321
3317
|
}),
|
|
3322
3318
|
z19.object({
|
|
3323
3319
|
type: z19.literal("file_path"),
|
|
3324
3320
|
file_id: z19.string(),
|
|
3325
|
-
index: z19.number()
|
|
3321
|
+
index: z19.number()
|
|
3326
3322
|
})
|
|
3327
3323
|
])
|
|
3328
3324
|
}),
|
|
@@ -3419,25 +3415,21 @@ var openaiResponsesResponseSchema = lazySchema17(
|
|
|
3419
3415
|
z19.object({
|
|
3420
3416
|
type: z19.literal("file_citation"),
|
|
3421
3417
|
file_id: z19.string(),
|
|
3422
|
-
filename: z19.string()
|
|
3423
|
-
index: z19.number()
|
|
3424
|
-
start_index: z19.number().nullish(),
|
|
3425
|
-
end_index: z19.number().nullish(),
|
|
3426
|
-
quote: z19.string().nullish()
|
|
3418
|
+
filename: z19.string(),
|
|
3419
|
+
index: z19.number()
|
|
3427
3420
|
}),
|
|
3428
3421
|
z19.object({
|
|
3429
3422
|
type: z19.literal("container_file_citation"),
|
|
3430
3423
|
container_id: z19.string(),
|
|
3431
3424
|
file_id: z19.string(),
|
|
3432
|
-
filename: z19.string()
|
|
3433
|
-
start_index: z19.number()
|
|
3434
|
-
end_index: z19.number()
|
|
3435
|
-
index: z19.number().nullish()
|
|
3425
|
+
filename: z19.string(),
|
|
3426
|
+
start_index: z19.number(),
|
|
3427
|
+
end_index: z19.number()
|
|
3436
3428
|
}),
|
|
3437
3429
|
z19.object({
|
|
3438
3430
|
type: z19.literal("file_path"),
|
|
3439
3431
|
file_id: z19.string(),
|
|
3440
|
-
index: z19.number()
|
|
3432
|
+
index: z19.number()
|
|
3441
3433
|
})
|
|
3442
3434
|
])
|
|
3443
3435
|
)
|
|
@@ -4305,7 +4297,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4305
4297
|
};
|
|
4306
4298
|
}
|
|
4307
4299
|
async doGenerate(options) {
|
|
4308
|
-
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
|
|
4300
|
+
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;
|
|
4309
4301
|
const {
|
|
4310
4302
|
args: body,
|
|
4311
4303
|
warnings,
|
|
@@ -4452,29 +4444,29 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4452
4444
|
sourceType: "document",
|
|
4453
4445
|
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : generateId2(),
|
|
4454
4446
|
mediaType: "text/plain",
|
|
4455
|
-
title:
|
|
4456
|
-
filename:
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4447
|
+
title: annotation.filename,
|
|
4448
|
+
filename: annotation.filename,
|
|
4449
|
+
providerMetadata: {
|
|
4450
|
+
[providerOptionsName]: {
|
|
4451
|
+
type: annotation.type,
|
|
4452
|
+
fileId: annotation.file_id,
|
|
4453
|
+
index: annotation.index
|
|
4462
4454
|
}
|
|
4463
|
-
}
|
|
4455
|
+
}
|
|
4464
4456
|
});
|
|
4465
4457
|
} else if (annotation.type === "container_file_citation") {
|
|
4466
4458
|
content.push({
|
|
4467
4459
|
type: "source",
|
|
4468
4460
|
sourceType: "document",
|
|
4469
|
-
id: (
|
|
4461
|
+
id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : generateId2(),
|
|
4470
4462
|
mediaType: "text/plain",
|
|
4471
|
-
title:
|
|
4472
|
-
filename:
|
|
4463
|
+
title: annotation.filename,
|
|
4464
|
+
filename: annotation.filename,
|
|
4473
4465
|
providerMetadata: {
|
|
4474
4466
|
[providerOptionsName]: {
|
|
4467
|
+
type: annotation.type,
|
|
4475
4468
|
fileId: annotation.file_id,
|
|
4476
|
-
containerId: annotation.container_id
|
|
4477
|
-
...annotation.index != null ? { index: annotation.index } : {}
|
|
4469
|
+
containerId: annotation.container_id
|
|
4478
4470
|
}
|
|
4479
4471
|
}
|
|
4480
4472
|
});
|
|
@@ -4482,14 +4474,15 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4482
4474
|
content.push({
|
|
4483
4475
|
type: "source",
|
|
4484
4476
|
sourceType: "document",
|
|
4485
|
-
id: (
|
|
4477
|
+
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2(),
|
|
4486
4478
|
mediaType: "application/octet-stream",
|
|
4487
4479
|
title: annotation.file_id,
|
|
4488
4480
|
filename: annotation.file_id,
|
|
4489
4481
|
providerMetadata: {
|
|
4490
4482
|
[providerOptionsName]: {
|
|
4483
|
+
type: annotation.type,
|
|
4491
4484
|
fileId: annotation.file_id,
|
|
4492
|
-
|
|
4485
|
+
index: annotation.index
|
|
4493
4486
|
}
|
|
4494
4487
|
}
|
|
4495
4488
|
});
|
|
@@ -4534,7 +4527,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4534
4527
|
break;
|
|
4535
4528
|
}
|
|
4536
4529
|
case "mcp_call": {
|
|
4537
|
-
const toolCallId = part.approval_request_id != null ? (
|
|
4530
|
+
const toolCallId = part.approval_request_id != null ? (_p = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _p : part.id : part.id;
|
|
4538
4531
|
const toolName = `mcp.${part.name}`;
|
|
4539
4532
|
content.push({
|
|
4540
4533
|
type: "tool-call",
|
|
@@ -4568,8 +4561,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4568
4561
|
break;
|
|
4569
4562
|
}
|
|
4570
4563
|
case "mcp_approval_request": {
|
|
4571
|
-
const approvalRequestId = (
|
|
4572
|
-
const dummyToolCallId = (
|
|
4564
|
+
const approvalRequestId = (_q = part.approval_request_id) != null ? _q : part.id;
|
|
4565
|
+
const dummyToolCallId = (_t = (_s = (_r = this.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : generateId2();
|
|
4573
4566
|
const toolName = `mcp.${part.name}`;
|
|
4574
4567
|
content.push({
|
|
4575
4568
|
type: "tool-call",
|
|
@@ -4619,13 +4612,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4619
4612
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
4620
4613
|
result: {
|
|
4621
4614
|
queries: part.queries,
|
|
4622
|
-
results: (
|
|
4615
|
+
results: (_v = (_u = part.results) == null ? void 0 : _u.map((result) => ({
|
|
4623
4616
|
attributes: result.attributes,
|
|
4624
4617
|
fileId: result.file_id,
|
|
4625
4618
|
filename: result.filename,
|
|
4626
4619
|
score: result.score,
|
|
4627
4620
|
text: result.text
|
|
4628
|
-
}))) != null ?
|
|
4621
|
+
}))) != null ? _v : null
|
|
4629
4622
|
}
|
|
4630
4623
|
});
|
|
4631
4624
|
break;
|
|
@@ -4684,10 +4677,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4684
4677
|
content,
|
|
4685
4678
|
finishReason: {
|
|
4686
4679
|
unified: mapOpenAIResponseFinishReason({
|
|
4687
|
-
finishReason: (
|
|
4680
|
+
finishReason: (_w = response.incomplete_details) == null ? void 0 : _w.reason,
|
|
4688
4681
|
hasFunctionCall
|
|
4689
4682
|
}),
|
|
4690
|
-
raw: (
|
|
4683
|
+
raw: (_y = (_x = response.incomplete_details) == null ? void 0 : _x.reason) != null ? _y : void 0
|
|
4691
4684
|
},
|
|
4692
4685
|
usage: convertOpenAIResponsesUsage(usage),
|
|
4693
4686
|
request: { body },
|
|
@@ -4750,7 +4743,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4750
4743
|
controller.enqueue({ type: "stream-start", warnings });
|
|
4751
4744
|
},
|
|
4752
4745
|
transform(chunk, controller) {
|
|
4753
|
-
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
|
|
4746
|
+
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;
|
|
4754
4747
|
if (options.includeRawChunks) {
|
|
4755
4748
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
4756
4749
|
}
|
|
@@ -5347,29 +5340,29 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5347
5340
|
sourceType: "document",
|
|
5348
5341
|
id: (_x = (_w = (_v = self.config).generateId) == null ? void 0 : _w.call(_v)) != null ? _x : generateId2(),
|
|
5349
5342
|
mediaType: "text/plain",
|
|
5350
|
-
title:
|
|
5351
|
-
filename:
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5343
|
+
title: value.annotation.filename,
|
|
5344
|
+
filename: value.annotation.filename,
|
|
5345
|
+
providerMetadata: {
|
|
5346
|
+
[providerOptionsName]: {
|
|
5347
|
+
type: value.annotation.type,
|
|
5348
|
+
fileId: value.annotation.file_id,
|
|
5349
|
+
index: value.annotation.index
|
|
5357
5350
|
}
|
|
5358
|
-
}
|
|
5351
|
+
}
|
|
5359
5352
|
});
|
|
5360
5353
|
} else if (value.annotation.type === "container_file_citation") {
|
|
5361
5354
|
controller.enqueue({
|
|
5362
5355
|
type: "source",
|
|
5363
5356
|
sourceType: "document",
|
|
5364
|
-
id: (
|
|
5357
|
+
id: (_A = (_z = (_y = self.config).generateId) == null ? void 0 : _z.call(_y)) != null ? _A : generateId2(),
|
|
5365
5358
|
mediaType: "text/plain",
|
|
5366
|
-
title:
|
|
5367
|
-
filename:
|
|
5359
|
+
title: value.annotation.filename,
|
|
5360
|
+
filename: value.annotation.filename,
|
|
5368
5361
|
providerMetadata: {
|
|
5369
5362
|
[providerOptionsName]: {
|
|
5363
|
+
type: value.annotation.type,
|
|
5370
5364
|
fileId: value.annotation.file_id,
|
|
5371
|
-
containerId: value.annotation.container_id
|
|
5372
|
-
...value.annotation.index != null ? { index: value.annotation.index } : {}
|
|
5365
|
+
containerId: value.annotation.container_id
|
|
5373
5366
|
}
|
|
5374
5367
|
}
|
|
5375
5368
|
});
|
|
@@ -5377,14 +5370,15 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5377
5370
|
controller.enqueue({
|
|
5378
5371
|
type: "source",
|
|
5379
5372
|
sourceType: "document",
|
|
5380
|
-
id: (
|
|
5373
|
+
id: (_D = (_C = (_B = self.config).generateId) == null ? void 0 : _C.call(_B)) != null ? _D : generateId2(),
|
|
5381
5374
|
mediaType: "application/octet-stream",
|
|
5382
5375
|
title: value.annotation.file_id,
|
|
5383
5376
|
filename: value.annotation.file_id,
|
|
5384
5377
|
providerMetadata: {
|
|
5385
5378
|
[providerOptionsName]: {
|
|
5379
|
+
type: value.annotation.type,
|
|
5386
5380
|
fileId: value.annotation.file_id,
|
|
5387
|
-
|
|
5381
|
+
index: value.annotation.index
|
|
5388
5382
|
}
|
|
5389
5383
|
}
|
|
5390
5384
|
});
|
|
@@ -5848,7 +5842,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5848
5842
|
};
|
|
5849
5843
|
|
|
5850
5844
|
// src/version.ts
|
|
5851
|
-
var VERSION = true ? "3.0.
|
|
5845
|
+
var VERSION = true ? "3.0.8" : "0.0.0-test";
|
|
5852
5846
|
|
|
5853
5847
|
// src/openai-provider.ts
|
|
5854
5848
|
function createOpenAI(options = {}) {
|