@ai-sdk/openai 2.0.0-canary.12 → 2.0.0-canary.13
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 +7 -25
- package/dist/index.d.ts +7 -25
- package/dist/index.js +178 -164
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +178 -164
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +25 -43
- package/dist/internal/index.d.ts +25 -43
- package/dist/internal/index.js +174 -158
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +173 -158
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/internal/index.js
CHANGED
|
@@ -29,6 +29,7 @@ __export(internal_exports, {
|
|
|
29
29
|
OpenAITranscriptionModel: () => OpenAITranscriptionModel,
|
|
30
30
|
hasDefaultResponseFormat: () => hasDefaultResponseFormat,
|
|
31
31
|
modelMaxImagesPerCall: () => modelMaxImagesPerCall,
|
|
32
|
+
openAITranscriptionProviderOptions: () => openAITranscriptionProviderOptions,
|
|
32
33
|
openaiCompletionProviderOptions: () => openaiCompletionProviderOptions,
|
|
33
34
|
openaiEmbeddingProviderOptions: () => openaiEmbeddingProviderOptions,
|
|
34
35
|
openaiProviderOptions: () => openaiProviderOptions
|
|
@@ -273,7 +274,13 @@ var openaiProviderOptions = import_zod.z.object({
|
|
|
273
274
|
/**
|
|
274
275
|
* Parameters for prediction mode.
|
|
275
276
|
*/
|
|
276
|
-
prediction: import_zod.z.record(import_zod.z.any()).optional()
|
|
277
|
+
prediction: import_zod.z.record(import_zod.z.any()).optional(),
|
|
278
|
+
/**
|
|
279
|
+
* Whether to use structured outputs.
|
|
280
|
+
*
|
|
281
|
+
* @default true
|
|
282
|
+
*/
|
|
283
|
+
structuredOutputs: import_zod.z.boolean().optional()
|
|
277
284
|
});
|
|
278
285
|
|
|
279
286
|
// src/openai-error.ts
|
|
@@ -354,10 +361,9 @@ function prepareTools({
|
|
|
354
361
|
|
|
355
362
|
// src/openai-chat-language-model.ts
|
|
356
363
|
var OpenAIChatLanguageModel = class {
|
|
357
|
-
constructor(modelId,
|
|
364
|
+
constructor(modelId, config) {
|
|
358
365
|
this.specificationVersion = "v2";
|
|
359
366
|
this.modelId = modelId;
|
|
360
|
-
this.settings = settings;
|
|
361
367
|
this.config = config;
|
|
362
368
|
}
|
|
363
369
|
get provider() {
|
|
@@ -390,13 +396,14 @@ var OpenAIChatLanguageModel = class {
|
|
|
390
396
|
providerOptions,
|
|
391
397
|
schema: openaiProviderOptions
|
|
392
398
|
})) != null ? _a : {};
|
|
399
|
+
const structuredOutputs = (_b = openaiOptions.structuredOutputs) != null ? _b : true;
|
|
393
400
|
if (topK != null) {
|
|
394
401
|
warnings.push({
|
|
395
402
|
type: "unsupported-setting",
|
|
396
403
|
setting: "topK"
|
|
397
404
|
});
|
|
398
405
|
}
|
|
399
|
-
if ((responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !
|
|
406
|
+
if ((responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !structuredOutputs) {
|
|
400
407
|
warnings.push({
|
|
401
408
|
type: "unsupported-setting",
|
|
402
409
|
setting: "responseFormat",
|
|
@@ -425,12 +432,12 @@ var OpenAIChatLanguageModel = class {
|
|
|
425
432
|
presence_penalty: presencePenalty,
|
|
426
433
|
response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ? (
|
|
427
434
|
// TODO convert into provider option
|
|
428
|
-
|
|
435
|
+
structuredOutputs && responseFormat.schema != null ? {
|
|
429
436
|
type: "json_schema",
|
|
430
437
|
json_schema: {
|
|
431
438
|
schema: responseFormat.schema,
|
|
432
439
|
strict: true,
|
|
433
|
-
name: (
|
|
440
|
+
name: (_c = responseFormat.name) != null ? _c : "response",
|
|
434
441
|
description: responseFormat.description
|
|
435
442
|
}
|
|
436
443
|
} : { type: "json_object" }
|
|
@@ -510,7 +517,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
510
517
|
} = prepareTools({
|
|
511
518
|
tools,
|
|
512
519
|
toolChoice,
|
|
513
|
-
structuredOutputs
|
|
520
|
+
structuredOutputs
|
|
514
521
|
});
|
|
515
522
|
return {
|
|
516
523
|
args: {
|
|
@@ -886,13 +893,9 @@ var import_zod5 = require("zod");
|
|
|
886
893
|
var import_provider4 = require("@ai-sdk/provider");
|
|
887
894
|
function convertToOpenAICompletionPrompt({
|
|
888
895
|
prompt,
|
|
889
|
-
inputFormat,
|
|
890
896
|
user = "user",
|
|
891
897
|
assistant = "assistant"
|
|
892
898
|
}) {
|
|
893
|
-
if (inputFormat === "prompt" && prompt.length === 1 && prompt[0].role === "user" && prompt[0].content.length === 1 && prompt[0].content[0].type === "text") {
|
|
894
|
-
return { prompt: prompt[0].content[0].text };
|
|
895
|
-
}
|
|
896
899
|
let text = "";
|
|
897
900
|
if (prompt[0].role === "system") {
|
|
898
901
|
text += `${prompt[0].content}
|
|
@@ -1013,7 +1016,6 @@ var OpenAICompletionLanguageModel = class {
|
|
|
1013
1016
|
};
|
|
1014
1017
|
}
|
|
1015
1018
|
async getArgs({
|
|
1016
|
-
inputFormat,
|
|
1017
1019
|
prompt,
|
|
1018
1020
|
maxOutputTokens,
|
|
1019
1021
|
temperature,
|
|
@@ -1057,7 +1059,7 @@ var OpenAICompletionLanguageModel = class {
|
|
|
1057
1059
|
details: "JSON response format is not supported."
|
|
1058
1060
|
});
|
|
1059
1061
|
}
|
|
1060
|
-
const { prompt: completionPrompt, stopSequences } = convertToOpenAICompletionPrompt({ prompt
|
|
1062
|
+
const { prompt: completionPrompt, stopSequences } = convertToOpenAICompletionPrompt({ prompt });
|
|
1061
1063
|
const stop = [...stopSequences != null ? stopSequences : [], ...userStopSequences != null ? userStopSequences : []];
|
|
1062
1064
|
return {
|
|
1063
1065
|
args: {
|
|
@@ -1259,23 +1261,16 @@ var openaiEmbeddingProviderOptions = import_zod6.z.object({
|
|
|
1259
1261
|
|
|
1260
1262
|
// src/openai-embedding-model.ts
|
|
1261
1263
|
var OpenAIEmbeddingModel = class {
|
|
1262
|
-
constructor(modelId,
|
|
1264
|
+
constructor(modelId, config) {
|
|
1263
1265
|
this.specificationVersion = "v2";
|
|
1266
|
+
this.maxEmbeddingsPerCall = 2048;
|
|
1267
|
+
this.supportsParallelCalls = true;
|
|
1264
1268
|
this.modelId = modelId;
|
|
1265
|
-
this.settings = settings;
|
|
1266
1269
|
this.config = config;
|
|
1267
1270
|
}
|
|
1268
1271
|
get provider() {
|
|
1269
1272
|
return this.config.provider;
|
|
1270
1273
|
}
|
|
1271
|
-
get maxEmbeddingsPerCall() {
|
|
1272
|
-
var _a;
|
|
1273
|
-
return (_a = this.settings.maxEmbeddingsPerCall) != null ? _a : 2048;
|
|
1274
|
-
}
|
|
1275
|
-
get supportsParallelCalls() {
|
|
1276
|
-
var _a;
|
|
1277
|
-
return (_a = this.settings.supportsParallelCalls) != null ? _a : true;
|
|
1278
|
-
}
|
|
1279
1274
|
async doEmbed({
|
|
1280
1275
|
values,
|
|
1281
1276
|
headers,
|
|
@@ -1420,14 +1415,36 @@ var openaiImageResponseSchema = import_zod8.z.object({
|
|
|
1420
1415
|
|
|
1421
1416
|
// src/openai-transcription-model.ts
|
|
1422
1417
|
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
1418
|
+
var import_zod10 = require("zod");
|
|
1419
|
+
|
|
1420
|
+
// src/openai-transcription-options.ts
|
|
1423
1421
|
var import_zod9 = require("zod");
|
|
1424
|
-
var
|
|
1422
|
+
var openAITranscriptionProviderOptions = import_zod9.z.object({
|
|
1423
|
+
/**
|
|
1424
|
+
* Additional information to include in the transcription response.
|
|
1425
|
+
*/
|
|
1425
1426
|
include: import_zod9.z.array(import_zod9.z.string()).nullish(),
|
|
1427
|
+
/**
|
|
1428
|
+
* The language of the input audio in ISO-639-1 format.
|
|
1429
|
+
*/
|
|
1426
1430
|
language: import_zod9.z.string().nullish(),
|
|
1431
|
+
/**
|
|
1432
|
+
* An optional text to guide the model's style or continue a previous audio segment.
|
|
1433
|
+
*/
|
|
1427
1434
|
prompt: import_zod9.z.string().nullish(),
|
|
1428
|
-
|
|
1429
|
-
|
|
1435
|
+
/**
|
|
1436
|
+
* The sampling temperature, between 0 and 1.
|
|
1437
|
+
* @default 0
|
|
1438
|
+
*/
|
|
1439
|
+
temperature: import_zod9.z.number().min(0).max(1).default(0).nullish(),
|
|
1440
|
+
/**
|
|
1441
|
+
* The timestamp granularities to populate for this transcription.
|
|
1442
|
+
* @default ['segment']
|
|
1443
|
+
*/
|
|
1444
|
+
timestampGranularities: import_zod9.z.array(import_zod9.z.enum(["word", "segment"])).default(["segment"]).nullish()
|
|
1430
1445
|
});
|
|
1446
|
+
|
|
1447
|
+
// src/openai-transcription-model.ts
|
|
1431
1448
|
var languageMap = {
|
|
1432
1449
|
afrikaans: "af",
|
|
1433
1450
|
arabic: "ar",
|
|
@@ -1501,12 +1518,11 @@ var OpenAITranscriptionModel = class {
|
|
|
1501
1518
|
mediaType,
|
|
1502
1519
|
providerOptions
|
|
1503
1520
|
}) {
|
|
1504
|
-
var _a, _b, _c, _d, _e;
|
|
1505
1521
|
const warnings = [];
|
|
1506
1522
|
const openAIOptions = await (0, import_provider_utils7.parseProviderOptions)({
|
|
1507
1523
|
provider: "openai",
|
|
1508
1524
|
providerOptions,
|
|
1509
|
-
schema:
|
|
1525
|
+
schema: openAITranscriptionProviderOptions
|
|
1510
1526
|
});
|
|
1511
1527
|
const formData = new FormData();
|
|
1512
1528
|
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils7.convertBase64ToUint8Array)(audio)]);
|
|
@@ -1514,15 +1530,14 @@ var OpenAITranscriptionModel = class {
|
|
|
1514
1530
|
formData.append("file", new File([blob], "audio", { type: mediaType }));
|
|
1515
1531
|
if (openAIOptions) {
|
|
1516
1532
|
const transcriptionModelOptions = {
|
|
1517
|
-
include:
|
|
1518
|
-
language:
|
|
1519
|
-
prompt:
|
|
1520
|
-
temperature:
|
|
1521
|
-
timestamp_granularities:
|
|
1533
|
+
include: openAIOptions.include,
|
|
1534
|
+
language: openAIOptions.language,
|
|
1535
|
+
prompt: openAIOptions.prompt,
|
|
1536
|
+
temperature: openAIOptions.temperature,
|
|
1537
|
+
timestamp_granularities: openAIOptions.timestampGranularities
|
|
1522
1538
|
};
|
|
1523
|
-
for (const key
|
|
1524
|
-
|
|
1525
|
-
if (value !== void 0) {
|
|
1539
|
+
for (const [key, value] of Object.entries(transcriptionModelOptions)) {
|
|
1540
|
+
if (value != null) {
|
|
1526
1541
|
formData.append(key, String(value));
|
|
1527
1542
|
}
|
|
1528
1543
|
}
|
|
@@ -1574,25 +1589,25 @@ var OpenAITranscriptionModel = class {
|
|
|
1574
1589
|
};
|
|
1575
1590
|
}
|
|
1576
1591
|
};
|
|
1577
|
-
var openaiTranscriptionResponseSchema =
|
|
1578
|
-
text:
|
|
1579
|
-
language:
|
|
1580
|
-
duration:
|
|
1581
|
-
words:
|
|
1582
|
-
|
|
1583
|
-
word:
|
|
1584
|
-
start:
|
|
1585
|
-
end:
|
|
1592
|
+
var openaiTranscriptionResponseSchema = import_zod10.z.object({
|
|
1593
|
+
text: import_zod10.z.string(),
|
|
1594
|
+
language: import_zod10.z.string().nullish(),
|
|
1595
|
+
duration: import_zod10.z.number().nullish(),
|
|
1596
|
+
words: import_zod10.z.array(
|
|
1597
|
+
import_zod10.z.object({
|
|
1598
|
+
word: import_zod10.z.string(),
|
|
1599
|
+
start: import_zod10.z.number(),
|
|
1600
|
+
end: import_zod10.z.number()
|
|
1586
1601
|
})
|
|
1587
1602
|
).nullish()
|
|
1588
1603
|
});
|
|
1589
1604
|
|
|
1590
1605
|
// src/openai-speech-model.ts
|
|
1591
1606
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1592
|
-
var
|
|
1593
|
-
var OpenAIProviderOptionsSchema =
|
|
1594
|
-
instructions:
|
|
1595
|
-
speed:
|
|
1607
|
+
var import_zod11 = require("zod");
|
|
1608
|
+
var OpenAIProviderOptionsSchema = import_zod11.z.object({
|
|
1609
|
+
instructions: import_zod11.z.string().nullish(),
|
|
1610
|
+
speed: import_zod11.z.number().min(0.25).max(4).default(1).nullish()
|
|
1596
1611
|
});
|
|
1597
1612
|
var OpenAISpeechModel = class {
|
|
1598
1613
|
constructor(modelId, config) {
|
|
@@ -1688,7 +1703,7 @@ var OpenAISpeechModel = class {
|
|
|
1688
1703
|
|
|
1689
1704
|
// src/responses/openai-responses-language-model.ts
|
|
1690
1705
|
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1691
|
-
var
|
|
1706
|
+
var import_zod12 = require("zod");
|
|
1692
1707
|
|
|
1693
1708
|
// src/responses/convert-to-openai-responses-messages.ts
|
|
1694
1709
|
var import_provider6 = require("@ai-sdk/provider");
|
|
@@ -2049,55 +2064,55 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2049
2064
|
body,
|
|
2050
2065
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2051
2066
|
successfulResponseHandler: (0, import_provider_utils9.createJsonResponseHandler)(
|
|
2052
|
-
|
|
2053
|
-
id:
|
|
2054
|
-
created_at:
|
|
2055
|
-
model:
|
|
2056
|
-
output:
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
type:
|
|
2060
|
-
role:
|
|
2061
|
-
content:
|
|
2062
|
-
|
|
2063
|
-
type:
|
|
2064
|
-
text:
|
|
2065
|
-
annotations:
|
|
2066
|
-
|
|
2067
|
-
type:
|
|
2068
|
-
start_index:
|
|
2069
|
-
end_index:
|
|
2070
|
-
url:
|
|
2071
|
-
title:
|
|
2067
|
+
import_zod12.z.object({
|
|
2068
|
+
id: import_zod12.z.string(),
|
|
2069
|
+
created_at: import_zod12.z.number(),
|
|
2070
|
+
model: import_zod12.z.string(),
|
|
2071
|
+
output: import_zod12.z.array(
|
|
2072
|
+
import_zod12.z.discriminatedUnion("type", [
|
|
2073
|
+
import_zod12.z.object({
|
|
2074
|
+
type: import_zod12.z.literal("message"),
|
|
2075
|
+
role: import_zod12.z.literal("assistant"),
|
|
2076
|
+
content: import_zod12.z.array(
|
|
2077
|
+
import_zod12.z.object({
|
|
2078
|
+
type: import_zod12.z.literal("output_text"),
|
|
2079
|
+
text: import_zod12.z.string(),
|
|
2080
|
+
annotations: import_zod12.z.array(
|
|
2081
|
+
import_zod12.z.object({
|
|
2082
|
+
type: import_zod12.z.literal("url_citation"),
|
|
2083
|
+
start_index: import_zod12.z.number(),
|
|
2084
|
+
end_index: import_zod12.z.number(),
|
|
2085
|
+
url: import_zod12.z.string(),
|
|
2086
|
+
title: import_zod12.z.string()
|
|
2072
2087
|
})
|
|
2073
2088
|
)
|
|
2074
2089
|
})
|
|
2075
2090
|
)
|
|
2076
2091
|
}),
|
|
2077
|
-
|
|
2078
|
-
type:
|
|
2079
|
-
call_id:
|
|
2080
|
-
name:
|
|
2081
|
-
arguments:
|
|
2092
|
+
import_zod12.z.object({
|
|
2093
|
+
type: import_zod12.z.literal("function_call"),
|
|
2094
|
+
call_id: import_zod12.z.string(),
|
|
2095
|
+
name: import_zod12.z.string(),
|
|
2096
|
+
arguments: import_zod12.z.string()
|
|
2082
2097
|
}),
|
|
2083
|
-
|
|
2084
|
-
type:
|
|
2098
|
+
import_zod12.z.object({
|
|
2099
|
+
type: import_zod12.z.literal("web_search_call")
|
|
2085
2100
|
}),
|
|
2086
|
-
|
|
2087
|
-
type:
|
|
2101
|
+
import_zod12.z.object({
|
|
2102
|
+
type: import_zod12.z.literal("computer_call")
|
|
2088
2103
|
}),
|
|
2089
|
-
|
|
2090
|
-
type:
|
|
2091
|
-
summary:
|
|
2092
|
-
|
|
2093
|
-
type:
|
|
2094
|
-
text:
|
|
2104
|
+
import_zod12.z.object({
|
|
2105
|
+
type: import_zod12.z.literal("reasoning"),
|
|
2106
|
+
summary: import_zod12.z.array(
|
|
2107
|
+
import_zod12.z.object({
|
|
2108
|
+
type: import_zod12.z.literal("summary_text"),
|
|
2109
|
+
text: import_zod12.z.string()
|
|
2095
2110
|
})
|
|
2096
2111
|
)
|
|
2097
2112
|
})
|
|
2098
2113
|
])
|
|
2099
2114
|
),
|
|
2100
|
-
incomplete_details:
|
|
2115
|
+
incomplete_details: import_zod12.z.object({ reason: import_zod12.z.string() }).nullable(),
|
|
2101
2116
|
usage: usageSchema
|
|
2102
2117
|
})
|
|
2103
2118
|
),
|
|
@@ -2311,86 +2326,86 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2311
2326
|
};
|
|
2312
2327
|
}
|
|
2313
2328
|
};
|
|
2314
|
-
var usageSchema =
|
|
2315
|
-
input_tokens:
|
|
2316
|
-
input_tokens_details:
|
|
2317
|
-
output_tokens:
|
|
2318
|
-
output_tokens_details:
|
|
2329
|
+
var usageSchema = import_zod12.z.object({
|
|
2330
|
+
input_tokens: import_zod12.z.number(),
|
|
2331
|
+
input_tokens_details: import_zod12.z.object({ cached_tokens: import_zod12.z.number().nullish() }).nullish(),
|
|
2332
|
+
output_tokens: import_zod12.z.number(),
|
|
2333
|
+
output_tokens_details: import_zod12.z.object({ reasoning_tokens: import_zod12.z.number().nullish() }).nullish()
|
|
2319
2334
|
});
|
|
2320
|
-
var textDeltaChunkSchema =
|
|
2321
|
-
type:
|
|
2322
|
-
delta:
|
|
2335
|
+
var textDeltaChunkSchema = import_zod12.z.object({
|
|
2336
|
+
type: import_zod12.z.literal("response.output_text.delta"),
|
|
2337
|
+
delta: import_zod12.z.string()
|
|
2323
2338
|
});
|
|
2324
|
-
var responseFinishedChunkSchema =
|
|
2325
|
-
type:
|
|
2326
|
-
response:
|
|
2327
|
-
incomplete_details:
|
|
2339
|
+
var responseFinishedChunkSchema = import_zod12.z.object({
|
|
2340
|
+
type: import_zod12.z.enum(["response.completed", "response.incomplete"]),
|
|
2341
|
+
response: import_zod12.z.object({
|
|
2342
|
+
incomplete_details: import_zod12.z.object({ reason: import_zod12.z.string() }).nullish(),
|
|
2328
2343
|
usage: usageSchema
|
|
2329
2344
|
})
|
|
2330
2345
|
});
|
|
2331
|
-
var responseCreatedChunkSchema =
|
|
2332
|
-
type:
|
|
2333
|
-
response:
|
|
2334
|
-
id:
|
|
2335
|
-
created_at:
|
|
2336
|
-
model:
|
|
2346
|
+
var responseCreatedChunkSchema = import_zod12.z.object({
|
|
2347
|
+
type: import_zod12.z.literal("response.created"),
|
|
2348
|
+
response: import_zod12.z.object({
|
|
2349
|
+
id: import_zod12.z.string(),
|
|
2350
|
+
created_at: import_zod12.z.number(),
|
|
2351
|
+
model: import_zod12.z.string()
|
|
2337
2352
|
})
|
|
2338
2353
|
});
|
|
2339
|
-
var responseOutputItemDoneSchema =
|
|
2340
|
-
type:
|
|
2341
|
-
output_index:
|
|
2342
|
-
item:
|
|
2343
|
-
|
|
2344
|
-
type:
|
|
2354
|
+
var responseOutputItemDoneSchema = import_zod12.z.object({
|
|
2355
|
+
type: import_zod12.z.literal("response.output_item.done"),
|
|
2356
|
+
output_index: import_zod12.z.number(),
|
|
2357
|
+
item: import_zod12.z.discriminatedUnion("type", [
|
|
2358
|
+
import_zod12.z.object({
|
|
2359
|
+
type: import_zod12.z.literal("message")
|
|
2345
2360
|
}),
|
|
2346
|
-
|
|
2347
|
-
type:
|
|
2348
|
-
id:
|
|
2349
|
-
call_id:
|
|
2350
|
-
name:
|
|
2351
|
-
arguments:
|
|
2352
|
-
status:
|
|
2361
|
+
import_zod12.z.object({
|
|
2362
|
+
type: import_zod12.z.literal("function_call"),
|
|
2363
|
+
id: import_zod12.z.string(),
|
|
2364
|
+
call_id: import_zod12.z.string(),
|
|
2365
|
+
name: import_zod12.z.string(),
|
|
2366
|
+
arguments: import_zod12.z.string(),
|
|
2367
|
+
status: import_zod12.z.literal("completed")
|
|
2353
2368
|
})
|
|
2354
2369
|
])
|
|
2355
2370
|
});
|
|
2356
|
-
var responseFunctionCallArgumentsDeltaSchema =
|
|
2357
|
-
type:
|
|
2358
|
-
item_id:
|
|
2359
|
-
output_index:
|
|
2360
|
-
delta:
|
|
2371
|
+
var responseFunctionCallArgumentsDeltaSchema = import_zod12.z.object({
|
|
2372
|
+
type: import_zod12.z.literal("response.function_call_arguments.delta"),
|
|
2373
|
+
item_id: import_zod12.z.string(),
|
|
2374
|
+
output_index: import_zod12.z.number(),
|
|
2375
|
+
delta: import_zod12.z.string()
|
|
2361
2376
|
});
|
|
2362
|
-
var responseOutputItemAddedSchema =
|
|
2363
|
-
type:
|
|
2364
|
-
output_index:
|
|
2365
|
-
item:
|
|
2366
|
-
|
|
2367
|
-
type:
|
|
2377
|
+
var responseOutputItemAddedSchema = import_zod12.z.object({
|
|
2378
|
+
type: import_zod12.z.literal("response.output_item.added"),
|
|
2379
|
+
output_index: import_zod12.z.number(),
|
|
2380
|
+
item: import_zod12.z.discriminatedUnion("type", [
|
|
2381
|
+
import_zod12.z.object({
|
|
2382
|
+
type: import_zod12.z.literal("message")
|
|
2368
2383
|
}),
|
|
2369
|
-
|
|
2370
|
-
type:
|
|
2371
|
-
id:
|
|
2372
|
-
call_id:
|
|
2373
|
-
name:
|
|
2374
|
-
arguments:
|
|
2384
|
+
import_zod12.z.object({
|
|
2385
|
+
type: import_zod12.z.literal("function_call"),
|
|
2386
|
+
id: import_zod12.z.string(),
|
|
2387
|
+
call_id: import_zod12.z.string(),
|
|
2388
|
+
name: import_zod12.z.string(),
|
|
2389
|
+
arguments: import_zod12.z.string()
|
|
2375
2390
|
})
|
|
2376
2391
|
])
|
|
2377
2392
|
});
|
|
2378
|
-
var responseAnnotationAddedSchema =
|
|
2379
|
-
type:
|
|
2380
|
-
annotation:
|
|
2381
|
-
type:
|
|
2382
|
-
url:
|
|
2383
|
-
title:
|
|
2393
|
+
var responseAnnotationAddedSchema = import_zod12.z.object({
|
|
2394
|
+
type: import_zod12.z.literal("response.output_text.annotation.added"),
|
|
2395
|
+
annotation: import_zod12.z.object({
|
|
2396
|
+
type: import_zod12.z.literal("url_citation"),
|
|
2397
|
+
url: import_zod12.z.string(),
|
|
2398
|
+
title: import_zod12.z.string()
|
|
2384
2399
|
})
|
|
2385
2400
|
});
|
|
2386
|
-
var responseReasoningSummaryTextDeltaSchema =
|
|
2387
|
-
type:
|
|
2388
|
-
item_id:
|
|
2389
|
-
output_index:
|
|
2390
|
-
summary_index:
|
|
2391
|
-
delta:
|
|
2401
|
+
var responseReasoningSummaryTextDeltaSchema = import_zod12.z.object({
|
|
2402
|
+
type: import_zod12.z.literal("response.reasoning_summary_text.delta"),
|
|
2403
|
+
item_id: import_zod12.z.string(),
|
|
2404
|
+
output_index: import_zod12.z.number(),
|
|
2405
|
+
summary_index: import_zod12.z.number(),
|
|
2406
|
+
delta: import_zod12.z.string()
|
|
2392
2407
|
});
|
|
2393
|
-
var openaiResponsesChunkSchema =
|
|
2408
|
+
var openaiResponsesChunkSchema = import_zod12.z.union([
|
|
2394
2409
|
textDeltaChunkSchema,
|
|
2395
2410
|
responseFinishedChunkSchema,
|
|
2396
2411
|
responseCreatedChunkSchema,
|
|
@@ -2399,7 +2414,7 @@ var openaiResponsesChunkSchema = import_zod11.z.union([
|
|
|
2399
2414
|
responseOutputItemAddedSchema,
|
|
2400
2415
|
responseAnnotationAddedSchema,
|
|
2401
2416
|
responseReasoningSummaryTextDeltaSchema,
|
|
2402
|
-
|
|
2417
|
+
import_zod12.z.object({ type: import_zod12.z.string() }).passthrough()
|
|
2403
2418
|
// fallback for unknown chunks
|
|
2404
2419
|
]);
|
|
2405
2420
|
function isTextDeltaChunk(chunk) {
|
|
@@ -2447,16 +2462,16 @@ function getResponsesModelConfig(modelId) {
|
|
|
2447
2462
|
requiredAutoTruncation: false
|
|
2448
2463
|
};
|
|
2449
2464
|
}
|
|
2450
|
-
var openaiResponsesProviderOptionsSchema =
|
|
2451
|
-
metadata:
|
|
2452
|
-
parallelToolCalls:
|
|
2453
|
-
previousResponseId:
|
|
2454
|
-
store:
|
|
2455
|
-
user:
|
|
2456
|
-
reasoningEffort:
|
|
2457
|
-
strictSchemas:
|
|
2458
|
-
instructions:
|
|
2459
|
-
reasoningSummary:
|
|
2465
|
+
var openaiResponsesProviderOptionsSchema = import_zod12.z.object({
|
|
2466
|
+
metadata: import_zod12.z.any().nullish(),
|
|
2467
|
+
parallelToolCalls: import_zod12.z.boolean().nullish(),
|
|
2468
|
+
previousResponseId: import_zod12.z.string().nullish(),
|
|
2469
|
+
store: import_zod12.z.boolean().nullish(),
|
|
2470
|
+
user: import_zod12.z.string().nullish(),
|
|
2471
|
+
reasoningEffort: import_zod12.z.string().nullish(),
|
|
2472
|
+
strictSchemas: import_zod12.z.boolean().nullish(),
|
|
2473
|
+
instructions: import_zod12.z.string().nullish(),
|
|
2474
|
+
reasoningSummary: import_zod12.z.string().nullish()
|
|
2460
2475
|
});
|
|
2461
2476
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2462
2477
|
0 && (module.exports = {
|
|
@@ -2469,6 +2484,7 @@ var openaiResponsesProviderOptionsSchema = import_zod11.z.object({
|
|
|
2469
2484
|
OpenAITranscriptionModel,
|
|
2470
2485
|
hasDefaultResponseFormat,
|
|
2471
2486
|
modelMaxImagesPerCall,
|
|
2487
|
+
openAITranscriptionProviderOptions,
|
|
2472
2488
|
openaiCompletionProviderOptions,
|
|
2473
2489
|
openaiEmbeddingProviderOptions,
|
|
2474
2490
|
openaiProviderOptions
|