@ai-sdk/openai 1.3.7 → 1.3.9
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 +19 -0
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +297 -115
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +295 -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 +286 -110
- package/internal/dist/index.js.map +1 -1
- package/internal/dist/index.mjs +286 -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,187 @@ 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
|
+
mediaType,
|
|
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: mediaType }));
|
|
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, _d, _e, _f;
|
|
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 {
|
|
1730
|
+
value: response,
|
|
1731
|
+
responseHeaders,
|
|
1732
|
+
rawValue: rawResponse
|
|
1733
|
+
} = await (0, import_provider_utils7.postFormDataToApi)({
|
|
1734
|
+
url: this.config.url({
|
|
1735
|
+
path: "/audio/transcriptions",
|
|
1736
|
+
modelId: this.modelId
|
|
1737
|
+
}),
|
|
1738
|
+
headers: (0, import_provider_utils7.combineHeaders)(this.config.headers(), options.headers),
|
|
1739
|
+
formData,
|
|
1740
|
+
failedResponseHandler: openaiFailedResponseHandler,
|
|
1741
|
+
successfulResponseHandler: (0, import_provider_utils7.createJsonResponseHandler)(
|
|
1742
|
+
openaiTranscriptionResponseSchema
|
|
1743
|
+
),
|
|
1744
|
+
abortSignal: options.abortSignal,
|
|
1745
|
+
fetch: this.config.fetch
|
|
1746
|
+
});
|
|
1747
|
+
const language = response.language != null && response.language in languageMap ? languageMap[response.language] : void 0;
|
|
1748
|
+
return {
|
|
1749
|
+
text: response.text,
|
|
1750
|
+
segments: (_e = (_d = response.words) == null ? void 0 : _d.map((word) => ({
|
|
1751
|
+
text: word.word,
|
|
1752
|
+
startSecond: word.start,
|
|
1753
|
+
endSecond: word.end
|
|
1754
|
+
}))) != null ? _e : [],
|
|
1755
|
+
language,
|
|
1756
|
+
durationInSeconds: (_f = response.duration) != null ? _f : void 0,
|
|
1757
|
+
warnings,
|
|
1758
|
+
response: {
|
|
1759
|
+
timestamp: currentDate,
|
|
1760
|
+
modelId: this.modelId,
|
|
1761
|
+
headers: responseHeaders,
|
|
1762
|
+
body: rawResponse
|
|
1763
|
+
}
|
|
1764
|
+
};
|
|
1765
|
+
}
|
|
1766
|
+
};
|
|
1767
|
+
var openaiTranscriptionResponseSchema = import_zod6.z.object({
|
|
1768
|
+
text: import_zod6.z.string(),
|
|
1769
|
+
language: import_zod6.z.string().nullish(),
|
|
1770
|
+
duration: import_zod6.z.number().nullish(),
|
|
1771
|
+
words: import_zod6.z.array(
|
|
1772
|
+
import_zod6.z.object({
|
|
1773
|
+
word: import_zod6.z.string(),
|
|
1774
|
+
start: import_zod6.z.number(),
|
|
1775
|
+
end: import_zod6.z.number()
|
|
1776
|
+
})
|
|
1777
|
+
).nullish()
|
|
1778
|
+
});
|
|
1779
|
+
|
|
1780
|
+
// src/responses/openai-responses-language-model.ts
|
|
1781
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1782
|
+
var import_zod7 = require("zod");
|
|
1608
1783
|
|
|
1609
1784
|
// src/responses/convert-to-openai-responses-messages.ts
|
|
1610
1785
|
var import_provider7 = require("@ai-sdk/provider");
|
|
1611
|
-
var
|
|
1786
|
+
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1612
1787
|
function convertToOpenAIResponsesMessages({
|
|
1613
1788
|
prompt,
|
|
1614
1789
|
systemMessageMode
|
|
@@ -1655,7 +1830,7 @@ function convertToOpenAIResponsesMessages({
|
|
|
1655
1830
|
case "image": {
|
|
1656
1831
|
return {
|
|
1657
1832
|
type: "input_image",
|
|
1658
|
-
image_url: part.image instanceof URL ? part.image.toString() : `data:${(_a = part.mimeType) != null ? _a : "image/jpeg"};base64,${(0,
|
|
1833
|
+
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
1834
|
// OpenAI specific extension: image detail
|
|
1660
1835
|
detail: (_c = (_b = part.providerMetadata) == null ? void 0 : _b.openai) == null ? void 0 : _c.imageDetail
|
|
1661
1836
|
};
|
|
@@ -1891,7 +2066,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
1891
2066
|
systemMessageMode: modelConfig.systemMessageMode
|
|
1892
2067
|
});
|
|
1893
2068
|
warnings.push(...messageWarnings);
|
|
1894
|
-
const openaiOptions = (0,
|
|
2069
|
+
const openaiOptions = (0, import_provider_utils9.parseProviderOptions)({
|
|
1895
2070
|
provider: "openai",
|
|
1896
2071
|
providerOptions: providerMetadata,
|
|
1897
2072
|
schema: openaiResponsesProviderOptionsSchema
|
|
@@ -2011,58 +2186,58 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2011
2186
|
responseHeaders,
|
|
2012
2187
|
value: response,
|
|
2013
2188
|
rawValue: rawResponse
|
|
2014
|
-
} = await (0,
|
|
2189
|
+
} = await (0, import_provider_utils9.postJsonToApi)({
|
|
2015
2190
|
url: this.config.url({
|
|
2016
2191
|
path: "/responses",
|
|
2017
2192
|
modelId: this.modelId
|
|
2018
2193
|
}),
|
|
2019
|
-
headers: (0,
|
|
2194
|
+
headers: (0, import_provider_utils9.combineHeaders)(this.config.headers(), options.headers),
|
|
2020
2195
|
body,
|
|
2021
2196
|
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:
|
|
2197
|
+
successfulResponseHandler: (0, import_provider_utils9.createJsonResponseHandler)(
|
|
2198
|
+
import_zod7.z.object({
|
|
2199
|
+
id: import_zod7.z.string(),
|
|
2200
|
+
created_at: import_zod7.z.number(),
|
|
2201
|
+
model: import_zod7.z.string(),
|
|
2202
|
+
output: import_zod7.z.array(
|
|
2203
|
+
import_zod7.z.discriminatedUnion("type", [
|
|
2204
|
+
import_zod7.z.object({
|
|
2205
|
+
type: import_zod7.z.literal("message"),
|
|
2206
|
+
role: import_zod7.z.literal("assistant"),
|
|
2207
|
+
content: import_zod7.z.array(
|
|
2208
|
+
import_zod7.z.object({
|
|
2209
|
+
type: import_zod7.z.literal("output_text"),
|
|
2210
|
+
text: import_zod7.z.string(),
|
|
2211
|
+
annotations: import_zod7.z.array(
|
|
2212
|
+
import_zod7.z.object({
|
|
2213
|
+
type: import_zod7.z.literal("url_citation"),
|
|
2214
|
+
start_index: import_zod7.z.number(),
|
|
2215
|
+
end_index: import_zod7.z.number(),
|
|
2216
|
+
url: import_zod7.z.string(),
|
|
2217
|
+
title: import_zod7.z.string()
|
|
2043
2218
|
})
|
|
2044
2219
|
)
|
|
2045
2220
|
})
|
|
2046
2221
|
)
|
|
2047
2222
|
}),
|
|
2048
|
-
|
|
2049
|
-
type:
|
|
2050
|
-
call_id:
|
|
2051
|
-
name:
|
|
2052
|
-
arguments:
|
|
2223
|
+
import_zod7.z.object({
|
|
2224
|
+
type: import_zod7.z.literal("function_call"),
|
|
2225
|
+
call_id: import_zod7.z.string(),
|
|
2226
|
+
name: import_zod7.z.string(),
|
|
2227
|
+
arguments: import_zod7.z.string()
|
|
2053
2228
|
}),
|
|
2054
|
-
|
|
2055
|
-
type:
|
|
2229
|
+
import_zod7.z.object({
|
|
2230
|
+
type: import_zod7.z.literal("web_search_call")
|
|
2056
2231
|
}),
|
|
2057
|
-
|
|
2058
|
-
type:
|
|
2232
|
+
import_zod7.z.object({
|
|
2233
|
+
type: import_zod7.z.literal("computer_call")
|
|
2059
2234
|
}),
|
|
2060
|
-
|
|
2061
|
-
type:
|
|
2235
|
+
import_zod7.z.object({
|
|
2236
|
+
type: import_zod7.z.literal("reasoning")
|
|
2062
2237
|
})
|
|
2063
2238
|
])
|
|
2064
2239
|
),
|
|
2065
|
-
incomplete_details:
|
|
2240
|
+
incomplete_details: import_zod7.z.object({ reason: import_zod7.z.string() }).nullable(),
|
|
2066
2241
|
usage: usageSchema
|
|
2067
2242
|
})
|
|
2068
2243
|
),
|
|
@@ -2083,7 +2258,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2083
2258
|
var _a2, _b2, _c2;
|
|
2084
2259
|
return {
|
|
2085
2260
|
sourceType: "url",
|
|
2086
|
-
id: (_c2 = (_b2 = (_a2 = this.config).generateId) == null ? void 0 : _b2.call(_a2)) != null ? _c2 : (0,
|
|
2261
|
+
id: (_c2 = (_b2 = (_a2 = this.config).generateId) == null ? void 0 : _b2.call(_a2)) != null ? _c2 : (0, import_provider_utils9.generateId)(),
|
|
2087
2262
|
url: annotation.url,
|
|
2088
2263
|
title: annotation.title
|
|
2089
2264
|
};
|
|
@@ -2126,18 +2301,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2126
2301
|
}
|
|
2127
2302
|
async doStream(options) {
|
|
2128
2303
|
const { args: body, warnings } = this.getArgs(options);
|
|
2129
|
-
const { responseHeaders, value: response } = await (0,
|
|
2304
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils9.postJsonToApi)({
|
|
2130
2305
|
url: this.config.url({
|
|
2131
2306
|
path: "/responses",
|
|
2132
2307
|
modelId: this.modelId
|
|
2133
2308
|
}),
|
|
2134
|
-
headers: (0,
|
|
2309
|
+
headers: (0, import_provider_utils9.combineHeaders)(this.config.headers(), options.headers),
|
|
2135
2310
|
body: {
|
|
2136
2311
|
...body,
|
|
2137
2312
|
stream: true
|
|
2138
2313
|
},
|
|
2139
2314
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2140
|
-
successfulResponseHandler: (0,
|
|
2315
|
+
successfulResponseHandler: (0, import_provider_utils9.createEventSourceResponseHandler)(
|
|
2141
2316
|
openaiResponsesChunkSchema
|
|
2142
2317
|
),
|
|
2143
2318
|
abortSignal: options.abortSignal,
|
|
@@ -2225,7 +2400,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2225
2400
|
type: "source",
|
|
2226
2401
|
source: {
|
|
2227
2402
|
sourceType: "url",
|
|
2228
|
-
id: (_h = (_g = (_f = self.config).generateId) == null ? void 0 : _g.call(_f)) != null ? _h : (0,
|
|
2403
|
+
id: (_h = (_g = (_f = self.config).generateId) == null ? void 0 : _g.call(_f)) != null ? _h : (0, import_provider_utils9.generateId)(),
|
|
2229
2404
|
url: value.annotation.url,
|
|
2230
2405
|
title: value.annotation.title
|
|
2231
2406
|
}
|
|
@@ -2260,79 +2435,79 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2260
2435
|
};
|
|
2261
2436
|
}
|
|
2262
2437
|
};
|
|
2263
|
-
var usageSchema =
|
|
2264
|
-
input_tokens:
|
|
2265
|
-
input_tokens_details:
|
|
2266
|
-
output_tokens:
|
|
2267
|
-
output_tokens_details:
|
|
2438
|
+
var usageSchema = import_zod7.z.object({
|
|
2439
|
+
input_tokens: import_zod7.z.number(),
|
|
2440
|
+
input_tokens_details: import_zod7.z.object({ cached_tokens: import_zod7.z.number().nullish() }).nullish(),
|
|
2441
|
+
output_tokens: import_zod7.z.number(),
|
|
2442
|
+
output_tokens_details: import_zod7.z.object({ reasoning_tokens: import_zod7.z.number().nullish() }).nullish()
|
|
2268
2443
|
});
|
|
2269
|
-
var textDeltaChunkSchema =
|
|
2270
|
-
type:
|
|
2271
|
-
delta:
|
|
2444
|
+
var textDeltaChunkSchema = import_zod7.z.object({
|
|
2445
|
+
type: import_zod7.z.literal("response.output_text.delta"),
|
|
2446
|
+
delta: import_zod7.z.string()
|
|
2272
2447
|
});
|
|
2273
|
-
var responseFinishedChunkSchema =
|
|
2274
|
-
type:
|
|
2275
|
-
response:
|
|
2276
|
-
incomplete_details:
|
|
2448
|
+
var responseFinishedChunkSchema = import_zod7.z.object({
|
|
2449
|
+
type: import_zod7.z.enum(["response.completed", "response.incomplete"]),
|
|
2450
|
+
response: import_zod7.z.object({
|
|
2451
|
+
incomplete_details: import_zod7.z.object({ reason: import_zod7.z.string() }).nullish(),
|
|
2277
2452
|
usage: usageSchema
|
|
2278
2453
|
})
|
|
2279
2454
|
});
|
|
2280
|
-
var responseCreatedChunkSchema =
|
|
2281
|
-
type:
|
|
2282
|
-
response:
|
|
2283
|
-
id:
|
|
2284
|
-
created_at:
|
|
2285
|
-
model:
|
|
2455
|
+
var responseCreatedChunkSchema = import_zod7.z.object({
|
|
2456
|
+
type: import_zod7.z.literal("response.created"),
|
|
2457
|
+
response: import_zod7.z.object({
|
|
2458
|
+
id: import_zod7.z.string(),
|
|
2459
|
+
created_at: import_zod7.z.number(),
|
|
2460
|
+
model: import_zod7.z.string()
|
|
2286
2461
|
})
|
|
2287
2462
|
});
|
|
2288
|
-
var responseOutputItemDoneSchema =
|
|
2289
|
-
type:
|
|
2290
|
-
output_index:
|
|
2291
|
-
item:
|
|
2292
|
-
|
|
2293
|
-
type:
|
|
2463
|
+
var responseOutputItemDoneSchema = import_zod7.z.object({
|
|
2464
|
+
type: import_zod7.z.literal("response.output_item.done"),
|
|
2465
|
+
output_index: import_zod7.z.number(),
|
|
2466
|
+
item: import_zod7.z.discriminatedUnion("type", [
|
|
2467
|
+
import_zod7.z.object({
|
|
2468
|
+
type: import_zod7.z.literal("message")
|
|
2294
2469
|
}),
|
|
2295
|
-
|
|
2296
|
-
type:
|
|
2297
|
-
id:
|
|
2298
|
-
call_id:
|
|
2299
|
-
name:
|
|
2300
|
-
arguments:
|
|
2301
|
-
status:
|
|
2470
|
+
import_zod7.z.object({
|
|
2471
|
+
type: import_zod7.z.literal("function_call"),
|
|
2472
|
+
id: import_zod7.z.string(),
|
|
2473
|
+
call_id: import_zod7.z.string(),
|
|
2474
|
+
name: import_zod7.z.string(),
|
|
2475
|
+
arguments: import_zod7.z.string(),
|
|
2476
|
+
status: import_zod7.z.literal("completed")
|
|
2302
2477
|
})
|
|
2303
2478
|
])
|
|
2304
2479
|
});
|
|
2305
|
-
var responseFunctionCallArgumentsDeltaSchema =
|
|
2306
|
-
type:
|
|
2307
|
-
item_id:
|
|
2308
|
-
output_index:
|
|
2309
|
-
delta:
|
|
2480
|
+
var responseFunctionCallArgumentsDeltaSchema = import_zod7.z.object({
|
|
2481
|
+
type: import_zod7.z.literal("response.function_call_arguments.delta"),
|
|
2482
|
+
item_id: import_zod7.z.string(),
|
|
2483
|
+
output_index: import_zod7.z.number(),
|
|
2484
|
+
delta: import_zod7.z.string()
|
|
2310
2485
|
});
|
|
2311
|
-
var responseOutputItemAddedSchema =
|
|
2312
|
-
type:
|
|
2313
|
-
output_index:
|
|
2314
|
-
item:
|
|
2315
|
-
|
|
2316
|
-
type:
|
|
2486
|
+
var responseOutputItemAddedSchema = import_zod7.z.object({
|
|
2487
|
+
type: import_zod7.z.literal("response.output_item.added"),
|
|
2488
|
+
output_index: import_zod7.z.number(),
|
|
2489
|
+
item: import_zod7.z.discriminatedUnion("type", [
|
|
2490
|
+
import_zod7.z.object({
|
|
2491
|
+
type: import_zod7.z.literal("message")
|
|
2317
2492
|
}),
|
|
2318
|
-
|
|
2319
|
-
type:
|
|
2320
|
-
id:
|
|
2321
|
-
call_id:
|
|
2322
|
-
name:
|
|
2323
|
-
arguments:
|
|
2493
|
+
import_zod7.z.object({
|
|
2494
|
+
type: import_zod7.z.literal("function_call"),
|
|
2495
|
+
id: import_zod7.z.string(),
|
|
2496
|
+
call_id: import_zod7.z.string(),
|
|
2497
|
+
name: import_zod7.z.string(),
|
|
2498
|
+
arguments: import_zod7.z.string()
|
|
2324
2499
|
})
|
|
2325
2500
|
])
|
|
2326
2501
|
});
|
|
2327
|
-
var responseAnnotationAddedSchema =
|
|
2328
|
-
type:
|
|
2329
|
-
annotation:
|
|
2330
|
-
type:
|
|
2331
|
-
url:
|
|
2332
|
-
title:
|
|
2502
|
+
var responseAnnotationAddedSchema = import_zod7.z.object({
|
|
2503
|
+
type: import_zod7.z.literal("response.output_text.annotation.added"),
|
|
2504
|
+
annotation: import_zod7.z.object({
|
|
2505
|
+
type: import_zod7.z.literal("url_citation"),
|
|
2506
|
+
url: import_zod7.z.string(),
|
|
2507
|
+
title: import_zod7.z.string()
|
|
2333
2508
|
})
|
|
2334
2509
|
});
|
|
2335
|
-
var openaiResponsesChunkSchema =
|
|
2510
|
+
var openaiResponsesChunkSchema = import_zod7.z.union([
|
|
2336
2511
|
textDeltaChunkSchema,
|
|
2337
2512
|
responseFinishedChunkSchema,
|
|
2338
2513
|
responseCreatedChunkSchema,
|
|
@@ -2340,7 +2515,7 @@ var openaiResponsesChunkSchema = import_zod6.z.union([
|
|
|
2340
2515
|
responseFunctionCallArgumentsDeltaSchema,
|
|
2341
2516
|
responseOutputItemAddedSchema,
|
|
2342
2517
|
responseAnnotationAddedSchema,
|
|
2343
|
-
|
|
2518
|
+
import_zod7.z.object({ type: import_zod7.z.string() }).passthrough()
|
|
2344
2519
|
// fallback for unknown chunks
|
|
2345
2520
|
]);
|
|
2346
2521
|
function isTextDeltaChunk(chunk) {
|
|
@@ -2385,15 +2560,15 @@ function getResponsesModelConfig(modelId) {
|
|
|
2385
2560
|
requiredAutoTruncation: false
|
|
2386
2561
|
};
|
|
2387
2562
|
}
|
|
2388
|
-
var openaiResponsesProviderOptionsSchema =
|
|
2389
|
-
metadata:
|
|
2390
|
-
parallelToolCalls:
|
|
2391
|
-
previousResponseId:
|
|
2392
|
-
store:
|
|
2393
|
-
user:
|
|
2394
|
-
reasoningEffort:
|
|
2395
|
-
strictSchemas:
|
|
2396
|
-
instructions:
|
|
2563
|
+
var openaiResponsesProviderOptionsSchema = import_zod7.z.object({
|
|
2564
|
+
metadata: import_zod7.z.any().nullish(),
|
|
2565
|
+
parallelToolCalls: import_zod7.z.boolean().nullish(),
|
|
2566
|
+
previousResponseId: import_zod7.z.string().nullish(),
|
|
2567
|
+
store: import_zod7.z.boolean().nullish(),
|
|
2568
|
+
user: import_zod7.z.string().nullish(),
|
|
2569
|
+
reasoningEffort: import_zod7.z.string().nullish(),
|
|
2570
|
+
strictSchemas: import_zod7.z.boolean().nullish(),
|
|
2571
|
+
instructions: import_zod7.z.string().nullish()
|
|
2397
2572
|
});
|
|
2398
2573
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2399
2574
|
0 && (module.exports = {
|
|
@@ -2402,6 +2577,7 @@ var openaiResponsesProviderOptionsSchema = import_zod6.z.object({
|
|
|
2402
2577
|
OpenAIEmbeddingModel,
|
|
2403
2578
|
OpenAIImageModel,
|
|
2404
2579
|
OpenAIResponsesLanguageModel,
|
|
2580
|
+
OpenAITranscriptionModel,
|
|
2405
2581
|
modelMaxImagesPerCall
|
|
2406
2582
|
});
|
|
2407
2583
|
//# sourceMappingURL=index.js.map
|