@ai-sdk/openai 1.3.7 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +302 -115
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +300 -107
- package/dist/index.mjs.map +1 -1
- package/internal/dist/index.d.mts +67 -2
- package/internal/dist/index.d.ts +67 -2
- package/internal/dist/index.js +291 -110
- package/internal/dist/index.js.map +1 -1
- package/internal/dist/index.mjs +291 -105
- 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
|
+
OpenAITranscriptionModel: () => OpenAITranscriptionModel,
|
|
28
29
|
modelMaxImagesPerCall: () => modelMaxImagesPerCall
|
|
29
30
|
});
|
|
30
31
|
module.exports = __toCommonJS(internal_exports);
|
|
@@ -1602,13 +1603,192 @@ var openaiImageResponseSchema = import_zod5.z.object({
|
|
|
1602
1603
|
data: import_zod5.z.array(import_zod5.z.object({ b64_json: import_zod5.z.string() }))
|
|
1603
1604
|
});
|
|
1604
1605
|
|
|
1605
|
-
// src/
|
|
1606
|
-
var
|
|
1606
|
+
// src/openai-transcription-model.ts
|
|
1607
|
+
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
1607
1608
|
var import_zod6 = require("zod");
|
|
1609
|
+
var OpenAIProviderOptionsSchema = import_zod6.z.object({
|
|
1610
|
+
include: import_zod6.z.array(import_zod6.z.string()).optional().describe(
|
|
1611
|
+
"Additional information to include in the transcription response."
|
|
1612
|
+
),
|
|
1613
|
+
language: import_zod6.z.string().optional().describe("The language of the input audio in ISO-639-1 format."),
|
|
1614
|
+
prompt: import_zod6.z.string().optional().describe(
|
|
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
|
+
)
|
|
1621
|
+
});
|
|
1622
|
+
var languageMap = {
|
|
1623
|
+
afrikaans: "af",
|
|
1624
|
+
arabic: "ar",
|
|
1625
|
+
armenian: "hy",
|
|
1626
|
+
azerbaijani: "az",
|
|
1627
|
+
belarusian: "be",
|
|
1628
|
+
bosnian: "bs",
|
|
1629
|
+
bulgarian: "bg",
|
|
1630
|
+
catalan: "ca",
|
|
1631
|
+
chinese: "zh",
|
|
1632
|
+
croatian: "hr",
|
|
1633
|
+
czech: "cs",
|
|
1634
|
+
danish: "da",
|
|
1635
|
+
dutch: "nl",
|
|
1636
|
+
english: "en",
|
|
1637
|
+
estonian: "et",
|
|
1638
|
+
finnish: "fi",
|
|
1639
|
+
french: "fr",
|
|
1640
|
+
galician: "gl",
|
|
1641
|
+
german: "de",
|
|
1642
|
+
greek: "el",
|
|
1643
|
+
hebrew: "he",
|
|
1644
|
+
hindi: "hi",
|
|
1645
|
+
hungarian: "hu",
|
|
1646
|
+
icelandic: "is",
|
|
1647
|
+
indonesian: "id",
|
|
1648
|
+
italian: "it",
|
|
1649
|
+
japanese: "ja",
|
|
1650
|
+
kannada: "kn",
|
|
1651
|
+
kazakh: "kk",
|
|
1652
|
+
korean: "ko",
|
|
1653
|
+
latvian: "lv",
|
|
1654
|
+
lithuanian: "lt",
|
|
1655
|
+
macedonian: "mk",
|
|
1656
|
+
malay: "ms",
|
|
1657
|
+
marathi: "mr",
|
|
1658
|
+
maori: "mi",
|
|
1659
|
+
nepali: "ne",
|
|
1660
|
+
norwegian: "no",
|
|
1661
|
+
persian: "fa",
|
|
1662
|
+
polish: "pl",
|
|
1663
|
+
portuguese: "pt",
|
|
1664
|
+
romanian: "ro",
|
|
1665
|
+
russian: "ru",
|
|
1666
|
+
serbian: "sr",
|
|
1667
|
+
slovak: "sk",
|
|
1668
|
+
slovenian: "sl",
|
|
1669
|
+
spanish: "es",
|
|
1670
|
+
swahili: "sw",
|
|
1671
|
+
swedish: "sv",
|
|
1672
|
+
tagalog: "tl",
|
|
1673
|
+
tamil: "ta",
|
|
1674
|
+
thai: "th",
|
|
1675
|
+
turkish: "tr",
|
|
1676
|
+
ukrainian: "uk",
|
|
1677
|
+
urdu: "ur",
|
|
1678
|
+
vietnamese: "vi",
|
|
1679
|
+
welsh: "cy"
|
|
1680
|
+
};
|
|
1681
|
+
var OpenAITranscriptionModel = class {
|
|
1682
|
+
constructor(modelId, config) {
|
|
1683
|
+
this.modelId = modelId;
|
|
1684
|
+
this.config = config;
|
|
1685
|
+
this.specificationVersion = "v1";
|
|
1686
|
+
}
|
|
1687
|
+
get provider() {
|
|
1688
|
+
return this.config.provider;
|
|
1689
|
+
}
|
|
1690
|
+
getArgs({
|
|
1691
|
+
audio,
|
|
1692
|
+
mimeType,
|
|
1693
|
+
providerOptions
|
|
1694
|
+
}) {
|
|
1695
|
+
const warnings = [];
|
|
1696
|
+
const openAIOptions = (0, import_provider_utils7.parseProviderOptions)({
|
|
1697
|
+
provider: "openai",
|
|
1698
|
+
providerOptions,
|
|
1699
|
+
schema: OpenAIProviderOptionsSchema
|
|
1700
|
+
});
|
|
1701
|
+
const formData = new FormData();
|
|
1702
|
+
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils7.convertBase64ToUint8Array)(audio)]);
|
|
1703
|
+
formData.append("model", this.modelId);
|
|
1704
|
+
formData.append("file", new File([blob], "audio", { type: mimeType }));
|
|
1705
|
+
if (openAIOptions) {
|
|
1706
|
+
const transcriptionModelOptions = {
|
|
1707
|
+
include: openAIOptions.include,
|
|
1708
|
+
language: openAIOptions.language,
|
|
1709
|
+
prompt: openAIOptions.prompt,
|
|
1710
|
+
temperature: openAIOptions.temperature,
|
|
1711
|
+
timestamp_granularities: openAIOptions.timestampGranularities
|
|
1712
|
+
};
|
|
1713
|
+
for (const key in transcriptionModelOptions) {
|
|
1714
|
+
const value = transcriptionModelOptions[key];
|
|
1715
|
+
if (value !== void 0) {
|
|
1716
|
+
formData.append(key, value);
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
return {
|
|
1721
|
+
formData,
|
|
1722
|
+
warnings
|
|
1723
|
+
};
|
|
1724
|
+
}
|
|
1725
|
+
async doGenerate(options) {
|
|
1726
|
+
var _a, _b, _c;
|
|
1727
|
+
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
1728
|
+
const { formData, warnings } = this.getArgs(options);
|
|
1729
|
+
const { value: response, responseHeaders } = await (0, import_provider_utils7.postFormDataToApi)({
|
|
1730
|
+
url: this.config.url({
|
|
1731
|
+
path: "/audio/transcriptions",
|
|
1732
|
+
modelId: this.modelId
|
|
1733
|
+
}),
|
|
1734
|
+
headers: (0, import_provider_utils7.combineHeaders)(this.config.headers(), options.headers),
|
|
1735
|
+
formData,
|
|
1736
|
+
failedResponseHandler: openaiFailedResponseHandler,
|
|
1737
|
+
successfulResponseHandler: (0, import_provider_utils7.createJsonResponseHandler)(
|
|
1738
|
+
openaiTranscriptionResponseSchema
|
|
1739
|
+
),
|
|
1740
|
+
abortSignal: options.abortSignal,
|
|
1741
|
+
fetch: this.config.fetch
|
|
1742
|
+
});
|
|
1743
|
+
let language;
|
|
1744
|
+
if (response.language && response.language in languageMap) {
|
|
1745
|
+
language = languageMap[response.language];
|
|
1746
|
+
}
|
|
1747
|
+
return {
|
|
1748
|
+
text: response.text,
|
|
1749
|
+
segments: response.words.map((word) => ({
|
|
1750
|
+
text: word.word,
|
|
1751
|
+
startSecond: word.start,
|
|
1752
|
+
endSecond: word.end
|
|
1753
|
+
})),
|
|
1754
|
+
language,
|
|
1755
|
+
durationInSeconds: response.duration,
|
|
1756
|
+
warnings,
|
|
1757
|
+
response: {
|
|
1758
|
+
timestamp: currentDate,
|
|
1759
|
+
modelId: this.modelId,
|
|
1760
|
+
headers: responseHeaders,
|
|
1761
|
+
body: response
|
|
1762
|
+
},
|
|
1763
|
+
// When using format `verbose_json` on `whisper-1`, OpenAI includes the things like `task` and enhanced `segments` information.
|
|
1764
|
+
providerMetadata: {
|
|
1765
|
+
openai: {
|
|
1766
|
+
transcript: response
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
};
|
|
1770
|
+
}
|
|
1771
|
+
};
|
|
1772
|
+
var openaiTranscriptionResponseSchema = import_zod6.z.object({
|
|
1773
|
+
text: import_zod6.z.string(),
|
|
1774
|
+
language: import_zod6.z.string().optional(),
|
|
1775
|
+
duration: import_zod6.z.number().optional(),
|
|
1776
|
+
words: import_zod6.z.array(
|
|
1777
|
+
import_zod6.z.object({
|
|
1778
|
+
word: import_zod6.z.string(),
|
|
1779
|
+
start: import_zod6.z.number(),
|
|
1780
|
+
end: import_zod6.z.number()
|
|
1781
|
+
})
|
|
1782
|
+
)
|
|
1783
|
+
});
|
|
1784
|
+
|
|
1785
|
+
// src/responses/openai-responses-language-model.ts
|
|
1786
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1787
|
+
var import_zod7 = require("zod");
|
|
1608
1788
|
|
|
1609
1789
|
// src/responses/convert-to-openai-responses-messages.ts
|
|
1610
1790
|
var import_provider7 = require("@ai-sdk/provider");
|
|
1611
|
-
var
|
|
1791
|
+
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1612
1792
|
function convertToOpenAIResponsesMessages({
|
|
1613
1793
|
prompt,
|
|
1614
1794
|
systemMessageMode
|
|
@@ -1655,7 +1835,7 @@ function convertToOpenAIResponsesMessages({
|
|
|
1655
1835
|
case "image": {
|
|
1656
1836
|
return {
|
|
1657
1837
|
type: "input_image",
|
|
1658
|
-
image_url: part.image instanceof URL ? part.image.toString() : `data:${(_a = part.mimeType) != null ? _a : "image/jpeg"};base64,${(0,
|
|
1838
|
+
image_url: part.image instanceof URL ? part.image.toString() : `data:${(_a = part.mimeType) != null ? _a : "image/jpeg"};base64,${(0, import_provider_utils8.convertUint8ArrayToBase64)(part.image)}`,
|
|
1659
1839
|
// OpenAI specific extension: image detail
|
|
1660
1840
|
detail: (_c = (_b = part.providerMetadata) == null ? void 0 : _b.openai) == null ? void 0 : _c.imageDetail
|
|
1661
1841
|
};
|
|
@@ -1891,7 +2071,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
1891
2071
|
systemMessageMode: modelConfig.systemMessageMode
|
|
1892
2072
|
});
|
|
1893
2073
|
warnings.push(...messageWarnings);
|
|
1894
|
-
const openaiOptions = (0,
|
|
2074
|
+
const openaiOptions = (0, import_provider_utils9.parseProviderOptions)({
|
|
1895
2075
|
provider: "openai",
|
|
1896
2076
|
providerOptions: providerMetadata,
|
|
1897
2077
|
schema: openaiResponsesProviderOptionsSchema
|
|
@@ -2011,58 +2191,58 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2011
2191
|
responseHeaders,
|
|
2012
2192
|
value: response,
|
|
2013
2193
|
rawValue: rawResponse
|
|
2014
|
-
} = await (0,
|
|
2194
|
+
} = await (0, import_provider_utils9.postJsonToApi)({
|
|
2015
2195
|
url: this.config.url({
|
|
2016
2196
|
path: "/responses",
|
|
2017
2197
|
modelId: this.modelId
|
|
2018
2198
|
}),
|
|
2019
|
-
headers: (0,
|
|
2199
|
+
headers: (0, import_provider_utils9.combineHeaders)(this.config.headers(), options.headers),
|
|
2020
2200
|
body,
|
|
2021
2201
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2022
|
-
successfulResponseHandler: (0,
|
|
2023
|
-
|
|
2024
|
-
id:
|
|
2025
|
-
created_at:
|
|
2026
|
-
model:
|
|
2027
|
-
output:
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
type:
|
|
2031
|
-
role:
|
|
2032
|
-
content:
|
|
2033
|
-
|
|
2034
|
-
type:
|
|
2035
|
-
text:
|
|
2036
|
-
annotations:
|
|
2037
|
-
|
|
2038
|
-
type:
|
|
2039
|
-
start_index:
|
|
2040
|
-
end_index:
|
|
2041
|
-
url:
|
|
2042
|
-
title:
|
|
2202
|
+
successfulResponseHandler: (0, import_provider_utils9.createJsonResponseHandler)(
|
|
2203
|
+
import_zod7.z.object({
|
|
2204
|
+
id: import_zod7.z.string(),
|
|
2205
|
+
created_at: import_zod7.z.number(),
|
|
2206
|
+
model: import_zod7.z.string(),
|
|
2207
|
+
output: import_zod7.z.array(
|
|
2208
|
+
import_zod7.z.discriminatedUnion("type", [
|
|
2209
|
+
import_zod7.z.object({
|
|
2210
|
+
type: import_zod7.z.literal("message"),
|
|
2211
|
+
role: import_zod7.z.literal("assistant"),
|
|
2212
|
+
content: import_zod7.z.array(
|
|
2213
|
+
import_zod7.z.object({
|
|
2214
|
+
type: import_zod7.z.literal("output_text"),
|
|
2215
|
+
text: import_zod7.z.string(),
|
|
2216
|
+
annotations: import_zod7.z.array(
|
|
2217
|
+
import_zod7.z.object({
|
|
2218
|
+
type: import_zod7.z.literal("url_citation"),
|
|
2219
|
+
start_index: import_zod7.z.number(),
|
|
2220
|
+
end_index: import_zod7.z.number(),
|
|
2221
|
+
url: import_zod7.z.string(),
|
|
2222
|
+
title: import_zod7.z.string()
|
|
2043
2223
|
})
|
|
2044
2224
|
)
|
|
2045
2225
|
})
|
|
2046
2226
|
)
|
|
2047
2227
|
}),
|
|
2048
|
-
|
|
2049
|
-
type:
|
|
2050
|
-
call_id:
|
|
2051
|
-
name:
|
|
2052
|
-
arguments:
|
|
2228
|
+
import_zod7.z.object({
|
|
2229
|
+
type: import_zod7.z.literal("function_call"),
|
|
2230
|
+
call_id: import_zod7.z.string(),
|
|
2231
|
+
name: import_zod7.z.string(),
|
|
2232
|
+
arguments: import_zod7.z.string()
|
|
2053
2233
|
}),
|
|
2054
|
-
|
|
2055
|
-
type:
|
|
2234
|
+
import_zod7.z.object({
|
|
2235
|
+
type: import_zod7.z.literal("web_search_call")
|
|
2056
2236
|
}),
|
|
2057
|
-
|
|
2058
|
-
type:
|
|
2237
|
+
import_zod7.z.object({
|
|
2238
|
+
type: import_zod7.z.literal("computer_call")
|
|
2059
2239
|
}),
|
|
2060
|
-
|
|
2061
|
-
type:
|
|
2240
|
+
import_zod7.z.object({
|
|
2241
|
+
type: import_zod7.z.literal("reasoning")
|
|
2062
2242
|
})
|
|
2063
2243
|
])
|
|
2064
2244
|
),
|
|
2065
|
-
incomplete_details:
|
|
2245
|
+
incomplete_details: import_zod7.z.object({ reason: import_zod7.z.string() }).nullable(),
|
|
2066
2246
|
usage: usageSchema
|
|
2067
2247
|
})
|
|
2068
2248
|
),
|
|
@@ -2083,7 +2263,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2083
2263
|
var _a2, _b2, _c2;
|
|
2084
2264
|
return {
|
|
2085
2265
|
sourceType: "url",
|
|
2086
|
-
id: (_c2 = (_b2 = (_a2 = this.config).generateId) == null ? void 0 : _b2.call(_a2)) != null ? _c2 : (0,
|
|
2266
|
+
id: (_c2 = (_b2 = (_a2 = this.config).generateId) == null ? void 0 : _b2.call(_a2)) != null ? _c2 : (0, import_provider_utils9.generateId)(),
|
|
2087
2267
|
url: annotation.url,
|
|
2088
2268
|
title: annotation.title
|
|
2089
2269
|
};
|
|
@@ -2126,18 +2306,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2126
2306
|
}
|
|
2127
2307
|
async doStream(options) {
|
|
2128
2308
|
const { args: body, warnings } = this.getArgs(options);
|
|
2129
|
-
const { responseHeaders, value: response } = await (0,
|
|
2309
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils9.postJsonToApi)({
|
|
2130
2310
|
url: this.config.url({
|
|
2131
2311
|
path: "/responses",
|
|
2132
2312
|
modelId: this.modelId
|
|
2133
2313
|
}),
|
|
2134
|
-
headers: (0,
|
|
2314
|
+
headers: (0, import_provider_utils9.combineHeaders)(this.config.headers(), options.headers),
|
|
2135
2315
|
body: {
|
|
2136
2316
|
...body,
|
|
2137
2317
|
stream: true
|
|
2138
2318
|
},
|
|
2139
2319
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2140
|
-
successfulResponseHandler: (0,
|
|
2320
|
+
successfulResponseHandler: (0, import_provider_utils9.createEventSourceResponseHandler)(
|
|
2141
2321
|
openaiResponsesChunkSchema
|
|
2142
2322
|
),
|
|
2143
2323
|
abortSignal: options.abortSignal,
|
|
@@ -2225,7 +2405,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2225
2405
|
type: "source",
|
|
2226
2406
|
source: {
|
|
2227
2407
|
sourceType: "url",
|
|
2228
|
-
id: (_h = (_g = (_f = self.config).generateId) == null ? void 0 : _g.call(_f)) != null ? _h : (0,
|
|
2408
|
+
id: (_h = (_g = (_f = self.config).generateId) == null ? void 0 : _g.call(_f)) != null ? _h : (0, import_provider_utils9.generateId)(),
|
|
2229
2409
|
url: value.annotation.url,
|
|
2230
2410
|
title: value.annotation.title
|
|
2231
2411
|
}
|
|
@@ -2260,79 +2440,79 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2260
2440
|
};
|
|
2261
2441
|
}
|
|
2262
2442
|
};
|
|
2263
|
-
var usageSchema =
|
|
2264
|
-
input_tokens:
|
|
2265
|
-
input_tokens_details:
|
|
2266
|
-
output_tokens:
|
|
2267
|
-
output_tokens_details:
|
|
2443
|
+
var usageSchema = import_zod7.z.object({
|
|
2444
|
+
input_tokens: import_zod7.z.number(),
|
|
2445
|
+
input_tokens_details: import_zod7.z.object({ cached_tokens: import_zod7.z.number().nullish() }).nullish(),
|
|
2446
|
+
output_tokens: import_zod7.z.number(),
|
|
2447
|
+
output_tokens_details: import_zod7.z.object({ reasoning_tokens: import_zod7.z.number().nullish() }).nullish()
|
|
2268
2448
|
});
|
|
2269
|
-
var textDeltaChunkSchema =
|
|
2270
|
-
type:
|
|
2271
|
-
delta:
|
|
2449
|
+
var textDeltaChunkSchema = import_zod7.z.object({
|
|
2450
|
+
type: import_zod7.z.literal("response.output_text.delta"),
|
|
2451
|
+
delta: import_zod7.z.string()
|
|
2272
2452
|
});
|
|
2273
|
-
var responseFinishedChunkSchema =
|
|
2274
|
-
type:
|
|
2275
|
-
response:
|
|
2276
|
-
incomplete_details:
|
|
2453
|
+
var responseFinishedChunkSchema = import_zod7.z.object({
|
|
2454
|
+
type: import_zod7.z.enum(["response.completed", "response.incomplete"]),
|
|
2455
|
+
response: import_zod7.z.object({
|
|
2456
|
+
incomplete_details: import_zod7.z.object({ reason: import_zod7.z.string() }).nullish(),
|
|
2277
2457
|
usage: usageSchema
|
|
2278
2458
|
})
|
|
2279
2459
|
});
|
|
2280
|
-
var responseCreatedChunkSchema =
|
|
2281
|
-
type:
|
|
2282
|
-
response:
|
|
2283
|
-
id:
|
|
2284
|
-
created_at:
|
|
2285
|
-
model:
|
|
2460
|
+
var responseCreatedChunkSchema = import_zod7.z.object({
|
|
2461
|
+
type: import_zod7.z.literal("response.created"),
|
|
2462
|
+
response: import_zod7.z.object({
|
|
2463
|
+
id: import_zod7.z.string(),
|
|
2464
|
+
created_at: import_zod7.z.number(),
|
|
2465
|
+
model: import_zod7.z.string()
|
|
2286
2466
|
})
|
|
2287
2467
|
});
|
|
2288
|
-
var responseOutputItemDoneSchema =
|
|
2289
|
-
type:
|
|
2290
|
-
output_index:
|
|
2291
|
-
item:
|
|
2292
|
-
|
|
2293
|
-
type:
|
|
2468
|
+
var responseOutputItemDoneSchema = import_zod7.z.object({
|
|
2469
|
+
type: import_zod7.z.literal("response.output_item.done"),
|
|
2470
|
+
output_index: import_zod7.z.number(),
|
|
2471
|
+
item: import_zod7.z.discriminatedUnion("type", [
|
|
2472
|
+
import_zod7.z.object({
|
|
2473
|
+
type: import_zod7.z.literal("message")
|
|
2294
2474
|
}),
|
|
2295
|
-
|
|
2296
|
-
type:
|
|
2297
|
-
id:
|
|
2298
|
-
call_id:
|
|
2299
|
-
name:
|
|
2300
|
-
arguments:
|
|
2301
|
-
status:
|
|
2475
|
+
import_zod7.z.object({
|
|
2476
|
+
type: import_zod7.z.literal("function_call"),
|
|
2477
|
+
id: import_zod7.z.string(),
|
|
2478
|
+
call_id: import_zod7.z.string(),
|
|
2479
|
+
name: import_zod7.z.string(),
|
|
2480
|
+
arguments: import_zod7.z.string(),
|
|
2481
|
+
status: import_zod7.z.literal("completed")
|
|
2302
2482
|
})
|
|
2303
2483
|
])
|
|
2304
2484
|
});
|
|
2305
|
-
var responseFunctionCallArgumentsDeltaSchema =
|
|
2306
|
-
type:
|
|
2307
|
-
item_id:
|
|
2308
|
-
output_index:
|
|
2309
|
-
delta:
|
|
2485
|
+
var responseFunctionCallArgumentsDeltaSchema = import_zod7.z.object({
|
|
2486
|
+
type: import_zod7.z.literal("response.function_call_arguments.delta"),
|
|
2487
|
+
item_id: import_zod7.z.string(),
|
|
2488
|
+
output_index: import_zod7.z.number(),
|
|
2489
|
+
delta: import_zod7.z.string()
|
|
2310
2490
|
});
|
|
2311
|
-
var responseOutputItemAddedSchema =
|
|
2312
|
-
type:
|
|
2313
|
-
output_index:
|
|
2314
|
-
item:
|
|
2315
|
-
|
|
2316
|
-
type:
|
|
2491
|
+
var responseOutputItemAddedSchema = import_zod7.z.object({
|
|
2492
|
+
type: import_zod7.z.literal("response.output_item.added"),
|
|
2493
|
+
output_index: import_zod7.z.number(),
|
|
2494
|
+
item: import_zod7.z.discriminatedUnion("type", [
|
|
2495
|
+
import_zod7.z.object({
|
|
2496
|
+
type: import_zod7.z.literal("message")
|
|
2317
2497
|
}),
|
|
2318
|
-
|
|
2319
|
-
type:
|
|
2320
|
-
id:
|
|
2321
|
-
call_id:
|
|
2322
|
-
name:
|
|
2323
|
-
arguments:
|
|
2498
|
+
import_zod7.z.object({
|
|
2499
|
+
type: import_zod7.z.literal("function_call"),
|
|
2500
|
+
id: import_zod7.z.string(),
|
|
2501
|
+
call_id: import_zod7.z.string(),
|
|
2502
|
+
name: import_zod7.z.string(),
|
|
2503
|
+
arguments: import_zod7.z.string()
|
|
2324
2504
|
})
|
|
2325
2505
|
])
|
|
2326
2506
|
});
|
|
2327
|
-
var responseAnnotationAddedSchema =
|
|
2328
|
-
type:
|
|
2329
|
-
annotation:
|
|
2330
|
-
type:
|
|
2331
|
-
url:
|
|
2332
|
-
title:
|
|
2507
|
+
var responseAnnotationAddedSchema = import_zod7.z.object({
|
|
2508
|
+
type: import_zod7.z.literal("response.output_text.annotation.added"),
|
|
2509
|
+
annotation: import_zod7.z.object({
|
|
2510
|
+
type: import_zod7.z.literal("url_citation"),
|
|
2511
|
+
url: import_zod7.z.string(),
|
|
2512
|
+
title: import_zod7.z.string()
|
|
2333
2513
|
})
|
|
2334
2514
|
});
|
|
2335
|
-
var openaiResponsesChunkSchema =
|
|
2515
|
+
var openaiResponsesChunkSchema = import_zod7.z.union([
|
|
2336
2516
|
textDeltaChunkSchema,
|
|
2337
2517
|
responseFinishedChunkSchema,
|
|
2338
2518
|
responseCreatedChunkSchema,
|
|
@@ -2340,7 +2520,7 @@ var openaiResponsesChunkSchema = import_zod6.z.union([
|
|
|
2340
2520
|
responseFunctionCallArgumentsDeltaSchema,
|
|
2341
2521
|
responseOutputItemAddedSchema,
|
|
2342
2522
|
responseAnnotationAddedSchema,
|
|
2343
|
-
|
|
2523
|
+
import_zod7.z.object({ type: import_zod7.z.string() }).passthrough()
|
|
2344
2524
|
// fallback for unknown chunks
|
|
2345
2525
|
]);
|
|
2346
2526
|
function isTextDeltaChunk(chunk) {
|
|
@@ -2385,15 +2565,15 @@ function getResponsesModelConfig(modelId) {
|
|
|
2385
2565
|
requiredAutoTruncation: false
|
|
2386
2566
|
};
|
|
2387
2567
|
}
|
|
2388
|
-
var openaiResponsesProviderOptionsSchema =
|
|
2389
|
-
metadata:
|
|
2390
|
-
parallelToolCalls:
|
|
2391
|
-
previousResponseId:
|
|
2392
|
-
store:
|
|
2393
|
-
user:
|
|
2394
|
-
reasoningEffort:
|
|
2395
|
-
strictSchemas:
|
|
2396
|
-
instructions:
|
|
2568
|
+
var openaiResponsesProviderOptionsSchema = import_zod7.z.object({
|
|
2569
|
+
metadata: import_zod7.z.any().nullish(),
|
|
2570
|
+
parallelToolCalls: import_zod7.z.boolean().nullish(),
|
|
2571
|
+
previousResponseId: import_zod7.z.string().nullish(),
|
|
2572
|
+
store: import_zod7.z.boolean().nullish(),
|
|
2573
|
+
user: import_zod7.z.string().nullish(),
|
|
2574
|
+
reasoningEffort: import_zod7.z.string().nullish(),
|
|
2575
|
+
strictSchemas: import_zod7.z.boolean().nullish(),
|
|
2576
|
+
instructions: import_zod7.z.string().nullish()
|
|
2397
2577
|
});
|
|
2398
2578
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2399
2579
|
0 && (module.exports = {
|
|
@@ -2402,6 +2582,7 @@ var openaiResponsesProviderOptionsSchema = import_zod6.z.object({
|
|
|
2402
2582
|
OpenAIEmbeddingModel,
|
|
2403
2583
|
OpenAIImageModel,
|
|
2404
2584
|
OpenAIResponsesLanguageModel,
|
|
2585
|
+
OpenAITranscriptionModel,
|
|
2405
2586
|
modelMaxImagesPerCall
|
|
2406
2587
|
});
|
|
2407
2588
|
//# sourceMappingURL=index.js.map
|