@ai-sdk/openai 2.0.135 → 2.0.137
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 +15 -0
- package/dist/index.js +37 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +116 -96
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +36 -22
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +115 -95
- 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(),
|
|
@@ -1998,7 +2005,12 @@ var openaiTranscriptionResponseSchema = lazyValidator9(
|
|
|
1998
2005
|
compression_ratio: z10.number(),
|
|
1999
2006
|
no_speech_prob: z10.number()
|
|
2000
2007
|
})
|
|
2001
|
-
).nullish()
|
|
2008
|
+
).nullish(),
|
|
2009
|
+
// Lenient: an unexpected usage shape must not fail the transcription.
|
|
2010
|
+
usage: z10.object({
|
|
2011
|
+
type: z10.string().nullish(),
|
|
2012
|
+
seconds: z10.number().nullish()
|
|
2013
|
+
}).nullish().catch(void 0)
|
|
2002
2014
|
})
|
|
2003
2015
|
)
|
|
2004
2016
|
);
|
|
@@ -2006,11 +2018,11 @@ var openaiTranscriptionResponseSchema = lazyValidator9(
|
|
|
2006
2018
|
// src/transcription/openai-transcription-options.ts
|
|
2007
2019
|
import {
|
|
2008
2020
|
lazyValidator as lazyValidator10,
|
|
2009
|
-
zodSchema as
|
|
2021
|
+
zodSchema as zodSchema11
|
|
2010
2022
|
} from "@ai-sdk/provider-utils";
|
|
2011
2023
|
import { z as z11 } from "zod/v4";
|
|
2012
2024
|
var openAITranscriptionProviderOptions = lazyValidator10(
|
|
2013
|
-
() =>
|
|
2025
|
+
() => zodSchema11(
|
|
2014
2026
|
z11.object({
|
|
2015
2027
|
/**
|
|
2016
2028
|
* Additional information to include in the transcription response.
|
|
@@ -2134,10 +2146,10 @@ var OpenAITranscriptionModel = class {
|
|
|
2134
2146
|
prompt: openAIOptions.prompt,
|
|
2135
2147
|
// https://platform.openai.com/docs/api-reference/audio/createTranscription#audio_createtranscription-response_format
|
|
2136
2148
|
// prefer verbose_json to get segments for models that support it
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2149
|
+
// gpt-4o(-mini)-transcribe (incl. snapshots) and gpt-transcribe reject verbose_json:
|
|
2150
|
+
response_format: ["gpt-4o-transcribe", "gpt-4o-mini-transcribe"].includes(
|
|
2151
|
+
this.modelId
|
|
2152
|
+
) || this.modelId.startsWith("gpt-4o-mini-transcribe-") || this.modelId === "gpt-transcribe" || this.modelId.startsWith("gpt-transcribe-") ? "json" : "verbose_json",
|
|
2141
2153
|
temperature: openAIOptions.temperature,
|
|
2142
2154
|
timestamp_granularities: openAIOptions.timestampGranularities
|
|
2143
2155
|
};
|
|
@@ -2159,7 +2171,7 @@ var OpenAITranscriptionModel = class {
|
|
|
2159
2171
|
};
|
|
2160
2172
|
}
|
|
2161
2173
|
async doGenerate(options) {
|
|
2162
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
2174
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
2163
2175
|
const currentDate = (_c = (_b = (_a2 = this.config._internal) == null ? void 0 : _a2.currentDate) == null ? void 0 : _b.call(_a2)) != null ? _c : /* @__PURE__ */ new Date();
|
|
2164
2176
|
const { formData, warnings } = await this.getArgs(options);
|
|
2165
2177
|
const {
|
|
@@ -2193,7 +2205,8 @@ var OpenAITranscriptionModel = class {
|
|
|
2193
2205
|
endSecond: word.end
|
|
2194
2206
|
}))) != null ? _g : [],
|
|
2195
2207
|
language,
|
|
2196
|
-
|
|
2208
|
+
// Duration-billed json responses report the duration only in `usage`:
|
|
2209
|
+
durationInSeconds: (_j = response.duration) != null ? _j : ((_h = response.usage) == null ? void 0 : _h.type) === "duration" ? (_i = response.usage.seconds) != null ? _i : void 0 : void 0,
|
|
2197
2210
|
warnings,
|
|
2198
2211
|
response: {
|
|
2199
2212
|
timestamp: currentDate,
|
|
@@ -2216,11 +2229,11 @@ import {
|
|
|
2216
2229
|
// src/speech/openai-speech-options.ts
|
|
2217
2230
|
import {
|
|
2218
2231
|
lazyValidator as lazyValidator11,
|
|
2219
|
-
zodSchema as
|
|
2232
|
+
zodSchema as zodSchema12
|
|
2220
2233
|
} from "@ai-sdk/provider-utils";
|
|
2221
2234
|
import { z as z12 } from "zod/v4";
|
|
2222
2235
|
var openaiSpeechProviderOptionsSchema = lazyValidator11(
|
|
2223
|
-
() =>
|
|
2236
|
+
() => zodSchema12(
|
|
2224
2237
|
z12.object({
|
|
2225
2238
|
instructions: z12.string().nullish(),
|
|
2226
2239
|
speed: z12.number().min(0.25).max(4).default(1).nullish()
|
|
@@ -2348,6 +2361,8 @@ import {
|
|
|
2348
2361
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError4
|
|
2349
2362
|
} from "@ai-sdk/provider";
|
|
2350
2363
|
import {
|
|
2364
|
+
lazySchema as lazySchema4,
|
|
2365
|
+
zodSchema as zodSchema16,
|
|
2351
2366
|
convertToBase64 as convertToBase642,
|
|
2352
2367
|
parseProviderOptions as parseProviderOptions7,
|
|
2353
2368
|
safeValidateTypes,
|
|
@@ -2358,7 +2373,7 @@ import { z as z16 } from "zod/v4";
|
|
|
2358
2373
|
// src/responses/openai-responses-options.ts
|
|
2359
2374
|
import {
|
|
2360
2375
|
lazyValidator as lazyValidator12,
|
|
2361
|
-
zodSchema as
|
|
2376
|
+
zodSchema as zodSchema13
|
|
2362
2377
|
} from "@ai-sdk/provider-utils";
|
|
2363
2378
|
import { z as z13 } from "zod/v4";
|
|
2364
2379
|
var TOP_LOGPROBS_MAX = 20;
|
|
@@ -2451,7 +2466,7 @@ var openaiResponsesModelIds = [
|
|
|
2451
2466
|
...openaiResponsesReasoningModelIds
|
|
2452
2467
|
];
|
|
2453
2468
|
var openaiResponsesProviderOptionsSchema = lazyValidator12(
|
|
2454
|
-
() =>
|
|
2469
|
+
() => zodSchema13(
|
|
2455
2470
|
z13.object({
|
|
2456
2471
|
conversation: z13.string().nullish(),
|
|
2457
2472
|
include: z13.array(
|
|
@@ -2545,7 +2560,7 @@ var openaiResponsesProviderOptionsSchema = lazyValidator12(
|
|
|
2545
2560
|
)
|
|
2546
2561
|
);
|
|
2547
2562
|
var openaiResponsesSystemMessageOptionsSchema = lazyValidator12(
|
|
2548
|
-
() =>
|
|
2563
|
+
() => zodSchema13(
|
|
2549
2564
|
z13.object({
|
|
2550
2565
|
/**
|
|
2551
2566
|
* Emit a configuration update at this position in Responses history.
|
|
@@ -2563,12 +2578,12 @@ var openaiResponsesSystemMessageOptionsSchema = lazyValidator12(
|
|
|
2563
2578
|
// src/tool/local-shell.ts
|
|
2564
2579
|
import {
|
|
2565
2580
|
createProviderDefinedToolFactoryWithOutputSchema,
|
|
2566
|
-
lazySchema,
|
|
2567
|
-
zodSchema as
|
|
2581
|
+
lazySchema as lazySchema2,
|
|
2582
|
+
zodSchema as zodSchema14
|
|
2568
2583
|
} from "@ai-sdk/provider-utils";
|
|
2569
2584
|
import { z as z14 } from "zod/v4";
|
|
2570
|
-
var localShellInputSchema =
|
|
2571
|
-
() =>
|
|
2585
|
+
var localShellInputSchema = lazySchema2(
|
|
2586
|
+
() => zodSchema14(
|
|
2572
2587
|
z14.object({
|
|
2573
2588
|
action: z14.object({
|
|
2574
2589
|
type: z14.literal("exec"),
|
|
@@ -2581,8 +2596,8 @@ var localShellInputSchema = lazySchema(
|
|
|
2581
2596
|
})
|
|
2582
2597
|
)
|
|
2583
2598
|
);
|
|
2584
|
-
var localShellOutputSchema =
|
|
2585
|
-
() =>
|
|
2599
|
+
var localShellOutputSchema = lazySchema2(
|
|
2600
|
+
() => zodSchema14(z14.object({ output: z14.string() }))
|
|
2586
2601
|
);
|
|
2587
2602
|
var localShell = createProviderDefinedToolFactoryWithOutputSchema({
|
|
2588
2603
|
id: "openai.local_shell",
|
|
@@ -2594,12 +2609,12 @@ var localShell = createProviderDefinedToolFactoryWithOutputSchema({
|
|
|
2594
2609
|
// src/tool/web-search.ts
|
|
2595
2610
|
import {
|
|
2596
2611
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2,
|
|
2597
|
-
lazySchema as
|
|
2598
|
-
zodSchema as
|
|
2612
|
+
lazySchema as lazySchema3,
|
|
2613
|
+
zodSchema as zodSchema15
|
|
2599
2614
|
} from "@ai-sdk/provider-utils";
|
|
2600
2615
|
import { z as z15 } from "zod/v4";
|
|
2601
|
-
var webSearchArgsSchema =
|
|
2602
|
-
() =>
|
|
2616
|
+
var webSearchArgsSchema = lazySchema3(
|
|
2617
|
+
() => zodSchema15(
|
|
2603
2618
|
z15.object({
|
|
2604
2619
|
externalWebAccess: z15.boolean().optional(),
|
|
2605
2620
|
filters: z15.object({
|
|
@@ -2617,9 +2632,9 @@ var webSearchArgsSchema = lazySchema2(
|
|
|
2617
2632
|
})
|
|
2618
2633
|
)
|
|
2619
2634
|
);
|
|
2620
|
-
var webSearchInputSchema =
|
|
2621
|
-
var webSearchOutputSchema =
|
|
2622
|
-
() =>
|
|
2635
|
+
var webSearchInputSchema = lazySchema3(() => zodSchema15(z15.object({})));
|
|
2636
|
+
var webSearchOutputSchema = lazySchema3(
|
|
2637
|
+
() => zodSchema15(
|
|
2623
2638
|
z15.object({
|
|
2624
2639
|
action: z15.discriminatedUnion("type", [
|
|
2625
2640
|
z15.object({
|
|
@@ -3121,10 +3136,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
3121
3136
|
}
|
|
3122
3137
|
return { input, warnings };
|
|
3123
3138
|
}
|
|
3124
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3139
|
+
var openaiResponsesReasoningProviderOptionsSchema = lazySchema4(
|
|
3140
|
+
() => zodSchema16(
|
|
3141
|
+
z16.object({
|
|
3142
|
+
itemId: z16.string().nullish(),
|
|
3143
|
+
reasoningEncryptedContent: z16.string().nullish()
|
|
3144
|
+
})
|
|
3145
|
+
)
|
|
3146
|
+
);
|
|
3128
3147
|
|
|
3129
3148
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
3130
3149
|
function mapOpenAIResponseFinishReason({
|
|
@@ -3147,11 +3166,11 @@ function mapOpenAIResponseFinishReason({
|
|
|
3147
3166
|
// src/responses/openai-responses-api.ts
|
|
3148
3167
|
import {
|
|
3149
3168
|
lazyValidator as lazyValidator13,
|
|
3150
|
-
zodSchema as
|
|
3169
|
+
zodSchema as zodSchema17
|
|
3151
3170
|
} from "@ai-sdk/provider-utils";
|
|
3152
3171
|
import { z as z17 } from "zod/v4";
|
|
3153
3172
|
var openaiResponsesChunkSchema = lazyValidator13(
|
|
3154
|
-
() =>
|
|
3173
|
+
() => zodSchema17(
|
|
3155
3174
|
z17.union([
|
|
3156
3175
|
z17.object({
|
|
3157
3176
|
type: z17.literal("response.output_text.delta"),
|
|
@@ -3438,7 +3457,7 @@ var openaiResponsesChunkSchema = lazyValidator13(
|
|
|
3438
3457
|
)
|
|
3439
3458
|
);
|
|
3440
3459
|
var openaiResponsesResponseSchema = lazyValidator13(
|
|
3441
|
-
() =>
|
|
3460
|
+
() => zodSchema17(
|
|
3442
3461
|
z17.object({
|
|
3443
3462
|
id: z17.string().optional(),
|
|
3444
3463
|
created_at: z17.number().optional(),
|
|
@@ -3642,20 +3661,20 @@ import {
|
|
|
3642
3661
|
// src/tool/code-interpreter.ts
|
|
3643
3662
|
import {
|
|
3644
3663
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3,
|
|
3645
|
-
lazySchema as
|
|
3646
|
-
zodSchema as
|
|
3664
|
+
lazySchema as lazySchema5,
|
|
3665
|
+
zodSchema as zodSchema18
|
|
3647
3666
|
} from "@ai-sdk/provider-utils";
|
|
3648
3667
|
import { z as z18 } from "zod/v4";
|
|
3649
|
-
var codeInterpreterInputSchema =
|
|
3650
|
-
() =>
|
|
3668
|
+
var codeInterpreterInputSchema = lazySchema5(
|
|
3669
|
+
() => zodSchema18(
|
|
3651
3670
|
z18.object({
|
|
3652
3671
|
code: z18.string().nullish(),
|
|
3653
3672
|
containerId: z18.string()
|
|
3654
3673
|
})
|
|
3655
3674
|
)
|
|
3656
3675
|
);
|
|
3657
|
-
var codeInterpreterOutputSchema =
|
|
3658
|
-
() =>
|
|
3676
|
+
var codeInterpreterOutputSchema = lazySchema5(
|
|
3677
|
+
() => zodSchema18(
|
|
3659
3678
|
z18.object({
|
|
3660
3679
|
outputs: z18.array(
|
|
3661
3680
|
z18.discriminatedUnion("type", [
|
|
@@ -3666,8 +3685,8 @@ var codeInterpreterOutputSchema = lazySchema3(
|
|
|
3666
3685
|
})
|
|
3667
3686
|
)
|
|
3668
3687
|
);
|
|
3669
|
-
var codeInterpreterArgsSchema =
|
|
3670
|
-
() =>
|
|
3688
|
+
var codeInterpreterArgsSchema = lazySchema5(
|
|
3689
|
+
() => zodSchema18(
|
|
3671
3690
|
z18.object({
|
|
3672
3691
|
container: z18.union([
|
|
3673
3692
|
z18.string(),
|
|
@@ -3691,23 +3710,24 @@ var codeInterpreter = (args = {}) => {
|
|
|
3691
3710
|
// src/tool/file-search.ts
|
|
3692
3711
|
import {
|
|
3693
3712
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4,
|
|
3694
|
-
lazySchema as
|
|
3695
|
-
zodSchema as
|
|
3713
|
+
lazySchema as lazySchema6,
|
|
3714
|
+
zodSchema as zodSchema19
|
|
3696
3715
|
} from "@ai-sdk/provider-utils";
|
|
3697
3716
|
import { z as z19 } from "zod/v4";
|
|
3698
|
-
var comparisonFilterSchema = z19.object({
|
|
3717
|
+
var comparisonFilterSchema = () => z19.object({
|
|
3699
3718
|
key: z19.string(),
|
|
3700
3719
|
type: z19.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
|
|
3701
3720
|
value: z19.union([z19.string(), z19.number(), z19.boolean(), z19.array(z19.string())])
|
|
3702
3721
|
});
|
|
3703
|
-
var
|
|
3722
|
+
var cachedCompoundFilterSchema;
|
|
3723
|
+
var compoundFilterSchema = () => cachedCompoundFilterSchema != null ? cachedCompoundFilterSchema : cachedCompoundFilterSchema = z19.object({
|
|
3704
3724
|
type: z19.enum(["and", "or"]),
|
|
3705
3725
|
filters: z19.array(
|
|
3706
|
-
z19.union([comparisonFilterSchema, z19.lazy(() => compoundFilterSchema)])
|
|
3726
|
+
z19.union([comparisonFilterSchema(), z19.lazy(() => compoundFilterSchema())])
|
|
3707
3727
|
)
|
|
3708
3728
|
});
|
|
3709
|
-
var fileSearchArgsSchema =
|
|
3710
|
-
() =>
|
|
3729
|
+
var fileSearchArgsSchema = lazySchema6(
|
|
3730
|
+
() => zodSchema19(
|
|
3711
3731
|
z19.object({
|
|
3712
3732
|
vectorStoreIds: z19.array(z19.string()),
|
|
3713
3733
|
maxNumResults: z19.number().optional(),
|
|
@@ -3715,12 +3735,12 @@ var fileSearchArgsSchema = lazySchema4(
|
|
|
3715
3735
|
ranker: z19.string().optional(),
|
|
3716
3736
|
scoreThreshold: z19.number().optional()
|
|
3717
3737
|
}).optional(),
|
|
3718
|
-
filters: z19.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
3738
|
+
filters: z19.union([comparisonFilterSchema(), compoundFilterSchema()]).optional()
|
|
3719
3739
|
})
|
|
3720
3740
|
)
|
|
3721
3741
|
);
|
|
3722
|
-
var fileSearchOutputSchema =
|
|
3723
|
-
() =>
|
|
3742
|
+
var fileSearchOutputSchema = lazySchema6(
|
|
3743
|
+
() => zodSchema19(
|
|
3724
3744
|
z19.object({
|
|
3725
3745
|
queries: z19.array(z19.string()),
|
|
3726
3746
|
results: z19.array(
|
|
@@ -3745,12 +3765,12 @@ var fileSearch = createProviderDefinedToolFactoryWithOutputSchema4({
|
|
|
3745
3765
|
// src/tool/web-search-preview.ts
|
|
3746
3766
|
import {
|
|
3747
3767
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema5,
|
|
3748
|
-
lazySchema as
|
|
3749
|
-
zodSchema as
|
|
3768
|
+
lazySchema as lazySchema7,
|
|
3769
|
+
zodSchema as zodSchema20
|
|
3750
3770
|
} from "@ai-sdk/provider-utils";
|
|
3751
3771
|
import { z as z20 } from "zod/v4";
|
|
3752
|
-
var webSearchPreviewArgsSchema =
|
|
3753
|
-
() =>
|
|
3772
|
+
var webSearchPreviewArgsSchema = lazySchema7(
|
|
3773
|
+
() => zodSchema20(
|
|
3754
3774
|
z20.object({
|
|
3755
3775
|
searchContextSize: z20.enum(["low", "medium", "high"]).optional(),
|
|
3756
3776
|
userLocation: z20.object({
|
|
@@ -3763,11 +3783,11 @@ var webSearchPreviewArgsSchema = lazySchema5(
|
|
|
3763
3783
|
})
|
|
3764
3784
|
)
|
|
3765
3785
|
);
|
|
3766
|
-
var webSearchPreviewInputSchema =
|
|
3767
|
-
() =>
|
|
3786
|
+
var webSearchPreviewInputSchema = lazySchema7(
|
|
3787
|
+
() => zodSchema20(z20.object({}))
|
|
3768
3788
|
);
|
|
3769
|
-
var webSearchPreviewOutputSchema =
|
|
3770
|
-
() =>
|
|
3789
|
+
var webSearchPreviewOutputSchema = lazySchema7(
|
|
3790
|
+
() => zodSchema20(
|
|
3771
3791
|
z20.object({
|
|
3772
3792
|
action: z20.discriminatedUnion("type", [
|
|
3773
3793
|
z20.object({
|
|
@@ -3797,12 +3817,12 @@ var webSearchPreview = createProviderDefinedToolFactoryWithOutputSchema5({
|
|
|
3797
3817
|
// src/tool/image-generation.ts
|
|
3798
3818
|
import {
|
|
3799
3819
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema6,
|
|
3800
|
-
lazySchema as
|
|
3801
|
-
zodSchema as
|
|
3820
|
+
lazySchema as lazySchema8,
|
|
3821
|
+
zodSchema as zodSchema21
|
|
3802
3822
|
} from "@ai-sdk/provider-utils";
|
|
3803
3823
|
import { z as z21 } from "zod/v4";
|
|
3804
|
-
var imageGenerationArgsSchema =
|
|
3805
|
-
() =>
|
|
3824
|
+
var imageGenerationArgsSchema = lazySchema8(
|
|
3825
|
+
() => zodSchema21(
|
|
3806
3826
|
z21.object({
|
|
3807
3827
|
background: z21.enum(["auto", "opaque", "transparent"]).optional(),
|
|
3808
3828
|
inputFidelity: z21.enum(["low", "high"]).optional(),
|
|
@@ -3820,9 +3840,9 @@ var imageGenerationArgsSchema = lazySchema6(
|
|
|
3820
3840
|
}).strict()
|
|
3821
3841
|
)
|
|
3822
3842
|
);
|
|
3823
|
-
var imageGenerationInputSchema =
|
|
3824
|
-
var imageGenerationOutputSchema =
|
|
3825
|
-
() =>
|
|
3843
|
+
var imageGenerationInputSchema = lazySchema8(() => zodSchema21(z21.object({})));
|
|
3844
|
+
var imageGenerationOutputSchema = lazySchema8(
|
|
3845
|
+
() => zodSchema21(z21.object({ result: z21.string() }))
|
|
3826
3846
|
);
|
|
3827
3847
|
var imageGenerationToolFactory = createProviderDefinedToolFactoryWithOutputSchema6({
|
|
3828
3848
|
id: "openai.image_generation",
|