@ai-sdk/openai 1.3.9 → 1.3.11
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 +16 -0
- package/dist/index.d.mts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +133 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +135 -19
- package/dist/index.mjs.map +1 -1
- package/internal/dist/index.d.mts +50 -22
- package/internal/dist/index.d.ts +50 -22
- package/internal/dist/index.js +234 -129
- package/internal/dist/index.js.map +1 -1
- package/internal/dist/index.mjs +234 -125
- package/internal/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/internal/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ __export(internal_exports, {
|
|
|
25
25
|
OpenAIEmbeddingModel: () => OpenAIEmbeddingModel,
|
|
26
26
|
OpenAIImageModel: () => OpenAIImageModel,
|
|
27
27
|
OpenAIResponsesLanguageModel: () => OpenAIResponsesLanguageModel,
|
|
28
|
+
OpenAISpeechModel: () => OpenAISpeechModel,
|
|
28
29
|
OpenAITranscriptionModel: () => OpenAITranscriptionModel,
|
|
29
30
|
modelMaxImagesPerCall: () => modelMaxImagesPerCall
|
|
30
31
|
});
|
|
@@ -538,6 +539,15 @@ var OpenAIChatLanguageModel = class {
|
|
|
538
539
|
}
|
|
539
540
|
baseArgs.max_tokens = void 0;
|
|
540
541
|
}
|
|
542
|
+
} else if (this.modelId.startsWith("gpt-4o-search-preview")) {
|
|
543
|
+
if (baseArgs.temperature != null) {
|
|
544
|
+
baseArgs.temperature = void 0;
|
|
545
|
+
warnings.push({
|
|
546
|
+
type: "unsupported-setting",
|
|
547
|
+
setting: "temperature",
|
|
548
|
+
details: "temperature is not supported for the gpt-4o-search-preview model and has been removed."
|
|
549
|
+
});
|
|
550
|
+
}
|
|
541
551
|
}
|
|
542
552
|
switch (type) {
|
|
543
553
|
case "regular": {
|
|
@@ -1606,18 +1616,12 @@ var openaiImageResponseSchema = import_zod5.z.object({
|
|
|
1606
1616
|
// src/openai-transcription-model.ts
|
|
1607
1617
|
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
1608
1618
|
var import_zod6 = require("zod");
|
|
1609
|
-
var
|
|
1610
|
-
include: import_zod6.z.array(import_zod6.z.string()).
|
|
1611
|
-
|
|
1612
|
-
),
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
"An optional text to guide the model's style or continue a previous audio segment."
|
|
1616
|
-
),
|
|
1617
|
-
temperature: import_zod6.z.number().min(0).max(1).optional().default(0).describe("The sampling temperature, between 0 and 1."),
|
|
1618
|
-
timestampGranularities: import_zod6.z.array(import_zod6.z.enum(["word", "segment"])).optional().default(["segment"]).describe(
|
|
1619
|
-
"The timestamp granularities to populate for this transcription."
|
|
1620
|
-
)
|
|
1619
|
+
var openAIProviderOptionsSchema = import_zod6.z.object({
|
|
1620
|
+
include: import_zod6.z.array(import_zod6.z.string()).nullish(),
|
|
1621
|
+
language: import_zod6.z.string().nullish(),
|
|
1622
|
+
prompt: import_zod6.z.string().nullish(),
|
|
1623
|
+
temperature: import_zod6.z.number().min(0).max(1).nullish().default(0),
|
|
1624
|
+
timestampGranularities: import_zod6.z.array(import_zod6.z.enum(["word", "segment"])).nullish().default(["segment"])
|
|
1621
1625
|
});
|
|
1622
1626
|
var languageMap = {
|
|
1623
1627
|
afrikaans: "af",
|
|
@@ -1692,11 +1696,12 @@ var OpenAITranscriptionModel = class {
|
|
|
1692
1696
|
mediaType,
|
|
1693
1697
|
providerOptions
|
|
1694
1698
|
}) {
|
|
1699
|
+
var _a, _b, _c, _d, _e;
|
|
1695
1700
|
const warnings = [];
|
|
1696
1701
|
const openAIOptions = (0, import_provider_utils7.parseProviderOptions)({
|
|
1697
1702
|
provider: "openai",
|
|
1698
1703
|
providerOptions,
|
|
1699
|
-
schema:
|
|
1704
|
+
schema: openAIProviderOptionsSchema
|
|
1700
1705
|
});
|
|
1701
1706
|
const formData = new FormData();
|
|
1702
1707
|
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils7.convertBase64ToUint8Array)(audio)]);
|
|
@@ -1704,16 +1709,16 @@ var OpenAITranscriptionModel = class {
|
|
|
1704
1709
|
formData.append("file", new File([blob], "audio", { type: mediaType }));
|
|
1705
1710
|
if (openAIOptions) {
|
|
1706
1711
|
const transcriptionModelOptions = {
|
|
1707
|
-
include: openAIOptions.include,
|
|
1708
|
-
language: openAIOptions.language,
|
|
1709
|
-
prompt: openAIOptions.prompt,
|
|
1710
|
-
temperature: openAIOptions.temperature,
|
|
1711
|
-
timestamp_granularities: openAIOptions.timestampGranularities
|
|
1712
|
+
include: (_a = openAIOptions.include) != null ? _a : void 0,
|
|
1713
|
+
language: (_b = openAIOptions.language) != null ? _b : void 0,
|
|
1714
|
+
prompt: (_c = openAIOptions.prompt) != null ? _c : void 0,
|
|
1715
|
+
temperature: (_d = openAIOptions.temperature) != null ? _d : void 0,
|
|
1716
|
+
timestamp_granularities: (_e = openAIOptions.timestampGranularities) != null ? _e : void 0
|
|
1712
1717
|
};
|
|
1713
1718
|
for (const key in transcriptionModelOptions) {
|
|
1714
1719
|
const value = transcriptionModelOptions[key];
|
|
1715
1720
|
if (value !== void 0) {
|
|
1716
|
-
formData.append(key, value);
|
|
1721
|
+
formData.append(key, String(value));
|
|
1717
1722
|
}
|
|
1718
1723
|
}
|
|
1719
1724
|
}
|
|
@@ -1777,13 +1782,112 @@ var openaiTranscriptionResponseSchema = import_zod6.z.object({
|
|
|
1777
1782
|
).nullish()
|
|
1778
1783
|
});
|
|
1779
1784
|
|
|
1780
|
-
// src/
|
|
1781
|
-
var
|
|
1785
|
+
// src/openai-speech-model.ts
|
|
1786
|
+
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1782
1787
|
var import_zod7 = require("zod");
|
|
1788
|
+
var OpenAIProviderOptionsSchema = import_zod7.z.object({
|
|
1789
|
+
instructions: import_zod7.z.string().nullish(),
|
|
1790
|
+
speed: import_zod7.z.number().min(0.25).max(4).default(1).nullish()
|
|
1791
|
+
});
|
|
1792
|
+
var OpenAISpeechModel = class {
|
|
1793
|
+
constructor(modelId, config) {
|
|
1794
|
+
this.modelId = modelId;
|
|
1795
|
+
this.config = config;
|
|
1796
|
+
this.specificationVersion = "v1";
|
|
1797
|
+
}
|
|
1798
|
+
get provider() {
|
|
1799
|
+
return this.config.provider;
|
|
1800
|
+
}
|
|
1801
|
+
getArgs({
|
|
1802
|
+
text,
|
|
1803
|
+
voice = "alloy",
|
|
1804
|
+
outputFormat = "mp3",
|
|
1805
|
+
speed,
|
|
1806
|
+
instructions,
|
|
1807
|
+
providerOptions
|
|
1808
|
+
}) {
|
|
1809
|
+
const warnings = [];
|
|
1810
|
+
const openAIOptions = (0, import_provider_utils8.parseProviderOptions)({
|
|
1811
|
+
provider: "openai",
|
|
1812
|
+
providerOptions,
|
|
1813
|
+
schema: OpenAIProviderOptionsSchema
|
|
1814
|
+
});
|
|
1815
|
+
const requestBody = {
|
|
1816
|
+
model: this.modelId,
|
|
1817
|
+
input: text,
|
|
1818
|
+
voice,
|
|
1819
|
+
response_format: "mp3",
|
|
1820
|
+
speed,
|
|
1821
|
+
instructions
|
|
1822
|
+
};
|
|
1823
|
+
if (outputFormat) {
|
|
1824
|
+
if (["mp3", "opus", "aac", "flac", "wav", "pcm"].includes(outputFormat)) {
|
|
1825
|
+
requestBody.response_format = outputFormat;
|
|
1826
|
+
} else {
|
|
1827
|
+
warnings.push({
|
|
1828
|
+
type: "unsupported-setting",
|
|
1829
|
+
setting: "outputFormat",
|
|
1830
|
+
details: `Unsupported output format: ${outputFormat}. Using mp3 instead.`
|
|
1831
|
+
});
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
if (openAIOptions) {
|
|
1835
|
+
const speechModelOptions = {};
|
|
1836
|
+
for (const key in speechModelOptions) {
|
|
1837
|
+
const value = speechModelOptions[key];
|
|
1838
|
+
if (value !== void 0) {
|
|
1839
|
+
requestBody[key] = value;
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
return {
|
|
1844
|
+
requestBody,
|
|
1845
|
+
warnings
|
|
1846
|
+
};
|
|
1847
|
+
}
|
|
1848
|
+
async doGenerate(options) {
|
|
1849
|
+
var _a, _b, _c;
|
|
1850
|
+
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
1851
|
+
const { requestBody, warnings } = this.getArgs(options);
|
|
1852
|
+
const {
|
|
1853
|
+
value: audio,
|
|
1854
|
+
responseHeaders,
|
|
1855
|
+
rawValue: rawResponse
|
|
1856
|
+
} = await (0, import_provider_utils8.postJsonToApi)({
|
|
1857
|
+
url: this.config.url({
|
|
1858
|
+
path: "/audio/speech",
|
|
1859
|
+
modelId: this.modelId
|
|
1860
|
+
}),
|
|
1861
|
+
headers: (0, import_provider_utils8.combineHeaders)(this.config.headers(), options.headers),
|
|
1862
|
+
body: requestBody,
|
|
1863
|
+
failedResponseHandler: openaiFailedResponseHandler,
|
|
1864
|
+
successfulResponseHandler: (0, import_provider_utils8.createBinaryResponseHandler)(),
|
|
1865
|
+
abortSignal: options.abortSignal,
|
|
1866
|
+
fetch: this.config.fetch
|
|
1867
|
+
});
|
|
1868
|
+
return {
|
|
1869
|
+
audio,
|
|
1870
|
+
warnings,
|
|
1871
|
+
request: {
|
|
1872
|
+
body: JSON.stringify(requestBody)
|
|
1873
|
+
},
|
|
1874
|
+
response: {
|
|
1875
|
+
timestamp: currentDate,
|
|
1876
|
+
modelId: this.modelId,
|
|
1877
|
+
headers: responseHeaders,
|
|
1878
|
+
body: rawResponse
|
|
1879
|
+
}
|
|
1880
|
+
};
|
|
1881
|
+
}
|
|
1882
|
+
};
|
|
1883
|
+
|
|
1884
|
+
// src/responses/openai-responses-language-model.ts
|
|
1885
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
1886
|
+
var import_zod8 = require("zod");
|
|
1783
1887
|
|
|
1784
1888
|
// src/responses/convert-to-openai-responses-messages.ts
|
|
1785
1889
|
var import_provider7 = require("@ai-sdk/provider");
|
|
1786
|
-
var
|
|
1890
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1787
1891
|
function convertToOpenAIResponsesMessages({
|
|
1788
1892
|
prompt,
|
|
1789
1893
|
systemMessageMode
|
|
@@ -1830,7 +1934,7 @@ function convertToOpenAIResponsesMessages({
|
|
|
1830
1934
|
case "image": {
|
|
1831
1935
|
return {
|
|
1832
1936
|
type: "input_image",
|
|
1833
|
-
image_url: part.image instanceof URL ? part.image.toString() : `data:${(_a = part.mimeType) != null ? _a : "image/jpeg"};base64,${(0,
|
|
1937
|
+
image_url: part.image instanceof URL ? part.image.toString() : `data:${(_a = part.mimeType) != null ? _a : "image/jpeg"};base64,${(0, import_provider_utils9.convertUint8ArrayToBase64)(part.image)}`,
|
|
1834
1938
|
// OpenAI specific extension: image detail
|
|
1835
1939
|
detail: (_c = (_b = part.providerMetadata) == null ? void 0 : _b.openai) == null ? void 0 : _c.imageDetail
|
|
1836
1940
|
};
|
|
@@ -2066,7 +2170,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2066
2170
|
systemMessageMode: modelConfig.systemMessageMode
|
|
2067
2171
|
});
|
|
2068
2172
|
warnings.push(...messageWarnings);
|
|
2069
|
-
const openaiOptions = (0,
|
|
2173
|
+
const openaiOptions = (0, import_provider_utils10.parseProviderOptions)({
|
|
2070
2174
|
provider: "openai",
|
|
2071
2175
|
providerOptions: providerMetadata,
|
|
2072
2176
|
schema: openaiResponsesProviderOptionsSchema
|
|
@@ -2186,58 +2290,58 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2186
2290
|
responseHeaders,
|
|
2187
2291
|
value: response,
|
|
2188
2292
|
rawValue: rawResponse
|
|
2189
|
-
} = await (0,
|
|
2293
|
+
} = await (0, import_provider_utils10.postJsonToApi)({
|
|
2190
2294
|
url: this.config.url({
|
|
2191
2295
|
path: "/responses",
|
|
2192
2296
|
modelId: this.modelId
|
|
2193
2297
|
}),
|
|
2194
|
-
headers: (0,
|
|
2298
|
+
headers: (0, import_provider_utils10.combineHeaders)(this.config.headers(), options.headers),
|
|
2195
2299
|
body,
|
|
2196
2300
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2197
|
-
successfulResponseHandler: (0,
|
|
2198
|
-
|
|
2199
|
-
id:
|
|
2200
|
-
created_at:
|
|
2201
|
-
model:
|
|
2202
|
-
output:
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
type:
|
|
2206
|
-
role:
|
|
2207
|
-
content:
|
|
2208
|
-
|
|
2209
|
-
type:
|
|
2210
|
-
text:
|
|
2211
|
-
annotations:
|
|
2212
|
-
|
|
2213
|
-
type:
|
|
2214
|
-
start_index:
|
|
2215
|
-
end_index:
|
|
2216
|
-
url:
|
|
2217
|
-
title:
|
|
2301
|
+
successfulResponseHandler: (0, import_provider_utils10.createJsonResponseHandler)(
|
|
2302
|
+
import_zod8.z.object({
|
|
2303
|
+
id: import_zod8.z.string(),
|
|
2304
|
+
created_at: import_zod8.z.number(),
|
|
2305
|
+
model: import_zod8.z.string(),
|
|
2306
|
+
output: import_zod8.z.array(
|
|
2307
|
+
import_zod8.z.discriminatedUnion("type", [
|
|
2308
|
+
import_zod8.z.object({
|
|
2309
|
+
type: import_zod8.z.literal("message"),
|
|
2310
|
+
role: import_zod8.z.literal("assistant"),
|
|
2311
|
+
content: import_zod8.z.array(
|
|
2312
|
+
import_zod8.z.object({
|
|
2313
|
+
type: import_zod8.z.literal("output_text"),
|
|
2314
|
+
text: import_zod8.z.string(),
|
|
2315
|
+
annotations: import_zod8.z.array(
|
|
2316
|
+
import_zod8.z.object({
|
|
2317
|
+
type: import_zod8.z.literal("url_citation"),
|
|
2318
|
+
start_index: import_zod8.z.number(),
|
|
2319
|
+
end_index: import_zod8.z.number(),
|
|
2320
|
+
url: import_zod8.z.string(),
|
|
2321
|
+
title: import_zod8.z.string()
|
|
2218
2322
|
})
|
|
2219
2323
|
)
|
|
2220
2324
|
})
|
|
2221
2325
|
)
|
|
2222
2326
|
}),
|
|
2223
|
-
|
|
2224
|
-
type:
|
|
2225
|
-
call_id:
|
|
2226
|
-
name:
|
|
2227
|
-
arguments:
|
|
2327
|
+
import_zod8.z.object({
|
|
2328
|
+
type: import_zod8.z.literal("function_call"),
|
|
2329
|
+
call_id: import_zod8.z.string(),
|
|
2330
|
+
name: import_zod8.z.string(),
|
|
2331
|
+
arguments: import_zod8.z.string()
|
|
2228
2332
|
}),
|
|
2229
|
-
|
|
2230
|
-
type:
|
|
2333
|
+
import_zod8.z.object({
|
|
2334
|
+
type: import_zod8.z.literal("web_search_call")
|
|
2231
2335
|
}),
|
|
2232
|
-
|
|
2233
|
-
type:
|
|
2336
|
+
import_zod8.z.object({
|
|
2337
|
+
type: import_zod8.z.literal("computer_call")
|
|
2234
2338
|
}),
|
|
2235
|
-
|
|
2236
|
-
type:
|
|
2339
|
+
import_zod8.z.object({
|
|
2340
|
+
type: import_zod8.z.literal("reasoning")
|
|
2237
2341
|
})
|
|
2238
2342
|
])
|
|
2239
2343
|
),
|
|
2240
|
-
incomplete_details:
|
|
2344
|
+
incomplete_details: import_zod8.z.object({ reason: import_zod8.z.string() }).nullable(),
|
|
2241
2345
|
usage: usageSchema
|
|
2242
2346
|
})
|
|
2243
2347
|
),
|
|
@@ -2258,7 +2362,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2258
2362
|
var _a2, _b2, _c2;
|
|
2259
2363
|
return {
|
|
2260
2364
|
sourceType: "url",
|
|
2261
|
-
id: (_c2 = (_b2 = (_a2 = this.config).generateId) == null ? void 0 : _b2.call(_a2)) != null ? _c2 : (0,
|
|
2365
|
+
id: (_c2 = (_b2 = (_a2 = this.config).generateId) == null ? void 0 : _b2.call(_a2)) != null ? _c2 : (0, import_provider_utils10.generateId)(),
|
|
2262
2366
|
url: annotation.url,
|
|
2263
2367
|
title: annotation.title
|
|
2264
2368
|
};
|
|
@@ -2301,18 +2405,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2301
2405
|
}
|
|
2302
2406
|
async doStream(options) {
|
|
2303
2407
|
const { args: body, warnings } = this.getArgs(options);
|
|
2304
|
-
const { responseHeaders, value: response } = await (0,
|
|
2408
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils10.postJsonToApi)({
|
|
2305
2409
|
url: this.config.url({
|
|
2306
2410
|
path: "/responses",
|
|
2307
2411
|
modelId: this.modelId
|
|
2308
2412
|
}),
|
|
2309
|
-
headers: (0,
|
|
2413
|
+
headers: (0, import_provider_utils10.combineHeaders)(this.config.headers(), options.headers),
|
|
2310
2414
|
body: {
|
|
2311
2415
|
...body,
|
|
2312
2416
|
stream: true
|
|
2313
2417
|
},
|
|
2314
2418
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2315
|
-
successfulResponseHandler: (0,
|
|
2419
|
+
successfulResponseHandler: (0, import_provider_utils10.createEventSourceResponseHandler)(
|
|
2316
2420
|
openaiResponsesChunkSchema
|
|
2317
2421
|
),
|
|
2318
2422
|
abortSignal: options.abortSignal,
|
|
@@ -2400,7 +2504,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2400
2504
|
type: "source",
|
|
2401
2505
|
source: {
|
|
2402
2506
|
sourceType: "url",
|
|
2403
|
-
id: (_h = (_g = (_f = self.config).generateId) == null ? void 0 : _g.call(_f)) != null ? _h : (0,
|
|
2507
|
+
id: (_h = (_g = (_f = self.config).generateId) == null ? void 0 : _g.call(_f)) != null ? _h : (0, import_provider_utils10.generateId)(),
|
|
2404
2508
|
url: value.annotation.url,
|
|
2405
2509
|
title: value.annotation.title
|
|
2406
2510
|
}
|
|
@@ -2435,79 +2539,79 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2435
2539
|
};
|
|
2436
2540
|
}
|
|
2437
2541
|
};
|
|
2438
|
-
var usageSchema =
|
|
2439
|
-
input_tokens:
|
|
2440
|
-
input_tokens_details:
|
|
2441
|
-
output_tokens:
|
|
2442
|
-
output_tokens_details:
|
|
2542
|
+
var usageSchema = import_zod8.z.object({
|
|
2543
|
+
input_tokens: import_zod8.z.number(),
|
|
2544
|
+
input_tokens_details: import_zod8.z.object({ cached_tokens: import_zod8.z.number().nullish() }).nullish(),
|
|
2545
|
+
output_tokens: import_zod8.z.number(),
|
|
2546
|
+
output_tokens_details: import_zod8.z.object({ reasoning_tokens: import_zod8.z.number().nullish() }).nullish()
|
|
2443
2547
|
});
|
|
2444
|
-
var textDeltaChunkSchema =
|
|
2445
|
-
type:
|
|
2446
|
-
delta:
|
|
2548
|
+
var textDeltaChunkSchema = import_zod8.z.object({
|
|
2549
|
+
type: import_zod8.z.literal("response.output_text.delta"),
|
|
2550
|
+
delta: import_zod8.z.string()
|
|
2447
2551
|
});
|
|
2448
|
-
var responseFinishedChunkSchema =
|
|
2449
|
-
type:
|
|
2450
|
-
response:
|
|
2451
|
-
incomplete_details:
|
|
2552
|
+
var responseFinishedChunkSchema = import_zod8.z.object({
|
|
2553
|
+
type: import_zod8.z.enum(["response.completed", "response.incomplete"]),
|
|
2554
|
+
response: import_zod8.z.object({
|
|
2555
|
+
incomplete_details: import_zod8.z.object({ reason: import_zod8.z.string() }).nullish(),
|
|
2452
2556
|
usage: usageSchema
|
|
2453
2557
|
})
|
|
2454
2558
|
});
|
|
2455
|
-
var responseCreatedChunkSchema =
|
|
2456
|
-
type:
|
|
2457
|
-
response:
|
|
2458
|
-
id:
|
|
2459
|
-
created_at:
|
|
2460
|
-
model:
|
|
2559
|
+
var responseCreatedChunkSchema = import_zod8.z.object({
|
|
2560
|
+
type: import_zod8.z.literal("response.created"),
|
|
2561
|
+
response: import_zod8.z.object({
|
|
2562
|
+
id: import_zod8.z.string(),
|
|
2563
|
+
created_at: import_zod8.z.number(),
|
|
2564
|
+
model: import_zod8.z.string()
|
|
2461
2565
|
})
|
|
2462
2566
|
});
|
|
2463
|
-
var responseOutputItemDoneSchema =
|
|
2464
|
-
type:
|
|
2465
|
-
output_index:
|
|
2466
|
-
item:
|
|
2467
|
-
|
|
2468
|
-
type:
|
|
2567
|
+
var responseOutputItemDoneSchema = import_zod8.z.object({
|
|
2568
|
+
type: import_zod8.z.literal("response.output_item.done"),
|
|
2569
|
+
output_index: import_zod8.z.number(),
|
|
2570
|
+
item: import_zod8.z.discriminatedUnion("type", [
|
|
2571
|
+
import_zod8.z.object({
|
|
2572
|
+
type: import_zod8.z.literal("message")
|
|
2469
2573
|
}),
|
|
2470
|
-
|
|
2471
|
-
type:
|
|
2472
|
-
id:
|
|
2473
|
-
call_id:
|
|
2474
|
-
name:
|
|
2475
|
-
arguments:
|
|
2476
|
-
status:
|
|
2574
|
+
import_zod8.z.object({
|
|
2575
|
+
type: import_zod8.z.literal("function_call"),
|
|
2576
|
+
id: import_zod8.z.string(),
|
|
2577
|
+
call_id: import_zod8.z.string(),
|
|
2578
|
+
name: import_zod8.z.string(),
|
|
2579
|
+
arguments: import_zod8.z.string(),
|
|
2580
|
+
status: import_zod8.z.literal("completed")
|
|
2477
2581
|
})
|
|
2478
2582
|
])
|
|
2479
2583
|
});
|
|
2480
|
-
var responseFunctionCallArgumentsDeltaSchema =
|
|
2481
|
-
type:
|
|
2482
|
-
item_id:
|
|
2483
|
-
output_index:
|
|
2484
|
-
delta:
|
|
2584
|
+
var responseFunctionCallArgumentsDeltaSchema = import_zod8.z.object({
|
|
2585
|
+
type: import_zod8.z.literal("response.function_call_arguments.delta"),
|
|
2586
|
+
item_id: import_zod8.z.string(),
|
|
2587
|
+
output_index: import_zod8.z.number(),
|
|
2588
|
+
delta: import_zod8.z.string()
|
|
2485
2589
|
});
|
|
2486
|
-
var responseOutputItemAddedSchema =
|
|
2487
|
-
type:
|
|
2488
|
-
output_index:
|
|
2489
|
-
item:
|
|
2490
|
-
|
|
2491
|
-
type:
|
|
2590
|
+
var responseOutputItemAddedSchema = import_zod8.z.object({
|
|
2591
|
+
type: import_zod8.z.literal("response.output_item.added"),
|
|
2592
|
+
output_index: import_zod8.z.number(),
|
|
2593
|
+
item: import_zod8.z.discriminatedUnion("type", [
|
|
2594
|
+
import_zod8.z.object({
|
|
2595
|
+
type: import_zod8.z.literal("message")
|
|
2492
2596
|
}),
|
|
2493
|
-
|
|
2494
|
-
type:
|
|
2495
|
-
id:
|
|
2496
|
-
call_id:
|
|
2497
|
-
name:
|
|
2498
|
-
arguments:
|
|
2597
|
+
import_zod8.z.object({
|
|
2598
|
+
type: import_zod8.z.literal("function_call"),
|
|
2599
|
+
id: import_zod8.z.string(),
|
|
2600
|
+
call_id: import_zod8.z.string(),
|
|
2601
|
+
name: import_zod8.z.string(),
|
|
2602
|
+
arguments: import_zod8.z.string()
|
|
2499
2603
|
})
|
|
2500
2604
|
])
|
|
2501
2605
|
});
|
|
2502
|
-
var responseAnnotationAddedSchema =
|
|
2503
|
-
type:
|
|
2504
|
-
annotation:
|
|
2505
|
-
type:
|
|
2506
|
-
url:
|
|
2507
|
-
title:
|
|
2606
|
+
var responseAnnotationAddedSchema = import_zod8.z.object({
|
|
2607
|
+
type: import_zod8.z.literal("response.output_text.annotation.added"),
|
|
2608
|
+
annotation: import_zod8.z.object({
|
|
2609
|
+
type: import_zod8.z.literal("url_citation"),
|
|
2610
|
+
url: import_zod8.z.string(),
|
|
2611
|
+
title: import_zod8.z.string()
|
|
2508
2612
|
})
|
|
2509
2613
|
});
|
|
2510
|
-
var openaiResponsesChunkSchema =
|
|
2614
|
+
var openaiResponsesChunkSchema = import_zod8.z.union([
|
|
2511
2615
|
textDeltaChunkSchema,
|
|
2512
2616
|
responseFinishedChunkSchema,
|
|
2513
2617
|
responseCreatedChunkSchema,
|
|
@@ -2515,7 +2619,7 @@ var openaiResponsesChunkSchema = import_zod7.z.union([
|
|
|
2515
2619
|
responseFunctionCallArgumentsDeltaSchema,
|
|
2516
2620
|
responseOutputItemAddedSchema,
|
|
2517
2621
|
responseAnnotationAddedSchema,
|
|
2518
|
-
|
|
2622
|
+
import_zod8.z.object({ type: import_zod8.z.string() }).passthrough()
|
|
2519
2623
|
// fallback for unknown chunks
|
|
2520
2624
|
]);
|
|
2521
2625
|
function isTextDeltaChunk(chunk) {
|
|
@@ -2560,15 +2664,15 @@ function getResponsesModelConfig(modelId) {
|
|
|
2560
2664
|
requiredAutoTruncation: false
|
|
2561
2665
|
};
|
|
2562
2666
|
}
|
|
2563
|
-
var openaiResponsesProviderOptionsSchema =
|
|
2564
|
-
metadata:
|
|
2565
|
-
parallelToolCalls:
|
|
2566
|
-
previousResponseId:
|
|
2567
|
-
store:
|
|
2568
|
-
user:
|
|
2569
|
-
reasoningEffort:
|
|
2570
|
-
strictSchemas:
|
|
2571
|
-
instructions:
|
|
2667
|
+
var openaiResponsesProviderOptionsSchema = import_zod8.z.object({
|
|
2668
|
+
metadata: import_zod8.z.any().nullish(),
|
|
2669
|
+
parallelToolCalls: import_zod8.z.boolean().nullish(),
|
|
2670
|
+
previousResponseId: import_zod8.z.string().nullish(),
|
|
2671
|
+
store: import_zod8.z.boolean().nullish(),
|
|
2672
|
+
user: import_zod8.z.string().nullish(),
|
|
2673
|
+
reasoningEffort: import_zod8.z.string().nullish(),
|
|
2674
|
+
strictSchemas: import_zod8.z.boolean().nullish(),
|
|
2675
|
+
instructions: import_zod8.z.string().nullish()
|
|
2572
2676
|
});
|
|
2573
2677
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2574
2678
|
0 && (module.exports = {
|
|
@@ -2577,6 +2681,7 @@ var openaiResponsesProviderOptionsSchema = import_zod7.z.object({
|
|
|
2577
2681
|
OpenAIEmbeddingModel,
|
|
2578
2682
|
OpenAIImageModel,
|
|
2579
2683
|
OpenAIResponsesLanguageModel,
|
|
2684
|
+
OpenAISpeechModel,
|
|
2580
2685
|
OpenAITranscriptionModel,
|
|
2581
2686
|
modelMaxImagesPerCall
|
|
2582
2687
|
});
|