@ai-sdk/openai 2.0.134 → 2.0.136
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 +17 -0
- package/dist/index.js +34 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +113 -93
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +33 -19
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +112 -92
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/internal/index.mjs
CHANGED
|
@@ -14,8 +14,12 @@ import {
|
|
|
14
14
|
|
|
15
15
|
// src/openai-error.ts
|
|
16
16
|
import { z } from "zod/v4";
|
|
17
|
-
import {
|
|
18
|
-
|
|
17
|
+
import {
|
|
18
|
+
lazySchema,
|
|
19
|
+
zodSchema,
|
|
20
|
+
createJsonErrorResponseHandler
|
|
21
|
+
} from "@ai-sdk/provider-utils";
|
|
22
|
+
var openaiErrorDataSchema = () => z.object({
|
|
19
23
|
error: z.object({
|
|
20
24
|
message: z.string(),
|
|
21
25
|
// The additional information below is handled loosely to support
|
|
@@ -26,8 +30,11 @@ var openaiErrorDataSchema = z.object({
|
|
|
26
30
|
code: z.union([z.string(), z.number()]).nullish()
|
|
27
31
|
})
|
|
28
32
|
});
|
|
33
|
+
var openaiErrorDataSchemaValidator = lazySchema(
|
|
34
|
+
() => zodSchema(openaiErrorDataSchema())
|
|
35
|
+
);
|
|
29
36
|
var openaiFailedResponseHandler = createJsonErrorResponseHandler({
|
|
30
|
-
errorSchema:
|
|
37
|
+
errorSchema: openaiErrorDataSchemaValidator,
|
|
31
38
|
errorToMessage: (data) => data.error.message
|
|
32
39
|
});
|
|
33
40
|
|
|
@@ -360,11 +367,11 @@ function mapOpenAIFinishReason(finishReason) {
|
|
|
360
367
|
// src/chat/openai-chat-api.ts
|
|
361
368
|
import {
|
|
362
369
|
lazyValidator,
|
|
363
|
-
zodSchema
|
|
370
|
+
zodSchema as zodSchema2
|
|
364
371
|
} from "@ai-sdk/provider-utils";
|
|
365
372
|
import { z as z2 } from "zod/v4";
|
|
366
373
|
var openaiChatResponseSchema = lazyValidator(
|
|
367
|
-
() =>
|
|
374
|
+
() => zodSchema2(
|
|
368
375
|
z2.object({
|
|
369
376
|
id: z2.string().nullish(),
|
|
370
377
|
created: z2.number().nullish(),
|
|
@@ -435,7 +442,7 @@ var openaiChatResponseSchema = lazyValidator(
|
|
|
435
442
|
)
|
|
436
443
|
);
|
|
437
444
|
var openaiChatChunkSchema = lazyValidator(
|
|
438
|
-
() =>
|
|
445
|
+
() => zodSchema2(
|
|
439
446
|
z2.union([
|
|
440
447
|
z2.object({
|
|
441
448
|
id: z2.string().nullish(),
|
|
@@ -502,7 +509,7 @@ var openaiChatChunkSchema = lazyValidator(
|
|
|
502
509
|
}).nullish()
|
|
503
510
|
}).nullish()
|
|
504
511
|
}),
|
|
505
|
-
openaiErrorDataSchema
|
|
512
|
+
openaiErrorDataSchema()
|
|
506
513
|
])
|
|
507
514
|
)
|
|
508
515
|
);
|
|
@@ -510,11 +517,11 @@ var openaiChatChunkSchema = lazyValidator(
|
|
|
510
517
|
// src/chat/openai-chat-options.ts
|
|
511
518
|
import {
|
|
512
519
|
lazyValidator as lazyValidator2,
|
|
513
|
-
zodSchema as
|
|
520
|
+
zodSchema as zodSchema3
|
|
514
521
|
} from "@ai-sdk/provider-utils";
|
|
515
522
|
import { z as z3 } from "zod/v4";
|
|
516
523
|
var openaiChatLanguageModelOptions = lazyValidator2(
|
|
517
|
-
() =>
|
|
524
|
+
() => zodSchema3(
|
|
518
525
|
z3.object({
|
|
519
526
|
/**
|
|
520
527
|
* Modify the likelihood of specified tokens appearing in the completion.
|
|
@@ -1270,10 +1277,10 @@ function mapOpenAIFinishReason2(finishReason) {
|
|
|
1270
1277
|
import { z as z4 } from "zod/v4";
|
|
1271
1278
|
import {
|
|
1272
1279
|
lazyValidator as lazyValidator3,
|
|
1273
|
-
zodSchema as
|
|
1280
|
+
zodSchema as zodSchema4
|
|
1274
1281
|
} from "@ai-sdk/provider-utils";
|
|
1275
1282
|
var openaiCompletionResponseSchema = lazyValidator3(
|
|
1276
|
-
() =>
|
|
1283
|
+
() => zodSchema4(
|
|
1277
1284
|
z4.object({
|
|
1278
1285
|
id: z4.string().nullish(),
|
|
1279
1286
|
created: z4.number().nullish(),
|
|
@@ -1298,7 +1305,7 @@ var openaiCompletionResponseSchema = lazyValidator3(
|
|
|
1298
1305
|
)
|
|
1299
1306
|
);
|
|
1300
1307
|
var openaiCompletionChunkSchema = lazyValidator3(
|
|
1301
|
-
() =>
|
|
1308
|
+
() => zodSchema4(
|
|
1302
1309
|
z4.union([
|
|
1303
1310
|
z4.object({
|
|
1304
1311
|
id: z4.string().nullish(),
|
|
@@ -1322,7 +1329,7 @@ var openaiCompletionChunkSchema = lazyValidator3(
|
|
|
1322
1329
|
total_tokens: z4.number()
|
|
1323
1330
|
}).nullish()
|
|
1324
1331
|
}),
|
|
1325
|
-
openaiErrorDataSchema
|
|
1332
|
+
openaiErrorDataSchema()
|
|
1326
1333
|
])
|
|
1327
1334
|
)
|
|
1328
1335
|
);
|
|
@@ -1330,11 +1337,11 @@ var openaiCompletionChunkSchema = lazyValidator3(
|
|
|
1330
1337
|
// src/completion/openai-completion-options.ts
|
|
1331
1338
|
import {
|
|
1332
1339
|
lazyValidator as lazyValidator4,
|
|
1333
|
-
zodSchema as
|
|
1340
|
+
zodSchema as zodSchema5
|
|
1334
1341
|
} from "@ai-sdk/provider-utils";
|
|
1335
1342
|
import { z as z5 } from "zod/v4";
|
|
1336
1343
|
var openaiCompletionProviderOptions = lazyValidator4(
|
|
1337
|
-
() =>
|
|
1344
|
+
() => zodSchema5(
|
|
1338
1345
|
z5.object({
|
|
1339
1346
|
/**
|
|
1340
1347
|
Echo back the prompt in addition to the completion.
|
|
@@ -1623,11 +1630,11 @@ import {
|
|
|
1623
1630
|
// src/embedding/openai-embedding-options.ts
|
|
1624
1631
|
import {
|
|
1625
1632
|
lazyValidator as lazyValidator5,
|
|
1626
|
-
zodSchema as
|
|
1633
|
+
zodSchema as zodSchema6
|
|
1627
1634
|
} from "@ai-sdk/provider-utils";
|
|
1628
1635
|
import { z as z6 } from "zod/v4";
|
|
1629
1636
|
var openaiEmbeddingProviderOptions = lazyValidator5(
|
|
1630
|
-
() =>
|
|
1637
|
+
() => zodSchema6(
|
|
1631
1638
|
z6.object({
|
|
1632
1639
|
/**
|
|
1633
1640
|
The number of dimensions the resulting output embeddings should have.
|
|
@@ -1644,10 +1651,10 @@ var openaiEmbeddingProviderOptions = lazyValidator5(
|
|
|
1644
1651
|
);
|
|
1645
1652
|
|
|
1646
1653
|
// src/embedding/openai-embedding-api.ts
|
|
1647
|
-
import { lazyValidator as lazyValidator6, zodSchema as
|
|
1654
|
+
import { lazyValidator as lazyValidator6, zodSchema as zodSchema7 } from "@ai-sdk/provider-utils";
|
|
1648
1655
|
import { z as z7 } from "zod/v4";
|
|
1649
1656
|
var openaiTextEmbeddingResponseSchema = lazyValidator6(
|
|
1650
|
-
() =>
|
|
1657
|
+
() => zodSchema7(
|
|
1651
1658
|
z7.object({
|
|
1652
1659
|
data: z7.array(z7.object({ embedding: z7.array(z7.number()) })),
|
|
1653
1660
|
usage: z7.object({ prompt_tokens: z7.number() }).nullish()
|
|
@@ -1731,10 +1738,10 @@ import {
|
|
|
1731
1738
|
} from "@ai-sdk/provider-utils";
|
|
1732
1739
|
|
|
1733
1740
|
// src/image/openai-image-api.ts
|
|
1734
|
-
import { lazyValidator as lazyValidator7, zodSchema as
|
|
1741
|
+
import { lazyValidator as lazyValidator7, zodSchema as zodSchema8 } from "@ai-sdk/provider-utils";
|
|
1735
1742
|
import { z as z8 } from "zod/v4";
|
|
1736
1743
|
var openaiImageResponseSchema = lazyValidator7(
|
|
1737
|
-
() =>
|
|
1744
|
+
() => zodSchema8(
|
|
1738
1745
|
z8.object({
|
|
1739
1746
|
created: z8.number().nullish(),
|
|
1740
1747
|
data: z8.array(
|
|
@@ -1763,7 +1770,7 @@ var openaiImageResponseSchema = lazyValidator7(
|
|
|
1763
1770
|
// src/image/openai-image-options.ts
|
|
1764
1771
|
import {
|
|
1765
1772
|
lazyValidator as lazyValidator8,
|
|
1766
|
-
zodSchema as
|
|
1773
|
+
zodSchema as zodSchema9
|
|
1767
1774
|
} from "@ai-sdk/provider-utils";
|
|
1768
1775
|
import { z as z9 } from "zod/v4";
|
|
1769
1776
|
var modelMaxImagesPerCall = {
|
|
@@ -1784,7 +1791,7 @@ function getMaxImagesPerCall(modelId) {
|
|
|
1784
1791
|
var _a2;
|
|
1785
1792
|
return (_a2 = modelMaxImagesPerCall[modelId]) != null ? _a2 : modelId.startsWith("gpt-image-") ? 10 : 1;
|
|
1786
1793
|
}
|
|
1787
|
-
var baseImageModelOptionsObject = z9.object({
|
|
1794
|
+
var baseImageModelOptionsObject = () => z9.object({
|
|
1788
1795
|
/**
|
|
1789
1796
|
* Quality of the generated image(s).
|
|
1790
1797
|
*
|
|
@@ -1814,11 +1821,11 @@ var baseImageModelOptionsObject = z9.object({
|
|
|
1814
1821
|
user: z9.string().optional()
|
|
1815
1822
|
});
|
|
1816
1823
|
var openaiImageModelOptions = lazyValidator8(
|
|
1817
|
-
() =>
|
|
1824
|
+
() => zodSchema9(baseImageModelOptionsObject())
|
|
1818
1825
|
);
|
|
1819
1826
|
var openaiImageModelGenerationOptions = lazyValidator8(
|
|
1820
|
-
() =>
|
|
1821
|
-
baseImageModelOptionsObject.extend({
|
|
1827
|
+
() => zodSchema9(
|
|
1828
|
+
baseImageModelOptionsObject().extend({
|
|
1822
1829
|
/**
|
|
1823
1830
|
* Style of the generated image. `vivid` produces hyper-real and
|
|
1824
1831
|
* dramatic images; `natural` produces more subdued, less hyper-real
|
|
@@ -1970,10 +1977,10 @@ import {
|
|
|
1970
1977
|
} from "@ai-sdk/provider-utils";
|
|
1971
1978
|
|
|
1972
1979
|
// src/transcription/openai-transcription-api.ts
|
|
1973
|
-
import { lazyValidator as lazyValidator9, zodSchema as
|
|
1980
|
+
import { lazyValidator as lazyValidator9, zodSchema as zodSchema10 } from "@ai-sdk/provider-utils";
|
|
1974
1981
|
import { z as z10 } from "zod/v4";
|
|
1975
1982
|
var openaiTranscriptionResponseSchema = lazyValidator9(
|
|
1976
|
-
() =>
|
|
1983
|
+
() => zodSchema10(
|
|
1977
1984
|
z10.object({
|
|
1978
1985
|
text: z10.string(),
|
|
1979
1986
|
language: z10.string().nullish(),
|
|
@@ -2006,11 +2013,11 @@ var openaiTranscriptionResponseSchema = lazyValidator9(
|
|
|
2006
2013
|
// src/transcription/openai-transcription-options.ts
|
|
2007
2014
|
import {
|
|
2008
2015
|
lazyValidator as lazyValidator10,
|
|
2009
|
-
zodSchema as
|
|
2016
|
+
zodSchema as zodSchema11
|
|
2010
2017
|
} from "@ai-sdk/provider-utils";
|
|
2011
2018
|
import { z as z11 } from "zod/v4";
|
|
2012
2019
|
var openAITranscriptionProviderOptions = lazyValidator10(
|
|
2013
|
-
() =>
|
|
2020
|
+
() => zodSchema11(
|
|
2014
2021
|
z11.object({
|
|
2015
2022
|
/**
|
|
2016
2023
|
* Additional information to include in the transcription response.
|
|
@@ -2216,11 +2223,11 @@ import {
|
|
|
2216
2223
|
// src/speech/openai-speech-options.ts
|
|
2217
2224
|
import {
|
|
2218
2225
|
lazyValidator as lazyValidator11,
|
|
2219
|
-
zodSchema as
|
|
2226
|
+
zodSchema as zodSchema12
|
|
2220
2227
|
} from "@ai-sdk/provider-utils";
|
|
2221
2228
|
import { z as z12 } from "zod/v4";
|
|
2222
2229
|
var openaiSpeechProviderOptionsSchema = lazyValidator11(
|
|
2223
|
-
() =>
|
|
2230
|
+
() => zodSchema12(
|
|
2224
2231
|
z12.object({
|
|
2225
2232
|
instructions: z12.string().nullish(),
|
|
2226
2233
|
speed: z12.number().min(0.25).max(4).default(1).nullish()
|
|
@@ -2348,6 +2355,8 @@ import {
|
|
|
2348
2355
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError4
|
|
2349
2356
|
} from "@ai-sdk/provider";
|
|
2350
2357
|
import {
|
|
2358
|
+
lazySchema as lazySchema4,
|
|
2359
|
+
zodSchema as zodSchema16,
|
|
2351
2360
|
convertToBase64 as convertToBase642,
|
|
2352
2361
|
parseProviderOptions as parseProviderOptions7,
|
|
2353
2362
|
safeValidateTypes,
|
|
@@ -2358,7 +2367,7 @@ import { z as z16 } from "zod/v4";
|
|
|
2358
2367
|
// src/responses/openai-responses-options.ts
|
|
2359
2368
|
import {
|
|
2360
2369
|
lazyValidator as lazyValidator12,
|
|
2361
|
-
zodSchema as
|
|
2370
|
+
zodSchema as zodSchema13
|
|
2362
2371
|
} from "@ai-sdk/provider-utils";
|
|
2363
2372
|
import { z as z13 } from "zod/v4";
|
|
2364
2373
|
var TOP_LOGPROBS_MAX = 20;
|
|
@@ -2451,7 +2460,7 @@ var openaiResponsesModelIds = [
|
|
|
2451
2460
|
...openaiResponsesReasoningModelIds
|
|
2452
2461
|
];
|
|
2453
2462
|
var openaiResponsesProviderOptionsSchema = lazyValidator12(
|
|
2454
|
-
() =>
|
|
2463
|
+
() => zodSchema13(
|
|
2455
2464
|
z13.object({
|
|
2456
2465
|
conversation: z13.string().nullish(),
|
|
2457
2466
|
include: z13.array(
|
|
@@ -2545,7 +2554,7 @@ var openaiResponsesProviderOptionsSchema = lazyValidator12(
|
|
|
2545
2554
|
)
|
|
2546
2555
|
);
|
|
2547
2556
|
var openaiResponsesSystemMessageOptionsSchema = lazyValidator12(
|
|
2548
|
-
() =>
|
|
2557
|
+
() => zodSchema13(
|
|
2549
2558
|
z13.object({
|
|
2550
2559
|
/**
|
|
2551
2560
|
* Emit a configuration update at this position in Responses history.
|
|
@@ -2563,12 +2572,12 @@ var openaiResponsesSystemMessageOptionsSchema = lazyValidator12(
|
|
|
2563
2572
|
// src/tool/local-shell.ts
|
|
2564
2573
|
import {
|
|
2565
2574
|
createProviderDefinedToolFactoryWithOutputSchema,
|
|
2566
|
-
lazySchema,
|
|
2567
|
-
zodSchema as
|
|
2575
|
+
lazySchema as lazySchema2,
|
|
2576
|
+
zodSchema as zodSchema14
|
|
2568
2577
|
} from "@ai-sdk/provider-utils";
|
|
2569
2578
|
import { z as z14 } from "zod/v4";
|
|
2570
|
-
var localShellInputSchema =
|
|
2571
|
-
() =>
|
|
2579
|
+
var localShellInputSchema = lazySchema2(
|
|
2580
|
+
() => zodSchema14(
|
|
2572
2581
|
z14.object({
|
|
2573
2582
|
action: z14.object({
|
|
2574
2583
|
type: z14.literal("exec"),
|
|
@@ -2581,8 +2590,8 @@ var localShellInputSchema = lazySchema(
|
|
|
2581
2590
|
})
|
|
2582
2591
|
)
|
|
2583
2592
|
);
|
|
2584
|
-
var localShellOutputSchema =
|
|
2585
|
-
() =>
|
|
2593
|
+
var localShellOutputSchema = lazySchema2(
|
|
2594
|
+
() => zodSchema14(z14.object({ output: z14.string() }))
|
|
2586
2595
|
);
|
|
2587
2596
|
var localShell = createProviderDefinedToolFactoryWithOutputSchema({
|
|
2588
2597
|
id: "openai.local_shell",
|
|
@@ -2594,12 +2603,12 @@ var localShell = createProviderDefinedToolFactoryWithOutputSchema({
|
|
|
2594
2603
|
// src/tool/web-search.ts
|
|
2595
2604
|
import {
|
|
2596
2605
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2,
|
|
2597
|
-
lazySchema as
|
|
2598
|
-
zodSchema as
|
|
2606
|
+
lazySchema as lazySchema3,
|
|
2607
|
+
zodSchema as zodSchema15
|
|
2599
2608
|
} from "@ai-sdk/provider-utils";
|
|
2600
2609
|
import { z as z15 } from "zod/v4";
|
|
2601
|
-
var webSearchArgsSchema =
|
|
2602
|
-
() =>
|
|
2610
|
+
var webSearchArgsSchema = lazySchema3(
|
|
2611
|
+
() => zodSchema15(
|
|
2603
2612
|
z15.object({
|
|
2604
2613
|
externalWebAccess: z15.boolean().optional(),
|
|
2605
2614
|
filters: z15.object({
|
|
@@ -2617,9 +2626,9 @@ var webSearchArgsSchema = lazySchema2(
|
|
|
2617
2626
|
})
|
|
2618
2627
|
)
|
|
2619
2628
|
);
|
|
2620
|
-
var webSearchInputSchema =
|
|
2621
|
-
var webSearchOutputSchema =
|
|
2622
|
-
() =>
|
|
2629
|
+
var webSearchInputSchema = lazySchema3(() => zodSchema15(z15.object({})));
|
|
2630
|
+
var webSearchOutputSchema = lazySchema3(
|
|
2631
|
+
() => zodSchema15(
|
|
2623
2632
|
z15.object({
|
|
2624
2633
|
action: z15.discriminatedUnion("type", [
|
|
2625
2634
|
z15.object({
|
|
@@ -2719,6 +2728,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2719
2728
|
explicitMessageItemType = false,
|
|
2720
2729
|
fileIdPrefixes,
|
|
2721
2730
|
store,
|
|
2731
|
+
isReasoningModel = false,
|
|
2722
2732
|
configurationUpdateUnsupportedReason,
|
|
2723
2733
|
hasLocalShellTool = false,
|
|
2724
2734
|
webSearchToolName
|
|
@@ -2872,12 +2882,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
2872
2882
|
case "assistant": {
|
|
2873
2883
|
const reasoningMessages = {};
|
|
2874
2884
|
const toolCallParts = {};
|
|
2885
|
+
let hasPrecedingReasoning = false;
|
|
2875
2886
|
for (const part of content) {
|
|
2876
2887
|
switch (part.type) {
|
|
2877
2888
|
case "text": {
|
|
2878
2889
|
const id = (_b = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b.itemId;
|
|
2879
2890
|
const phase = (_d = (_c = part.providerOptions) == null ? void 0 : _c.openai) == null ? void 0 : _d.phase;
|
|
2880
|
-
|
|
2891
|
+
const canUseItemId = id != null && (!isReasoningModel || hasPrecedingReasoning);
|
|
2892
|
+
if (store && canUseItemId) {
|
|
2881
2893
|
input.push({ type: "item_reference", id });
|
|
2882
2894
|
break;
|
|
2883
2895
|
}
|
|
@@ -2885,7 +2897,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2885
2897
|
...explicitMessageItemType && { type: "message" },
|
|
2886
2898
|
role: "assistant",
|
|
2887
2899
|
content: [{ type: "output_text", text: part.text }],
|
|
2888
|
-
id,
|
|
2900
|
+
id: canUseItemId ? id : void 0,
|
|
2889
2901
|
...phase != null && { phase }
|
|
2890
2902
|
});
|
|
2891
2903
|
break;
|
|
@@ -2897,7 +2909,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2897
2909
|
}
|
|
2898
2910
|
const id = (_f = (_e = part.providerOptions) == null ? void 0 : _e.openai) == null ? void 0 : _f.itemId;
|
|
2899
2911
|
const isAsync = (_h = (_g = part.providerOptions) == null ? void 0 : _g.openai) == null ? void 0 : _h.async;
|
|
2900
|
-
|
|
2912
|
+
const canUseItemId = id != null && (!isReasoningModel || hasPrecedingReasoning);
|
|
2913
|
+
if (store && canUseItemId) {
|
|
2901
2914
|
input.push({ type: "item_reference", id });
|
|
2902
2915
|
break;
|
|
2903
2916
|
}
|
|
@@ -2927,7 +2940,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2927
2940
|
name: part.toolName,
|
|
2928
2941
|
arguments: JSON.stringify(part.input),
|
|
2929
2942
|
...isAsync != null && { async: isAsync },
|
|
2930
|
-
id
|
|
2943
|
+
id: canUseItemId ? id : void 0
|
|
2931
2944
|
});
|
|
2932
2945
|
break;
|
|
2933
2946
|
}
|
|
@@ -2959,6 +2972,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2959
2972
|
break;
|
|
2960
2973
|
}
|
|
2961
2974
|
case "reasoning": {
|
|
2975
|
+
hasPrecedingReasoning = true;
|
|
2962
2976
|
const providerOptions2 = await parseProviderOptions7({
|
|
2963
2977
|
provider: "openai",
|
|
2964
2978
|
providerOptions: part.providerOptions,
|
|
@@ -3116,10 +3130,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
3116
3130
|
}
|
|
3117
3131
|
return { input, warnings };
|
|
3118
3132
|
}
|
|
3119
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3133
|
+
var openaiResponsesReasoningProviderOptionsSchema = lazySchema4(
|
|
3134
|
+
() => zodSchema16(
|
|
3135
|
+
z16.object({
|
|
3136
|
+
itemId: z16.string().nullish(),
|
|
3137
|
+
reasoningEncryptedContent: z16.string().nullish()
|
|
3138
|
+
})
|
|
3139
|
+
)
|
|
3140
|
+
);
|
|
3123
3141
|
|
|
3124
3142
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
3125
3143
|
function mapOpenAIResponseFinishReason({
|
|
@@ -3142,11 +3160,11 @@ function mapOpenAIResponseFinishReason({
|
|
|
3142
3160
|
// src/responses/openai-responses-api.ts
|
|
3143
3161
|
import {
|
|
3144
3162
|
lazyValidator as lazyValidator13,
|
|
3145
|
-
zodSchema as
|
|
3163
|
+
zodSchema as zodSchema17
|
|
3146
3164
|
} from "@ai-sdk/provider-utils";
|
|
3147
3165
|
import { z as z17 } from "zod/v4";
|
|
3148
3166
|
var openaiResponsesChunkSchema = lazyValidator13(
|
|
3149
|
-
() =>
|
|
3167
|
+
() => zodSchema17(
|
|
3150
3168
|
z17.union([
|
|
3151
3169
|
z17.object({
|
|
3152
3170
|
type: z17.literal("response.output_text.delta"),
|
|
@@ -3433,7 +3451,7 @@ var openaiResponsesChunkSchema = lazyValidator13(
|
|
|
3433
3451
|
)
|
|
3434
3452
|
);
|
|
3435
3453
|
var openaiResponsesResponseSchema = lazyValidator13(
|
|
3436
|
-
() =>
|
|
3454
|
+
() => zodSchema17(
|
|
3437
3455
|
z17.object({
|
|
3438
3456
|
id: z17.string().optional(),
|
|
3439
3457
|
created_at: z17.number().optional(),
|
|
@@ -3637,20 +3655,20 @@ import {
|
|
|
3637
3655
|
// src/tool/code-interpreter.ts
|
|
3638
3656
|
import {
|
|
3639
3657
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3,
|
|
3640
|
-
lazySchema as
|
|
3641
|
-
zodSchema as
|
|
3658
|
+
lazySchema as lazySchema5,
|
|
3659
|
+
zodSchema as zodSchema18
|
|
3642
3660
|
} from "@ai-sdk/provider-utils";
|
|
3643
3661
|
import { z as z18 } from "zod/v4";
|
|
3644
|
-
var codeInterpreterInputSchema =
|
|
3645
|
-
() =>
|
|
3662
|
+
var codeInterpreterInputSchema = lazySchema5(
|
|
3663
|
+
() => zodSchema18(
|
|
3646
3664
|
z18.object({
|
|
3647
3665
|
code: z18.string().nullish(),
|
|
3648
3666
|
containerId: z18.string()
|
|
3649
3667
|
})
|
|
3650
3668
|
)
|
|
3651
3669
|
);
|
|
3652
|
-
var codeInterpreterOutputSchema =
|
|
3653
|
-
() =>
|
|
3670
|
+
var codeInterpreterOutputSchema = lazySchema5(
|
|
3671
|
+
() => zodSchema18(
|
|
3654
3672
|
z18.object({
|
|
3655
3673
|
outputs: z18.array(
|
|
3656
3674
|
z18.discriminatedUnion("type", [
|
|
@@ -3661,8 +3679,8 @@ var codeInterpreterOutputSchema = lazySchema3(
|
|
|
3661
3679
|
})
|
|
3662
3680
|
)
|
|
3663
3681
|
);
|
|
3664
|
-
var codeInterpreterArgsSchema =
|
|
3665
|
-
() =>
|
|
3682
|
+
var codeInterpreterArgsSchema = lazySchema5(
|
|
3683
|
+
() => zodSchema18(
|
|
3666
3684
|
z18.object({
|
|
3667
3685
|
container: z18.union([
|
|
3668
3686
|
z18.string(),
|
|
@@ -3686,23 +3704,24 @@ var codeInterpreter = (args = {}) => {
|
|
|
3686
3704
|
// src/tool/file-search.ts
|
|
3687
3705
|
import {
|
|
3688
3706
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4,
|
|
3689
|
-
lazySchema as
|
|
3690
|
-
zodSchema as
|
|
3707
|
+
lazySchema as lazySchema6,
|
|
3708
|
+
zodSchema as zodSchema19
|
|
3691
3709
|
} from "@ai-sdk/provider-utils";
|
|
3692
3710
|
import { z as z19 } from "zod/v4";
|
|
3693
|
-
var comparisonFilterSchema = z19.object({
|
|
3711
|
+
var comparisonFilterSchema = () => z19.object({
|
|
3694
3712
|
key: z19.string(),
|
|
3695
3713
|
type: z19.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
|
|
3696
3714
|
value: z19.union([z19.string(), z19.number(), z19.boolean(), z19.array(z19.string())])
|
|
3697
3715
|
});
|
|
3698
|
-
var
|
|
3716
|
+
var cachedCompoundFilterSchema;
|
|
3717
|
+
var compoundFilterSchema = () => cachedCompoundFilterSchema != null ? cachedCompoundFilterSchema : cachedCompoundFilterSchema = z19.object({
|
|
3699
3718
|
type: z19.enum(["and", "or"]),
|
|
3700
3719
|
filters: z19.array(
|
|
3701
|
-
z19.union([comparisonFilterSchema, z19.lazy(() => compoundFilterSchema)])
|
|
3720
|
+
z19.union([comparisonFilterSchema(), z19.lazy(() => compoundFilterSchema())])
|
|
3702
3721
|
)
|
|
3703
3722
|
});
|
|
3704
|
-
var fileSearchArgsSchema =
|
|
3705
|
-
() =>
|
|
3723
|
+
var fileSearchArgsSchema = lazySchema6(
|
|
3724
|
+
() => zodSchema19(
|
|
3706
3725
|
z19.object({
|
|
3707
3726
|
vectorStoreIds: z19.array(z19.string()),
|
|
3708
3727
|
maxNumResults: z19.number().optional(),
|
|
@@ -3710,12 +3729,12 @@ var fileSearchArgsSchema = lazySchema4(
|
|
|
3710
3729
|
ranker: z19.string().optional(),
|
|
3711
3730
|
scoreThreshold: z19.number().optional()
|
|
3712
3731
|
}).optional(),
|
|
3713
|
-
filters: z19.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
3732
|
+
filters: z19.union([comparisonFilterSchema(), compoundFilterSchema()]).optional()
|
|
3714
3733
|
})
|
|
3715
3734
|
)
|
|
3716
3735
|
);
|
|
3717
|
-
var fileSearchOutputSchema =
|
|
3718
|
-
() =>
|
|
3736
|
+
var fileSearchOutputSchema = lazySchema6(
|
|
3737
|
+
() => zodSchema19(
|
|
3719
3738
|
z19.object({
|
|
3720
3739
|
queries: z19.array(z19.string()),
|
|
3721
3740
|
results: z19.array(
|
|
@@ -3740,12 +3759,12 @@ var fileSearch = createProviderDefinedToolFactoryWithOutputSchema4({
|
|
|
3740
3759
|
// src/tool/web-search-preview.ts
|
|
3741
3760
|
import {
|
|
3742
3761
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema5,
|
|
3743
|
-
lazySchema as
|
|
3744
|
-
zodSchema as
|
|
3762
|
+
lazySchema as lazySchema7,
|
|
3763
|
+
zodSchema as zodSchema20
|
|
3745
3764
|
} from "@ai-sdk/provider-utils";
|
|
3746
3765
|
import { z as z20 } from "zod/v4";
|
|
3747
|
-
var webSearchPreviewArgsSchema =
|
|
3748
|
-
() =>
|
|
3766
|
+
var webSearchPreviewArgsSchema = lazySchema7(
|
|
3767
|
+
() => zodSchema20(
|
|
3749
3768
|
z20.object({
|
|
3750
3769
|
searchContextSize: z20.enum(["low", "medium", "high"]).optional(),
|
|
3751
3770
|
userLocation: z20.object({
|
|
@@ -3758,11 +3777,11 @@ var webSearchPreviewArgsSchema = lazySchema5(
|
|
|
3758
3777
|
})
|
|
3759
3778
|
)
|
|
3760
3779
|
);
|
|
3761
|
-
var webSearchPreviewInputSchema =
|
|
3762
|
-
() =>
|
|
3780
|
+
var webSearchPreviewInputSchema = lazySchema7(
|
|
3781
|
+
() => zodSchema20(z20.object({}))
|
|
3763
3782
|
);
|
|
3764
|
-
var webSearchPreviewOutputSchema =
|
|
3765
|
-
() =>
|
|
3783
|
+
var webSearchPreviewOutputSchema = lazySchema7(
|
|
3784
|
+
() => zodSchema20(
|
|
3766
3785
|
z20.object({
|
|
3767
3786
|
action: z20.discriminatedUnion("type", [
|
|
3768
3787
|
z20.object({
|
|
@@ -3792,12 +3811,12 @@ var webSearchPreview = createProviderDefinedToolFactoryWithOutputSchema5({
|
|
|
3792
3811
|
// src/tool/image-generation.ts
|
|
3793
3812
|
import {
|
|
3794
3813
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema6,
|
|
3795
|
-
lazySchema as
|
|
3796
|
-
zodSchema as
|
|
3814
|
+
lazySchema as lazySchema8,
|
|
3815
|
+
zodSchema as zodSchema21
|
|
3797
3816
|
} from "@ai-sdk/provider-utils";
|
|
3798
3817
|
import { z as z21 } from "zod/v4";
|
|
3799
|
-
var imageGenerationArgsSchema =
|
|
3800
|
-
() =>
|
|
3818
|
+
var imageGenerationArgsSchema = lazySchema8(
|
|
3819
|
+
() => zodSchema21(
|
|
3801
3820
|
z21.object({
|
|
3802
3821
|
background: z21.enum(["auto", "opaque", "transparent"]).optional(),
|
|
3803
3822
|
inputFidelity: z21.enum(["low", "high"]).optional(),
|
|
@@ -3815,9 +3834,9 @@ var imageGenerationArgsSchema = lazySchema6(
|
|
|
3815
3834
|
}).strict()
|
|
3816
3835
|
)
|
|
3817
3836
|
);
|
|
3818
|
-
var imageGenerationInputSchema =
|
|
3819
|
-
var imageGenerationOutputSchema =
|
|
3820
|
-
() =>
|
|
3837
|
+
var imageGenerationInputSchema = lazySchema8(() => zodSchema21(z21.object({})));
|
|
3838
|
+
var imageGenerationOutputSchema = lazySchema8(
|
|
3839
|
+
() => zodSchema21(z21.object({ result: z21.string() }))
|
|
3821
3840
|
);
|
|
3822
3841
|
var imageGenerationToolFactory = createProviderDefinedToolFactoryWithOutputSchema6({
|
|
3823
3842
|
id: "openai.image_generation",
|
|
@@ -4091,6 +4110,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4091
4110
|
explicitMessageItemType: this.config.explicitMessageItemType,
|
|
4092
4111
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
4093
4112
|
store: (_b = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _b : true,
|
|
4113
|
+
isReasoningModel: modelCapabilities.isReasoningModel,
|
|
4094
4114
|
hasLocalShellTool: hasOpenAITool("openai.local_shell"),
|
|
4095
4115
|
webSearchToolName
|
|
4096
4116
|
});
|