drizzle-cube 0.4.30 → 0.4.32
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/dist/adapters/express/index.cjs +1 -1
- package/dist/adapters/express/index.d.ts +1 -1
- package/dist/adapters/express/index.js +7 -7
- package/dist/adapters/fastify/index.cjs +1 -1
- package/dist/adapters/fastify/index.d.ts +1 -1
- package/dist/adapters/fastify/index.js +7 -7
- package/dist/adapters/{handler-B8vuFQYP.cjs → handler-ClgB__a-.cjs} +2 -2
- package/dist/adapters/{handler-D-2-6uLM.js → handler-rPpxuopb.js} +4 -4
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.d.ts +1 -1
- package/dist/adapters/hono/index.js +3 -3
- package/dist/adapters/mcp-transport-DPpei63d.cjs +255 -0
- package/dist/adapters/{mcp-transport-CuugoG8t.js → mcp-transport-DWSNkwUY.js} +1588 -962
- package/dist/adapters/nextjs/index.cjs +1 -1
- package/dist/adapters/nextjs/index.d.ts +1 -1
- package/dist/adapters/nextjs/index.js +3 -3
- package/dist/adapters/{openai-DhLE0A9Z.cjs → openai-Bc8qwEKW.cjs} +1 -1
- package/dist/adapters/openai-C96O8M75.cjs +16 -0
- package/dist/adapters/{openai-CjBvA6mK.js → openai-Ckpe7iU7.js} +659 -637
- package/dist/adapters/{openai-Zjw4Zo4R.js → openai-DxeVtl8X.js} +1 -1
- package/dist/adapters/{utils-ChhNGUOF.js → utils-B7VkyzMv.js} +7 -3
- package/dist/adapters/{utils-CwJplXR5.cjs → utils-BLFzzCI9.cjs} +1 -1
- package/dist/adapters/utils.cjs +1 -1
- package/dist/adapters/utils.d.ts +1 -1
- package/dist/adapters/utils.js +1 -1
- package/dist/client/charts.js +13 -13
- package/dist/client/chunks/{DashboardEditModal-C076pscL.js → DashboardEditModal-DenRJiYr.js} +11 -11
- package/dist/client/chunks/{DashboardEditModal-C076pscL.js.map → DashboardEditModal-DenRJiYr.js.map} +1 -1
- package/dist/client/chunks/{FieldSearchModal-C0DjSWk3.js → FieldSearchModal-BQS1v1up.js} +3 -3
- package/dist/client/chunks/{FieldSearchModal-C0DjSWk3.js.map → FieldSearchModal-BQS1v1up.js.map} +1 -1
- package/dist/client/chunks/{RetentionCombinedChart-DuGXc-AP.js → RetentionCombinedChart-D4Yf1TnQ.js} +3 -3
- package/dist/client/chunks/{RetentionCombinedChart-DuGXc-AP.js.map → RetentionCombinedChart-D4Yf1TnQ.js.map} +1 -1
- package/dist/client/chunks/{analysis-builder-DF0XntqC.js → analysis-builder-DG38V1gO.js} +14 -20
- package/dist/client/chunks/{analysis-builder-DF0XntqC.js.map → analysis-builder-DG38V1gO.js.map} +1 -1
- package/dist/client/chunks/{analysis-builder-shared-2QhKYbs6.js → analysis-builder-shared-DaFu78dk.js} +19 -17
- package/dist/client/chunks/analysis-builder-shared-DaFu78dk.js.map +1 -0
- package/dist/client/chunks/{chart-activity-grid-CNES9VBk.js → chart-activity-grid-wR2Twpo7.js} +9 -6
- package/dist/client/chunks/chart-activity-grid-wR2Twpo7.js.map +1 -0
- package/dist/client/chunks/{chart-area-CRJc3KOu.js → chart-area-e9ysnatQ.js} +2 -2
- package/dist/client/chunks/{chart-area-CRJc3KOu.js.map → chart-area-e9ysnatQ.js.map} +1 -1
- package/dist/client/chunks/{chart-bar-DD2PjJ5n.js → chart-bar-Bx4oKlqo.js} +3 -3
- package/dist/client/chunks/{chart-bar-DD2PjJ5n.js.map → chart-bar-Bx4oKlqo.js.map} +1 -1
- package/dist/client/chunks/{chart-box-plot-BcqleldJ.js → chart-box-plot-CVIi1aM5.js} +2 -2
- package/dist/client/chunks/{chart-box-plot-BcqleldJ.js.map → chart-box-plot-CVIi1aM5.js.map} +1 -1
- package/dist/client/chunks/{chart-bubble-BmQkVk4K.js → chart-bubble-DvyG15UB.js} +2 -2
- package/dist/client/chunks/{chart-bubble-BmQkVk4K.js.map → chart-bubble-DvyG15UB.js.map} +1 -1
- package/dist/client/chunks/{chart-candlestick-C3Rep469.js → chart-candlestick-caHyxB9O.js} +2 -2
- package/dist/client/chunks/{chart-candlestick-C3Rep469.js.map → chart-candlestick-caHyxB9O.js.map} +1 -1
- package/dist/client/chunks/{chart-data-table-DehW1C1G.js → chart-data-table-B2m_6EZe.js} +2 -2
- package/dist/client/chunks/{chart-data-table-DehW1C1G.js.map → chart-data-table-B2m_6EZe.js.map} +1 -1
- package/dist/client/chunks/{chart-funnel-BjkpnG5g.js → chart-funnel-C9JRW79j.js} +2 -2
- package/dist/client/chunks/{chart-funnel-BjkpnG5g.js.map → chart-funnel-C9JRW79j.js.map} +1 -1
- package/dist/client/chunks/{chart-gauge-BWW_HEfg.js → chart-gauge-BLLJqeXo.js} +2 -2
- package/dist/client/chunks/{chart-gauge-BWW_HEfg.js.map → chart-gauge-BLLJqeXo.js.map} +1 -1
- package/dist/client/chunks/{chart-heat-map-BWuOuDcm.js → chart-heat-map-f2fM2mDC.js} +2 -2
- package/dist/client/chunks/{chart-heat-map-BWuOuDcm.js.map → chart-heat-map-f2fM2mDC.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-delta-D5OHtDJx.js → chart-kpi-delta-S6qDEoJO.js} +3 -3
- package/dist/client/chunks/{chart-kpi-delta-D5OHtDJx.js.map → chart-kpi-delta-S6qDEoJO.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-number-C9zH-aKC.js → chart-kpi-number-CEUBsVW2.js} +5 -5
- package/dist/client/chunks/{chart-kpi-number-C9zH-aKC.js.map → chart-kpi-number-CEUBsVW2.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-text-ChVn3S7j.js → chart-kpi-text-DgRig_jQ.js} +3 -3
- package/dist/client/chunks/{chart-kpi-text-ChVn3S7j.js.map → chart-kpi-text-DgRig_jQ.js.map} +1 -1
- package/dist/client/chunks/{chart-line-DOIMkP0b.js → chart-line-CPhQRMZ7.js} +4 -3
- package/dist/client/chunks/chart-line-CPhQRMZ7.js.map +1 -0
- package/dist/client/chunks/{chart-measure-profile-C6wrr9il.js → chart-measure-profile-CVlqGslU.js} +3 -3
- package/dist/client/chunks/{chart-measure-profile-C6wrr9il.js.map → chart-measure-profile-CVlqGslU.js.map} +1 -1
- package/dist/client/chunks/{chart-pie-BU_FgwDc.js → chart-pie-DafSc9sE.js} +3 -3
- package/dist/client/chunks/{chart-pie-BU_FgwDc.js.map → chart-pie-DafSc9sE.js.map} +1 -1
- package/dist/client/chunks/{chart-radar-DlufwnAX.js → chart-radar-Dz9F5k-B.js} +3 -3
- package/dist/client/chunks/{chart-radar-DlufwnAX.js.map → chart-radar-Dz9F5k-B.js.map} +1 -1
- package/dist/client/chunks/{chart-radial-bar-B5vS_Aw5.js → chart-radial-bar-N3MNUL7o.js} +3 -3
- package/dist/client/chunks/{chart-radial-bar-B5vS_Aw5.js.map → chart-radial-bar-N3MNUL7o.js.map} +1 -1
- package/dist/client/chunks/{chart-sankey-FChb26UX.js → chart-sankey-8nRYnupt.js} +2 -2
- package/dist/client/chunks/{chart-sankey-FChb26UX.js.map → chart-sankey-8nRYnupt.js.map} +1 -1
- package/dist/client/chunks/{chart-scatter-DW0cAZ2H.js → chart-scatter-J2JNi88S.js} +3 -3
- package/dist/client/chunks/{chart-scatter-DW0cAZ2H.js.map → chart-scatter-J2JNi88S.js.map} +1 -1
- package/dist/client/chunks/{chart-sunburst-Clf-6WxW.js → chart-sunburst-D1NFQjqk.js} +3 -3
- package/dist/client/chunks/{chart-sunburst-Clf-6WxW.js.map → chart-sunburst-D1NFQjqk.js.map} +1 -1
- package/dist/client/chunks/{chart-tree-map-p_VwUJPF.js → chart-tree-map-CbYjko2s.js} +3 -3
- package/dist/client/chunks/{chart-tree-map-p_VwUJPF.js.map → chart-tree-map-CbYjko2s.js.map} +1 -1
- package/dist/client/chunks/{chart-waterfall-jt44IQ-w.js → chart-waterfall-Z65TGMUO.js} +3 -3
- package/dist/client/chunks/{chart-waterfall-jt44IQ-w.js.map → chart-waterfall-Z65TGMUO.js.map} +1 -1
- package/dist/client/chunks/{charts-core-CUVzf4cV.js → charts-core-CJlGzwsW.js} +2 -2
- package/dist/client/chunks/{charts-core-CUVzf4cV.js.map → charts-core-CJlGzwsW.js.map} +1 -1
- package/dist/client/chunks/{charts-loader-AGpph8_I.js → charts-loader-BI07yxaQ.js} +25 -25
- package/dist/client/chunks/{charts-loader-AGpph8_I.js.map → charts-loader-BI07yxaQ.js.map} +1 -1
- package/dist/client/chunks/{schema-visualization-ZugB4Io9.js → schema-visualization-DPL5_Tkh.js} +2 -2
- package/dist/client/chunks/{schema-visualization-ZugB4Io9.js.map → schema-visualization-DPL5_Tkh.js.map} +1 -1
- package/dist/client/chunks/{useDebounce-BQjNWndQ.js → useDebounce-DkuM7nQk.js} +4 -4
- package/dist/client/chunks/{useDebounce-BQjNWndQ.js.map → useDebounce-DkuM7nQk.js.map} +1 -1
- package/dist/client/chunks/{useExplainAI-c_bHxZe5.js → useExplainAI-RflLTDVL.js} +7 -7
- package/dist/client/chunks/useExplainAI-RflLTDVL.js.map +1 -0
- package/dist/client/chunks/{utils-A54Ny29G.js → utils--32ZtfbZ.js} +2 -2
- package/dist/client/chunks/{utils-A54Ny29G.js.map → utils--32ZtfbZ.js.map} +1 -1
- package/dist/client/chunks/{vendor-CoPBRumI.js → vendor-CZX7UVzM.js} +2 -2
- package/dist/client/chunks/{vendor-CoPBRumI.js.map → vendor-CZX7UVzM.js.map} +1 -1
- package/dist/client/components/AnalysisBuilder/AnalysisModeErrorBoundary.d.ts +0 -1
- package/dist/client/components.js +3 -3
- package/dist/client/hooks.js +3 -3
- package/dist/client/icons.js +1 -1
- package/dist/client/index.js +15 -15
- package/dist/client/providers.js +1 -1
- package/dist/client/utils.js +5 -5
- package/dist/client-bundle-stats.html +1 -1
- package/dist/server/index.cjs +42 -40
- package/dist/server/index.d.ts +77 -9
- package/dist/server/index.js +1868 -1238
- package/dist/server/{openai-CLsoLaue.cjs → openai-0HbLlZq6.cjs} +1 -1
- package/dist/server/openai-DKpZPCay.cjs +16 -0
- package/dist/server/{openai-D1kZ5sdM.js → openai-DnGeU9PT.js} +1 -1
- package/dist/server/{openai-BPhmb8mi.js → openai-DqCEogm0.js} +659 -637
- package/package.json +24 -4
- package/dist/adapters/mcp-transport-Dpp6hdZe.cjs +0 -253
- package/dist/adapters/openai-eJBw3LfQ.cjs +0 -16
- package/dist/client/chunks/analysis-builder-shared-2QhKYbs6.js.map +0 -1
- package/dist/client/chunks/chart-activity-grid-CNES9VBk.js.map +0 -1
- package/dist/client/chunks/chart-line-DOIMkP0b.js.map +0 -1
- package/dist/client/chunks/useExplainAI-c_bHxZe5.js.map +0 -1
- package/dist/server/openai-DkOKbVLC.cjs +0 -16
|
@@ -83,44 +83,44 @@ var i = (e) => {
|
|
|
83
83
|
function C(e) {
|
|
84
84
|
return typeof e == "object" ? e ?? {} : {};
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function w(e) {
|
|
87
87
|
if (!e) return !0;
|
|
88
88
|
for (let t in e) return !1;
|
|
89
89
|
return !0;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function ne(e, t) {
|
|
92
92
|
return Object.prototype.hasOwnProperty.call(e, t);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function T(e) {
|
|
95
95
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
96
96
|
}
|
|
97
|
-
var
|
|
97
|
+
var re = (e, t) => {
|
|
98
98
|
if (typeof t != "number" || !Number.isInteger(t)) throw new a(`${e} must be an integer`);
|
|
99
99
|
if (t < 0) throw new a(`${e} must be a positive integer`);
|
|
100
100
|
return t;
|
|
101
|
-
},
|
|
101
|
+
}, ie = (e) => {
|
|
102
102
|
try {
|
|
103
103
|
return JSON.parse(e);
|
|
104
104
|
} catch {
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
|
-
},
|
|
108
|
-
function
|
|
107
|
+
}, ae = (e) => new Promise((t) => setTimeout(t, e)), oe = "6.32.0", se = () => typeof window < "u" && window.document !== void 0 && typeof navigator < "u";
|
|
108
|
+
function ce() {
|
|
109
109
|
return typeof Deno < "u" && Deno.build != null ? "deno" : typeof EdgeRuntime < "u" ? "edge" : Object.prototype.toString.call(globalThis.process === void 0 ? 0 : globalThis.process) === "[object process]" ? "node" : "unknown";
|
|
110
110
|
}
|
|
111
|
-
var
|
|
112
|
-
let e =
|
|
111
|
+
var le = () => {
|
|
112
|
+
let e = ce();
|
|
113
113
|
if (e === "deno") return {
|
|
114
114
|
"X-Stainless-Lang": "js",
|
|
115
|
-
"X-Stainless-Package-Version":
|
|
116
|
-
"X-Stainless-OS":
|
|
117
|
-
"X-Stainless-Arch":
|
|
115
|
+
"X-Stainless-Package-Version": oe,
|
|
116
|
+
"X-Stainless-OS": fe(Deno.build.os),
|
|
117
|
+
"X-Stainless-Arch": de(Deno.build.arch),
|
|
118
118
|
"X-Stainless-Runtime": "deno",
|
|
119
119
|
"X-Stainless-Runtime-Version": typeof Deno.version == "string" ? Deno.version : Deno.version?.deno ?? "unknown"
|
|
120
120
|
};
|
|
121
121
|
if (typeof EdgeRuntime < "u") return {
|
|
122
122
|
"X-Stainless-Lang": "js",
|
|
123
|
-
"X-Stainless-Package-Version":
|
|
123
|
+
"X-Stainless-Package-Version": oe,
|
|
124
124
|
"X-Stainless-OS": "Unknown",
|
|
125
125
|
"X-Stainless-Arch": `other:${EdgeRuntime}`,
|
|
126
126
|
"X-Stainless-Runtime": "edge",
|
|
@@ -128,30 +128,30 @@ var ue = () => {
|
|
|
128
128
|
};
|
|
129
129
|
if (e === "node") return {
|
|
130
130
|
"X-Stainless-Lang": "js",
|
|
131
|
-
"X-Stainless-Package-Version":
|
|
132
|
-
"X-Stainless-OS":
|
|
133
|
-
"X-Stainless-Arch":
|
|
131
|
+
"X-Stainless-Package-Version": oe,
|
|
132
|
+
"X-Stainless-OS": fe(globalThis.process.platform ?? "unknown"),
|
|
133
|
+
"X-Stainless-Arch": de(globalThis.process.arch ?? "unknown"),
|
|
134
134
|
"X-Stainless-Runtime": "node",
|
|
135
135
|
"X-Stainless-Runtime-Version": globalThis.process.version ?? "unknown"
|
|
136
136
|
};
|
|
137
|
-
let t =
|
|
137
|
+
let t = ue();
|
|
138
138
|
return t ? {
|
|
139
139
|
"X-Stainless-Lang": "js",
|
|
140
|
-
"X-Stainless-Package-Version":
|
|
140
|
+
"X-Stainless-Package-Version": oe,
|
|
141
141
|
"X-Stainless-OS": "Unknown",
|
|
142
142
|
"X-Stainless-Arch": "unknown",
|
|
143
143
|
"X-Stainless-Runtime": `browser:${t.browser}`,
|
|
144
144
|
"X-Stainless-Runtime-Version": t.version
|
|
145
145
|
} : {
|
|
146
146
|
"X-Stainless-Lang": "js",
|
|
147
|
-
"X-Stainless-Package-Version":
|
|
147
|
+
"X-Stainless-Package-Version": oe,
|
|
148
148
|
"X-Stainless-OS": "Unknown",
|
|
149
149
|
"X-Stainless-Arch": "unknown",
|
|
150
150
|
"X-Stainless-Runtime": "unknown",
|
|
151
151
|
"X-Stainless-Runtime-Version": "unknown"
|
|
152
152
|
};
|
|
153
153
|
};
|
|
154
|
-
function
|
|
154
|
+
function ue() {
|
|
155
155
|
if (typeof navigator > "u" || !navigator) return null;
|
|
156
156
|
for (let { key: e, pattern: t } of [
|
|
157
157
|
{
|
|
@@ -187,21 +187,21 @@ function de() {
|
|
|
187
187
|
}
|
|
188
188
|
return null;
|
|
189
189
|
}
|
|
190
|
-
var
|
|
190
|
+
var de = (e) => e === "x32" ? "x32" : e === "x86_64" || e === "x64" ? "x64" : e === "arm" ? "arm" : e === "aarch64" || e === "arm64" ? "arm64" : e ? `other:${e}` : "unknown", fe = (e) => (e = e.toLowerCase(), e.includes("ios") ? "iOS" : e === "android" ? "Android" : e === "darwin" ? "MacOS" : e === "win32" ? "Windows" : e === "freebsd" ? "FreeBSD" : e === "openbsd" ? "OpenBSD" : e === "linux" ? "Linux" : e ? `Other:${e}` : "Unknown"), pe, me = () => pe ??= le();
|
|
191
191
|
//#endregion
|
|
192
192
|
//#region node_modules/openai/internal/shims.mjs
|
|
193
|
-
function
|
|
193
|
+
function he() {
|
|
194
194
|
if (typeof fetch < "u") return fetch;
|
|
195
195
|
throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`");
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function ge(...e) {
|
|
198
198
|
let t = globalThis.ReadableStream;
|
|
199
199
|
if (t === void 0) throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");
|
|
200
200
|
return new t(...e);
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function _e(e) {
|
|
203
203
|
let t = Symbol.asyncIterator in e ? e[Symbol.asyncIterator]() : e[Symbol.iterator]();
|
|
204
|
-
return
|
|
204
|
+
return ge({
|
|
205
205
|
start() {},
|
|
206
206
|
async pull(e) {
|
|
207
207
|
let { done: n, value: r } = await t.next();
|
|
@@ -212,7 +212,7 @@ function ve(e) {
|
|
|
212
212
|
}
|
|
213
213
|
});
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function ve(e) {
|
|
216
216
|
if (e[Symbol.asyncIterator]) return e;
|
|
217
217
|
let t = e.getReader();
|
|
218
218
|
return {
|
|
@@ -236,7 +236,7 @@ function ye(e) {
|
|
|
236
236
|
}
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
|
-
async function
|
|
239
|
+
async function ye(e) {
|
|
240
240
|
if (typeof e != "object" || !e) return;
|
|
241
241
|
if (e[Symbol.asyncIterator]) {
|
|
242
242
|
await e[Symbol.asyncIterator]().return?.();
|
|
@@ -247,25 +247,25 @@ async function be(e) {
|
|
|
247
247
|
}
|
|
248
248
|
//#endregion
|
|
249
249
|
//#region node_modules/openai/internal/request-options.mjs
|
|
250
|
-
var
|
|
250
|
+
var be = ({ headers: e, body: t }) => ({
|
|
251
251
|
bodyHeaders: { "content-type": "application/json" },
|
|
252
252
|
body: JSON.stringify(t)
|
|
253
|
-
}),
|
|
253
|
+
}), xe = "RFC3986", Se = (e) => String(e), Ce = {
|
|
254
254
|
RFC1738: (e) => String(e).replace(/%20/g, "+"),
|
|
255
|
-
RFC3986:
|
|
256
|
-
},
|
|
255
|
+
RFC3986: Se
|
|
256
|
+
}, we = (e, t) => (we = Object.hasOwn ?? Function.prototype.call.bind(Object.prototype.hasOwnProperty), we(e, t)), E = /* @__PURE__ */ (() => {
|
|
257
257
|
let e = [];
|
|
258
258
|
for (let t = 0; t < 256; ++t) e.push("%" + ((t < 16 ? "0" : "") + t.toString(16)).toUpperCase());
|
|
259
259
|
return e;
|
|
260
|
-
})(),
|
|
260
|
+
})(), Te = 1024, Ee = (e, t, n, r, i) => {
|
|
261
261
|
if (e.length === 0) return e;
|
|
262
262
|
let a = e;
|
|
263
263
|
if (typeof e == "symbol" ? a = Symbol.prototype.toString.call(e) : typeof e != "string" && (a = String(e)), n === "iso-8859-1") return escape(a).replace(/%u[0-9a-f]{4}/gi, function(e) {
|
|
264
264
|
return "%26%23" + parseInt(e.slice(2), 16) + "%3B";
|
|
265
265
|
});
|
|
266
266
|
let o = "";
|
|
267
|
-
for (let e = 0; e < a.length; e +=
|
|
268
|
-
let t = a.length >=
|
|
267
|
+
for (let e = 0; e < a.length; e += Te) {
|
|
268
|
+
let t = a.length >= Te ? a.slice(e, e + Te) : a, n = [];
|
|
269
269
|
for (let e = 0; e < t.length; ++e) {
|
|
270
270
|
let r = t.charCodeAt(e);
|
|
271
271
|
if (r === 45 || r === 46 || r === 95 || r === 126 || r >= 48 && r <= 57 || r >= 65 && r <= 90 || r >= 97 && r <= 122 || i === "RFC1738" && (r === 40 || r === 41)) {
|
|
@@ -273,27 +273,27 @@ var xe = ({ headers: e, body: t }) => ({
|
|
|
273
273
|
continue;
|
|
274
274
|
}
|
|
275
275
|
if (r < 128) {
|
|
276
|
-
n[n.length] =
|
|
276
|
+
n[n.length] = E[r];
|
|
277
277
|
continue;
|
|
278
278
|
}
|
|
279
279
|
if (r < 2048) {
|
|
280
|
-
n[n.length] =
|
|
280
|
+
n[n.length] = E[192 | r >> 6] + E[128 | r & 63];
|
|
281
281
|
continue;
|
|
282
282
|
}
|
|
283
283
|
if (r < 55296 || r >= 57344) {
|
|
284
|
-
n[n.length] =
|
|
284
|
+
n[n.length] = E[224 | r >> 12] + E[128 | r >> 6 & 63] + E[128 | r & 63];
|
|
285
285
|
continue;
|
|
286
286
|
}
|
|
287
|
-
e += 1, r = 65536 + ((r & 1023) << 10 | t.charCodeAt(e) & 1023), n[n.length] =
|
|
287
|
+
e += 1, r = 65536 + ((r & 1023) << 10 | t.charCodeAt(e) & 1023), n[n.length] = E[240 | r >> 18] + E[128 | r >> 12 & 63] + E[128 | r >> 6 & 63] + E[128 | r & 63];
|
|
288
288
|
}
|
|
289
289
|
o += n.join("");
|
|
290
290
|
}
|
|
291
291
|
return o;
|
|
292
292
|
};
|
|
293
|
-
function
|
|
293
|
+
function De(e) {
|
|
294
294
|
return !e || typeof e != "object" ? !1 : !!(e.constructor && e.constructor.isBuffer && e.constructor.isBuffer(e));
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function Oe(e, t) {
|
|
297
297
|
if (x(e)) {
|
|
298
298
|
let n = [];
|
|
299
299
|
for (let r = 0; r < e.length; r += 1) n.push(t(e[r]));
|
|
@@ -303,7 +303,7 @@ function ke(e, t) {
|
|
|
303
303
|
}
|
|
304
304
|
//#endregion
|
|
305
305
|
//#region node_modules/openai/internal/qs/stringify.mjs
|
|
306
|
-
var
|
|
306
|
+
var ke = {
|
|
307
307
|
brackets(e) {
|
|
308
308
|
return String(e) + "[]";
|
|
309
309
|
},
|
|
@@ -314,9 +314,9 @@ var Ae = {
|
|
|
314
314
|
repeat(e) {
|
|
315
315
|
return String(e);
|
|
316
316
|
}
|
|
317
|
-
},
|
|
317
|
+
}, Ae = function(e, t) {
|
|
318
318
|
Array.prototype.push.apply(e, x(t) ? t : [t]);
|
|
319
|
-
},
|
|
319
|
+
}, je, D = {
|
|
320
320
|
addQueryPrefix: !1,
|
|
321
321
|
allowDots: !1,
|
|
322
322
|
allowEmptyArrays: !1,
|
|
@@ -326,173 +326,173 @@ var Ae = {
|
|
|
326
326
|
delimiter: "&",
|
|
327
327
|
encode: !0,
|
|
328
328
|
encodeDotInKeys: !1,
|
|
329
|
-
encoder:
|
|
329
|
+
encoder: Ee,
|
|
330
330
|
encodeValuesOnly: !1,
|
|
331
|
-
format:
|
|
332
|
-
formatter:
|
|
331
|
+
format: xe,
|
|
332
|
+
formatter: Se,
|
|
333
333
|
indices: !1,
|
|
334
334
|
serializeDate(e) {
|
|
335
|
-
return (
|
|
335
|
+
return (je ??= Function.prototype.call.bind(Date.prototype.toISOString))(e);
|
|
336
336
|
},
|
|
337
337
|
skipNulls: !1,
|
|
338
338
|
strictNullHandling: !1
|
|
339
339
|
};
|
|
340
|
-
function
|
|
340
|
+
function Me(e) {
|
|
341
341
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "symbol" || typeof e == "bigint";
|
|
342
342
|
}
|
|
343
|
-
var
|
|
344
|
-
function
|
|
343
|
+
var Ne = {};
|
|
344
|
+
function Pe(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, _) {
|
|
345
345
|
let v = e, y = _, b = 0, ee = !1;
|
|
346
|
-
for (; (y = y.get(
|
|
346
|
+
for (; (y = y.get(Ne)) !== void 0 && !ee;) {
|
|
347
347
|
let t = y.get(e);
|
|
348
348
|
if (b += 1, t !== void 0) {
|
|
349
349
|
if (t === b) throw RangeError("Cyclic object value");
|
|
350
350
|
ee = !0;
|
|
351
351
|
}
|
|
352
|
-
y.get(
|
|
352
|
+
y.get(Ne) === void 0 && (b = 0);
|
|
353
353
|
}
|
|
354
|
-
if (typeof l == "function" ? v = l(t, v) : v instanceof Date ? v = f?.(v) : n === "comma" && x(v) && (v =
|
|
354
|
+
if (typeof l == "function" ? v = l(t, v) : v instanceof Date ? v = f?.(v) : n === "comma" && x(v) && (v = Oe(v, function(e) {
|
|
355
355
|
return e instanceof Date ? f?.(e) : e;
|
|
356
356
|
})), v === null) {
|
|
357
|
-
if (a) return c && !h ? c(t,
|
|
357
|
+
if (a) return c && !h ? c(t, D.encoder, g, "key", p) : t;
|
|
358
358
|
v = "";
|
|
359
359
|
}
|
|
360
|
-
if (
|
|
360
|
+
if (Me(v) || De(v)) {
|
|
361
361
|
if (c) {
|
|
362
|
-
let e = h ? t : c(t,
|
|
363
|
-
return [m?.(e) + "=" + m?.(c(v,
|
|
362
|
+
let e = h ? t : c(t, D.encoder, g, "key", p);
|
|
363
|
+
return [m?.(e) + "=" + m?.(c(v, D.encoder, g, "value", p))];
|
|
364
364
|
}
|
|
365
365
|
return [m?.(t) + "=" + m?.(String(v))];
|
|
366
366
|
}
|
|
367
367
|
let te = [];
|
|
368
368
|
if (v === void 0) return te;
|
|
369
369
|
let S;
|
|
370
|
-
if (n === "comma" && x(v)) h && c && (v =
|
|
370
|
+
if (n === "comma" && x(v)) h && c && (v = Oe(v, c)), S = [{ value: v.length > 0 ? v.join(",") || null : void 0 }];
|
|
371
371
|
else if (x(l)) S = l;
|
|
372
372
|
else {
|
|
373
373
|
let e = Object.keys(v);
|
|
374
374
|
S = u ? e.sort(u) : e;
|
|
375
375
|
}
|
|
376
|
-
let C = s ? String(t).replace(/\./g, "%2E") : String(t),
|
|
377
|
-
if (i && x(v) && v.length === 0) return
|
|
376
|
+
let C = s ? String(t).replace(/\./g, "%2E") : String(t), w = r && x(v) && v.length === 1 ? C + "[]" : C;
|
|
377
|
+
if (i && x(v) && v.length === 0) return w + "[]";
|
|
378
378
|
for (let t = 0; t < S.length; ++t) {
|
|
379
379
|
let y = S[t], ee = typeof y == "object" && y.value !== void 0 ? y.value : v[y];
|
|
380
380
|
if (o && ee === null) continue;
|
|
381
|
-
let C = d && s ? y.replace(/\./g, "%2E") : y,
|
|
381
|
+
let C = d && s ? y.replace(/\./g, "%2E") : y, ne = x(v) ? typeof n == "function" ? n(w, C) : w : w + (d ? "." + C : "[" + C + "]");
|
|
382
382
|
_.set(e, b);
|
|
383
|
-
let
|
|
384
|
-
|
|
383
|
+
let T = /* @__PURE__ */ new WeakMap();
|
|
384
|
+
T.set(Ne, _), Ae(te, Pe(ee, ne, n, r, i, a, o, s, n === "comma" && h && x(v) ? null : c, l, u, d, f, p, m, h, g, T));
|
|
385
385
|
}
|
|
386
386
|
return te;
|
|
387
387
|
}
|
|
388
|
-
function
|
|
388
|
+
function Fe(e = D) {
|
|
389
389
|
if (e.allowEmptyArrays !== void 0 && typeof e.allowEmptyArrays != "boolean") throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
|
|
390
390
|
if (e.encodeDotInKeys !== void 0 && typeof e.encodeDotInKeys != "boolean") throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");
|
|
391
391
|
if (e.encoder !== null && e.encoder !== void 0 && typeof e.encoder != "function") throw TypeError("Encoder has to be a function.");
|
|
392
|
-
let t = e.charset ||
|
|
392
|
+
let t = e.charset || D.charset;
|
|
393
393
|
if (e.charset !== void 0 && e.charset !== "utf-8" && e.charset !== "iso-8859-1") throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
|
|
394
|
-
let n =
|
|
394
|
+
let n = xe;
|
|
395
395
|
if (e.format !== void 0) {
|
|
396
|
-
if (!
|
|
396
|
+
if (!we(Ce, e.format)) throw TypeError("Unknown format option provided.");
|
|
397
397
|
n = e.format;
|
|
398
398
|
}
|
|
399
|
-
let r =
|
|
399
|
+
let r = Ce[n], i = D.filter;
|
|
400
400
|
(typeof e.filter == "function" || x(e.filter)) && (i = e.filter);
|
|
401
401
|
let a;
|
|
402
|
-
if (a = e.arrayFormat && e.arrayFormat in
|
|
403
|
-
let o = e.allowDots === void 0 ? e.encodeDotInKeys ? !0 :
|
|
402
|
+
if (a = e.arrayFormat && e.arrayFormat in ke ? e.arrayFormat : "indices" in e ? e.indices ? "indices" : "repeat" : D.arrayFormat, "commaRoundTrip" in e && typeof e.commaRoundTrip != "boolean") throw TypeError("`commaRoundTrip` must be a boolean, or absent");
|
|
403
|
+
let o = e.allowDots === void 0 ? e.encodeDotInKeys ? !0 : D.allowDots : !!e.allowDots;
|
|
404
404
|
return {
|
|
405
|
-
addQueryPrefix: typeof e.addQueryPrefix == "boolean" ? e.addQueryPrefix :
|
|
405
|
+
addQueryPrefix: typeof e.addQueryPrefix == "boolean" ? e.addQueryPrefix : D.addQueryPrefix,
|
|
406
406
|
allowDots: o,
|
|
407
|
-
allowEmptyArrays: typeof e.allowEmptyArrays == "boolean" ? !!e.allowEmptyArrays :
|
|
407
|
+
allowEmptyArrays: typeof e.allowEmptyArrays == "boolean" ? !!e.allowEmptyArrays : D.allowEmptyArrays,
|
|
408
408
|
arrayFormat: a,
|
|
409
409
|
charset: t,
|
|
410
|
-
charsetSentinel: typeof e.charsetSentinel == "boolean" ? e.charsetSentinel :
|
|
410
|
+
charsetSentinel: typeof e.charsetSentinel == "boolean" ? e.charsetSentinel : D.charsetSentinel,
|
|
411
411
|
commaRoundTrip: !!e.commaRoundTrip,
|
|
412
|
-
delimiter: e.delimiter === void 0 ?
|
|
413
|
-
encode: typeof e.encode == "boolean" ? e.encode :
|
|
414
|
-
encodeDotInKeys: typeof e.encodeDotInKeys == "boolean" ? e.encodeDotInKeys :
|
|
415
|
-
encoder: typeof e.encoder == "function" ? e.encoder :
|
|
416
|
-
encodeValuesOnly: typeof e.encodeValuesOnly == "boolean" ? e.encodeValuesOnly :
|
|
412
|
+
delimiter: e.delimiter === void 0 ? D.delimiter : e.delimiter,
|
|
413
|
+
encode: typeof e.encode == "boolean" ? e.encode : D.encode,
|
|
414
|
+
encodeDotInKeys: typeof e.encodeDotInKeys == "boolean" ? e.encodeDotInKeys : D.encodeDotInKeys,
|
|
415
|
+
encoder: typeof e.encoder == "function" ? e.encoder : D.encoder,
|
|
416
|
+
encodeValuesOnly: typeof e.encodeValuesOnly == "boolean" ? e.encodeValuesOnly : D.encodeValuesOnly,
|
|
417
417
|
filter: i,
|
|
418
418
|
format: n,
|
|
419
419
|
formatter: r,
|
|
420
|
-
serializeDate: typeof e.serializeDate == "function" ? e.serializeDate :
|
|
421
|
-
skipNulls: typeof e.skipNulls == "boolean" ? e.skipNulls :
|
|
420
|
+
serializeDate: typeof e.serializeDate == "function" ? e.serializeDate : D.serializeDate,
|
|
421
|
+
skipNulls: typeof e.skipNulls == "boolean" ? e.skipNulls : D.skipNulls,
|
|
422
422
|
sort: typeof e.sort == "function" ? e.sort : null,
|
|
423
|
-
strictNullHandling: typeof e.strictNullHandling == "boolean" ? e.strictNullHandling :
|
|
423
|
+
strictNullHandling: typeof e.strictNullHandling == "boolean" ? e.strictNullHandling : D.strictNullHandling
|
|
424
424
|
};
|
|
425
425
|
}
|
|
426
|
-
function
|
|
427
|
-
let n = e, r =
|
|
426
|
+
function Ie(e, t = {}) {
|
|
427
|
+
let n = e, r = Fe(t), i, a;
|
|
428
428
|
typeof r.filter == "function" ? (a = r.filter, n = a("", n)) : x(r.filter) && (a = r.filter, i = a);
|
|
429
429
|
let o = [];
|
|
430
430
|
if (typeof n != "object" || !n) return "";
|
|
431
|
-
let s =
|
|
431
|
+
let s = ke[r.arrayFormat], c = s === "comma" && r.commaRoundTrip;
|
|
432
432
|
i ||= Object.keys(n), r.sort && i.sort(r.sort);
|
|
433
433
|
let l = /* @__PURE__ */ new WeakMap();
|
|
434
434
|
for (let e = 0; e < i.length; ++e) {
|
|
435
435
|
let t = i[e];
|
|
436
|
-
r.skipNulls && n[t] === null ||
|
|
436
|
+
r.skipNulls && n[t] === null || Ae(o, Pe(n[t], t, s, c, r.allowEmptyArrays, r.strictNullHandling, r.skipNulls, r.encodeDotInKeys, r.encode ? r.encoder : null, r.filter, r.sort, r.allowDots, r.serializeDate, r.format, r.formatter, r.encodeValuesOnly, r.charset, l));
|
|
437
437
|
}
|
|
438
438
|
let u = o.join(r.delimiter), d = r.addQueryPrefix === !0 ? "?" : "";
|
|
439
439
|
return r.charsetSentinel && (r.charset === "iso-8859-1" ? d += "utf8=%26%2310003%3B&" : d += "utf8=%E2%9C%93&"), u.length > 0 ? d + u : "";
|
|
440
440
|
}
|
|
441
441
|
//#endregion
|
|
442
442
|
//#region node_modules/openai/internal/utils/query.mjs
|
|
443
|
-
function
|
|
444
|
-
return
|
|
443
|
+
function Le(e) {
|
|
444
|
+
return Ie(e, { arrayFormat: "brackets" });
|
|
445
445
|
}
|
|
446
446
|
//#endregion
|
|
447
447
|
//#region node_modules/openai/internal/utils/bytes.mjs
|
|
448
|
-
function
|
|
448
|
+
function Re(e) {
|
|
449
449
|
let t = 0;
|
|
450
450
|
for (let n of e) t += n.length;
|
|
451
451
|
let n = new Uint8Array(t), r = 0;
|
|
452
452
|
for (let t of e) n.set(t, r), r += t.length;
|
|
453
453
|
return n;
|
|
454
454
|
}
|
|
455
|
-
var
|
|
456
|
-
function
|
|
455
|
+
var ze;
|
|
456
|
+
function Be(e) {
|
|
457
457
|
let t;
|
|
458
|
-
return (
|
|
458
|
+
return (ze ??= (t = new globalThis.TextEncoder(), t.encode.bind(t)))(e);
|
|
459
459
|
}
|
|
460
|
-
var
|
|
461
|
-
function
|
|
460
|
+
var Ve;
|
|
461
|
+
function He(e) {
|
|
462
462
|
let t;
|
|
463
|
-
return (
|
|
463
|
+
return (Ve ??= (t = new globalThis.TextDecoder(), t.decode.bind(t)))(e);
|
|
464
464
|
}
|
|
465
465
|
//#endregion
|
|
466
466
|
//#region node_modules/openai/internal/decoders/line.mjs
|
|
467
|
-
var
|
|
467
|
+
var O, k, Ue = class {
|
|
468
468
|
constructor() {
|
|
469
|
-
|
|
469
|
+
O.set(this, void 0), k.set(this, void 0), e(this, O, new Uint8Array(), "f"), e(this, k, null, "f");
|
|
470
470
|
}
|
|
471
471
|
decode(n) {
|
|
472
472
|
if (n == null) return [];
|
|
473
|
-
let r = n instanceof ArrayBuffer ? new Uint8Array(n) : typeof n == "string" ?
|
|
474
|
-
e(this,
|
|
473
|
+
let r = n instanceof ArrayBuffer ? new Uint8Array(n) : typeof n == "string" ? Be(n) : n;
|
|
474
|
+
e(this, O, Re([t(this, O, "f"), r]), "f");
|
|
475
475
|
let i = [], a;
|
|
476
|
-
for (; (a =
|
|
477
|
-
if (a.carriage && t(this,
|
|
478
|
-
e(this,
|
|
476
|
+
for (; (a = We(t(this, O, "f"), t(this, k, "f"))) != null;) {
|
|
477
|
+
if (a.carriage && t(this, k, "f") == null) {
|
|
478
|
+
e(this, k, a.index, "f");
|
|
479
479
|
continue;
|
|
480
480
|
}
|
|
481
|
-
if (t(this,
|
|
482
|
-
i.push(
|
|
481
|
+
if (t(this, k, "f") != null && (a.index !== t(this, k, "f") + 1 || a.carriage)) {
|
|
482
|
+
i.push(He(t(this, O, "f").subarray(0, t(this, k, "f") - 1))), e(this, O, t(this, O, "f").subarray(t(this, k, "f")), "f"), e(this, k, null, "f");
|
|
483
483
|
continue;
|
|
484
484
|
}
|
|
485
|
-
let n = t(this,
|
|
486
|
-
i.push(r), e(this,
|
|
485
|
+
let n = t(this, k, "f") === null ? a.preceding : a.preceding - 1, r = He(t(this, O, "f").subarray(0, n));
|
|
486
|
+
i.push(r), e(this, O, t(this, O, "f").subarray(a.index), "f"), e(this, k, null, "f");
|
|
487
487
|
}
|
|
488
488
|
return i;
|
|
489
489
|
}
|
|
490
490
|
flush() {
|
|
491
|
-
return t(this,
|
|
491
|
+
return t(this, O, "f").length ? this.decode("\n") : [];
|
|
492
492
|
}
|
|
493
493
|
};
|
|
494
|
-
|
|
495
|
-
function
|
|
494
|
+
O = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), Ue.NEWLINE_CHARS = new Set(["\n", "\r"]), Ue.NEWLINE_REGEXP = /\r\n|[\n\r]/g;
|
|
495
|
+
function We(e, t) {
|
|
496
496
|
for (let n = t ?? 0; n < e.length; n++) {
|
|
497
497
|
if (e[n] === 10) return {
|
|
498
498
|
preceding: n,
|
|
@@ -507,7 +507,7 @@ function Ge(e, t) {
|
|
|
507
507
|
}
|
|
508
508
|
return null;
|
|
509
509
|
}
|
|
510
|
-
function
|
|
510
|
+
function Ge(e) {
|
|
511
511
|
for (let t = 0; t < e.length - 1; t++) {
|
|
512
512
|
if (e[t] === 10 && e[t + 1] === 10 || e[t] === 13 && e[t + 1] === 13) return t + 2;
|
|
513
513
|
if (e[t] === 13 && e[t + 1] === 10 && t + 3 < e.length && e[t + 2] === 13 && e[t + 3] === 10) return t + 4;
|
|
@@ -516,53 +516,53 @@ function Ke(e) {
|
|
|
516
516
|
}
|
|
517
517
|
//#endregion
|
|
518
518
|
//#region node_modules/openai/internal/utils/log.mjs
|
|
519
|
-
var
|
|
519
|
+
var Ke = {
|
|
520
520
|
off: 0,
|
|
521
521
|
error: 200,
|
|
522
522
|
warn: 300,
|
|
523
523
|
info: 400,
|
|
524
524
|
debug: 500
|
|
525
|
-
},
|
|
525
|
+
}, qe = (e, t, n) => {
|
|
526
526
|
if (e) {
|
|
527
|
-
if (
|
|
528
|
-
|
|
527
|
+
if (ne(Ke, e)) return e;
|
|
528
|
+
A(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Ke))}`);
|
|
529
529
|
}
|
|
530
530
|
};
|
|
531
|
-
function
|
|
532
|
-
function
|
|
533
|
-
return !t ||
|
|
531
|
+
function Je() {}
|
|
532
|
+
function Ye(e, t, n) {
|
|
533
|
+
return !t || Ke[e] > Ke[n] ? Je : t[e].bind(t);
|
|
534
534
|
}
|
|
535
|
-
var
|
|
536
|
-
error:
|
|
537
|
-
warn:
|
|
538
|
-
info:
|
|
539
|
-
debug:
|
|
540
|
-
},
|
|
541
|
-
function
|
|
535
|
+
var Xe = {
|
|
536
|
+
error: Je,
|
|
537
|
+
warn: Je,
|
|
538
|
+
info: Je,
|
|
539
|
+
debug: Je
|
|
540
|
+
}, Ze = /* @__PURE__ */ new WeakMap();
|
|
541
|
+
function A(e) {
|
|
542
542
|
let t = e.logger, n = e.logLevel ?? "off";
|
|
543
|
-
if (!t) return
|
|
544
|
-
let r =
|
|
543
|
+
if (!t) return Xe;
|
|
544
|
+
let r = Ze.get(t);
|
|
545
545
|
if (r && r[0] === n) return r[1];
|
|
546
546
|
let i = {
|
|
547
|
-
error:
|
|
548
|
-
warn:
|
|
549
|
-
info:
|
|
550
|
-
debug:
|
|
547
|
+
error: Ye("error", t, n),
|
|
548
|
+
warn: Ye("warn", t, n),
|
|
549
|
+
info: Ye("info", t, n),
|
|
550
|
+
debug: Ye("debug", t, n)
|
|
551
551
|
};
|
|
552
|
-
return
|
|
552
|
+
return Ze.set(t, [n, i]), i;
|
|
553
553
|
}
|
|
554
|
-
var
|
|
554
|
+
var j = (e) => (e.options && (e.options = { ...e.options }, delete e.options.headers), e.headers &&= Object.fromEntries((e.headers instanceof Headers ? [...e.headers] : Object.entries(e.headers)).map(([e, t]) => [e, e.toLowerCase() === "authorization" || e.toLowerCase() === "cookie" || e.toLowerCase() === "set-cookie" ? "***" : t])), "retryOfRequestLogID" in e && (e.retryOfRequestLogID && (e.retryOf = e.retryOfRequestLogID), delete e.retryOfRequestLogID), e), Qe, $e = class n {
|
|
555
555
|
constructor(t, n, r) {
|
|
556
|
-
this.iterator = t,
|
|
556
|
+
this.iterator = t, Qe.set(this, void 0), this.controller = n, e(this, Qe, r, "f");
|
|
557
557
|
}
|
|
558
558
|
static fromSSEResponse(e, t, i, s) {
|
|
559
|
-
let c = !1, l = i ?
|
|
559
|
+
let c = !1, l = i ? A(i) : console;
|
|
560
560
|
async function* u() {
|
|
561
561
|
if (c) throw new a("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");
|
|
562
562
|
c = !0;
|
|
563
563
|
let n = !1;
|
|
564
564
|
try {
|
|
565
|
-
for await (let r of
|
|
565
|
+
for await (let r of et(e, t)) if (!n) {
|
|
566
566
|
if (r.data.startsWith("[DONE]")) {
|
|
567
567
|
n = !0;
|
|
568
568
|
continue;
|
|
@@ -606,7 +606,7 @@ var A = (e) => (e.options && (e.options = { ...e.options }, delete e.options.hea
|
|
|
606
606
|
static fromReadableStream(e, t, i) {
|
|
607
607
|
let o = !1;
|
|
608
608
|
async function* s() {
|
|
609
|
-
let t = new
|
|
609
|
+
let t = new Ue(), n = ve(e);
|
|
610
610
|
for await (let e of n) for (let n of t.decode(e)) yield n;
|
|
611
611
|
for (let e of t.flush()) yield e;
|
|
612
612
|
}
|
|
@@ -626,7 +626,7 @@ var A = (e) => (e.options && (e.options = { ...e.options }, delete e.options.hea
|
|
|
626
626
|
}
|
|
627
627
|
return new n(c, t, i);
|
|
628
628
|
}
|
|
629
|
-
[(
|
|
629
|
+
[(Qe = /* @__PURE__ */ new WeakMap(), Symbol.asyncIterator)]() {
|
|
630
630
|
return this.iterator();
|
|
631
631
|
}
|
|
632
632
|
tee() {
|
|
@@ -637,11 +637,11 @@ var A = (e) => (e.options && (e.options = { ...e.options }, delete e.options.hea
|
|
|
637
637
|
}
|
|
638
638
|
return t.shift();
|
|
639
639
|
} });
|
|
640
|
-
return [new n(() => a(e), this.controller, t(this,
|
|
640
|
+
return [new n(() => a(e), this.controller, t(this, Qe, "f")), new n(() => a(r), this.controller, t(this, Qe, "f"))];
|
|
641
641
|
}
|
|
642
642
|
toReadableStream() {
|
|
643
643
|
let e = this, t;
|
|
644
|
-
return
|
|
644
|
+
return ge({
|
|
645
645
|
async start() {
|
|
646
646
|
t = e[Symbol.asyncIterator]();
|
|
647
647
|
},
|
|
@@ -649,7 +649,7 @@ var A = (e) => (e.options && (e.options = { ...e.options }, delete e.options.hea
|
|
|
649
649
|
try {
|
|
650
650
|
let { value: n, done: r } = await t.next();
|
|
651
651
|
if (r) return e.close();
|
|
652
|
-
let i =
|
|
652
|
+
let i = Be(JSON.stringify(n) + "\n");
|
|
653
653
|
e.enqueue(i);
|
|
654
654
|
} catch (t) {
|
|
655
655
|
e.error(t);
|
|
@@ -661,10 +661,10 @@ var A = (e) => (e.options && (e.options = { ...e.options }, delete e.options.hea
|
|
|
661
661
|
});
|
|
662
662
|
}
|
|
663
663
|
};
|
|
664
|
-
async function*
|
|
664
|
+
async function* et(e, t) {
|
|
665
665
|
if (!e.body) throw t.abort(), globalThis.navigator !== void 0 && globalThis.navigator.product === "ReactNative" ? new a("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api") : new a("Attempted to iterate over a response with no body");
|
|
666
|
-
let n = new
|
|
667
|
-
for await (let e of
|
|
666
|
+
let n = new nt(), r = new Ue(), i = ve(e.body);
|
|
667
|
+
for await (let e of tt(i)) for (let t of r.decode(e)) {
|
|
668
668
|
let e = n.decode(t);
|
|
669
669
|
e && (yield e);
|
|
670
670
|
}
|
|
@@ -673,18 +673,18 @@ async function* tt(e, t) {
|
|
|
673
673
|
t && (yield t);
|
|
674
674
|
}
|
|
675
675
|
}
|
|
676
|
-
async function*
|
|
676
|
+
async function* tt(e) {
|
|
677
677
|
let t = new Uint8Array();
|
|
678
678
|
for await (let n of e) {
|
|
679
679
|
if (n == null) continue;
|
|
680
|
-
let e = n instanceof ArrayBuffer ? new Uint8Array(n) : typeof n == "string" ?
|
|
680
|
+
let e = n instanceof ArrayBuffer ? new Uint8Array(n) : typeof n == "string" ? Be(n) : n, r = new Uint8Array(t.length + e.length);
|
|
681
681
|
r.set(t), r.set(e, t.length), t = r;
|
|
682
682
|
let i;
|
|
683
|
-
for (; (i =
|
|
683
|
+
for (; (i = Ge(t)) !== -1;) yield t.slice(0, i), t = t.slice(i);
|
|
684
684
|
}
|
|
685
685
|
t.length > 0 && (yield t);
|
|
686
686
|
}
|
|
687
|
-
var
|
|
687
|
+
var nt = class {
|
|
688
688
|
constructor() {
|
|
689
689
|
this.event = null, this.data = [], this.chunks = [];
|
|
690
690
|
}
|
|
@@ -699,11 +699,11 @@ var rt = class {
|
|
|
699
699
|
return this.event = null, this.data = [], this.chunks = [], e;
|
|
700
700
|
}
|
|
701
701
|
if (this.chunks.push(e), e.startsWith(":")) return null;
|
|
702
|
-
let [t, n, r] =
|
|
702
|
+
let [t, n, r] = rt(e, ":");
|
|
703
703
|
return r.startsWith(" ") && (r = r.substring(1)), t === "event" ? this.event = r : t === "data" && this.data.push(r), null;
|
|
704
704
|
}
|
|
705
705
|
};
|
|
706
|
-
function
|
|
706
|
+
function rt(e, t) {
|
|
707
707
|
let n = e.indexOf(t);
|
|
708
708
|
return n === -1 ? [
|
|
709
709
|
e,
|
|
@@ -717,15 +717,15 @@ function it(e, t) {
|
|
|
717
717
|
}
|
|
718
718
|
//#endregion
|
|
719
719
|
//#region node_modules/openai/internal/parse.mjs
|
|
720
|
-
async function
|
|
720
|
+
async function it(e, t) {
|
|
721
721
|
let { response: n, requestLogID: r, retryOfRequestLogID: i, startTime: a } = t, o = await (async () => {
|
|
722
|
-
if (t.options.stream) return
|
|
722
|
+
if (t.options.stream) return A(e).debug("response", n.status, n.url, n.headers, n.body), t.options.__streamClass ? t.options.__streamClass.fromSSEResponse(n, t.controller, e, t.options.__synthesizeEventData) : $e.fromSSEResponse(n, t.controller, e, t.options.__synthesizeEventData);
|
|
723
723
|
if (n.status === 204) return null;
|
|
724
724
|
if (t.options.__binaryResponse) return n;
|
|
725
725
|
let r = n.headers.get("content-type")?.split(";")[0]?.trim();
|
|
726
|
-
return r?.includes("application/json") || r?.endsWith("+json") ? n.headers.get("content-length") === "0" ? void 0 :
|
|
726
|
+
return r?.includes("application/json") || r?.endsWith("+json") ? n.headers.get("content-length") === "0" ? void 0 : at(await n.json(), n) : await n.text();
|
|
727
727
|
})();
|
|
728
|
-
return
|
|
728
|
+
return A(e).debug(`[${r}] response parsed`, j({
|
|
729
729
|
retryOfRequestLogID: i,
|
|
730
730
|
url: n.url,
|
|
731
731
|
status: n.status,
|
|
@@ -733,7 +733,7 @@ async function at(e, t) {
|
|
|
733
733
|
durationMs: Date.now() - a
|
|
734
734
|
})), o;
|
|
735
735
|
}
|
|
736
|
-
function
|
|
736
|
+
function at(e, t) {
|
|
737
737
|
return !e || typeof e != "object" || Array.isArray(e) ? e : Object.defineProperty(e, "_request_id", {
|
|
738
738
|
value: t.headers.get("x-request-id"),
|
|
739
739
|
enumerable: !1
|
|
@@ -741,14 +741,14 @@ function ot(e, t) {
|
|
|
741
741
|
}
|
|
742
742
|
//#endregion
|
|
743
743
|
//#region node_modules/openai/core/api-promise.mjs
|
|
744
|
-
var
|
|
745
|
-
constructor(t, n, r =
|
|
744
|
+
var ot, st = class n extends Promise {
|
|
745
|
+
constructor(t, n, r = it) {
|
|
746
746
|
super((e) => {
|
|
747
747
|
e(null);
|
|
748
|
-
}), this.responsePromise = n, this.parseResponse = r,
|
|
748
|
+
}), this.responsePromise = n, this.parseResponse = r, ot.set(this, void 0), e(this, ot, t, "f");
|
|
749
749
|
}
|
|
750
750
|
_thenUnwrap(e) {
|
|
751
|
-
return new n(t(this,
|
|
751
|
+
return new n(t(this, ot, "f"), this.responsePromise, async (t, n) => at(e(await this.parseResponse(t, n), n), n.response));
|
|
752
752
|
}
|
|
753
753
|
asResponse() {
|
|
754
754
|
return this.responsePromise.then((e) => e.response);
|
|
@@ -762,7 +762,7 @@ var st, ct = class n extends Promise {
|
|
|
762
762
|
};
|
|
763
763
|
}
|
|
764
764
|
parse() {
|
|
765
|
-
return this.parsedPromise ||= this.responsePromise.then((e) => this.parseResponse(t(this,
|
|
765
|
+
return this.parsedPromise ||= this.responsePromise.then((e) => this.parseResponse(t(this, ot, "f"), e)), this.parsedPromise;
|
|
766
766
|
}
|
|
767
767
|
then(e, t) {
|
|
768
768
|
return this.parse().then(e, t);
|
|
@@ -774,12 +774,12 @@ var st, ct = class n extends Promise {
|
|
|
774
774
|
return this.parse().finally(e);
|
|
775
775
|
}
|
|
776
776
|
};
|
|
777
|
-
|
|
777
|
+
ot = /* @__PURE__ */ new WeakMap();
|
|
778
778
|
//#endregion
|
|
779
779
|
//#region node_modules/openai/core/pagination.mjs
|
|
780
|
-
var
|
|
780
|
+
var ct, lt = class {
|
|
781
781
|
constructor(t, n, r, i) {
|
|
782
|
-
|
|
782
|
+
ct.set(this, void 0), e(this, ct, t, "f"), this.options = i, this.response = n, this.body = r;
|
|
783
783
|
}
|
|
784
784
|
hasNextPage() {
|
|
785
785
|
return this.getPaginatedItems().length ? this.nextPageRequestOptions() != null : !1;
|
|
@@ -787,24 +787,24 @@ var lt, ut = class {
|
|
|
787
787
|
async getNextPage() {
|
|
788
788
|
let e = this.nextPageRequestOptions();
|
|
789
789
|
if (!e) throw new a("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");
|
|
790
|
-
return await t(this,
|
|
790
|
+
return await t(this, ct, "f").requestAPIList(this.constructor, e);
|
|
791
791
|
}
|
|
792
792
|
async *iterPages() {
|
|
793
793
|
let e = this;
|
|
794
794
|
for (yield e; e.hasNextPage();) e = await e.getNextPage(), yield e;
|
|
795
795
|
}
|
|
796
|
-
async *[(
|
|
796
|
+
async *[(ct = /* @__PURE__ */ new WeakMap(), Symbol.asyncIterator)]() {
|
|
797
797
|
for await (let e of this.iterPages()) for (let t of e.getPaginatedItems()) yield t;
|
|
798
798
|
}
|
|
799
|
-
},
|
|
799
|
+
}, ut = class extends st {
|
|
800
800
|
constructor(e, t, n) {
|
|
801
|
-
super(e, t, async (e, t) => new n(e, t.response, await
|
|
801
|
+
super(e, t, async (e, t) => new n(e, t.response, await it(e, t), t.options));
|
|
802
802
|
}
|
|
803
803
|
async *[Symbol.asyncIterator]() {
|
|
804
804
|
let e = await this;
|
|
805
805
|
for await (let t of e) yield t;
|
|
806
806
|
}
|
|
807
|
-
},
|
|
807
|
+
}, dt = class extends lt {
|
|
808
808
|
constructor(e, t, n, r) {
|
|
809
809
|
super(e, t, n, r), this.data = n.data || [], this.object = n.object;
|
|
810
810
|
}
|
|
@@ -814,7 +814,7 @@ var lt, ut = class {
|
|
|
814
814
|
nextPageRequestOptions() {
|
|
815
815
|
return null;
|
|
816
816
|
}
|
|
817
|
-
},
|
|
817
|
+
}, M = class extends lt {
|
|
818
818
|
constructor(e, t, n, r) {
|
|
819
819
|
super(e, t, n, r), this.data = n.data || [], this.has_more = n.has_more || !1;
|
|
820
820
|
}
|
|
@@ -834,7 +834,7 @@ var lt, ut = class {
|
|
|
834
834
|
}
|
|
835
835
|
} : null;
|
|
836
836
|
}
|
|
837
|
-
},
|
|
837
|
+
}, ft = class extends lt {
|
|
838
838
|
constructor(e, t, n, r) {
|
|
839
839
|
super(e, t, n, r), this.data = n.data || [], this.has_more = n.has_more || !1, this.last_id = n.last_id || "";
|
|
840
840
|
}
|
|
@@ -854,27 +854,27 @@ var lt, ut = class {
|
|
|
854
854
|
}
|
|
855
855
|
} : null;
|
|
856
856
|
}
|
|
857
|
-
},
|
|
857
|
+
}, pt = () => {
|
|
858
858
|
if (typeof File > "u") {
|
|
859
859
|
let { process: e } = globalThis, t = typeof e?.versions?.node == "string" && parseInt(e.versions.node.split(".")) < 20;
|
|
860
860
|
throw Error("`File` is not defined as a global, which is required for file uploads." + (t ? " Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`." : ""));
|
|
861
861
|
}
|
|
862
862
|
};
|
|
863
|
-
function
|
|
864
|
-
return
|
|
863
|
+
function mt(e, t, n) {
|
|
864
|
+
return pt(), new File(e, t ?? "unknown_file", n);
|
|
865
865
|
}
|
|
866
|
-
function
|
|
866
|
+
function ht(e) {
|
|
867
867
|
return (typeof e == "object" && !!e && ("name" in e && e.name && String(e.name) || "url" in e && e.url && String(e.url) || "filename" in e && e.filename && String(e.filename) || "path" in e && e.path && String(e.path)) || "").split(/[\\/]/).pop() || void 0;
|
|
868
868
|
}
|
|
869
|
-
var
|
|
869
|
+
var gt = (e) => typeof e == "object" && !!e && typeof e[Symbol.asyncIterator] == "function", _t = async (e, t) => Ct(e.body) ? {
|
|
870
870
|
...e,
|
|
871
|
-
body: await
|
|
872
|
-
} : e,
|
|
871
|
+
body: await bt(e.body, t)
|
|
872
|
+
} : e, N = async (e, t) => ({
|
|
873
873
|
...e,
|
|
874
|
-
body: await
|
|
875
|
-
}),
|
|
876
|
-
function
|
|
877
|
-
let t = typeof e == "function" ? e : e.fetch, n =
|
|
874
|
+
body: await bt(e.body, t)
|
|
875
|
+
}), vt = /* @__PURE__ */ new WeakMap();
|
|
876
|
+
function yt(e) {
|
|
877
|
+
let t = typeof e == "function" ? e : e.fetch, n = vt.get(t);
|
|
878
878
|
if (n) return n;
|
|
879
879
|
let r = (async () => {
|
|
880
880
|
try {
|
|
@@ -884,79 +884,79 @@ function bt(e) {
|
|
|
884
884
|
return !0;
|
|
885
885
|
}
|
|
886
886
|
})();
|
|
887
|
-
return
|
|
887
|
+
return vt.set(t, r), r;
|
|
888
888
|
}
|
|
889
|
-
var
|
|
890
|
-
if (!await
|
|
889
|
+
var bt = async (e, t) => {
|
|
890
|
+
if (!await yt(t)) throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");
|
|
891
891
|
let n = new FormData();
|
|
892
|
-
return await Promise.all(Object.entries(e || {}).map(([e, t]) =>
|
|
893
|
-
},
|
|
894
|
-
if (
|
|
895
|
-
if (Array.isArray(e)) return e.some(
|
|
892
|
+
return await Promise.all(Object.entries(e || {}).map(([e, t]) => wt(n, e, t))), n;
|
|
893
|
+
}, xt = (e) => e instanceof Blob && "name" in e, St = (e) => typeof e == "object" && !!e && (e instanceof Response || gt(e) || xt(e)), Ct = (e) => {
|
|
894
|
+
if (St(e)) return !0;
|
|
895
|
+
if (Array.isArray(e)) return e.some(Ct);
|
|
896
896
|
if (e && typeof e == "object") {
|
|
897
|
-
for (let t in e) if (
|
|
897
|
+
for (let t in e) if (Ct(e[t])) return !0;
|
|
898
898
|
}
|
|
899
899
|
return !1;
|
|
900
|
-
},
|
|
900
|
+
}, wt = async (e, t, n) => {
|
|
901
901
|
if (n !== void 0) {
|
|
902
902
|
if (n == null) throw TypeError(`Received null for "${t}"; to pass null in FormData, you must use the string 'null'`);
|
|
903
903
|
if (typeof n == "string" || typeof n == "number" || typeof n == "boolean") e.append(t, String(n));
|
|
904
|
-
else if (n instanceof Response) e.append(t,
|
|
905
|
-
else if (
|
|
906
|
-
else if (
|
|
907
|
-
else if (Array.isArray(n)) await Promise.all(n.map((n) =>
|
|
908
|
-
else if (typeof n == "object") await Promise.all(Object.entries(n).map(([n, r]) =>
|
|
904
|
+
else if (n instanceof Response) e.append(t, mt([await n.blob()], ht(n)));
|
|
905
|
+
else if (gt(n)) e.append(t, mt([await new Response(_e(n)).blob()], ht(n)));
|
|
906
|
+
else if (xt(n)) e.append(t, n, ht(n));
|
|
907
|
+
else if (Array.isArray(n)) await Promise.all(n.map((n) => wt(e, t + "[]", n)));
|
|
908
|
+
else if (typeof n == "object") await Promise.all(Object.entries(n).map(([n, r]) => wt(e, `${t}[${n}]`, r)));
|
|
909
909
|
else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${n} instead`);
|
|
910
910
|
}
|
|
911
|
-
},
|
|
912
|
-
async function
|
|
913
|
-
if (
|
|
914
|
-
if (
|
|
911
|
+
}, Tt = (e) => typeof e == "object" && !!e && typeof e.size == "number" && typeof e.type == "string" && typeof e.text == "function" && typeof e.slice == "function" && typeof e.arrayBuffer == "function", Et = (e) => typeof e == "object" && !!e && typeof e.name == "string" && typeof e.lastModified == "number" && Tt(e), Dt = (e) => typeof e == "object" && !!e && typeof e.url == "string" && typeof e.blob == "function";
|
|
912
|
+
async function Ot(e, t, n) {
|
|
913
|
+
if (pt(), e = await e, Et(e)) return e instanceof File ? e : mt([await e.arrayBuffer()], e.name);
|
|
914
|
+
if (Dt(e)) {
|
|
915
915
|
let r = await e.blob();
|
|
916
|
-
return t ||= new URL(e.url).pathname.split(/[\\/]/).pop(),
|
|
916
|
+
return t ||= new URL(e.url).pathname.split(/[\\/]/).pop(), mt(await kt(r), t, n);
|
|
917
917
|
}
|
|
918
|
-
let r = await
|
|
919
|
-
if (t ||=
|
|
918
|
+
let r = await kt(e);
|
|
919
|
+
if (t ||= ht(e), !n?.type) {
|
|
920
920
|
let e = r.find((e) => typeof e == "object" && "type" in e && e.type);
|
|
921
921
|
typeof e == "string" && (n = {
|
|
922
922
|
...n,
|
|
923
923
|
type: e
|
|
924
924
|
});
|
|
925
925
|
}
|
|
926
|
-
return
|
|
926
|
+
return mt(r, t, n);
|
|
927
927
|
}
|
|
928
|
-
async function
|
|
928
|
+
async function kt(e) {
|
|
929
929
|
let t = [];
|
|
930
930
|
if (typeof e == "string" || ArrayBuffer.isView(e) || e instanceof ArrayBuffer) t.push(e);
|
|
931
|
-
else if (
|
|
932
|
-
else if (
|
|
931
|
+
else if (Tt(e)) t.push(e instanceof Blob ? e : await e.arrayBuffer());
|
|
932
|
+
else if (gt(e)) for await (let n of e) t.push(...await kt(n));
|
|
933
933
|
else {
|
|
934
934
|
let t = e?.constructor?.name;
|
|
935
|
-
throw Error(`Unexpected data type: ${typeof e}${t ? `; constructor: ${t}` : ""}${
|
|
935
|
+
throw Error(`Unexpected data type: ${typeof e}${t ? `; constructor: ${t}` : ""}${At(e)}`);
|
|
936
936
|
}
|
|
937
937
|
return t;
|
|
938
938
|
}
|
|
939
|
-
function
|
|
939
|
+
function At(e) {
|
|
940
940
|
return typeof e != "object" || !e ? "" : `; props: [${Object.getOwnPropertyNames(e).map((e) => `"${e}"`).join(", ")}]`;
|
|
941
941
|
}
|
|
942
942
|
//#endregion
|
|
943
943
|
//#region node_modules/openai/core/resource.mjs
|
|
944
|
-
var
|
|
944
|
+
var P = class {
|
|
945
945
|
constructor(e) {
|
|
946
946
|
this._client = e;
|
|
947
947
|
}
|
|
948
948
|
};
|
|
949
949
|
//#endregion
|
|
950
950
|
//#region node_modules/openai/internal/utils/path.mjs
|
|
951
|
-
function
|
|
951
|
+
function jt(e) {
|
|
952
952
|
return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
|
|
953
953
|
}
|
|
954
|
-
var
|
|
954
|
+
var Mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null)), F = /* @__PURE__ */ ((e = jt) => function(t, ...n) {
|
|
955
955
|
if (t.length === 1) return t[0];
|
|
956
956
|
let r = !1, i = [], o = t.reduce((t, a, o) => {
|
|
957
957
|
/[?#]/.test(a) && (r = !0);
|
|
958
958
|
let s = n[o], c = (r ? encodeURIComponent : e)("" + s);
|
|
959
|
-
return o !== n.length && (s == null || typeof s == "object" && s.toString === Object.getPrototypeOf(Object.getPrototypeOf(s.hasOwnProperty ??
|
|
959
|
+
return o !== n.length && (s == null || typeof s == "object" && s.toString === Object.getPrototypeOf(Object.getPrototypeOf(s.hasOwnProperty ?? Mt) ?? Mt)?.toString) && (c = s + "", i.push({
|
|
960
960
|
start: t.length + a.length,
|
|
961
961
|
length: c.length,
|
|
962
962
|
error: `Value of type ${Object.prototype.toString.call(s).slice(8, -1)} is not a valid path parameter`
|
|
@@ -975,9 +975,9 @@ var Nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null)), P =
|
|
|
975
975
|
throw new a(`Path parameters result in path with invalid segments:\n${i.map((e) => e.error).join("\n")}\n${o}\n${t}`);
|
|
976
976
|
}
|
|
977
977
|
return o;
|
|
978
|
-
})(
|
|
978
|
+
})(jt), Nt = class extends P {
|
|
979
979
|
list(e, t = {}, n) {
|
|
980
|
-
return this._client.getAPIList(
|
|
980
|
+
return this._client.getAPIList(F`/chat/completions/${e}/messages`, M, {
|
|
981
981
|
query: t,
|
|
982
982
|
...n
|
|
983
983
|
});
|
|
@@ -985,19 +985,19 @@ var Nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null)), P =
|
|
|
985
985
|
};
|
|
986
986
|
//#endregion
|
|
987
987
|
//#region node_modules/openai/lib/parser.mjs
|
|
988
|
-
function
|
|
988
|
+
function Pt(e) {
|
|
989
989
|
return e !== void 0 && "function" in e && e.function !== void 0;
|
|
990
990
|
}
|
|
991
|
-
function
|
|
991
|
+
function Ft(e) {
|
|
992
992
|
return e?.$brand === "auto-parseable-response-format";
|
|
993
993
|
}
|
|
994
|
-
function
|
|
994
|
+
function It(e) {
|
|
995
995
|
return e?.$brand === "auto-parseable-tool";
|
|
996
996
|
}
|
|
997
|
-
function
|
|
998
|
-
return !t || !
|
|
997
|
+
function Lt(e, t) {
|
|
998
|
+
return !t || !Ht(t) ? {
|
|
999
999
|
...e,
|
|
1000
|
-
choices: e.choices.map((e) => (
|
|
1000
|
+
choices: e.choices.map((e) => (Ut(e.message.tool_calls), {
|
|
1001
1001
|
...e,
|
|
1002
1002
|
message: {
|
|
1003
1003
|
...e.message,
|
|
@@ -1005,18 +1005,18 @@ function Rt(e, t) {
|
|
|
1005
1005
|
...e.message.tool_calls ? { tool_calls: e.message.tool_calls } : void 0
|
|
1006
1006
|
}
|
|
1007
1007
|
}))
|
|
1008
|
-
} :
|
|
1008
|
+
} : Rt(e, t);
|
|
1009
1009
|
}
|
|
1010
|
-
function
|
|
1010
|
+
function Rt(e, t) {
|
|
1011
1011
|
let n = e.choices.map((e) => {
|
|
1012
1012
|
if (e.finish_reason === "length") throw new v();
|
|
1013
1013
|
if (e.finish_reason === "content_filter") throw new y();
|
|
1014
|
-
return
|
|
1014
|
+
return Ut(e.message.tool_calls), {
|
|
1015
1015
|
...e,
|
|
1016
1016
|
message: {
|
|
1017
1017
|
...e.message,
|
|
1018
|
-
...e.message.tool_calls ? { tool_calls: e.message.tool_calls?.map((e) =>
|
|
1019
|
-
parsed: e.message.content && !e.message.refusal ?
|
|
1018
|
+
...e.message.tool_calls ? { tool_calls: e.message.tool_calls?.map((e) => Bt(t, e)) ?? void 0 } : void 0,
|
|
1019
|
+
parsed: e.message.content && !e.message.refusal ? zt(t, e.message.content) : null
|
|
1020
1020
|
}
|
|
1021
1021
|
};
|
|
1022
1022
|
});
|
|
@@ -1025,31 +1025,31 @@ function zt(e, t) {
|
|
|
1025
1025
|
choices: n
|
|
1026
1026
|
};
|
|
1027
1027
|
}
|
|
1028
|
-
function
|
|
1028
|
+
function zt(e, t) {
|
|
1029
1029
|
return e.response_format?.type === "json_schema" && e.response_format?.type === "json_schema" ? "$parseRaw" in e.response_format ? e.response_format.$parseRaw(t) : JSON.parse(t) : null;
|
|
1030
1030
|
}
|
|
1031
|
-
function
|
|
1032
|
-
let n = e.tools?.find((e) =>
|
|
1031
|
+
function Bt(e, t) {
|
|
1032
|
+
let n = e.tools?.find((e) => Pt(e) && e.function?.name === t.function.name);
|
|
1033
1033
|
return {
|
|
1034
1034
|
...t,
|
|
1035
1035
|
function: {
|
|
1036
1036
|
...t.function,
|
|
1037
|
-
parsed_arguments:
|
|
1037
|
+
parsed_arguments: It(n) ? n.$parseRaw(t.function.arguments) : n?.function.strict ? JSON.parse(t.function.arguments) : null
|
|
1038
1038
|
}
|
|
1039
1039
|
};
|
|
1040
1040
|
}
|
|
1041
|
-
function
|
|
1041
|
+
function Vt(e, t) {
|
|
1042
1042
|
if (!e || !("tools" in e) || !e.tools) return !1;
|
|
1043
|
-
let n = e.tools?.find((e) =>
|
|
1044
|
-
return
|
|
1043
|
+
let n = e.tools?.find((e) => Pt(e) && e.function?.name === t.function.name);
|
|
1044
|
+
return Pt(n) && (It(n) || n?.function.strict || !1);
|
|
1045
1045
|
}
|
|
1046
|
-
function
|
|
1047
|
-
return
|
|
1046
|
+
function Ht(e) {
|
|
1047
|
+
return Ft(e.response_format) ? !0 : e.tools?.some((e) => It(e) || e.type === "function" && e.function.strict === !0) ?? !1;
|
|
1048
1048
|
}
|
|
1049
|
-
function
|
|
1049
|
+
function Ut(e) {
|
|
1050
1050
|
for (let t of e || []) if (t.type !== "function") throw new a(`Currently only \`function\` tool calls are supported; Received \`${t.type}\``);
|
|
1051
1051
|
}
|
|
1052
|
-
function
|
|
1052
|
+
function Wt(e) {
|
|
1053
1053
|
for (let t of e ?? []) {
|
|
1054
1054
|
if (t.type !== "function") throw new a(`Currently only \`function\` tool types support auto-parsing; Received \`${t.type}\``);
|
|
1055
1055
|
if (t.function.strict !== !0) throw new a(`The \`${t.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`);
|
|
@@ -1057,77 +1057,77 @@ function Gt(e) {
|
|
|
1057
1057
|
}
|
|
1058
1058
|
//#endregion
|
|
1059
1059
|
//#region node_modules/openai/lib/chatCompletionUtils.mjs
|
|
1060
|
-
var
|
|
1060
|
+
var Gt = (e) => e?.role === "assistant", Kt = (e) => e?.role === "tool", qt, Jt, Yt, Xt, Zt, Qt, $t, I, en, tn, nn, rn, an, on = class {
|
|
1061
1061
|
constructor() {
|
|
1062
|
-
|
|
1063
|
-
e(this,
|
|
1064
|
-
}), "f"), e(this,
|
|
1065
|
-
e(this,
|
|
1066
|
-
}), "f"), t(this,
|
|
1062
|
+
qt.add(this), this.controller = new AbortController(), Jt.set(this, void 0), Yt.set(this, () => {}), Xt.set(this, () => {}), Zt.set(this, void 0), Qt.set(this, () => {}), $t.set(this, () => {}), I.set(this, {}), en.set(this, !1), tn.set(this, !1), nn.set(this, !1), rn.set(this, !1), e(this, Jt, new Promise((t, n) => {
|
|
1063
|
+
e(this, Yt, t, "f"), e(this, Xt, n, "f");
|
|
1064
|
+
}), "f"), e(this, Zt, new Promise((t, n) => {
|
|
1065
|
+
e(this, Qt, t, "f"), e(this, $t, n, "f");
|
|
1066
|
+
}), "f"), t(this, Jt, "f").catch(() => {}), t(this, Zt, "f").catch(() => {});
|
|
1067
1067
|
}
|
|
1068
1068
|
_run(e) {
|
|
1069
1069
|
setTimeout(() => {
|
|
1070
1070
|
e().then(() => {
|
|
1071
1071
|
this._emitFinal(), this._emit("end");
|
|
1072
|
-
}, t(this,
|
|
1072
|
+
}, t(this, qt, "m", an).bind(this));
|
|
1073
1073
|
}, 0);
|
|
1074
1074
|
}
|
|
1075
1075
|
_connected() {
|
|
1076
|
-
this.ended || (t(this,
|
|
1076
|
+
this.ended || (t(this, Yt, "f").call(this), this._emit("connect"));
|
|
1077
1077
|
}
|
|
1078
1078
|
get ended() {
|
|
1079
|
-
return t(this,
|
|
1079
|
+
return t(this, en, "f");
|
|
1080
1080
|
}
|
|
1081
1081
|
get errored() {
|
|
1082
|
-
return t(this,
|
|
1082
|
+
return t(this, tn, "f");
|
|
1083
1083
|
}
|
|
1084
1084
|
get aborted() {
|
|
1085
|
-
return t(this,
|
|
1085
|
+
return t(this, nn, "f");
|
|
1086
1086
|
}
|
|
1087
1087
|
abort() {
|
|
1088
1088
|
this.controller.abort();
|
|
1089
1089
|
}
|
|
1090
1090
|
on(e, n) {
|
|
1091
|
-
return (t(this,
|
|
1091
|
+
return (t(this, I, "f")[e] || (t(this, I, "f")[e] = [])).push({ listener: n }), this;
|
|
1092
1092
|
}
|
|
1093
1093
|
off(e, n) {
|
|
1094
|
-
let r = t(this,
|
|
1094
|
+
let r = t(this, I, "f")[e];
|
|
1095
1095
|
if (!r) return this;
|
|
1096
1096
|
let i = r.findIndex((e) => e.listener === n);
|
|
1097
1097
|
return i >= 0 && r.splice(i, 1), this;
|
|
1098
1098
|
}
|
|
1099
1099
|
once(e, n) {
|
|
1100
|
-
return (t(this,
|
|
1100
|
+
return (t(this, I, "f")[e] || (t(this, I, "f")[e] = [])).push({
|
|
1101
1101
|
listener: n,
|
|
1102
1102
|
once: !0
|
|
1103
1103
|
}), this;
|
|
1104
1104
|
}
|
|
1105
1105
|
emitted(t) {
|
|
1106
1106
|
return new Promise((n, r) => {
|
|
1107
|
-
e(this,
|
|
1107
|
+
e(this, rn, !0, "f"), t !== "error" && this.once("error", r), this.once(t, n);
|
|
1108
1108
|
});
|
|
1109
1109
|
}
|
|
1110
1110
|
async done() {
|
|
1111
|
-
e(this,
|
|
1111
|
+
e(this, rn, !0, "f"), await t(this, Zt, "f");
|
|
1112
1112
|
}
|
|
1113
1113
|
_emit(n, ...r) {
|
|
1114
|
-
if (t(this,
|
|
1115
|
-
n === "end" && (e(this,
|
|
1116
|
-
let i = t(this,
|
|
1117
|
-
if (i && (t(this,
|
|
1114
|
+
if (t(this, en, "f")) return;
|
|
1115
|
+
n === "end" && (e(this, en, !0, "f"), t(this, Qt, "f").call(this));
|
|
1116
|
+
let i = t(this, I, "f")[n];
|
|
1117
|
+
if (i && (t(this, I, "f")[n] = i.filter((e) => !e.once), i.forEach(({ listener: e }) => e(...r))), n === "abort") {
|
|
1118
1118
|
let e = r[0];
|
|
1119
|
-
!t(this,
|
|
1119
|
+
!t(this, rn, "f") && !i?.length && Promise.reject(e), t(this, Xt, "f").call(this, e), t(this, $t, "f").call(this, e), this._emit("end");
|
|
1120
1120
|
return;
|
|
1121
1121
|
}
|
|
1122
1122
|
if (n === "error") {
|
|
1123
1123
|
let e = r[0];
|
|
1124
|
-
!t(this,
|
|
1124
|
+
!t(this, rn, "f") && !i?.length && Promise.reject(e), t(this, Xt, "f").call(this, e), t(this, $t, "f").call(this, e), this._emit("end");
|
|
1125
1125
|
}
|
|
1126
1126
|
}
|
|
1127
1127
|
_emitFinal() {}
|
|
1128
1128
|
};
|
|
1129
|
-
|
|
1130
|
-
if (e(this,
|
|
1129
|
+
Jt = /* @__PURE__ */ new WeakMap(), Yt = /* @__PURE__ */ new WeakMap(), Xt = /* @__PURE__ */ new WeakMap(), Zt = /* @__PURE__ */ new WeakMap(), Qt = /* @__PURE__ */ new WeakMap(), $t = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), en = /* @__PURE__ */ new WeakMap(), tn = /* @__PURE__ */ new WeakMap(), nn = /* @__PURE__ */ new WeakMap(), rn = /* @__PURE__ */ new WeakMap(), qt = /* @__PURE__ */ new WeakSet(), an = function(t) {
|
|
1130
|
+
if (e(this, tn, !0, "f"), t instanceof Error && t.name === "AbortError" && (t = new s()), t instanceof s) return e(this, nn, !0, "f"), this._emit("abort", t);
|
|
1131
1131
|
if (t instanceof a) return this._emit("error", t);
|
|
1132
1132
|
if (t instanceof Error) {
|
|
1133
1133
|
let e = new a(t.message);
|
|
@@ -1137,14 +1137,14 @@ Yt = /* @__PURE__ */ new WeakMap(), Xt = /* @__PURE__ */ new WeakMap(), Zt = /*
|
|
|
1137
1137
|
};
|
|
1138
1138
|
//#endregion
|
|
1139
1139
|
//#region node_modules/openai/lib/RunnableFunction.mjs
|
|
1140
|
-
function
|
|
1140
|
+
function sn(e) {
|
|
1141
1141
|
return typeof e.parse == "function";
|
|
1142
1142
|
}
|
|
1143
1143
|
//#endregion
|
|
1144
1144
|
//#region node_modules/openai/lib/AbstractChatCompletionRunner.mjs
|
|
1145
|
-
var
|
|
1145
|
+
var L, cn, ln, un, dn, fn, pn, mn, hn = 10, gn = class extends on {
|
|
1146
1146
|
constructor() {
|
|
1147
|
-
super(...arguments),
|
|
1147
|
+
super(...arguments), L.add(this), this._chatCompletions = [], this.messages = [];
|
|
1148
1148
|
}
|
|
1149
1149
|
_addChatCompletion(e) {
|
|
1150
1150
|
this._chatCompletions.push(e), this._emit("chatCompletion", e);
|
|
@@ -1153,8 +1153,8 @@ var I, ln, un, dn, fn, pn, mn, hn, gn = 10, _n = class extends sn {
|
|
|
1153
1153
|
}
|
|
1154
1154
|
_addMessage(e, t = !0) {
|
|
1155
1155
|
if ("content" in e || (e.content = null), this.messages.push(e), t) {
|
|
1156
|
-
if (this._emit("message", e),
|
|
1157
|
-
else if (
|
|
1156
|
+
if (this._emit("message", e), Kt(e) && e.content) this._emit("functionToolCallResult", e.content);
|
|
1157
|
+
else if (Gt(e) && e.tool_calls) for (let t of e.tool_calls) t.type === "function" && this._emit("functionToolCall", t.function);
|
|
1158
1158
|
}
|
|
1159
1159
|
}
|
|
1160
1160
|
async finalChatCompletion() {
|
|
@@ -1164,19 +1164,19 @@ var I, ln, un, dn, fn, pn, mn, hn, gn = 10, _n = class extends sn {
|
|
|
1164
1164
|
return e;
|
|
1165
1165
|
}
|
|
1166
1166
|
async finalContent() {
|
|
1167
|
-
return await this.done(), t(this,
|
|
1167
|
+
return await this.done(), t(this, L, "m", cn).call(this);
|
|
1168
1168
|
}
|
|
1169
1169
|
async finalMessage() {
|
|
1170
|
-
return await this.done(), t(this,
|
|
1170
|
+
return await this.done(), t(this, L, "m", ln).call(this);
|
|
1171
1171
|
}
|
|
1172
1172
|
async finalFunctionToolCall() {
|
|
1173
|
-
return await this.done(), t(this,
|
|
1173
|
+
return await this.done(), t(this, L, "m", un).call(this);
|
|
1174
1174
|
}
|
|
1175
1175
|
async finalFunctionToolCallResult() {
|
|
1176
|
-
return await this.done(), t(this,
|
|
1176
|
+
return await this.done(), t(this, L, "m", dn).call(this);
|
|
1177
1177
|
}
|
|
1178
1178
|
async totalUsage() {
|
|
1179
|
-
return await this.done(), t(this,
|
|
1179
|
+
return await this.done(), t(this, L, "m", fn).call(this);
|
|
1180
1180
|
}
|
|
1181
1181
|
allChatCompletions() {
|
|
1182
1182
|
return [...this._chatCompletions];
|
|
@@ -1184,18 +1184,18 @@ var I, ln, un, dn, fn, pn, mn, hn, gn = 10, _n = class extends sn {
|
|
|
1184
1184
|
_emitFinal() {
|
|
1185
1185
|
let e = this._chatCompletions[this._chatCompletions.length - 1];
|
|
1186
1186
|
e && this._emit("finalChatCompletion", e);
|
|
1187
|
-
let n = t(this,
|
|
1187
|
+
let n = t(this, L, "m", ln).call(this);
|
|
1188
1188
|
n && this._emit("finalMessage", n);
|
|
1189
|
-
let r = t(this,
|
|
1189
|
+
let r = t(this, L, "m", cn).call(this);
|
|
1190
1190
|
r && this._emit("finalContent", r);
|
|
1191
|
-
let i = t(this,
|
|
1191
|
+
let i = t(this, L, "m", un).call(this);
|
|
1192
1192
|
i && this._emit("finalFunctionToolCall", i);
|
|
1193
|
-
let a = t(this,
|
|
1194
|
-
a != null && this._emit("finalFunctionToolCallResult", a), this._chatCompletions.some((e) => e.usage) && this._emit("totalUsage", t(this,
|
|
1193
|
+
let a = t(this, L, "m", dn).call(this);
|
|
1194
|
+
a != null && this._emit("finalFunctionToolCallResult", a), this._chatCompletions.some((e) => e.usage) && this._emit("totalUsage", t(this, L, "m", fn).call(this));
|
|
1195
1195
|
}
|
|
1196
1196
|
async _createChatCompletion(e, n, r) {
|
|
1197
1197
|
let i = r?.signal;
|
|
1198
|
-
i && (i.aborted && this.controller.abort(), i.addEventListener("abort", () => this.controller.abort())), t(this,
|
|
1198
|
+
i && (i.aborted && this.controller.abort(), i.addEventListener("abort", () => this.controller.abort())), t(this, L, "m", pn).call(this, n);
|
|
1199
1199
|
let a = await e.chat.completions.create({
|
|
1200
1200
|
...n,
|
|
1201
1201
|
stream: !1
|
|
@@ -1203,15 +1203,15 @@ var I, ln, un, dn, fn, pn, mn, hn, gn = 10, _n = class extends sn {
|
|
|
1203
1203
|
...r,
|
|
1204
1204
|
signal: this.controller.signal
|
|
1205
1205
|
});
|
|
1206
|
-
return this._connected(), this._addChatCompletion(
|
|
1206
|
+
return this._connected(), this._addChatCompletion(Rt(a, n));
|
|
1207
1207
|
}
|
|
1208
1208
|
async _runChatCompletion(e, t, n) {
|
|
1209
1209
|
for (let e of t.messages) this._addMessage(e, !1);
|
|
1210
1210
|
return await this._createChatCompletion(e, t, n);
|
|
1211
1211
|
}
|
|
1212
1212
|
async _runTools(e, n, r) {
|
|
1213
|
-
let i = "tool", { tool_choice: o = "auto", stream: s, ...c } = n, l = typeof o != "string" && o.type === "function" && o?.function?.name, { maxChatCompletions: u =
|
|
1214
|
-
if (
|
|
1213
|
+
let i = "tool", { tool_choice: o = "auto", stream: s, ...c } = n, l = typeof o != "string" && o.type === "function" && o?.function?.name, { maxChatCompletions: u = hn } = r || {}, d = n.tools.map((e) => {
|
|
1214
|
+
if (It(e)) {
|
|
1215
1215
|
if (!e.$callback) throw new a("Tool given to `.runTools()` that does not have an associated function");
|
|
1216
1216
|
return {
|
|
1217
1217
|
type: "function",
|
|
@@ -1269,7 +1269,7 @@ var I, ln, un, dn, fn, pn, mn, hn, gn = 10, _n = class extends sn {
|
|
|
1269
1269
|
}
|
|
1270
1270
|
let s;
|
|
1271
1271
|
try {
|
|
1272
|
-
s =
|
|
1272
|
+
s = sn(o) ? await o.parse(a) : a;
|
|
1273
1273
|
} catch (e) {
|
|
1274
1274
|
let t = e instanceof Error ? e.message : String(e);
|
|
1275
1275
|
this._addMessage({
|
|
@@ -1279,7 +1279,7 @@ var I, ln, un, dn, fn, pn, mn, hn, gn = 10, _n = class extends sn {
|
|
|
1279
1279
|
});
|
|
1280
1280
|
continue;
|
|
1281
1281
|
}
|
|
1282
|
-
let c = await o.function(s, this), u = t(this,
|
|
1282
|
+
let c = await o.function(s, this), u = t(this, L, "m", mn).call(this, c);
|
|
1283
1283
|
if (this._addMessage({
|
|
1284
1284
|
role: i,
|
|
1285
1285
|
tool_call_id: n,
|
|
@@ -1289,30 +1289,30 @@ var I, ln, un, dn, fn, pn, mn, hn, gn = 10, _n = class extends sn {
|
|
|
1289
1289
|
}
|
|
1290
1290
|
}
|
|
1291
1291
|
};
|
|
1292
|
-
|
|
1293
|
-
return t(this,
|
|
1294
|
-
},
|
|
1292
|
+
L = /* @__PURE__ */ new WeakSet(), cn = function() {
|
|
1293
|
+
return t(this, L, "m", ln).call(this).content ?? null;
|
|
1294
|
+
}, ln = function() {
|
|
1295
1295
|
let e = this.messages.length;
|
|
1296
1296
|
for (; e-- > 0;) {
|
|
1297
1297
|
let t = this.messages[e];
|
|
1298
|
-
if (
|
|
1298
|
+
if (Gt(t)) return {
|
|
1299
1299
|
...t,
|
|
1300
1300
|
content: t.content ?? null,
|
|
1301
1301
|
refusal: t.refusal ?? null
|
|
1302
1302
|
};
|
|
1303
1303
|
}
|
|
1304
1304
|
throw new a("stream ended without producing a ChatCompletionMessage with role=assistant");
|
|
1305
|
-
},
|
|
1305
|
+
}, un = function() {
|
|
1306
1306
|
for (let e = this.messages.length - 1; e >= 0; e--) {
|
|
1307
1307
|
let t = this.messages[e];
|
|
1308
|
-
if (
|
|
1308
|
+
if (Gt(t) && t?.tool_calls?.length) return t.tool_calls.filter((e) => e.type === "function").at(-1)?.function;
|
|
1309
1309
|
}
|
|
1310
|
-
},
|
|
1310
|
+
}, dn = function() {
|
|
1311
1311
|
for (let e = this.messages.length - 1; e >= 0; e--) {
|
|
1312
1312
|
let t = this.messages[e];
|
|
1313
|
-
if (
|
|
1313
|
+
if (Kt(t) && t.content != null && typeof t.content == "string" && this.messages.some((e) => e.role === "assistant" && e.tool_calls?.some((e) => e.type === "function" && e.id === t.tool_call_id))) return t.content;
|
|
1314
1314
|
}
|
|
1315
|
-
},
|
|
1315
|
+
}, fn = function() {
|
|
1316
1316
|
let e = {
|
|
1317
1317
|
completion_tokens: 0,
|
|
1318
1318
|
prompt_tokens: 0,
|
|
@@ -1320,14 +1320,14 @@ I = /* @__PURE__ */ new WeakSet(), ln = function() {
|
|
|
1320
1320
|
};
|
|
1321
1321
|
for (let { usage: t } of this._chatCompletions) t && (e.completion_tokens += t.completion_tokens, e.prompt_tokens += t.prompt_tokens, e.total_tokens += t.total_tokens);
|
|
1322
1322
|
return e;
|
|
1323
|
-
},
|
|
1323
|
+
}, pn = function(e) {
|
|
1324
1324
|
if (e.n != null && e.n > 1) throw new a("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.");
|
|
1325
|
-
},
|
|
1325
|
+
}, mn = function(e) {
|
|
1326
1326
|
return typeof e == "string" ? e : e === void 0 ? "undefined" : JSON.stringify(e);
|
|
1327
1327
|
};
|
|
1328
1328
|
//#endregion
|
|
1329
1329
|
//#region node_modules/openai/lib/ChatCompletionRunner.mjs
|
|
1330
|
-
var
|
|
1330
|
+
var _n = class e extends gn {
|
|
1331
1331
|
static runTools(t, n, r) {
|
|
1332
1332
|
let i = new e(), a = {
|
|
1333
1333
|
...r,
|
|
@@ -1339,35 +1339,35 @@ var vn = class e extends _n {
|
|
|
1339
1339
|
return i._run(() => i._runTools(t, n, a)), i;
|
|
1340
1340
|
}
|
|
1341
1341
|
_addMessage(e, t = !0) {
|
|
1342
|
-
super._addMessage(e, t),
|
|
1343
|
-
}
|
|
1344
|
-
},
|
|
1345
|
-
STR:
|
|
1346
|
-
NUM:
|
|
1347
|
-
ARR:
|
|
1348
|
-
OBJ:
|
|
1349
|
-
NULL:
|
|
1350
|
-
BOOL:
|
|
1351
|
-
NAN:
|
|
1352
|
-
INFINITY:
|
|
1353
|
-
MINUS_INFINITY:
|
|
1354
|
-
INF:
|
|
1355
|
-
SPECIAL:
|
|
1356
|
-
ATOM:
|
|
1357
|
-
COLLECTION:
|
|
1358
|
-
ALL:
|
|
1359
|
-
},
|
|
1360
|
-
function
|
|
1342
|
+
super._addMessage(e, t), Gt(e) && e.content && this._emit("content", e.content);
|
|
1343
|
+
}
|
|
1344
|
+
}, vn = 1, yn = 2, bn = 4, xn = 8, Sn = 16, Cn = 32, wn = 64, Tn = 128, En = 256, Dn = Tn | En, On = 496, kn = yn | 497, An = bn | xn, R = {
|
|
1345
|
+
STR: vn,
|
|
1346
|
+
NUM: yn,
|
|
1347
|
+
ARR: bn,
|
|
1348
|
+
OBJ: xn,
|
|
1349
|
+
NULL: Sn,
|
|
1350
|
+
BOOL: Cn,
|
|
1351
|
+
NAN: wn,
|
|
1352
|
+
INFINITY: Tn,
|
|
1353
|
+
MINUS_INFINITY: En,
|
|
1354
|
+
INF: Dn,
|
|
1355
|
+
SPECIAL: On,
|
|
1356
|
+
ATOM: kn,
|
|
1357
|
+
COLLECTION: An,
|
|
1358
|
+
ALL: kn | An
|
|
1359
|
+
}, jn = class extends Error {}, Mn = class extends Error {};
|
|
1360
|
+
function Nn(e, t = R.ALL) {
|
|
1361
1361
|
if (typeof e != "string") throw TypeError(`expecting str, got ${typeof e}`);
|
|
1362
1362
|
if (!e.trim()) throw Error(`${e} is empty`);
|
|
1363
|
-
return
|
|
1363
|
+
return Pn(e.trim(), t);
|
|
1364
1364
|
}
|
|
1365
|
-
var
|
|
1365
|
+
var Pn = (e, t) => {
|
|
1366
1366
|
let n = e.length, r = 0, i = (e) => {
|
|
1367
|
-
throw new
|
|
1367
|
+
throw new jn(`${e} at position ${r}`);
|
|
1368
1368
|
}, a = (e) => {
|
|
1369
|
-
throw new
|
|
1370
|
-
}, o = () => (d(), r >= n && i("Unexpected end of input"), e[r] === "\"" ? s() : e[r] === "{" ? c() : e[r] === "[" ? l() : e.substring(r, r + 4) === "null" ||
|
|
1369
|
+
throw new Mn(`${e} at position ${r}`);
|
|
1370
|
+
}, o = () => (d(), r >= n && i("Unexpected end of input"), e[r] === "\"" ? s() : e[r] === "{" ? c() : e[r] === "[" ? l() : e.substring(r, r + 4) === "null" || R.NULL & t && n - r < 4 && "null".startsWith(e.substring(r)) ? (r += 4, null) : e.substring(r, r + 4) === "true" || R.BOOL & t && n - r < 4 && "true".startsWith(e.substring(r)) ? (r += 4, !0) : e.substring(r, r + 5) === "false" || R.BOOL & t && n - r < 5 && "false".startsWith(e.substring(r)) ? (r += 5, !1) : e.substring(r, r + 8) === "Infinity" || R.INFINITY & t && n - r < 8 && "Infinity".startsWith(e.substring(r)) ? (r += 8, Infinity) : e.substring(r, r + 9) === "-Infinity" || R.MINUS_INFINITY & t && 1 < n - r && n - r < 9 && "-Infinity".startsWith(e.substring(r)) ? (r += 9, -Infinity) : e.substring(r, r + 3) === "NaN" || R.NAN & t && n - r < 3 && "NaN".startsWith(e.substring(r)) ? (r += 3, NaN) : u()), s = () => {
|
|
1371
1371
|
let o = r, s = !1;
|
|
1372
1372
|
for (r++; r < n && (e[r] !== "\"" || s && e[r - 1] === "\\");) s = e[r] === "\\" ? !s : !1, r++;
|
|
1373
1373
|
if (e.charAt(r) == "\"") try {
|
|
@@ -1375,7 +1375,7 @@ var Fn = (e, t) => {
|
|
|
1375
1375
|
} catch (e) {
|
|
1376
1376
|
a(String(e));
|
|
1377
1377
|
}
|
|
1378
|
-
else if (
|
|
1378
|
+
else if (R.STR & t) try {
|
|
1379
1379
|
return JSON.parse(e.substring(o, r - Number(s)) + "\"");
|
|
1380
1380
|
} catch {
|
|
1381
1381
|
return JSON.parse(e.substring(o, e.lastIndexOf("\\")) + "\"");
|
|
@@ -1386,7 +1386,7 @@ var Fn = (e, t) => {
|
|
|
1386
1386
|
let a = {};
|
|
1387
1387
|
try {
|
|
1388
1388
|
for (; e[r] !== "}";) {
|
|
1389
|
-
if (d(), r >= n &&
|
|
1389
|
+
if (d(), r >= n && R.OBJ & t) return a;
|
|
1390
1390
|
let i = s();
|
|
1391
1391
|
d(), r++;
|
|
1392
1392
|
try {
|
|
@@ -1398,13 +1398,13 @@ var Fn = (e, t) => {
|
|
|
1398
1398
|
configurable: !0
|
|
1399
1399
|
});
|
|
1400
1400
|
} catch (e) {
|
|
1401
|
-
if (
|
|
1401
|
+
if (R.OBJ & t) return a;
|
|
1402
1402
|
throw e;
|
|
1403
1403
|
}
|
|
1404
1404
|
d(), e[r] === "," && r++;
|
|
1405
1405
|
}
|
|
1406
1406
|
} catch {
|
|
1407
|
-
if (
|
|
1407
|
+
if (R.OBJ & t) return a;
|
|
1408
1408
|
i("Expected '}' at end of object");
|
|
1409
1409
|
}
|
|
1410
1410
|
return r++, a;
|
|
@@ -1414,17 +1414,17 @@ var Fn = (e, t) => {
|
|
|
1414
1414
|
try {
|
|
1415
1415
|
for (; e[r] !== "]";) n.push(o()), d(), e[r] === "," && r++;
|
|
1416
1416
|
} catch {
|
|
1417
|
-
if (
|
|
1417
|
+
if (R.ARR & t) return n;
|
|
1418
1418
|
i("Expected ']' at end of array");
|
|
1419
1419
|
}
|
|
1420
1420
|
return r++, n;
|
|
1421
1421
|
}, u = () => {
|
|
1422
1422
|
if (r === 0) {
|
|
1423
|
-
e === "-" &&
|
|
1423
|
+
e === "-" && R.NUM & t && i("Not sure what '-' is");
|
|
1424
1424
|
try {
|
|
1425
1425
|
return JSON.parse(e);
|
|
1426
1426
|
} catch (n) {
|
|
1427
|
-
if (
|
|
1427
|
+
if (R.NUM & t) try {
|
|
1428
1428
|
return e[e.length - 1] === "." ? JSON.parse(e.substring(0, e.lastIndexOf("."))) : JSON.parse(e.substring(0, e.lastIndexOf("e")));
|
|
1429
1429
|
} catch {}
|
|
1430
1430
|
a(String(n));
|
|
@@ -1432,11 +1432,11 @@ var Fn = (e, t) => {
|
|
|
1432
1432
|
}
|
|
1433
1433
|
let o = r;
|
|
1434
1434
|
for (e[r] === "-" && r++; e[r] && !",]}".includes(e[r]);) r++;
|
|
1435
|
-
r == n && !(
|
|
1435
|
+
r == n && !(R.NUM & t) && i("Unterminated number literal");
|
|
1436
1436
|
try {
|
|
1437
1437
|
return JSON.parse(e.substring(o, r));
|
|
1438
1438
|
} catch {
|
|
1439
|
-
e.substring(o, r) === "-" &&
|
|
1439
|
+
e.substring(o, r) === "-" && R.NUM & t && i("Not sure what '-' is");
|
|
1440
1440
|
try {
|
|
1441
1441
|
return JSON.parse(e.substring(o, e.lastIndexOf("e")));
|
|
1442
1442
|
} catch (e) {
|
|
@@ -1447,9 +1447,9 @@ var Fn = (e, t) => {
|
|
|
1447
1447
|
for (; r < n && " \n\r ".includes(e[r]);) r++;
|
|
1448
1448
|
};
|
|
1449
1449
|
return o();
|
|
1450
|
-
},
|
|
1450
|
+
}, Fn = (e) => Nn(e, R.ALL ^ R.NUM), z, B, In, V, Ln, Rn, zn, Bn, Vn, Hn, Un, Wn, Gn = class n extends gn {
|
|
1451
1451
|
constructor(t) {
|
|
1452
|
-
super(),
|
|
1452
|
+
super(), z.add(this), B.set(this, void 0), In.set(this, void 0), V.set(this, void 0), e(this, B, t, "f"), e(this, In, [], "f");
|
|
1453
1453
|
}
|
|
1454
1454
|
get currentChatCompletionSnapshot() {
|
|
1455
1455
|
return t(this, V, "f");
|
|
@@ -1474,7 +1474,7 @@ var Fn = (e, t) => {
|
|
|
1474
1474
|
async _createChatCompletion(e, n, r) {
|
|
1475
1475
|
super._createChatCompletion;
|
|
1476
1476
|
let i = r?.signal;
|
|
1477
|
-
i && (i.aborted && this.controller.abort(), i.addEventListener("abort", () => this.controller.abort())), t(this,
|
|
1477
|
+
i && (i.aborted && this.controller.abort(), i.addEventListener("abort", () => this.controller.abort())), t(this, z, "m", Ln).call(this);
|
|
1478
1478
|
let a = await e.chat.completions.create({
|
|
1479
1479
|
...n,
|
|
1480
1480
|
stream: !0
|
|
@@ -1483,22 +1483,22 @@ var Fn = (e, t) => {
|
|
|
1483
1483
|
signal: this.controller.signal
|
|
1484
1484
|
});
|
|
1485
1485
|
this._connected();
|
|
1486
|
-
for await (let e of a) t(this,
|
|
1486
|
+
for await (let e of a) t(this, z, "m", zn).call(this, e);
|
|
1487
1487
|
if (a.controller.signal?.aborted) throw new s();
|
|
1488
|
-
return this._addChatCompletion(t(this,
|
|
1488
|
+
return this._addChatCompletion(t(this, z, "m", Hn).call(this));
|
|
1489
1489
|
}
|
|
1490
1490
|
async _fromReadableStream(e, n) {
|
|
1491
1491
|
let r = n?.signal;
|
|
1492
|
-
r && (r.aborted && this.controller.abort(), r.addEventListener("abort", () => this.controller.abort())), t(this,
|
|
1493
|
-
let i =
|
|
1494
|
-
for await (let e of i) a && a !== e.id && this._addChatCompletion(t(this,
|
|
1492
|
+
r && (r.aborted && this.controller.abort(), r.addEventListener("abort", () => this.controller.abort())), t(this, z, "m", Ln).call(this), this._connected();
|
|
1493
|
+
let i = $e.fromReadableStream(e, this.controller), a;
|
|
1494
|
+
for await (let e of i) a && a !== e.id && this._addChatCompletion(t(this, z, "m", Hn).call(this)), t(this, z, "m", zn).call(this, e), a = e.id;
|
|
1495
1495
|
if (i.controller.signal?.aborted) throw new s();
|
|
1496
|
-
return this._addChatCompletion(t(this,
|
|
1496
|
+
return this._addChatCompletion(t(this, z, "m", Hn).call(this));
|
|
1497
1497
|
}
|
|
1498
|
-
[(
|
|
1498
|
+
[(B = /* @__PURE__ */ new WeakMap(), In = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new WeakSet(), Ln = function() {
|
|
1499
1499
|
this.ended || e(this, V, void 0, "f");
|
|
1500
1500
|
}, Rn = function(e) {
|
|
1501
|
-
let n = t(this,
|
|
1501
|
+
let n = t(this, In, "f")[e.index];
|
|
1502
1502
|
return n || (n = {
|
|
1503
1503
|
content_done: !1,
|
|
1504
1504
|
refusal_done: !1,
|
|
@@ -1506,10 +1506,10 @@ var Fn = (e, t) => {
|
|
|
1506
1506
|
logprobs_refusal_done: !1,
|
|
1507
1507
|
done_tool_calls: /* @__PURE__ */ new Set(),
|
|
1508
1508
|
current_tool_call_index: null
|
|
1509
|
-
}, t(this,
|
|
1509
|
+
}, t(this, In, "f")[e.index] = n, n);
|
|
1510
1510
|
}, zn = function(e) {
|
|
1511
1511
|
if (this.ended) return;
|
|
1512
|
-
let n = t(this,
|
|
1512
|
+
let n = t(this, z, "m", Wn).call(this, e);
|
|
1513
1513
|
this._emit("chunk", e, n);
|
|
1514
1514
|
for (let r of e.choices) {
|
|
1515
1515
|
let e = n.choices[r.index];
|
|
@@ -1527,9 +1527,9 @@ var Fn = (e, t) => {
|
|
|
1527
1527
|
refusal: r.logprobs?.refusal,
|
|
1528
1528
|
snapshot: e.logprobs?.refusal ?? []
|
|
1529
1529
|
});
|
|
1530
|
-
let i = t(this,
|
|
1531
|
-
e.finish_reason && (t(this,
|
|
1532
|
-
for (let n of r.delta.tool_calls ?? []) i.current_tool_call_index !== n.index && (t(this,
|
|
1530
|
+
let i = t(this, z, "m", Rn).call(this, e);
|
|
1531
|
+
e.finish_reason && (t(this, z, "m", Vn).call(this, e), i.current_tool_call_index != null && t(this, z, "m", Bn).call(this, e, i.current_tool_call_index));
|
|
1532
|
+
for (let n of r.delta.tool_calls ?? []) i.current_tool_call_index !== n.index && (t(this, z, "m", Vn).call(this, e), i.current_tool_call_index != null && t(this, z, "m", Bn).call(this, e, i.current_tool_call_index)), i.current_tool_call_index = n.index;
|
|
1533
1533
|
for (let t of r.delta.tool_calls ?? []) {
|
|
1534
1534
|
let n = e.message.tool_calls?.[t.index];
|
|
1535
1535
|
n?.type && (n?.type === "function" ? this._emit("tool_calls.function.arguments.delta", {
|
|
@@ -1542,24 +1542,24 @@ var Fn = (e, t) => {
|
|
|
1542
1542
|
}
|
|
1543
1543
|
}
|
|
1544
1544
|
}, Bn = function(e, n) {
|
|
1545
|
-
if (t(this,
|
|
1545
|
+
if (t(this, z, "m", Rn).call(this, e).done_tool_calls.has(n)) return;
|
|
1546
1546
|
let r = e.message.tool_calls?.[n];
|
|
1547
1547
|
if (!r) throw Error("no tool call snapshot");
|
|
1548
1548
|
if (!r.type) throw Error("tool call snapshot missing `type`");
|
|
1549
1549
|
if (r.type === "function") {
|
|
1550
|
-
let e = t(this,
|
|
1550
|
+
let e = t(this, B, "f")?.tools?.find((e) => Pt(e) && e.function.name === r.function.name);
|
|
1551
1551
|
this._emit("tool_calls.function.arguments.done", {
|
|
1552
1552
|
name: r.function.name,
|
|
1553
1553
|
index: n,
|
|
1554
1554
|
arguments: r.function.arguments,
|
|
1555
|
-
parsed_arguments:
|
|
1555
|
+
parsed_arguments: It(e) ? e.$parseRaw(r.function.arguments) : e?.function.strict ? JSON.parse(r.function.arguments) : null
|
|
1556
1556
|
});
|
|
1557
1557
|
} else r.type;
|
|
1558
1558
|
}, Vn = function(e) {
|
|
1559
|
-
let n = t(this,
|
|
1559
|
+
let n = t(this, z, "m", Rn).call(this, e);
|
|
1560
1560
|
if (e.message.content && !n.content_done) {
|
|
1561
1561
|
n.content_done = !0;
|
|
1562
|
-
let r = t(this,
|
|
1562
|
+
let r = t(this, z, "m", Un).call(this);
|
|
1563
1563
|
this._emit("content.done", {
|
|
1564
1564
|
content: e.message.content,
|
|
1565
1565
|
parsed: r ? r.$parseRaw(e.message.content) : null
|
|
@@ -1570,10 +1570,10 @@ var Fn = (e, t) => {
|
|
|
1570
1570
|
if (this.ended) throw new a("stream has ended, this shouldn't happen");
|
|
1571
1571
|
let n = t(this, V, "f");
|
|
1572
1572
|
if (!n) throw new a("request ended without sending any chunks");
|
|
1573
|
-
return e(this, V, void 0, "f"), e(this,
|
|
1573
|
+
return e(this, V, void 0, "f"), e(this, In, [], "f"), Kn(n, t(this, B, "f"));
|
|
1574
1574
|
}, Un = function() {
|
|
1575
|
-
let e = t(this,
|
|
1576
|
-
return
|
|
1575
|
+
let e = t(this, B, "f")?.response_format;
|
|
1576
|
+
return Ft(e) ? e : null;
|
|
1577
1577
|
}, Wn = function(n) {
|
|
1578
1578
|
var r, i, a, o;
|
|
1579
1579
|
let s = t(this, V, "f"), { choices: c, ...l } = n;
|
|
@@ -1594,20 +1594,20 @@ var Fn = (e, t) => {
|
|
|
1594
1594
|
let { content: e, refusal: t, ...a } = u;
|
|
1595
1595
|
Object.assign(n.logprobs, a), e && ((r = n.logprobs).content ?? (r.content = []), n.logprobs.content.push(...e)), t && ((i = n.logprobs).refusal ?? (i.refusal = []), n.logprobs.refusal.push(...t));
|
|
1596
1596
|
}
|
|
1597
|
-
if (c && (n.finish_reason = c, t(this,
|
|
1597
|
+
if (c && (n.finish_reason = c, t(this, B, "f") && Ht(t(this, B, "f")))) {
|
|
1598
1598
|
if (c === "length") throw new v();
|
|
1599
1599
|
if (c === "content_filter") throw new y();
|
|
1600
1600
|
}
|
|
1601
1601
|
if (Object.assign(n, d), !e) continue;
|
|
1602
1602
|
let { content: f, refusal: p, function_call: m, role: h, tool_calls: g, ..._ } = e;
|
|
1603
|
-
if (Object.assign(n.message, _), p && (n.message.refusal = (n.message.refusal || "") + p), h && (n.message.role = h), m && (n.message.function_call ? (m.name && (n.message.function_call.name = m.name), m.arguments && ((a = n.message.function_call).arguments ?? (a.arguments = ""), n.message.function_call.arguments += m.arguments)) : n.message.function_call = m), f && (n.message.content = (n.message.content || "") + f, !n.message.refusal && t(this,
|
|
1603
|
+
if (Object.assign(n.message, _), p && (n.message.refusal = (n.message.refusal || "") + p), h && (n.message.role = h), m && (n.message.function_call ? (m.name && (n.message.function_call.name = m.name), m.arguments && ((a = n.message.function_call).arguments ?? (a.arguments = ""), n.message.function_call.arguments += m.arguments)) : n.message.function_call = m), f && (n.message.content = (n.message.content || "") + f, !n.message.refusal && t(this, z, "m", Un).call(this) && (n.message.parsed = Fn(n.message.content))), g) {
|
|
1604
1604
|
n.message.tool_calls || (n.message.tool_calls = []);
|
|
1605
1605
|
for (let { index: e, id: r, type: i, function: a, ...s } of g) {
|
|
1606
1606
|
let c = (o = n.message.tool_calls)[e] ?? (o[e] = {});
|
|
1607
1607
|
Object.assign(c, s), r && (c.id = r), i && (c.type = i), a && (c.function ??= {
|
|
1608
1608
|
name: a.name ?? "",
|
|
1609
1609
|
arguments: ""
|
|
1610
|
-
}), a?.name && (c.function.name = a.name), a?.arguments && (c.function.arguments += a.arguments,
|
|
1610
|
+
}), a?.name && (c.function.name = a.name), a?.arguments && (c.function.arguments += a.arguments, Vt(t(this, B, "f"), c) && (c.function.parsed_arguments = Fn(c.function.arguments)));
|
|
1611
1611
|
}
|
|
1612
1612
|
}
|
|
1613
1613
|
}
|
|
@@ -1653,12 +1653,12 @@ var Fn = (e, t) => {
|
|
|
1653
1653
|
};
|
|
1654
1654
|
}
|
|
1655
1655
|
toReadableStream() {
|
|
1656
|
-
return new
|
|
1656
|
+
return new $e(this[Symbol.asyncIterator].bind(this), this.controller).toReadableStream();
|
|
1657
1657
|
}
|
|
1658
1658
|
};
|
|
1659
1659
|
function Kn(e, t) {
|
|
1660
1660
|
let { id: n, choices: r, created: i, model: o, system_fingerprint: s, ...c } = e;
|
|
1661
|
-
return
|
|
1661
|
+
return Lt({
|
|
1662
1662
|
...c,
|
|
1663
1663
|
id: n,
|
|
1664
1664
|
choices: r.map(({ message: t, finish_reason: n, index: r, logprobs: i, ...o }) => {
|
|
@@ -1752,9 +1752,9 @@ var Jn = class e extends Gn {
|
|
|
1752
1752
|
};
|
|
1753
1753
|
return i._run(() => i._runTools(t, n, a)), i;
|
|
1754
1754
|
}
|
|
1755
|
-
}, Yn = class extends
|
|
1755
|
+
}, Yn = class extends P {
|
|
1756
1756
|
constructor() {
|
|
1757
|
-
super(...arguments), this.messages = new
|
|
1757
|
+
super(...arguments), this.messages = new Nt(this._client);
|
|
1758
1758
|
}
|
|
1759
1759
|
create(e, t) {
|
|
1760
1760
|
return this._client.post("/chat/completions", {
|
|
@@ -1764,43 +1764,43 @@ var Jn = class e extends Gn {
|
|
|
1764
1764
|
});
|
|
1765
1765
|
}
|
|
1766
1766
|
retrieve(e, t) {
|
|
1767
|
-
return this._client.get(
|
|
1767
|
+
return this._client.get(F`/chat/completions/${e}`, t);
|
|
1768
1768
|
}
|
|
1769
1769
|
update(e, t, n) {
|
|
1770
|
-
return this._client.post(
|
|
1770
|
+
return this._client.post(F`/chat/completions/${e}`, {
|
|
1771
1771
|
body: t,
|
|
1772
1772
|
...n
|
|
1773
1773
|
});
|
|
1774
1774
|
}
|
|
1775
1775
|
list(e = {}, t) {
|
|
1776
|
-
return this._client.getAPIList("/chat/completions",
|
|
1776
|
+
return this._client.getAPIList("/chat/completions", M, {
|
|
1777
1777
|
query: e,
|
|
1778
1778
|
...t
|
|
1779
1779
|
});
|
|
1780
1780
|
}
|
|
1781
1781
|
delete(e, t) {
|
|
1782
|
-
return this._client.delete(
|
|
1782
|
+
return this._client.delete(F`/chat/completions/${e}`, t);
|
|
1783
1783
|
}
|
|
1784
1784
|
parse(e, t) {
|
|
1785
|
-
return
|
|
1785
|
+
return Wt(e.tools), this._client.chat.completions.create(e, {
|
|
1786
1786
|
...t,
|
|
1787
1787
|
headers: {
|
|
1788
1788
|
...t?.headers,
|
|
1789
1789
|
"X-Stainless-Helper-Method": "chat.completions.parse"
|
|
1790
1790
|
}
|
|
1791
|
-
})._thenUnwrap((t) =>
|
|
1791
|
+
})._thenUnwrap((t) => Rt(t, e));
|
|
1792
1792
|
}
|
|
1793
1793
|
runTools(e, t) {
|
|
1794
|
-
return e.stream ? Jn.runTools(this._client, e, t) :
|
|
1794
|
+
return e.stream ? Jn.runTools(this._client, e, t) : _n.runTools(this._client, e, t);
|
|
1795
1795
|
}
|
|
1796
1796
|
stream(e, t) {
|
|
1797
1797
|
return Gn.createChatCompletion(this._client, e, t);
|
|
1798
1798
|
}
|
|
1799
1799
|
};
|
|
1800
|
-
Yn.Messages =
|
|
1800
|
+
Yn.Messages = Nt;
|
|
1801
1801
|
//#endregion
|
|
1802
1802
|
//#region node_modules/openai/resources/chat/chat.mjs
|
|
1803
|
-
var Xn = class extends
|
|
1803
|
+
var Xn = class extends P {
|
|
1804
1804
|
constructor() {
|
|
1805
1805
|
super(...arguments), this.completions = new Yn(this._client);
|
|
1806
1806
|
}
|
|
@@ -1840,7 +1840,7 @@ var H = (e) => {
|
|
|
1840
1840
|
values: t,
|
|
1841
1841
|
nulls: n
|
|
1842
1842
|
};
|
|
1843
|
-
}, $n = class extends
|
|
1843
|
+
}, $n = class extends P {
|
|
1844
1844
|
create(e, t) {
|
|
1845
1845
|
return this._client.post("/audio/speech", {
|
|
1846
1846
|
body: e,
|
|
@@ -1849,24 +1849,24 @@ var H = (e) => {
|
|
|
1849
1849
|
__binaryResponse: !0
|
|
1850
1850
|
});
|
|
1851
1851
|
}
|
|
1852
|
-
}, er = class extends
|
|
1852
|
+
}, er = class extends P {
|
|
1853
1853
|
create(e, t) {
|
|
1854
|
-
return this._client.post("/audio/transcriptions",
|
|
1854
|
+
return this._client.post("/audio/transcriptions", N({
|
|
1855
1855
|
body: e,
|
|
1856
1856
|
...t,
|
|
1857
1857
|
stream: e.stream ?? !1,
|
|
1858
1858
|
__metadata: { model: e.model }
|
|
1859
1859
|
}, this._client));
|
|
1860
1860
|
}
|
|
1861
|
-
}, tr = class extends
|
|
1861
|
+
}, tr = class extends P {
|
|
1862
1862
|
create(e, t) {
|
|
1863
|
-
return this._client.post("/audio/translations",
|
|
1863
|
+
return this._client.post("/audio/translations", N({
|
|
1864
1864
|
body: e,
|
|
1865
1865
|
...t,
|
|
1866
1866
|
__metadata: { model: e.model }
|
|
1867
1867
|
}, this._client));
|
|
1868
1868
|
}
|
|
1869
|
-
}, nr = class extends
|
|
1869
|
+
}, nr = class extends P {
|
|
1870
1870
|
constructor() {
|
|
1871
1871
|
super(...arguments), this.transcriptions = new er(this._client), this.translations = new tr(this._client), this.speech = new $n(this._client);
|
|
1872
1872
|
}
|
|
@@ -1874,7 +1874,7 @@ var H = (e) => {
|
|
|
1874
1874
|
nr.Transcriptions = er, nr.Translations = tr, nr.Speech = $n;
|
|
1875
1875
|
//#endregion
|
|
1876
1876
|
//#region node_modules/openai/resources/batches.mjs
|
|
1877
|
-
var rr = class extends
|
|
1877
|
+
var rr = class extends P {
|
|
1878
1878
|
create(e, t) {
|
|
1879
1879
|
return this._client.post("/batches", {
|
|
1880
1880
|
body: e,
|
|
@@ -1882,18 +1882,18 @@ var rr = class extends N {
|
|
|
1882
1882
|
});
|
|
1883
1883
|
}
|
|
1884
1884
|
retrieve(e, t) {
|
|
1885
|
-
return this._client.get(
|
|
1885
|
+
return this._client.get(F`/batches/${e}`, t);
|
|
1886
1886
|
}
|
|
1887
1887
|
list(e = {}, t) {
|
|
1888
|
-
return this._client.getAPIList("/batches",
|
|
1888
|
+
return this._client.getAPIList("/batches", M, {
|
|
1889
1889
|
query: e,
|
|
1890
1890
|
...t
|
|
1891
1891
|
});
|
|
1892
1892
|
}
|
|
1893
1893
|
cancel(e, t) {
|
|
1894
|
-
return this._client.post(
|
|
1894
|
+
return this._client.post(F`/batches/${e}/cancel`, t);
|
|
1895
1895
|
}
|
|
1896
|
-
}, ir = class extends
|
|
1896
|
+
}, ir = class extends P {
|
|
1897
1897
|
create(e, t) {
|
|
1898
1898
|
return this._client.post("/assistants", {
|
|
1899
1899
|
body: e,
|
|
@@ -1902,32 +1902,32 @@ var rr = class extends N {
|
|
|
1902
1902
|
});
|
|
1903
1903
|
}
|
|
1904
1904
|
retrieve(e, t) {
|
|
1905
|
-
return this._client.get(
|
|
1905
|
+
return this._client.get(F`/assistants/${e}`, {
|
|
1906
1906
|
...t,
|
|
1907
1907
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, t?.headers])
|
|
1908
1908
|
});
|
|
1909
1909
|
}
|
|
1910
1910
|
update(e, t, n) {
|
|
1911
|
-
return this._client.post(
|
|
1911
|
+
return this._client.post(F`/assistants/${e}`, {
|
|
1912
1912
|
body: t,
|
|
1913
1913
|
...n,
|
|
1914
1914
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
1915
1915
|
});
|
|
1916
1916
|
}
|
|
1917
1917
|
list(e = {}, t) {
|
|
1918
|
-
return this._client.getAPIList("/assistants",
|
|
1918
|
+
return this._client.getAPIList("/assistants", M, {
|
|
1919
1919
|
query: e,
|
|
1920
1920
|
...t,
|
|
1921
1921
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, t?.headers])
|
|
1922
1922
|
});
|
|
1923
1923
|
}
|
|
1924
1924
|
delete(e, t) {
|
|
1925
|
-
return this._client.delete(
|
|
1925
|
+
return this._client.delete(F`/assistants/${e}`, {
|
|
1926
1926
|
...t,
|
|
1927
1927
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, t?.headers])
|
|
1928
1928
|
});
|
|
1929
1929
|
}
|
|
1930
|
-
}, ar = class extends
|
|
1930
|
+
}, ar = class extends P {
|
|
1931
1931
|
create(e, t) {
|
|
1932
1932
|
return this._client.post("/realtime/sessions", {
|
|
1933
1933
|
body: e,
|
|
@@ -1935,7 +1935,7 @@ var rr = class extends N {
|
|
|
1935
1935
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, t?.headers])
|
|
1936
1936
|
});
|
|
1937
1937
|
}
|
|
1938
|
-
}, or = class extends
|
|
1938
|
+
}, or = class extends P {
|
|
1939
1939
|
create(e, t) {
|
|
1940
1940
|
return this._client.post("/realtime/transcription_sessions", {
|
|
1941
1941
|
body: e,
|
|
@@ -1943,7 +1943,7 @@ var rr = class extends N {
|
|
|
1943
1943
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, t?.headers])
|
|
1944
1944
|
});
|
|
1945
1945
|
}
|
|
1946
|
-
}, sr = class extends
|
|
1946
|
+
}, sr = class extends P {
|
|
1947
1947
|
constructor() {
|
|
1948
1948
|
super(...arguments), this.sessions = new ar(this._client), this.transcriptionSessions = new or(this._client);
|
|
1949
1949
|
}
|
|
@@ -1951,7 +1951,7 @@ var rr = class extends N {
|
|
|
1951
1951
|
sr.Sessions = ar, sr.TranscriptionSessions = or;
|
|
1952
1952
|
//#endregion
|
|
1953
1953
|
//#region node_modules/openai/resources/beta/chatkit/sessions.mjs
|
|
1954
|
-
var cr = class extends
|
|
1954
|
+
var cr = class extends P {
|
|
1955
1955
|
create(e, t) {
|
|
1956
1956
|
return this._client.post("/chatkit/sessions", {
|
|
1957
1957
|
body: e,
|
|
@@ -1960,39 +1960,39 @@ var cr = class extends N {
|
|
|
1960
1960
|
});
|
|
1961
1961
|
}
|
|
1962
1962
|
cancel(e, t) {
|
|
1963
|
-
return this._client.post(
|
|
1963
|
+
return this._client.post(F`/chatkit/sessions/${e}/cancel`, {
|
|
1964
1964
|
...t,
|
|
1965
1965
|
headers: H([{ "OpenAI-Beta": "chatkit_beta=v1" }, t?.headers])
|
|
1966
1966
|
});
|
|
1967
1967
|
}
|
|
1968
|
-
}, lr = class extends
|
|
1968
|
+
}, lr = class extends P {
|
|
1969
1969
|
retrieve(e, t) {
|
|
1970
|
-
return this._client.get(
|
|
1970
|
+
return this._client.get(F`/chatkit/threads/${e}`, {
|
|
1971
1971
|
...t,
|
|
1972
1972
|
headers: H([{ "OpenAI-Beta": "chatkit_beta=v1" }, t?.headers])
|
|
1973
1973
|
});
|
|
1974
1974
|
}
|
|
1975
1975
|
list(e = {}, t) {
|
|
1976
|
-
return this._client.getAPIList("/chatkit/threads",
|
|
1976
|
+
return this._client.getAPIList("/chatkit/threads", ft, {
|
|
1977
1977
|
query: e,
|
|
1978
1978
|
...t,
|
|
1979
1979
|
headers: H([{ "OpenAI-Beta": "chatkit_beta=v1" }, t?.headers])
|
|
1980
1980
|
});
|
|
1981
1981
|
}
|
|
1982
1982
|
delete(e, t) {
|
|
1983
|
-
return this._client.delete(
|
|
1983
|
+
return this._client.delete(F`/chatkit/threads/${e}`, {
|
|
1984
1984
|
...t,
|
|
1985
1985
|
headers: H([{ "OpenAI-Beta": "chatkit_beta=v1" }, t?.headers])
|
|
1986
1986
|
});
|
|
1987
1987
|
}
|
|
1988
1988
|
listItems(e, t = {}, n) {
|
|
1989
|
-
return this._client.getAPIList(
|
|
1989
|
+
return this._client.getAPIList(F`/chatkit/threads/${e}/items`, ft, {
|
|
1990
1990
|
query: t,
|
|
1991
1991
|
...n,
|
|
1992
1992
|
headers: H([{ "OpenAI-Beta": "chatkit_beta=v1" }, n?.headers])
|
|
1993
1993
|
});
|
|
1994
1994
|
}
|
|
1995
|
-
}, ur = class extends
|
|
1995
|
+
}, ur = class extends P {
|
|
1996
1996
|
constructor() {
|
|
1997
1997
|
super(...arguments), this.sessions = new cr(this._client), this.threads = new lr(this._client);
|
|
1998
1998
|
}
|
|
@@ -2000,9 +2000,9 @@ var cr = class extends N {
|
|
|
2000
2000
|
ur.Sessions = cr, ur.Threads = lr;
|
|
2001
2001
|
//#endregion
|
|
2002
2002
|
//#region node_modules/openai/resources/beta/threads/messages.mjs
|
|
2003
|
-
var dr = class extends
|
|
2003
|
+
var dr = class extends P {
|
|
2004
2004
|
create(e, t, n) {
|
|
2005
|
-
return this._client.post(
|
|
2005
|
+
return this._client.post(F`/threads/${e}/messages`, {
|
|
2006
2006
|
body: t,
|
|
2007
2007
|
...n,
|
|
2008
2008
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
@@ -2010,21 +2010,21 @@ var dr = class extends N {
|
|
|
2010
2010
|
}
|
|
2011
2011
|
retrieve(e, t, n) {
|
|
2012
2012
|
let { thread_id: r } = t;
|
|
2013
|
-
return this._client.get(
|
|
2013
|
+
return this._client.get(F`/threads/${r}/messages/${e}`, {
|
|
2014
2014
|
...n,
|
|
2015
2015
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
2016
2016
|
});
|
|
2017
2017
|
}
|
|
2018
2018
|
update(e, t, n) {
|
|
2019
2019
|
let { thread_id: r, ...i } = t;
|
|
2020
|
-
return this._client.post(
|
|
2020
|
+
return this._client.post(F`/threads/${r}/messages/${e}`, {
|
|
2021
2021
|
body: i,
|
|
2022
2022
|
...n,
|
|
2023
2023
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
2024
2024
|
});
|
|
2025
2025
|
}
|
|
2026
2026
|
list(e, t = {}, n) {
|
|
2027
|
-
return this._client.getAPIList(
|
|
2027
|
+
return this._client.getAPIList(F`/threads/${e}/messages`, M, {
|
|
2028
2028
|
query: t,
|
|
2029
2029
|
...n,
|
|
2030
2030
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
@@ -2032,15 +2032,15 @@ var dr = class extends N {
|
|
|
2032
2032
|
}
|
|
2033
2033
|
delete(e, t, n) {
|
|
2034
2034
|
let { thread_id: r } = t;
|
|
2035
|
-
return this._client.delete(
|
|
2035
|
+
return this._client.delete(F`/threads/${r}/messages/${e}`, {
|
|
2036
2036
|
...n,
|
|
2037
2037
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
2038
2038
|
});
|
|
2039
2039
|
}
|
|
2040
|
-
}, fr = class extends
|
|
2040
|
+
}, fr = class extends P {
|
|
2041
2041
|
retrieve(e, t, n) {
|
|
2042
2042
|
let { thread_id: r, run_id: i, ...a } = t;
|
|
2043
|
-
return this._client.get(
|
|
2043
|
+
return this._client.get(F`/threads/${r}/runs/${i}/steps/${e}`, {
|
|
2044
2044
|
query: a,
|
|
2045
2045
|
...n,
|
|
2046
2046
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
@@ -2048,7 +2048,7 @@ var dr = class extends N {
|
|
|
2048
2048
|
}
|
|
2049
2049
|
list(e, t, n) {
|
|
2050
2050
|
let { thread_id: r, ...i } = t;
|
|
2051
|
-
return this._client.getAPIList(
|
|
2051
|
+
return this._client.getAPIList(F`/threads/${r}/runs/${e}/steps`, M, {
|
|
2052
2052
|
query: i,
|
|
2053
2053
|
...n,
|
|
2054
2054
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
@@ -2066,7 +2066,7 @@ var dr = class extends N {
|
|
|
2066
2066
|
}, U = (e) => {
|
|
2067
2067
|
if (globalThis.process !== void 0) return globalThis.process.env?.[e]?.trim() ?? void 0;
|
|
2068
2068
|
if (globalThis.Deno !== void 0) return globalThis.Deno.env?.get?.(e)?.trim();
|
|
2069
|
-
}, W, G, mr, K, hr, q, J, gr, Y, _r, X, vr, yr, br, xr, Sr, Cr, wr, Tr, Er, Dr, Or, kr, Ar = class extends
|
|
2069
|
+
}, W, G, mr, K, hr, q, J, gr, Y, _r, X, vr, yr, br, xr, Sr, Cr, wr, Tr, Er, Dr, Or, kr, Ar = class extends on {
|
|
2070
2070
|
constructor() {
|
|
2071
2071
|
super(...arguments), W.add(this), mr.set(this, []), K.set(this, {}), hr.set(this, {}), q.set(this, void 0), J.set(this, void 0), gr.set(this, void 0), Y.set(this, void 0), _r.set(this, void 0), X.set(this, void 0), vr.set(this, void 0), yr.set(this, void 0), br.set(this, void 0);
|
|
2072
2072
|
}
|
|
@@ -2117,13 +2117,13 @@ var dr = class extends N {
|
|
|
2117
2117
|
async _fromReadableStream(e, n) {
|
|
2118
2118
|
let r = n?.signal;
|
|
2119
2119
|
r && (r.aborted && this.controller.abort(), r.addEventListener("abort", () => this.controller.abort())), this._connected();
|
|
2120
|
-
let i =
|
|
2120
|
+
let i = $e.fromReadableStream(e, this.controller);
|
|
2121
2121
|
for await (let e of i) t(this, W, "m", xr).call(this, e);
|
|
2122
2122
|
if (i.controller.signal?.aborted) throw new s();
|
|
2123
2123
|
return this._addRun(t(this, W, "m", Sr).call(this));
|
|
2124
2124
|
}
|
|
2125
2125
|
toReadableStream() {
|
|
2126
|
-
return new
|
|
2126
|
+
return new $e(this[Symbol.asyncIterator].bind(this), this.controller).toReadableStream();
|
|
2127
2127
|
}
|
|
2128
2128
|
static createToolAssistantStream(e, t, n, r) {
|
|
2129
2129
|
let i = new G();
|
|
@@ -2239,14 +2239,14 @@ var dr = class extends N {
|
|
|
2239
2239
|
}
|
|
2240
2240
|
if (typeof t == "string" && typeof r == "string") t += r;
|
|
2241
2241
|
else if (typeof t == "number" && typeof r == "number") t += r;
|
|
2242
|
-
else if (
|
|
2242
|
+
else if (T(t) && T(r)) t = this.accumulateDelta(t, r);
|
|
2243
2243
|
else if (Array.isArray(t) && Array.isArray(r)) {
|
|
2244
2244
|
if (t.every((e) => typeof e == "string" || typeof e == "number")) {
|
|
2245
2245
|
t.push(...r);
|
|
2246
2246
|
continue;
|
|
2247
2247
|
}
|
|
2248
2248
|
for (let e of r) {
|
|
2249
|
-
if (!
|
|
2249
|
+
if (!T(e)) throw Error(`Expected array delta entry to be an object but got: ${e}`);
|
|
2250
2250
|
let n = e.index;
|
|
2251
2251
|
if (n == null) throw console.error(e), Error("Expected array delta entry to have an `index` property");
|
|
2252
2252
|
if (typeof n != "number") throw Error(`Expected array delta entry \`index\` property to be a number but got ${n}`);
|
|
@@ -2440,13 +2440,13 @@ G = Ar, xr = function(n) {
|
|
|
2440
2440
|
};
|
|
2441
2441
|
//#endregion
|
|
2442
2442
|
//#region node_modules/openai/resources/beta/threads/runs/runs.mjs
|
|
2443
|
-
var jr = class extends
|
|
2443
|
+
var jr = class extends P {
|
|
2444
2444
|
constructor() {
|
|
2445
2445
|
super(...arguments), this.steps = new fr(this._client);
|
|
2446
2446
|
}
|
|
2447
2447
|
create(e, t, n) {
|
|
2448
2448
|
let { include: r, ...i } = t;
|
|
2449
|
-
return this._client.post(
|
|
2449
|
+
return this._client.post(F`/threads/${e}/runs`, {
|
|
2450
2450
|
query: { include: r },
|
|
2451
2451
|
body: i,
|
|
2452
2452
|
...n,
|
|
@@ -2457,21 +2457,21 @@ var jr = class extends N {
|
|
|
2457
2457
|
}
|
|
2458
2458
|
retrieve(e, t, n) {
|
|
2459
2459
|
let { thread_id: r } = t;
|
|
2460
|
-
return this._client.get(
|
|
2460
|
+
return this._client.get(F`/threads/${r}/runs/${e}`, {
|
|
2461
2461
|
...n,
|
|
2462
2462
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
2463
2463
|
});
|
|
2464
2464
|
}
|
|
2465
2465
|
update(e, t, n) {
|
|
2466
2466
|
let { thread_id: r, ...i } = t;
|
|
2467
|
-
return this._client.post(
|
|
2467
|
+
return this._client.post(F`/threads/${r}/runs/${e}`, {
|
|
2468
2468
|
body: i,
|
|
2469
2469
|
...n,
|
|
2470
2470
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
2471
2471
|
});
|
|
2472
2472
|
}
|
|
2473
2473
|
list(e, t = {}, n) {
|
|
2474
|
-
return this._client.getAPIList(
|
|
2474
|
+
return this._client.getAPIList(F`/threads/${e}/runs`, M, {
|
|
2475
2475
|
query: t,
|
|
2476
2476
|
...n,
|
|
2477
2477
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
@@ -2479,7 +2479,7 @@ var jr = class extends N {
|
|
|
2479
2479
|
}
|
|
2480
2480
|
cancel(e, t, n) {
|
|
2481
2481
|
let { thread_id: r } = t;
|
|
2482
|
-
return this._client.post(
|
|
2482
|
+
return this._client.post(F`/threads/${r}/runs/${e}/cancel`, {
|
|
2483
2483
|
...n,
|
|
2484
2484
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
2485
2485
|
});
|
|
@@ -2517,7 +2517,7 @@ var jr = class extends N {
|
|
|
2517
2517
|
isNaN(n) || (e = n);
|
|
2518
2518
|
}
|
|
2519
2519
|
}
|
|
2520
|
-
await
|
|
2520
|
+
await ae(e);
|
|
2521
2521
|
break;
|
|
2522
2522
|
case "requires_action":
|
|
2523
2523
|
case "incomplete":
|
|
@@ -2533,7 +2533,7 @@ var jr = class extends N {
|
|
|
2533
2533
|
}
|
|
2534
2534
|
submitToolOutputs(e, t, n) {
|
|
2535
2535
|
let { thread_id: r, ...i } = t;
|
|
2536
|
-
return this._client.post(
|
|
2536
|
+
return this._client.post(F`/threads/${r}/runs/${e}/submit_tool_outputs`, {
|
|
2537
2537
|
body: i,
|
|
2538
2538
|
...n,
|
|
2539
2539
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers]),
|
|
@@ -2552,7 +2552,7 @@ var jr = class extends N {
|
|
|
2552
2552
|
jr.Steps = fr;
|
|
2553
2553
|
//#endregion
|
|
2554
2554
|
//#region node_modules/openai/resources/beta/threads/threads.mjs
|
|
2555
|
-
var Mr = class extends
|
|
2555
|
+
var Mr = class extends P {
|
|
2556
2556
|
constructor() {
|
|
2557
2557
|
super(...arguments), this.runs = new jr(this._client), this.messages = new dr(this._client);
|
|
2558
2558
|
}
|
|
@@ -2564,20 +2564,20 @@ var Mr = class extends N {
|
|
|
2564
2564
|
});
|
|
2565
2565
|
}
|
|
2566
2566
|
retrieve(e, t) {
|
|
2567
|
-
return this._client.get(
|
|
2567
|
+
return this._client.get(F`/threads/${e}`, {
|
|
2568
2568
|
...t,
|
|
2569
2569
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, t?.headers])
|
|
2570
2570
|
});
|
|
2571
2571
|
}
|
|
2572
2572
|
update(e, t, n) {
|
|
2573
|
-
return this._client.post(
|
|
2573
|
+
return this._client.post(F`/threads/${e}`, {
|
|
2574
2574
|
body: t,
|
|
2575
2575
|
...n,
|
|
2576
2576
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
2577
2577
|
});
|
|
2578
2578
|
}
|
|
2579
2579
|
delete(e, t) {
|
|
2580
|
-
return this._client.delete(
|
|
2580
|
+
return this._client.delete(F`/threads/${e}`, {
|
|
2581
2581
|
...t,
|
|
2582
2582
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, t?.headers])
|
|
2583
2583
|
});
|
|
@@ -2602,7 +2602,7 @@ var Mr = class extends N {
|
|
|
2602
2602
|
Mr.Runs = jr, Mr.Messages = dr;
|
|
2603
2603
|
//#endregion
|
|
2604
2604
|
//#region node_modules/openai/resources/beta/beta.mjs
|
|
2605
|
-
var Nr = class extends
|
|
2605
|
+
var Nr = class extends P {
|
|
2606
2606
|
constructor() {
|
|
2607
2607
|
super(...arguments), this.realtime = new sr(this._client), this.chatkit = new ur(this._client), this.assistants = new ir(this._client), this.threads = new Mr(this._client);
|
|
2608
2608
|
}
|
|
@@ -2610,7 +2610,7 @@ var Nr = class extends N {
|
|
|
2610
2610
|
Nr.Realtime = sr, Nr.ChatKit = ur, Nr.Assistants = ir, Nr.Threads = Mr;
|
|
2611
2611
|
//#endregion
|
|
2612
2612
|
//#region node_modules/openai/resources/completions.mjs
|
|
2613
|
-
var Pr = class extends
|
|
2613
|
+
var Pr = class extends P {
|
|
2614
2614
|
create(e, t) {
|
|
2615
2615
|
return this._client.post("/completions", {
|
|
2616
2616
|
body: e,
|
|
@@ -2618,38 +2618,38 @@ var Pr = class extends N {
|
|
|
2618
2618
|
stream: e.stream ?? !1
|
|
2619
2619
|
});
|
|
2620
2620
|
}
|
|
2621
|
-
}, Fr = class extends
|
|
2621
|
+
}, Fr = class extends P {
|
|
2622
2622
|
retrieve(e, t, n) {
|
|
2623
2623
|
let { container_id: r } = t;
|
|
2624
|
-
return this._client.get(
|
|
2624
|
+
return this._client.get(F`/containers/${r}/files/${e}/content`, {
|
|
2625
2625
|
...n,
|
|
2626
2626
|
headers: H([{ Accept: "application/binary" }, n?.headers]),
|
|
2627
2627
|
__binaryResponse: !0
|
|
2628
2628
|
});
|
|
2629
2629
|
}
|
|
2630
|
-
}, Ir = class extends
|
|
2630
|
+
}, Ir = class extends P {
|
|
2631
2631
|
constructor() {
|
|
2632
2632
|
super(...arguments), this.content = new Fr(this._client);
|
|
2633
2633
|
}
|
|
2634
2634
|
create(e, t, n) {
|
|
2635
|
-
return this._client.post(
|
|
2635
|
+
return this._client.post(F`/containers/${e}/files`, _t({
|
|
2636
2636
|
body: t,
|
|
2637
2637
|
...n
|
|
2638
2638
|
}, this._client));
|
|
2639
2639
|
}
|
|
2640
2640
|
retrieve(e, t, n) {
|
|
2641
2641
|
let { container_id: r } = t;
|
|
2642
|
-
return this._client.get(
|
|
2642
|
+
return this._client.get(F`/containers/${r}/files/${e}`, n);
|
|
2643
2643
|
}
|
|
2644
2644
|
list(e, t = {}, n) {
|
|
2645
|
-
return this._client.getAPIList(
|
|
2645
|
+
return this._client.getAPIList(F`/containers/${e}/files`, M, {
|
|
2646
2646
|
query: t,
|
|
2647
2647
|
...n
|
|
2648
2648
|
});
|
|
2649
2649
|
}
|
|
2650
2650
|
delete(e, t, n) {
|
|
2651
2651
|
let { container_id: r } = t;
|
|
2652
|
-
return this._client.delete(
|
|
2652
|
+
return this._client.delete(F`/containers/${r}/files/${e}`, {
|
|
2653
2653
|
...n,
|
|
2654
2654
|
headers: H([{ Accept: "*/*" }, n?.headers])
|
|
2655
2655
|
});
|
|
@@ -2658,7 +2658,7 @@ var Pr = class extends N {
|
|
|
2658
2658
|
Ir.Content = Fr;
|
|
2659
2659
|
//#endregion
|
|
2660
2660
|
//#region node_modules/openai/resources/containers/containers.mjs
|
|
2661
|
-
var Lr = class extends
|
|
2661
|
+
var Lr = class extends P {
|
|
2662
2662
|
constructor() {
|
|
2663
2663
|
super(...arguments), this.files = new Ir(this._client);
|
|
2664
2664
|
}
|
|
@@ -2669,16 +2669,16 @@ var Lr = class extends N {
|
|
|
2669
2669
|
});
|
|
2670
2670
|
}
|
|
2671
2671
|
retrieve(e, t) {
|
|
2672
|
-
return this._client.get(
|
|
2672
|
+
return this._client.get(F`/containers/${e}`, t);
|
|
2673
2673
|
}
|
|
2674
2674
|
list(e = {}, t) {
|
|
2675
|
-
return this._client.getAPIList("/containers",
|
|
2675
|
+
return this._client.getAPIList("/containers", M, {
|
|
2676
2676
|
query: e,
|
|
2677
2677
|
...t
|
|
2678
2678
|
});
|
|
2679
2679
|
}
|
|
2680
2680
|
delete(e, t) {
|
|
2681
|
-
return this._client.delete(
|
|
2681
|
+
return this._client.delete(F`/containers/${e}`, {
|
|
2682
2682
|
...t,
|
|
2683
2683
|
headers: H([{ Accept: "*/*" }, t?.headers])
|
|
2684
2684
|
});
|
|
@@ -2687,10 +2687,10 @@ var Lr = class extends N {
|
|
|
2687
2687
|
Lr.Files = Ir;
|
|
2688
2688
|
//#endregion
|
|
2689
2689
|
//#region node_modules/openai/resources/conversations/items.mjs
|
|
2690
|
-
var Rr = class extends
|
|
2690
|
+
var Rr = class extends P {
|
|
2691
2691
|
create(e, t, n) {
|
|
2692
2692
|
let { include: r, ...i } = t;
|
|
2693
|
-
return this._client.post(
|
|
2693
|
+
return this._client.post(F`/conversations/${e}/items`, {
|
|
2694
2694
|
query: { include: r },
|
|
2695
2695
|
body: i,
|
|
2696
2696
|
...n
|
|
@@ -2698,22 +2698,22 @@ var Rr = class extends N {
|
|
|
2698
2698
|
}
|
|
2699
2699
|
retrieve(e, t, n) {
|
|
2700
2700
|
let { conversation_id: r, ...i } = t;
|
|
2701
|
-
return this._client.get(
|
|
2701
|
+
return this._client.get(F`/conversations/${r}/items/${e}`, {
|
|
2702
2702
|
query: i,
|
|
2703
2703
|
...n
|
|
2704
2704
|
});
|
|
2705
2705
|
}
|
|
2706
2706
|
list(e, t = {}, n) {
|
|
2707
|
-
return this._client.getAPIList(
|
|
2707
|
+
return this._client.getAPIList(F`/conversations/${e}/items`, ft, {
|
|
2708
2708
|
query: t,
|
|
2709
2709
|
...n
|
|
2710
2710
|
});
|
|
2711
2711
|
}
|
|
2712
2712
|
delete(e, t, n) {
|
|
2713
2713
|
let { conversation_id: r } = t;
|
|
2714
|
-
return this._client.delete(
|
|
2714
|
+
return this._client.delete(F`/conversations/${r}/items/${e}`, n);
|
|
2715
2715
|
}
|
|
2716
|
-
}, zr = class extends
|
|
2716
|
+
}, zr = class extends P {
|
|
2717
2717
|
constructor() {
|
|
2718
2718
|
super(...arguments), this.items = new Rr(this._client);
|
|
2719
2719
|
}
|
|
@@ -2724,25 +2724,25 @@ var Rr = class extends N {
|
|
|
2724
2724
|
});
|
|
2725
2725
|
}
|
|
2726
2726
|
retrieve(e, t) {
|
|
2727
|
-
return this._client.get(
|
|
2727
|
+
return this._client.get(F`/conversations/${e}`, t);
|
|
2728
2728
|
}
|
|
2729
2729
|
update(e, t, n) {
|
|
2730
|
-
return this._client.post(
|
|
2730
|
+
return this._client.post(F`/conversations/${e}`, {
|
|
2731
2731
|
body: t,
|
|
2732
2732
|
...n
|
|
2733
2733
|
});
|
|
2734
2734
|
}
|
|
2735
2735
|
delete(e, t) {
|
|
2736
|
-
return this._client.delete(
|
|
2736
|
+
return this._client.delete(F`/conversations/${e}`, t);
|
|
2737
2737
|
}
|
|
2738
2738
|
};
|
|
2739
2739
|
zr.Items = Rr;
|
|
2740
2740
|
//#endregion
|
|
2741
2741
|
//#region node_modules/openai/resources/embeddings.mjs
|
|
2742
|
-
var Br = class extends
|
|
2742
|
+
var Br = class extends P {
|
|
2743
2743
|
create(e, t) {
|
|
2744
2744
|
let n = !!e.encoding_format, r = n ? e.encoding_format : "base64";
|
|
2745
|
-
n &&
|
|
2745
|
+
n && A(this._client).debug("embeddings/user defined encoding_format:", e.encoding_format);
|
|
2746
2746
|
let i = this._client.post("/embeddings", {
|
|
2747
2747
|
body: {
|
|
2748
2748
|
...e,
|
|
@@ -2750,56 +2750,56 @@ var Br = class extends N {
|
|
|
2750
2750
|
},
|
|
2751
2751
|
...t
|
|
2752
2752
|
});
|
|
2753
|
-
return n ? i : (
|
|
2753
|
+
return n ? i : (A(this._client).debug("embeddings/decoding base64 embeddings from base64"), i._thenUnwrap((e) => (e && e.data && e.data.forEach((e) => {
|
|
2754
2754
|
let t = e.embedding;
|
|
2755
2755
|
e.embedding = pr(t);
|
|
2756
2756
|
}), e)));
|
|
2757
2757
|
}
|
|
2758
|
-
}, Vr = class extends
|
|
2758
|
+
}, Vr = class extends P {
|
|
2759
2759
|
retrieve(e, t, n) {
|
|
2760
2760
|
let { eval_id: r, run_id: i } = t;
|
|
2761
|
-
return this._client.get(
|
|
2761
|
+
return this._client.get(F`/evals/${r}/runs/${i}/output_items/${e}`, n);
|
|
2762
2762
|
}
|
|
2763
2763
|
list(e, t, n) {
|
|
2764
2764
|
let { eval_id: r, ...i } = t;
|
|
2765
|
-
return this._client.getAPIList(
|
|
2765
|
+
return this._client.getAPIList(F`/evals/${r}/runs/${e}/output_items`, M, {
|
|
2766
2766
|
query: i,
|
|
2767
2767
|
...n
|
|
2768
2768
|
});
|
|
2769
2769
|
}
|
|
2770
|
-
}, Hr = class extends
|
|
2770
|
+
}, Hr = class extends P {
|
|
2771
2771
|
constructor() {
|
|
2772
2772
|
super(...arguments), this.outputItems = new Vr(this._client);
|
|
2773
2773
|
}
|
|
2774
2774
|
create(e, t, n) {
|
|
2775
|
-
return this._client.post(
|
|
2775
|
+
return this._client.post(F`/evals/${e}/runs`, {
|
|
2776
2776
|
body: t,
|
|
2777
2777
|
...n
|
|
2778
2778
|
});
|
|
2779
2779
|
}
|
|
2780
2780
|
retrieve(e, t, n) {
|
|
2781
2781
|
let { eval_id: r } = t;
|
|
2782
|
-
return this._client.get(
|
|
2782
|
+
return this._client.get(F`/evals/${r}/runs/${e}`, n);
|
|
2783
2783
|
}
|
|
2784
2784
|
list(e, t = {}, n) {
|
|
2785
|
-
return this._client.getAPIList(
|
|
2785
|
+
return this._client.getAPIList(F`/evals/${e}/runs`, M, {
|
|
2786
2786
|
query: t,
|
|
2787
2787
|
...n
|
|
2788
2788
|
});
|
|
2789
2789
|
}
|
|
2790
2790
|
delete(e, t, n) {
|
|
2791
2791
|
let { eval_id: r } = t;
|
|
2792
|
-
return this._client.delete(
|
|
2792
|
+
return this._client.delete(F`/evals/${r}/runs/${e}`, n);
|
|
2793
2793
|
}
|
|
2794
2794
|
cancel(e, t, n) {
|
|
2795
2795
|
let { eval_id: r } = t;
|
|
2796
|
-
return this._client.post(
|
|
2796
|
+
return this._client.post(F`/evals/${r}/runs/${e}`, n);
|
|
2797
2797
|
}
|
|
2798
2798
|
};
|
|
2799
2799
|
Hr.OutputItems = Vr;
|
|
2800
2800
|
//#endregion
|
|
2801
2801
|
//#region node_modules/openai/resources/evals/evals.mjs
|
|
2802
|
-
var Ur = class extends
|
|
2802
|
+
var Ur = class extends P {
|
|
2803
2803
|
constructor() {
|
|
2804
2804
|
super(...arguments), this.runs = new Hr(this._client);
|
|
2805
2805
|
}
|
|
@@ -2810,48 +2810,48 @@ var Ur = class extends N {
|
|
|
2810
2810
|
});
|
|
2811
2811
|
}
|
|
2812
2812
|
retrieve(e, t) {
|
|
2813
|
-
return this._client.get(
|
|
2813
|
+
return this._client.get(F`/evals/${e}`, t);
|
|
2814
2814
|
}
|
|
2815
2815
|
update(e, t, n) {
|
|
2816
|
-
return this._client.post(
|
|
2816
|
+
return this._client.post(F`/evals/${e}`, {
|
|
2817
2817
|
body: t,
|
|
2818
2818
|
...n
|
|
2819
2819
|
});
|
|
2820
2820
|
}
|
|
2821
2821
|
list(e = {}, t) {
|
|
2822
|
-
return this._client.getAPIList("/evals",
|
|
2822
|
+
return this._client.getAPIList("/evals", M, {
|
|
2823
2823
|
query: e,
|
|
2824
2824
|
...t
|
|
2825
2825
|
});
|
|
2826
2826
|
}
|
|
2827
2827
|
delete(e, t) {
|
|
2828
|
-
return this._client.delete(
|
|
2828
|
+
return this._client.delete(F`/evals/${e}`, t);
|
|
2829
2829
|
}
|
|
2830
2830
|
};
|
|
2831
2831
|
Ur.Runs = Hr;
|
|
2832
2832
|
//#endregion
|
|
2833
2833
|
//#region node_modules/openai/resources/files.mjs
|
|
2834
|
-
var Wr = class extends
|
|
2834
|
+
var Wr = class extends P {
|
|
2835
2835
|
create(e, t) {
|
|
2836
|
-
return this._client.post("/files",
|
|
2836
|
+
return this._client.post("/files", N({
|
|
2837
2837
|
body: e,
|
|
2838
2838
|
...t
|
|
2839
2839
|
}, this._client));
|
|
2840
2840
|
}
|
|
2841
2841
|
retrieve(e, t) {
|
|
2842
|
-
return this._client.get(
|
|
2842
|
+
return this._client.get(F`/files/${e}`, t);
|
|
2843
2843
|
}
|
|
2844
2844
|
list(e = {}, t) {
|
|
2845
|
-
return this._client.getAPIList("/files",
|
|
2845
|
+
return this._client.getAPIList("/files", M, {
|
|
2846
2846
|
query: e,
|
|
2847
2847
|
...t
|
|
2848
2848
|
});
|
|
2849
2849
|
}
|
|
2850
2850
|
delete(e, t) {
|
|
2851
|
-
return this._client.delete(
|
|
2851
|
+
return this._client.delete(F`/files/${e}`, t);
|
|
2852
2852
|
}
|
|
2853
2853
|
content(e, t) {
|
|
2854
|
-
return this._client.get(
|
|
2854
|
+
return this._client.get(F`/files/${e}/content`, {
|
|
2855
2855
|
...t,
|
|
2856
2856
|
headers: H([{ Accept: "application/binary" }, t?.headers]),
|
|
2857
2857
|
__binaryResponse: !0
|
|
@@ -2863,10 +2863,10 @@ var Wr = class extends N {
|
|
|
2863
2863
|
"error",
|
|
2864
2864
|
"deleted"
|
|
2865
2865
|
]), i = Date.now(), a = await this.retrieve(e);
|
|
2866
|
-
for (; !a.status || !r.has(a.status);) if (await
|
|
2866
|
+
for (; !a.status || !r.has(a.status);) if (await ae(t), a = await this.retrieve(e), Date.now() - i > n) throw new l({ message: `Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.` });
|
|
2867
2867
|
return a;
|
|
2868
2868
|
}
|
|
2869
|
-
}, Gr = class extends
|
|
2869
|
+
}, Gr = class extends P {}, Kr = class extends P {
|
|
2870
2870
|
run(e, t) {
|
|
2871
2871
|
return this._client.post("/fine_tuning/alpha/graders/run", {
|
|
2872
2872
|
body: e,
|
|
@@ -2879,7 +2879,7 @@ var Wr = class extends N {
|
|
|
2879
2879
|
...t
|
|
2880
2880
|
});
|
|
2881
2881
|
}
|
|
2882
|
-
}, qr = class extends
|
|
2882
|
+
}, qr = class extends P {
|
|
2883
2883
|
constructor() {
|
|
2884
2884
|
super(...arguments), this.graders = new Kr(this._client);
|
|
2885
2885
|
}
|
|
@@ -2887,31 +2887,31 @@ var Wr = class extends N {
|
|
|
2887
2887
|
qr.Graders = Kr;
|
|
2888
2888
|
//#endregion
|
|
2889
2889
|
//#region node_modules/openai/resources/fine-tuning/checkpoints/permissions.mjs
|
|
2890
|
-
var Jr = class extends
|
|
2890
|
+
var Jr = class extends P {
|
|
2891
2891
|
create(e, t, n) {
|
|
2892
|
-
return this._client.getAPIList(
|
|
2892
|
+
return this._client.getAPIList(F`/fine_tuning/checkpoints/${e}/permissions`, dt, {
|
|
2893
2893
|
body: t,
|
|
2894
2894
|
method: "post",
|
|
2895
2895
|
...n
|
|
2896
2896
|
});
|
|
2897
2897
|
}
|
|
2898
2898
|
retrieve(e, t = {}, n) {
|
|
2899
|
-
return this._client.get(
|
|
2899
|
+
return this._client.get(F`/fine_tuning/checkpoints/${e}/permissions`, {
|
|
2900
2900
|
query: t,
|
|
2901
2901
|
...n
|
|
2902
2902
|
});
|
|
2903
2903
|
}
|
|
2904
2904
|
list(e, t = {}, n) {
|
|
2905
|
-
return this._client.getAPIList(
|
|
2905
|
+
return this._client.getAPIList(F`/fine_tuning/checkpoints/${e}/permissions`, ft, {
|
|
2906
2906
|
query: t,
|
|
2907
2907
|
...n
|
|
2908
2908
|
});
|
|
2909
2909
|
}
|
|
2910
2910
|
delete(e, t, n) {
|
|
2911
2911
|
let { fine_tuned_model_checkpoint: r } = t;
|
|
2912
|
-
return this._client.delete(
|
|
2912
|
+
return this._client.delete(F`/fine_tuning/checkpoints/${r}/permissions/${e}`, n);
|
|
2913
2913
|
}
|
|
2914
|
-
}, Yr = class extends
|
|
2914
|
+
}, Yr = class extends P {
|
|
2915
2915
|
constructor() {
|
|
2916
2916
|
super(...arguments), this.permissions = new Jr(this._client);
|
|
2917
2917
|
}
|
|
@@ -2919,14 +2919,14 @@ var Jr = class extends N {
|
|
|
2919
2919
|
Yr.Permissions = Jr;
|
|
2920
2920
|
//#endregion
|
|
2921
2921
|
//#region node_modules/openai/resources/fine-tuning/jobs/checkpoints.mjs
|
|
2922
|
-
var Xr = class extends
|
|
2922
|
+
var Xr = class extends P {
|
|
2923
2923
|
list(e, t = {}, n) {
|
|
2924
|
-
return this._client.getAPIList(
|
|
2924
|
+
return this._client.getAPIList(F`/fine_tuning/jobs/${e}/checkpoints`, M, {
|
|
2925
2925
|
query: t,
|
|
2926
2926
|
...n
|
|
2927
2927
|
});
|
|
2928
2928
|
}
|
|
2929
|
-
}, Zr = class extends
|
|
2929
|
+
}, Zr = class extends P {
|
|
2930
2930
|
constructor() {
|
|
2931
2931
|
super(...arguments), this.checkpoints = new Xr(this._client);
|
|
2932
2932
|
}
|
|
@@ -2937,58 +2937,58 @@ var Xr = class extends N {
|
|
|
2937
2937
|
});
|
|
2938
2938
|
}
|
|
2939
2939
|
retrieve(e, t) {
|
|
2940
|
-
return this._client.get(
|
|
2940
|
+
return this._client.get(F`/fine_tuning/jobs/${e}`, t);
|
|
2941
2941
|
}
|
|
2942
2942
|
list(e = {}, t) {
|
|
2943
|
-
return this._client.getAPIList("/fine_tuning/jobs",
|
|
2943
|
+
return this._client.getAPIList("/fine_tuning/jobs", M, {
|
|
2944
2944
|
query: e,
|
|
2945
2945
|
...t
|
|
2946
2946
|
});
|
|
2947
2947
|
}
|
|
2948
2948
|
cancel(e, t) {
|
|
2949
|
-
return this._client.post(
|
|
2949
|
+
return this._client.post(F`/fine_tuning/jobs/${e}/cancel`, t);
|
|
2950
2950
|
}
|
|
2951
2951
|
listEvents(e, t = {}, n) {
|
|
2952
|
-
return this._client.getAPIList(
|
|
2952
|
+
return this._client.getAPIList(F`/fine_tuning/jobs/${e}/events`, M, {
|
|
2953
2953
|
query: t,
|
|
2954
2954
|
...n
|
|
2955
2955
|
});
|
|
2956
2956
|
}
|
|
2957
2957
|
pause(e, t) {
|
|
2958
|
-
return this._client.post(
|
|
2958
|
+
return this._client.post(F`/fine_tuning/jobs/${e}/pause`, t);
|
|
2959
2959
|
}
|
|
2960
2960
|
resume(e, t) {
|
|
2961
|
-
return this._client.post(
|
|
2961
|
+
return this._client.post(F`/fine_tuning/jobs/${e}/resume`, t);
|
|
2962
2962
|
}
|
|
2963
2963
|
};
|
|
2964
2964
|
Zr.Checkpoints = Xr;
|
|
2965
2965
|
//#endregion
|
|
2966
2966
|
//#region node_modules/openai/resources/fine-tuning/fine-tuning.mjs
|
|
2967
|
-
var
|
|
2967
|
+
var Qr = class extends P {
|
|
2968
2968
|
constructor() {
|
|
2969
2969
|
super(...arguments), this.methods = new Gr(this._client), this.jobs = new Zr(this._client), this.checkpoints = new Yr(this._client), this.alpha = new qr(this._client);
|
|
2970
2970
|
}
|
|
2971
2971
|
};
|
|
2972
|
-
|
|
2972
|
+
Qr.Methods = Gr, Qr.Jobs = Zr, Qr.Checkpoints = Yr, Qr.Alpha = qr;
|
|
2973
2973
|
//#endregion
|
|
2974
2974
|
//#region node_modules/openai/resources/graders/grader-models.mjs
|
|
2975
|
-
var
|
|
2975
|
+
var $r = class extends P {}, ei = class extends P {
|
|
2976
2976
|
constructor() {
|
|
2977
|
-
super(...arguments), this.graderModels = new
|
|
2977
|
+
super(...arguments), this.graderModels = new $r(this._client);
|
|
2978
2978
|
}
|
|
2979
2979
|
};
|
|
2980
|
-
|
|
2980
|
+
ei.GraderModels = $r;
|
|
2981
2981
|
//#endregion
|
|
2982
2982
|
//#region node_modules/openai/resources/images.mjs
|
|
2983
|
-
var
|
|
2983
|
+
var ti = class extends P {
|
|
2984
2984
|
createVariation(e, t) {
|
|
2985
|
-
return this._client.post("/images/variations",
|
|
2985
|
+
return this._client.post("/images/variations", N({
|
|
2986
2986
|
body: e,
|
|
2987
2987
|
...t
|
|
2988
2988
|
}, this._client));
|
|
2989
2989
|
}
|
|
2990
2990
|
edit(e, t) {
|
|
2991
|
-
return this._client.post("/images/edits",
|
|
2991
|
+
return this._client.post("/images/edits", N({
|
|
2992
2992
|
body: e,
|
|
2993
2993
|
...t,
|
|
2994
2994
|
stream: e.stream ?? !1
|
|
@@ -3001,68 +3001,68 @@ var ei = class extends N {
|
|
|
3001
3001
|
stream: e.stream ?? !1
|
|
3002
3002
|
});
|
|
3003
3003
|
}
|
|
3004
|
-
},
|
|
3004
|
+
}, ni = class extends P {
|
|
3005
3005
|
retrieve(e, t) {
|
|
3006
|
-
return this._client.get(
|
|
3006
|
+
return this._client.get(F`/models/${e}`, t);
|
|
3007
3007
|
}
|
|
3008
3008
|
list(e) {
|
|
3009
|
-
return this._client.getAPIList("/models",
|
|
3009
|
+
return this._client.getAPIList("/models", dt, e);
|
|
3010
3010
|
}
|
|
3011
3011
|
delete(e, t) {
|
|
3012
|
-
return this._client.delete(
|
|
3012
|
+
return this._client.delete(F`/models/${e}`, t);
|
|
3013
3013
|
}
|
|
3014
|
-
},
|
|
3014
|
+
}, ri = class extends P {
|
|
3015
3015
|
create(e, t) {
|
|
3016
3016
|
return this._client.post("/moderations", {
|
|
3017
3017
|
body: e,
|
|
3018
3018
|
...t
|
|
3019
3019
|
});
|
|
3020
3020
|
}
|
|
3021
|
-
},
|
|
3021
|
+
}, ii = class extends P {
|
|
3022
3022
|
accept(e, t, n) {
|
|
3023
|
-
return this._client.post(
|
|
3023
|
+
return this._client.post(F`/realtime/calls/${e}/accept`, {
|
|
3024
3024
|
body: t,
|
|
3025
3025
|
...n,
|
|
3026
3026
|
headers: H([{ Accept: "*/*" }, n?.headers])
|
|
3027
3027
|
});
|
|
3028
3028
|
}
|
|
3029
3029
|
hangup(e, t) {
|
|
3030
|
-
return this._client.post(
|
|
3030
|
+
return this._client.post(F`/realtime/calls/${e}/hangup`, {
|
|
3031
3031
|
...t,
|
|
3032
3032
|
headers: H([{ Accept: "*/*" }, t?.headers])
|
|
3033
3033
|
});
|
|
3034
3034
|
}
|
|
3035
3035
|
refer(e, t, n) {
|
|
3036
|
-
return this._client.post(
|
|
3036
|
+
return this._client.post(F`/realtime/calls/${e}/refer`, {
|
|
3037
3037
|
body: t,
|
|
3038
3038
|
...n,
|
|
3039
3039
|
headers: H([{ Accept: "*/*" }, n?.headers])
|
|
3040
3040
|
});
|
|
3041
3041
|
}
|
|
3042
3042
|
reject(e, t = {}, n) {
|
|
3043
|
-
return this._client.post(
|
|
3043
|
+
return this._client.post(F`/realtime/calls/${e}/reject`, {
|
|
3044
3044
|
body: t,
|
|
3045
3045
|
...n,
|
|
3046
3046
|
headers: H([{ Accept: "*/*" }, n?.headers])
|
|
3047
3047
|
});
|
|
3048
3048
|
}
|
|
3049
|
-
},
|
|
3049
|
+
}, ai = class extends P {
|
|
3050
3050
|
create(e, t) {
|
|
3051
3051
|
return this._client.post("/realtime/client_secrets", {
|
|
3052
3052
|
body: e,
|
|
3053
3053
|
...t
|
|
3054
3054
|
});
|
|
3055
3055
|
}
|
|
3056
|
-
},
|
|
3056
|
+
}, oi = class extends P {
|
|
3057
3057
|
constructor() {
|
|
3058
|
-
super(...arguments), this.clientSecrets = new
|
|
3058
|
+
super(...arguments), this.clientSecrets = new ai(this._client), this.calls = new ii(this._client);
|
|
3059
3059
|
}
|
|
3060
3060
|
};
|
|
3061
|
-
|
|
3061
|
+
oi.ClientSecrets = ai, oi.Calls = ii;
|
|
3062
3062
|
//#endregion
|
|
3063
3063
|
//#region node_modules/openai/lib/ResponsesParser.mjs
|
|
3064
|
-
function
|
|
3065
|
-
return !t || !
|
|
3064
|
+
function si(e, t) {
|
|
3065
|
+
return !t || !ui(t) ? {
|
|
3066
3066
|
...e,
|
|
3067
3067
|
output_parsed: null,
|
|
3068
3068
|
output: e.output.map((e) => e.type === "function_call" ? {
|
|
@@ -3075,18 +3075,18 @@ function oi(e, t) {
|
|
|
3075
3075
|
parsed: null
|
|
3076
3076
|
}))
|
|
3077
3077
|
} : e)
|
|
3078
|
-
} :
|
|
3078
|
+
} : ci(e, t);
|
|
3079
3079
|
}
|
|
3080
|
-
function
|
|
3080
|
+
function ci(e, t) {
|
|
3081
3081
|
let n = e.output.map((e) => {
|
|
3082
3082
|
if (e.type === "function_call") return {
|
|
3083
3083
|
...e,
|
|
3084
|
-
parsed_arguments:
|
|
3084
|
+
parsed_arguments: pi(t, e)
|
|
3085
3085
|
};
|
|
3086
3086
|
if (e.type === "message") {
|
|
3087
3087
|
let n = e.content.map((e) => e.type === "output_text" ? {
|
|
3088
3088
|
...e,
|
|
3089
|
-
parsed:
|
|
3089
|
+
parsed: li(t, e.text)
|
|
3090
3090
|
} : e);
|
|
3091
3091
|
return {
|
|
3092
3092
|
...e,
|
|
@@ -3095,7 +3095,7 @@ function si(e, t) {
|
|
|
3095
3095
|
}
|
|
3096
3096
|
return e;
|
|
3097
3097
|
}), r = Object.assign({}, e, { output: n });
|
|
3098
|
-
return Object.getOwnPropertyDescriptor(e, "output_text") ||
|
|
3098
|
+
return Object.getOwnPropertyDescriptor(e, "output_text") || mi(r), Object.defineProperty(r, "output_parsed", {
|
|
3099
3099
|
enumerable: !0,
|
|
3100
3100
|
get() {
|
|
3101
3101
|
for (let e of r.output) if (e.type === "message") {
|
|
@@ -3105,36 +3105,36 @@ function si(e, t) {
|
|
|
3105
3105
|
}
|
|
3106
3106
|
}), r;
|
|
3107
3107
|
}
|
|
3108
|
-
function
|
|
3108
|
+
function li(e, t) {
|
|
3109
3109
|
return e.text?.format?.type === "json_schema" ? "$parseRaw" in e.text?.format ? (e.text?.format).$parseRaw(t) : JSON.parse(t) : null;
|
|
3110
3110
|
}
|
|
3111
|
-
function li(e) {
|
|
3112
|
-
return !!It(e.text?.format);
|
|
3113
|
-
}
|
|
3114
3111
|
function ui(e) {
|
|
3112
|
+
return !!Ft(e.text?.format);
|
|
3113
|
+
}
|
|
3114
|
+
function di(e) {
|
|
3115
3115
|
return e?.$brand === "auto-parseable-tool";
|
|
3116
3116
|
}
|
|
3117
|
-
function
|
|
3117
|
+
function fi(e, t) {
|
|
3118
3118
|
return e.find((e) => e.type === "function" && e.name === t);
|
|
3119
3119
|
}
|
|
3120
|
-
function
|
|
3121
|
-
let n =
|
|
3120
|
+
function pi(e, t) {
|
|
3121
|
+
let n = fi(e.tools ?? [], t.name);
|
|
3122
3122
|
return {
|
|
3123
3123
|
...t,
|
|
3124
3124
|
...t,
|
|
3125
|
-
parsed_arguments:
|
|
3125
|
+
parsed_arguments: di(n) ? n.$parseRaw(t.arguments) : n?.strict ? JSON.parse(t.arguments) : null
|
|
3126
3126
|
};
|
|
3127
3127
|
}
|
|
3128
|
-
function
|
|
3128
|
+
function mi(e) {
|
|
3129
3129
|
let t = [];
|
|
3130
3130
|
for (let n of e.output) if (n.type === "message") for (let e of n.content) e.type === "output_text" && t.push(e.text);
|
|
3131
3131
|
e.output_text = t.join("");
|
|
3132
3132
|
}
|
|
3133
3133
|
//#endregion
|
|
3134
3134
|
//#region node_modules/openai/lib/responses/ResponseStream.mjs
|
|
3135
|
-
var
|
|
3135
|
+
var hi, gi, Z, _i, vi, yi, bi, xi, Si = class n extends on {
|
|
3136
3136
|
constructor(t) {
|
|
3137
|
-
super(),
|
|
3137
|
+
super(), hi.add(this), gi.set(this, void 0), Z.set(this, void 0), _i.set(this, void 0), e(this, gi, t, "f");
|
|
3138
3138
|
}
|
|
3139
3139
|
static createResponse(e, t, r) {
|
|
3140
3140
|
let i = new n(t);
|
|
@@ -3148,7 +3148,7 @@ var mi, hi, Q, gi, _i, vi, yi, bi, xi = class n extends sn {
|
|
|
3148
3148
|
}
|
|
3149
3149
|
async _createOrRetrieveResponse(e, n, r) {
|
|
3150
3150
|
let i = r?.signal;
|
|
3151
|
-
i && (i.aborted && this.controller.abort(), i.addEventListener("abort", () => this.controller.abort())), t(this,
|
|
3151
|
+
i && (i.aborted && this.controller.abort(), i.addEventListener("abort", () => this.controller.abort())), t(this, hi, "m", vi).call(this);
|
|
3152
3152
|
let a, o = null;
|
|
3153
3153
|
"response_id" in n ? (a = await e.responses.retrieve(n.response_id, { stream: !0 }, {
|
|
3154
3154
|
...r,
|
|
@@ -3161,17 +3161,17 @@ var mi, hi, Q, gi, _i, vi, yi, bi, xi = class n extends sn {
|
|
|
3161
3161
|
...r,
|
|
3162
3162
|
signal: this.controller.signal
|
|
3163
3163
|
}), this._connected();
|
|
3164
|
-
for await (let e of a) t(this,
|
|
3164
|
+
for await (let e of a) t(this, hi, "m", yi).call(this, e, o);
|
|
3165
3165
|
if (a.controller.signal?.aborted) throw new s();
|
|
3166
|
-
return t(this,
|
|
3166
|
+
return t(this, hi, "m", bi).call(this);
|
|
3167
3167
|
}
|
|
3168
|
-
[(
|
|
3169
|
-
this.ended || e(this,
|
|
3170
|
-
},
|
|
3168
|
+
[(gi = /* @__PURE__ */ new WeakMap(), Z = /* @__PURE__ */ new WeakMap(), _i = /* @__PURE__ */ new WeakMap(), hi = /* @__PURE__ */ new WeakSet(), vi = function() {
|
|
3169
|
+
this.ended || e(this, Z, void 0, "f");
|
|
3170
|
+
}, yi = function(e, n) {
|
|
3171
3171
|
if (this.ended) return;
|
|
3172
3172
|
let r = (e, t) => {
|
|
3173
3173
|
(n == null || t.sequence_number > n) && this._emit(e, t);
|
|
3174
|
-
}, i = t(this,
|
|
3174
|
+
}, i = t(this, hi, "m", xi).call(this, e);
|
|
3175
3175
|
switch (r("event", e), e.type) {
|
|
3176
3176
|
case "response.output_text.delta": {
|
|
3177
3177
|
let t = i.output[e.output_index];
|
|
@@ -3200,18 +3200,18 @@ var mi, hi, Q, gi, _i, vi, yi, bi, xi = class n extends sn {
|
|
|
3200
3200
|
r(e.type, e);
|
|
3201
3201
|
break;
|
|
3202
3202
|
}
|
|
3203
|
-
},
|
|
3203
|
+
}, bi = function() {
|
|
3204
3204
|
if (this.ended) throw new a("stream has ended, this shouldn't happen");
|
|
3205
|
-
let n = t(this,
|
|
3205
|
+
let n = t(this, Z, "f");
|
|
3206
3206
|
if (!n) throw new a("request ended without sending any events");
|
|
3207
|
-
e(this,
|
|
3208
|
-
let r =
|
|
3209
|
-
return e(this,
|
|
3210
|
-
},
|
|
3211
|
-
let r = t(this,
|
|
3207
|
+
e(this, Z, void 0, "f");
|
|
3208
|
+
let r = Ci(n, t(this, gi, "f"));
|
|
3209
|
+
return e(this, _i, r, "f"), r;
|
|
3210
|
+
}, xi = function(n) {
|
|
3211
|
+
let r = t(this, Z, "f");
|
|
3212
3212
|
if (!r) {
|
|
3213
3213
|
if (n.type !== "response.created") throw new a(`When snapshot hasn't been set yet, expected 'response.created' event, got ${n.type}`);
|
|
3214
|
-
return r = e(this,
|
|
3214
|
+
return r = e(this, Z, n.response, "f"), r;
|
|
3215
3215
|
}
|
|
3216
3216
|
switch (n.type) {
|
|
3217
3217
|
case "response.output_item.added":
|
|
@@ -3253,7 +3253,7 @@ var mi, hi, Q, gi, _i, vi, yi, bi, xi = class n extends sn {
|
|
|
3253
3253
|
break;
|
|
3254
3254
|
}
|
|
3255
3255
|
case "response.completed":
|
|
3256
|
-
e(this,
|
|
3256
|
+
e(this, Z, n.response, "f");
|
|
3257
3257
|
break;
|
|
3258
3258
|
}
|
|
3259
3259
|
return r;
|
|
@@ -3299,62 +3299,62 @@ var mi, hi, Q, gi, _i, vi, yi, bi, xi = class n extends sn {
|
|
|
3299
3299
|
}
|
|
3300
3300
|
async finalResponse() {
|
|
3301
3301
|
await this.done();
|
|
3302
|
-
let e = t(this,
|
|
3302
|
+
let e = t(this, _i, "f");
|
|
3303
3303
|
if (!e) throw new a("stream ended without producing a ChatCompletion");
|
|
3304
3304
|
return e;
|
|
3305
3305
|
}
|
|
3306
3306
|
};
|
|
3307
|
-
function
|
|
3308
|
-
return
|
|
3307
|
+
function Ci(e, t) {
|
|
3308
|
+
return si(e, t);
|
|
3309
3309
|
}
|
|
3310
3310
|
//#endregion
|
|
3311
3311
|
//#region node_modules/openai/resources/responses/input-items.mjs
|
|
3312
|
-
var
|
|
3312
|
+
var wi = class extends P {
|
|
3313
3313
|
list(e, t = {}, n) {
|
|
3314
|
-
return this._client.getAPIList(
|
|
3314
|
+
return this._client.getAPIList(F`/responses/${e}/input_items`, M, {
|
|
3315
3315
|
query: t,
|
|
3316
3316
|
...n
|
|
3317
3317
|
});
|
|
3318
3318
|
}
|
|
3319
|
-
},
|
|
3319
|
+
}, Ti = class extends P {
|
|
3320
3320
|
count(e = {}, t) {
|
|
3321
3321
|
return this._client.post("/responses/input_tokens", {
|
|
3322
3322
|
body: e,
|
|
3323
3323
|
...t
|
|
3324
3324
|
});
|
|
3325
3325
|
}
|
|
3326
|
-
},
|
|
3326
|
+
}, Ei = class extends P {
|
|
3327
3327
|
constructor() {
|
|
3328
|
-
super(...arguments), this.inputItems = new
|
|
3328
|
+
super(...arguments), this.inputItems = new wi(this._client), this.inputTokens = new Ti(this._client);
|
|
3329
3329
|
}
|
|
3330
3330
|
create(e, t) {
|
|
3331
3331
|
return this._client.post("/responses", {
|
|
3332
3332
|
body: e,
|
|
3333
3333
|
...t,
|
|
3334
3334
|
stream: e.stream ?? !1
|
|
3335
|
-
})._thenUnwrap((e) => ("object" in e && e.object === "response" &&
|
|
3335
|
+
})._thenUnwrap((e) => ("object" in e && e.object === "response" && mi(e), e));
|
|
3336
3336
|
}
|
|
3337
3337
|
retrieve(e, t = {}, n) {
|
|
3338
|
-
return this._client.get(
|
|
3338
|
+
return this._client.get(F`/responses/${e}`, {
|
|
3339
3339
|
query: t,
|
|
3340
3340
|
...n,
|
|
3341
3341
|
stream: t?.stream ?? !1
|
|
3342
|
-
})._thenUnwrap((e) => ("object" in e && e.object === "response" &&
|
|
3342
|
+
})._thenUnwrap((e) => ("object" in e && e.object === "response" && mi(e), e));
|
|
3343
3343
|
}
|
|
3344
3344
|
delete(e, t) {
|
|
3345
|
-
return this._client.delete(
|
|
3345
|
+
return this._client.delete(F`/responses/${e}`, {
|
|
3346
3346
|
...t,
|
|
3347
3347
|
headers: H([{ Accept: "*/*" }, t?.headers])
|
|
3348
3348
|
});
|
|
3349
3349
|
}
|
|
3350
3350
|
parse(e, t) {
|
|
3351
|
-
return this._client.responses.create(e, t)._thenUnwrap((t) =>
|
|
3351
|
+
return this._client.responses.create(e, t)._thenUnwrap((t) => ci(t, e));
|
|
3352
3352
|
}
|
|
3353
3353
|
stream(e, t) {
|
|
3354
|
-
return
|
|
3354
|
+
return Si.createResponse(this._client, e, t);
|
|
3355
3355
|
}
|
|
3356
3356
|
cancel(e, t) {
|
|
3357
|
-
return this._client.post(
|
|
3357
|
+
return this._client.post(F`/responses/${e}/cancel`, t);
|
|
3358
3358
|
}
|
|
3359
3359
|
compact(e, t) {
|
|
3360
3360
|
return this._client.post("/responses/compact", {
|
|
@@ -3363,96 +3363,96 @@ var Ci = class extends N {
|
|
|
3363
3363
|
});
|
|
3364
3364
|
}
|
|
3365
3365
|
};
|
|
3366
|
-
|
|
3366
|
+
Ei.InputItems = wi, Ei.InputTokens = Ti;
|
|
3367
3367
|
//#endregion
|
|
3368
3368
|
//#region node_modules/openai/resources/skills/content.mjs
|
|
3369
|
-
var
|
|
3369
|
+
var Di = class extends P {
|
|
3370
3370
|
retrieve(e, t) {
|
|
3371
|
-
return this._client.get(
|
|
3371
|
+
return this._client.get(F`/skills/${e}/content`, {
|
|
3372
3372
|
...t,
|
|
3373
3373
|
headers: H([{ Accept: "application/binary" }, t?.headers]),
|
|
3374
3374
|
__binaryResponse: !0
|
|
3375
3375
|
});
|
|
3376
3376
|
}
|
|
3377
|
-
},
|
|
3377
|
+
}, Oi = class extends P {
|
|
3378
3378
|
retrieve(e, t, n) {
|
|
3379
3379
|
let { skill_id: r } = t;
|
|
3380
|
-
return this._client.get(
|
|
3380
|
+
return this._client.get(F`/skills/${r}/versions/${e}/content`, {
|
|
3381
3381
|
...n,
|
|
3382
3382
|
headers: H([{ Accept: "application/binary" }, n?.headers]),
|
|
3383
3383
|
__binaryResponse: !0
|
|
3384
3384
|
});
|
|
3385
3385
|
}
|
|
3386
|
-
},
|
|
3386
|
+
}, ki = class extends P {
|
|
3387
3387
|
constructor() {
|
|
3388
|
-
super(...arguments), this.content = new
|
|
3388
|
+
super(...arguments), this.content = new Oi(this._client);
|
|
3389
3389
|
}
|
|
3390
3390
|
create(e, t = {}, n) {
|
|
3391
|
-
return this._client.post(
|
|
3391
|
+
return this._client.post(F`/skills/${e}/versions`, _t({
|
|
3392
3392
|
body: t,
|
|
3393
3393
|
...n
|
|
3394
3394
|
}, this._client));
|
|
3395
3395
|
}
|
|
3396
3396
|
retrieve(e, t, n) {
|
|
3397
3397
|
let { skill_id: r } = t;
|
|
3398
|
-
return this._client.get(
|
|
3398
|
+
return this._client.get(F`/skills/${r}/versions/${e}`, n);
|
|
3399
3399
|
}
|
|
3400
3400
|
list(e, t = {}, n) {
|
|
3401
|
-
return this._client.getAPIList(
|
|
3401
|
+
return this._client.getAPIList(F`/skills/${e}/versions`, M, {
|
|
3402
3402
|
query: t,
|
|
3403
3403
|
...n
|
|
3404
3404
|
});
|
|
3405
3405
|
}
|
|
3406
3406
|
delete(e, t, n) {
|
|
3407
3407
|
let { skill_id: r } = t;
|
|
3408
|
-
return this._client.delete(
|
|
3408
|
+
return this._client.delete(F`/skills/${r}/versions/${e}`, n);
|
|
3409
3409
|
}
|
|
3410
3410
|
};
|
|
3411
|
-
|
|
3411
|
+
ki.Content = Oi;
|
|
3412
3412
|
//#endregion
|
|
3413
3413
|
//#region node_modules/openai/resources/skills/skills.mjs
|
|
3414
|
-
var
|
|
3414
|
+
var Ai = class extends P {
|
|
3415
3415
|
constructor() {
|
|
3416
|
-
super(...arguments), this.content = new
|
|
3416
|
+
super(...arguments), this.content = new Di(this._client), this.versions = new ki(this._client);
|
|
3417
3417
|
}
|
|
3418
3418
|
create(e = {}, t) {
|
|
3419
|
-
return this._client.post("/skills",
|
|
3419
|
+
return this._client.post("/skills", _t({
|
|
3420
3420
|
body: e,
|
|
3421
3421
|
...t
|
|
3422
3422
|
}, this._client));
|
|
3423
3423
|
}
|
|
3424
3424
|
retrieve(e, t) {
|
|
3425
|
-
return this._client.get(
|
|
3425
|
+
return this._client.get(F`/skills/${e}`, t);
|
|
3426
3426
|
}
|
|
3427
3427
|
update(e, t, n) {
|
|
3428
|
-
return this._client.post(
|
|
3428
|
+
return this._client.post(F`/skills/${e}`, {
|
|
3429
3429
|
body: t,
|
|
3430
3430
|
...n
|
|
3431
3431
|
});
|
|
3432
3432
|
}
|
|
3433
3433
|
list(e = {}, t) {
|
|
3434
|
-
return this._client.getAPIList("/skills",
|
|
3434
|
+
return this._client.getAPIList("/skills", M, {
|
|
3435
3435
|
query: e,
|
|
3436
3436
|
...t
|
|
3437
3437
|
});
|
|
3438
3438
|
}
|
|
3439
3439
|
delete(e, t) {
|
|
3440
|
-
return this._client.delete(
|
|
3440
|
+
return this._client.delete(F`/skills/${e}`, t);
|
|
3441
3441
|
}
|
|
3442
3442
|
};
|
|
3443
|
-
|
|
3443
|
+
Ai.Content = Di, Ai.Versions = ki;
|
|
3444
3444
|
//#endregion
|
|
3445
3445
|
//#region node_modules/openai/resources/uploads/parts.mjs
|
|
3446
|
-
var
|
|
3446
|
+
var ji = class extends P {
|
|
3447
3447
|
create(e, t, n) {
|
|
3448
|
-
return this._client.post(
|
|
3448
|
+
return this._client.post(F`/uploads/${e}/parts`, N({
|
|
3449
3449
|
body: t,
|
|
3450
3450
|
...n
|
|
3451
3451
|
}, this._client));
|
|
3452
3452
|
}
|
|
3453
|
-
},
|
|
3453
|
+
}, Mi = class extends P {
|
|
3454
3454
|
constructor() {
|
|
3455
|
-
super(...arguments), this.parts = new
|
|
3455
|
+
super(...arguments), this.parts = new ji(this._client);
|
|
3456
3456
|
}
|
|
3457
3457
|
create(e, t) {
|
|
3458
3458
|
return this._client.post("/uploads", {
|
|
@@ -3461,19 +3461,19 @@ var Ai = class extends N {
|
|
|
3461
3461
|
});
|
|
3462
3462
|
}
|
|
3463
3463
|
cancel(e, t) {
|
|
3464
|
-
return this._client.post(
|
|
3464
|
+
return this._client.post(F`/uploads/${e}/cancel`, t);
|
|
3465
3465
|
}
|
|
3466
3466
|
complete(e, t, n) {
|
|
3467
|
-
return this._client.post(
|
|
3467
|
+
return this._client.post(F`/uploads/${e}/complete`, {
|
|
3468
3468
|
body: t,
|
|
3469
3469
|
...n
|
|
3470
3470
|
});
|
|
3471
3471
|
}
|
|
3472
3472
|
};
|
|
3473
|
-
|
|
3473
|
+
Mi.Parts = ji;
|
|
3474
3474
|
//#endregion
|
|
3475
3475
|
//#region node_modules/openai/lib/Util.mjs
|
|
3476
|
-
var
|
|
3476
|
+
var Ni = async (e) => {
|
|
3477
3477
|
let t = await Promise.allSettled(e), n = t.filter((e) => e.status === "rejected");
|
|
3478
3478
|
if (n.length) {
|
|
3479
3479
|
for (let e of n) console.error(e.reason);
|
|
@@ -3482,9 +3482,9 @@ var Mi = async (e) => {
|
|
|
3482
3482
|
let r = [];
|
|
3483
3483
|
for (let e of t) e.status === "fulfilled" && r.push(e.value);
|
|
3484
3484
|
return r;
|
|
3485
|
-
},
|
|
3485
|
+
}, Pi = class extends P {
|
|
3486
3486
|
create(e, t, n) {
|
|
3487
|
-
return this._client.post(
|
|
3487
|
+
return this._client.post(F`/vector_stores/${e}/file_batches`, {
|
|
3488
3488
|
body: t,
|
|
3489
3489
|
...n,
|
|
3490
3490
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
@@ -3492,14 +3492,14 @@ var Mi = async (e) => {
|
|
|
3492
3492
|
}
|
|
3493
3493
|
retrieve(e, t, n) {
|
|
3494
3494
|
let { vector_store_id: r } = t;
|
|
3495
|
-
return this._client.get(
|
|
3495
|
+
return this._client.get(F`/vector_stores/${r}/file_batches/${e}`, {
|
|
3496
3496
|
...n,
|
|
3497
3497
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
3498
3498
|
});
|
|
3499
3499
|
}
|
|
3500
3500
|
cancel(e, t, n) {
|
|
3501
3501
|
let { vector_store_id: r } = t;
|
|
3502
|
-
return this._client.post(
|
|
3502
|
+
return this._client.post(F`/vector_stores/${r}/file_batches/${e}/cancel`, {
|
|
3503
3503
|
...n,
|
|
3504
3504
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
3505
3505
|
});
|
|
@@ -3510,7 +3510,7 @@ var Mi = async (e) => {
|
|
|
3510
3510
|
}
|
|
3511
3511
|
listFiles(e, t, n) {
|
|
3512
3512
|
let { vector_store_id: r, ...i } = t;
|
|
3513
|
-
return this._client.getAPIList(
|
|
3513
|
+
return this._client.getAPIList(F`/vector_stores/${r}/file_batches/${e}/files`, M, {
|
|
3514
3514
|
query: i,
|
|
3515
3515
|
...n,
|
|
3516
3516
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
@@ -3537,7 +3537,7 @@ var Mi = async (e) => {
|
|
|
3537
3537
|
isNaN(n) || (e = n);
|
|
3538
3538
|
}
|
|
3539
3539
|
}
|
|
3540
|
-
await
|
|
3540
|
+
await ae(e);
|
|
3541
3541
|
break;
|
|
3542
3542
|
case "failed":
|
|
3543
3543
|
case "cancelled":
|
|
@@ -3557,11 +3557,11 @@ var Mi = async (e) => {
|
|
|
3557
3557
|
c.push(e.id);
|
|
3558
3558
|
}
|
|
3559
3559
|
}
|
|
3560
|
-
return await
|
|
3560
|
+
return await Ni(Array(a).fill(s).map(l)), await this.createAndPoll(e, { file_ids: c });
|
|
3561
3561
|
}
|
|
3562
|
-
},
|
|
3562
|
+
}, Fi = class extends P {
|
|
3563
3563
|
create(e, t, n) {
|
|
3564
|
-
return this._client.post(
|
|
3564
|
+
return this._client.post(F`/vector_stores/${e}/files`, {
|
|
3565
3565
|
body: t,
|
|
3566
3566
|
...n,
|
|
3567
3567
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
@@ -3569,21 +3569,21 @@ var Mi = async (e) => {
|
|
|
3569
3569
|
}
|
|
3570
3570
|
retrieve(e, t, n) {
|
|
3571
3571
|
let { vector_store_id: r } = t;
|
|
3572
|
-
return this._client.get(
|
|
3572
|
+
return this._client.get(F`/vector_stores/${r}/files/${e}`, {
|
|
3573
3573
|
...n,
|
|
3574
3574
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
3575
3575
|
});
|
|
3576
3576
|
}
|
|
3577
3577
|
update(e, t, n) {
|
|
3578
3578
|
let { vector_store_id: r, ...i } = t;
|
|
3579
|
-
return this._client.post(
|
|
3579
|
+
return this._client.post(F`/vector_stores/${r}/files/${e}`, {
|
|
3580
3580
|
body: i,
|
|
3581
3581
|
...n,
|
|
3582
3582
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
3583
3583
|
});
|
|
3584
3584
|
}
|
|
3585
3585
|
list(e, t = {}, n) {
|
|
3586
|
-
return this._client.getAPIList(
|
|
3586
|
+
return this._client.getAPIList(F`/vector_stores/${e}/files`, M, {
|
|
3587
3587
|
query: t,
|
|
3588
3588
|
...n,
|
|
3589
3589
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
@@ -3591,7 +3591,7 @@ var Mi = async (e) => {
|
|
|
3591
3591
|
}
|
|
3592
3592
|
delete(e, t, n) {
|
|
3593
3593
|
let { vector_store_id: r } = t;
|
|
3594
|
-
return this._client.delete(
|
|
3594
|
+
return this._client.delete(F`/vector_stores/${r}/files/${e}`, {
|
|
3595
3595
|
...n,
|
|
3596
3596
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
3597
3597
|
});
|
|
@@ -3621,7 +3621,7 @@ var Mi = async (e) => {
|
|
|
3621
3621
|
isNaN(n) || (e = n);
|
|
3622
3622
|
}
|
|
3623
3623
|
}
|
|
3624
|
-
await
|
|
3624
|
+
await ae(e);
|
|
3625
3625
|
break;
|
|
3626
3626
|
case "failed":
|
|
3627
3627
|
case "completed": return a;
|
|
@@ -3641,14 +3641,14 @@ var Mi = async (e) => {
|
|
|
3641
3641
|
}
|
|
3642
3642
|
content(e, t, n) {
|
|
3643
3643
|
let { vector_store_id: r } = t;
|
|
3644
|
-
return this._client.getAPIList(
|
|
3644
|
+
return this._client.getAPIList(F`/vector_stores/${r}/files/${e}/content`, dt, {
|
|
3645
3645
|
...n,
|
|
3646
3646
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
3647
3647
|
});
|
|
3648
3648
|
}
|
|
3649
|
-
},
|
|
3649
|
+
}, Ii = class extends P {
|
|
3650
3650
|
constructor() {
|
|
3651
|
-
super(...arguments), this.files = new
|
|
3651
|
+
super(...arguments), this.files = new Fi(this._client), this.fileBatches = new Pi(this._client);
|
|
3652
3652
|
}
|
|
3653
3653
|
create(e, t) {
|
|
3654
3654
|
return this._client.post("/vector_stores", {
|
|
@@ -3658,33 +3658,33 @@ var Mi = async (e) => {
|
|
|
3658
3658
|
});
|
|
3659
3659
|
}
|
|
3660
3660
|
retrieve(e, t) {
|
|
3661
|
-
return this._client.get(
|
|
3661
|
+
return this._client.get(F`/vector_stores/${e}`, {
|
|
3662
3662
|
...t,
|
|
3663
3663
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, t?.headers])
|
|
3664
3664
|
});
|
|
3665
3665
|
}
|
|
3666
3666
|
update(e, t, n) {
|
|
3667
|
-
return this._client.post(
|
|
3667
|
+
return this._client.post(F`/vector_stores/${e}`, {
|
|
3668
3668
|
body: t,
|
|
3669
3669
|
...n,
|
|
3670
3670
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, n?.headers])
|
|
3671
3671
|
});
|
|
3672
3672
|
}
|
|
3673
3673
|
list(e = {}, t) {
|
|
3674
|
-
return this._client.getAPIList("/vector_stores",
|
|
3674
|
+
return this._client.getAPIList("/vector_stores", M, {
|
|
3675
3675
|
query: e,
|
|
3676
3676
|
...t,
|
|
3677
3677
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, t?.headers])
|
|
3678
3678
|
});
|
|
3679
3679
|
}
|
|
3680
3680
|
delete(e, t) {
|
|
3681
|
-
return this._client.delete(
|
|
3681
|
+
return this._client.delete(F`/vector_stores/${e}`, {
|
|
3682
3682
|
...t,
|
|
3683
3683
|
headers: H([{ "OpenAI-Beta": "assistants=v2" }, t?.headers])
|
|
3684
3684
|
});
|
|
3685
3685
|
}
|
|
3686
3686
|
search(e, t, n) {
|
|
3687
|
-
return this._client.getAPIList(
|
|
3687
|
+
return this._client.getAPIList(F`/vector_stores/${e}/search`, dt, {
|
|
3688
3688
|
body: t,
|
|
3689
3689
|
method: "post",
|
|
3690
3690
|
...n,
|
|
@@ -3692,53 +3692,74 @@ var Mi = async (e) => {
|
|
|
3692
3692
|
});
|
|
3693
3693
|
}
|
|
3694
3694
|
};
|
|
3695
|
-
|
|
3695
|
+
Ii.Files = Fi, Ii.FileBatches = Pi;
|
|
3696
3696
|
//#endregion
|
|
3697
3697
|
//#region node_modules/openai/resources/videos.mjs
|
|
3698
|
-
var
|
|
3698
|
+
var Li = class extends P {
|
|
3699
3699
|
create(e, t) {
|
|
3700
|
-
return this._client.post("/videos",
|
|
3700
|
+
return this._client.post("/videos", N({
|
|
3701
3701
|
body: e,
|
|
3702
3702
|
...t
|
|
3703
3703
|
}, this._client));
|
|
3704
3704
|
}
|
|
3705
3705
|
retrieve(e, t) {
|
|
3706
|
-
return this._client.get(
|
|
3706
|
+
return this._client.get(F`/videos/${e}`, t);
|
|
3707
3707
|
}
|
|
3708
3708
|
list(e = {}, t) {
|
|
3709
|
-
return this._client.getAPIList("/videos",
|
|
3709
|
+
return this._client.getAPIList("/videos", ft, {
|
|
3710
3710
|
query: e,
|
|
3711
3711
|
...t
|
|
3712
3712
|
});
|
|
3713
3713
|
}
|
|
3714
3714
|
delete(e, t) {
|
|
3715
|
-
return this._client.delete(
|
|
3715
|
+
return this._client.delete(F`/videos/${e}`, t);
|
|
3716
|
+
}
|
|
3717
|
+
createCharacter(e, t) {
|
|
3718
|
+
return this._client.post("/videos/characters", N({
|
|
3719
|
+
body: e,
|
|
3720
|
+
...t
|
|
3721
|
+
}, this._client));
|
|
3716
3722
|
}
|
|
3717
3723
|
downloadContent(e, t = {}, n) {
|
|
3718
|
-
return this._client.get(
|
|
3724
|
+
return this._client.get(F`/videos/${e}/content`, {
|
|
3719
3725
|
query: t,
|
|
3720
3726
|
...n,
|
|
3721
3727
|
headers: H([{ Accept: "application/binary" }, n?.headers]),
|
|
3722
3728
|
__binaryResponse: !0
|
|
3723
3729
|
});
|
|
3724
3730
|
}
|
|
3731
|
+
edit(e, t) {
|
|
3732
|
+
return this._client.post("/videos/edits", N({
|
|
3733
|
+
body: e,
|
|
3734
|
+
...t
|
|
3735
|
+
}, this._client));
|
|
3736
|
+
}
|
|
3737
|
+
extend(e, t) {
|
|
3738
|
+
return this._client.post("/videos/extensions", N({
|
|
3739
|
+
body: e,
|
|
3740
|
+
...t
|
|
3741
|
+
}, this._client));
|
|
3742
|
+
}
|
|
3743
|
+
getCharacter(e, t) {
|
|
3744
|
+
return this._client.get(F`/videos/characters/${e}`, t);
|
|
3745
|
+
}
|
|
3725
3746
|
remix(e, t, n) {
|
|
3726
|
-
return this._client.post(
|
|
3747
|
+
return this._client.post(F`/videos/${e}/remix`, _t({
|
|
3727
3748
|
body: t,
|
|
3728
3749
|
...n
|
|
3729
3750
|
}, this._client));
|
|
3730
3751
|
}
|
|
3731
|
-
},
|
|
3752
|
+
}, Q, Ri, zi, Bi = class extends P {
|
|
3732
3753
|
constructor() {
|
|
3733
|
-
super(...arguments),
|
|
3754
|
+
super(...arguments), Q.add(this);
|
|
3734
3755
|
}
|
|
3735
3756
|
async unwrap(e, t, n = this._client.webhookSecret, r = 300) {
|
|
3736
3757
|
return await this.verifySignature(e, t, n, r), JSON.parse(e);
|
|
3737
3758
|
}
|
|
3738
3759
|
async verifySignature(e, n, r = this._client.webhookSecret, i = 300) {
|
|
3739
3760
|
if (typeof crypto > "u" || typeof crypto.subtle.importKey != "function" || typeof crypto.subtle.verify != "function") throw Error("Webhook signature verification is only supported when the `crypto` global is defined");
|
|
3740
|
-
t(this,
|
|
3741
|
-
let a = H([n]).values, o = t(this,
|
|
3761
|
+
t(this, Q, "m", Ri).call(this, r);
|
|
3762
|
+
let a = H([n]).values, o = t(this, Q, "m", zi).call(this, a, "webhook-signature"), s = t(this, Q, "m", zi).call(this, a, "webhook-timestamp"), c = t(this, Q, "m", zi).call(this, a, "webhook-id"), l = parseInt(s, 10);
|
|
3742
3763
|
if (isNaN(l)) throw new b("Invalid webhook timestamp format");
|
|
3743
3764
|
let u = Math.floor(Date.now() / 1e3);
|
|
3744
3765
|
if (u - l > i) throw new b("Webhook timestamp is too old");
|
|
@@ -3756,7 +3777,7 @@ var Ii = class extends N {
|
|
|
3756
3777
|
throw new b("The given webhook signature does not match the expected signature");
|
|
3757
3778
|
}
|
|
3758
3779
|
};
|
|
3759
|
-
|
|
3780
|
+
Q = /* @__PURE__ */ new WeakSet(), Ri = function(e) {
|
|
3760
3781
|
if (typeof e != "string" || e.length === 0) throw Error("The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function");
|
|
3761
3782
|
}, zi = function(e, t) {
|
|
3762
3783
|
if (!e) throw Error("Headers are required");
|
|
@@ -3768,7 +3789,7 @@ Li = /* @__PURE__ */ new WeakSet(), Ri = function(e) {
|
|
|
3768
3789
|
//#region node_modules/openai/client.mjs
|
|
3769
3790
|
var Vi, Hi, Ui, Wi, $ = class {
|
|
3770
3791
|
constructor({ baseURL: t = U("OPENAI_BASE_URL"), apiKey: n = U("OPENAI_API_KEY"), organization: r = U("OPENAI_ORG_ID") ?? null, project: i = U("OPENAI_PROJECT_ID") ?? null, webhookSecret: o = U("OPENAI_WEBHOOK_SECRET") ?? null, ...s } = {}) {
|
|
3771
|
-
if (Vi.add(this), Ui.set(this, void 0), this.completions = new Pr(this), this.chat = new Xn(this), this.embeddings = new Br(this), this.files = new Wr(this), this.images = new
|
|
3792
|
+
if (Vi.add(this), Ui.set(this, void 0), this.completions = new Pr(this), this.chat = new Xn(this), this.embeddings = new Br(this), this.files = new Wr(this), this.images = new ti(this), this.audio = new nr(this), this.moderations = new ri(this), this.models = new ni(this), this.fineTuning = new Qr(this), this.graders = new ei(this), this.vectorStores = new Ii(this), this.webhooks = new Bi(this), this.beta = new Nr(this), this.batches = new rr(this), this.uploads = new Mi(this), this.responses = new Ei(this), this.realtime = new oi(this), this.conversations = new zr(this), this.evals = new Ur(this), this.containers = new Lr(this), this.skills = new Ai(this), this.videos = new Li(this), n === void 0) throw new a("Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.");
|
|
3772
3793
|
let c = {
|
|
3773
3794
|
apiKey: n,
|
|
3774
3795
|
organization: r,
|
|
@@ -3777,10 +3798,10 @@ var Vi, Hi, Ui, Wi, $ = class {
|
|
|
3777
3798
|
...s,
|
|
3778
3799
|
baseURL: t || "https://api.openai.com/v1"
|
|
3779
3800
|
};
|
|
3780
|
-
if (!c.dangerouslyAllowBrowser &&
|
|
3801
|
+
if (!c.dangerouslyAllowBrowser && se()) throw new a("It looks like you're running in a browser-like environment.\n\nThis is disabled by default, as it risks exposing your secret API credentials to attackers.\nIf you understand the risks and have appropriate mitigations in place,\nyou can set the `dangerouslyAllowBrowser` option to `true`, e.g.,\n\nnew OpenAI({ apiKey, dangerouslyAllowBrowser: true });\n\nhttps://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety\n");
|
|
3781
3802
|
this.baseURL = c.baseURL, this.timeout = c.timeout ?? Hi.DEFAULT_TIMEOUT, this.logger = c.logger ?? console;
|
|
3782
3803
|
let l = "warn";
|
|
3783
|
-
this.logLevel = l, this.logLevel =
|
|
3804
|
+
this.logLevel = l, this.logLevel = qe(c.logLevel, "ClientOptions.logLevel", this) ?? qe(U("OPENAI_LOG"), "process.env['OPENAI_LOG']", this) ?? l, this.fetchOptions = c.fetchOptions, this.maxRetries = c.maxRetries ?? 2, this.fetch = c.fetch ?? he(), e(this, Ui, be, "f"), this._options = c, this.apiKey = typeof n == "string" ? n : "Missing Key", this.organization = r, this.project = i, this.webhookSecret = o;
|
|
3784
3805
|
}
|
|
3785
3806
|
withOptions(e) {
|
|
3786
3807
|
return new this.constructor({
|
|
@@ -3807,10 +3828,10 @@ var Vi, Hi, Ui, Wi, $ = class {
|
|
|
3807
3828
|
return H([{ Authorization: `Bearer ${this.apiKey}` }]);
|
|
3808
3829
|
}
|
|
3809
3830
|
stringifyQuery(e) {
|
|
3810
|
-
return
|
|
3831
|
+
return Le(e);
|
|
3811
3832
|
}
|
|
3812
3833
|
getUserAgent() {
|
|
3813
|
-
return `${this.constructor.name}/JS ${
|
|
3834
|
+
return `${this.constructor.name}/JS ${oe}`;
|
|
3814
3835
|
}
|
|
3815
3836
|
defaultIdempotencyKey() {
|
|
3816
3837
|
return `stainless-node-retry-${n()}`;
|
|
@@ -3831,8 +3852,9 @@ var Vi, Hi, Ui, Wi, $ = class {
|
|
|
3831
3852
|
return this.apiKey = t, !0;
|
|
3832
3853
|
}
|
|
3833
3854
|
buildURL(e, n, r) {
|
|
3834
|
-
let i = !t(this, Vi, "m", Wi).call(this) && r || this.baseURL, a = te(e) ? new URL(e) : new URL(i + (i.endsWith("/") && e.startsWith("/") ? e.slice(1) : e)), o = this.defaultQuery();
|
|
3835
|
-
return
|
|
3855
|
+
let i = !t(this, Vi, "m", Wi).call(this) && r || this.baseURL, a = te(e) ? new URL(e) : new URL(i + (i.endsWith("/") && e.startsWith("/") ? e.slice(1) : e)), o = this.defaultQuery(), s = Object.fromEntries(a.searchParams);
|
|
3856
|
+
return (!w(o) || !w(s)) && (n = {
|
|
3857
|
+
...s,
|
|
3836
3858
|
...o,
|
|
3837
3859
|
...n
|
|
3838
3860
|
}), typeof n == "object" && n && !Array.isArray(n) && (a.search = this.stringifyQuery(n)), a.toString();
|
|
@@ -3864,7 +3886,7 @@ var Vi, Hi, Ui, Wi, $ = class {
|
|
|
3864
3886
|
})));
|
|
3865
3887
|
}
|
|
3866
3888
|
request(e, t = null) {
|
|
3867
|
-
return new
|
|
3889
|
+
return new st(this, this.makeRequest(e, t, void 0));
|
|
3868
3890
|
}
|
|
3869
3891
|
async makeRequest(e, t, n) {
|
|
3870
3892
|
let a = await e, o = a.maxRetries ?? this.maxRetries;
|
|
@@ -3875,7 +3897,7 @@ var Vi, Hi, Ui, Wi, $ = class {
|
|
|
3875
3897
|
options: a
|
|
3876
3898
|
});
|
|
3877
3899
|
let p = "log_" + (Math.random() * (1 << 24) | 0).toString(16).padStart(6, "0"), m = n === void 0 ? "" : `, retryOf: ${n}`, h = Date.now();
|
|
3878
|
-
if (
|
|
3900
|
+
if (A(this).debug(`[${p}] sending request`, j({
|
|
3879
3901
|
retryOfRequestLogID: n,
|
|
3880
3902
|
method: a.method,
|
|
3881
3903
|
url: d,
|
|
@@ -3887,13 +3909,13 @@ var Vi, Hi, Ui, Wi, $ = class {
|
|
|
3887
3909
|
let e = `retrying, ${t} attempts remaining`;
|
|
3888
3910
|
if (a.signal?.aborted) throw new s();
|
|
3889
3911
|
let i = r(_) || /timed? ?out/i.test(String(_) + ("cause" in _ ? String(_.cause) : ""));
|
|
3890
|
-
if (t) return
|
|
3912
|
+
if (t) return A(this).info(`[${p}] connection ${i ? "timed out" : "failed"} - ${e}`), A(this).debug(`[${p}] connection ${i ? "timed out" : "failed"} (${e})`, j({
|
|
3891
3913
|
retryOfRequestLogID: n,
|
|
3892
3914
|
url: d,
|
|
3893
3915
|
durationMs: v - h,
|
|
3894
3916
|
message: _.message
|
|
3895
3917
|
})), this.retryRequest(a, t, n ?? p);
|
|
3896
|
-
throw
|
|
3918
|
+
throw A(this).info(`[${p}] connection ${i ? "timed out" : "failed"} - error; no more retries left`), A(this).debug(`[${p}] connection ${i ? "timed out" : "failed"} (error; no more retries left)`, j({
|
|
3897
3919
|
retryOfRequestLogID: n,
|
|
3898
3920
|
url: d,
|
|
3899
3921
|
durationMs: v - h,
|
|
@@ -3905,7 +3927,7 @@ var Vi, Hi, Ui, Wi, $ = class {
|
|
|
3905
3927
|
let e = await this.shouldRetry(_);
|
|
3906
3928
|
if (t && e) {
|
|
3907
3929
|
let e = `retrying, ${t} attempts remaining`;
|
|
3908
|
-
return await
|
|
3930
|
+
return await ye(_.body), A(this).info(`${y} - ${e}`), A(this).debug(`[${p}] response error (${e})`, j({
|
|
3909
3931
|
retryOfRequestLogID: n,
|
|
3910
3932
|
url: _.url,
|
|
3911
3933
|
status: _.status,
|
|
@@ -3914,9 +3936,9 @@ var Vi, Hi, Ui, Wi, $ = class {
|
|
|
3914
3936
|
})), this.retryRequest(a, t, n ?? p, _.headers);
|
|
3915
3937
|
}
|
|
3916
3938
|
let r = e ? "error; no more retries left" : "error; not retryable";
|
|
3917
|
-
|
|
3918
|
-
let o = await _.text().catch((e) => i(e).message), s =
|
|
3919
|
-
throw
|
|
3939
|
+
A(this).info(`${y} - ${r}`);
|
|
3940
|
+
let o = await _.text().catch((e) => i(e).message), s = ie(o), c = s ? void 0 : o;
|
|
3941
|
+
throw A(this).debug(`[${p}] response error (${r})`, j({
|
|
3920
3942
|
retryOfRequestLogID: n,
|
|
3921
3943
|
url: _.url,
|
|
3922
3944
|
status: _.status,
|
|
@@ -3925,7 +3947,7 @@ var Vi, Hi, Ui, Wi, $ = class {
|
|
|
3925
3947
|
durationMs: Date.now() - h
|
|
3926
3948
|
})), this.makeStatusError(_.status, s, c, _.headers);
|
|
3927
3949
|
}
|
|
3928
|
-
return
|
|
3950
|
+
return A(this).info(y), A(this).debug(`[${p}] response start`, j({
|
|
3929
3951
|
retryOfRequestLogID: n,
|
|
3930
3952
|
url: _.url,
|
|
3931
3953
|
status: _.status,
|
|
@@ -3953,7 +3975,7 @@ var Vi, Hi, Ui, Wi, $ = class {
|
|
|
3953
3975
|
}
|
|
3954
3976
|
requestAPIList(e, t) {
|
|
3955
3977
|
let n = this.makeRequest(t, null, void 0);
|
|
3956
|
-
return new
|
|
3978
|
+
return new ut(this, n, e);
|
|
3957
3979
|
}
|
|
3958
3980
|
async fetchWithTimeout(e, t, n, r) {
|
|
3959
3981
|
let { signal: i, method: a, ...o } = t || {}, s = this._makeAbort(r);
|
|
@@ -3990,7 +4012,7 @@ var Vi, Hi, Ui, Wi, $ = class {
|
|
|
3990
4012
|
let n = e.maxRetries ?? this.maxRetries;
|
|
3991
4013
|
i = this.calculateDefaultRetryTimeoutMillis(t, n);
|
|
3992
4014
|
}
|
|
3993
|
-
return await
|
|
4015
|
+
return await ae(i), this.makeRequest(e, t - 1, n);
|
|
3994
4016
|
}
|
|
3995
4017
|
calculateDefaultRetryTimeoutMillis(e, t) {
|
|
3996
4018
|
let n = t - e;
|
|
@@ -3998,7 +4020,7 @@ var Vi, Hi, Ui, Wi, $ = class {
|
|
|
3998
4020
|
}
|
|
3999
4021
|
async buildRequest(e, { retryCount: t = 0 } = {}) {
|
|
4000
4022
|
let n = { ...e }, { method: r, path: i, query: a, defaultBaseURL: o } = n, s = this.buildURL(i, a, o);
|
|
4001
|
-
"timeout" in n &&
|
|
4023
|
+
"timeout" in n && re("timeout", n.timeout), n.timeout = n.timeout ?? this.timeout;
|
|
4002
4024
|
let { bodyHeaders: c, body: l } = this.buildBody({ options: n });
|
|
4003
4025
|
return {
|
|
4004
4026
|
req: {
|
|
@@ -4029,7 +4051,7 @@ var Vi, Hi, Ui, Wi, $ = class {
|
|
|
4029
4051
|
"User-Agent": this.getUserAgent(),
|
|
4030
4052
|
"X-Stainless-Retry-Count": String(r),
|
|
4031
4053
|
...e.timeout ? { "X-Stainless-Timeout": String(Math.trunc(e.timeout / 1e3)) } : {},
|
|
4032
|
-
...
|
|
4054
|
+
...me(),
|
|
4033
4055
|
"OpenAI-Organization": this.organization,
|
|
4034
4056
|
"OpenAI-Project": this.project
|
|
4035
4057
|
},
|
|
@@ -4054,7 +4076,7 @@ var Vi, Hi, Ui, Wi, $ = class {
|
|
|
4054
4076
|
body: e
|
|
4055
4077
|
} : typeof e == "object" && (Symbol.asyncIterator in e || Symbol.iterator in e && "next" in e && typeof e.next == "function") ? {
|
|
4056
4078
|
bodyHeaders: void 0,
|
|
4057
|
-
body:
|
|
4079
|
+
body: _e(e)
|
|
4058
4080
|
} : typeof e == "object" && r.values.get("content-type") === "application/x-www-form-urlencoded" ? {
|
|
4059
4081
|
bodyHeaders: { "content-type": "application/x-www-form-urlencoded" },
|
|
4060
4082
|
body: this.stringifyQuery(e)
|
|
@@ -4066,7 +4088,7 @@ var Vi, Hi, Ui, Wi, $ = class {
|
|
|
4066
4088
|
};
|
|
4067
4089
|
Hi = $, Ui = /* @__PURE__ */ new WeakMap(), Vi = /* @__PURE__ */ new WeakSet(), Wi = function() {
|
|
4068
4090
|
return this.baseURL !== "https://api.openai.com/v1";
|
|
4069
|
-
}, $.OpenAI = Hi, $.DEFAULT_TIMEOUT = 6e5, $.OpenAIError = a, $.APIError = o, $.APIConnectionError = c, $.APIConnectionTimeoutError = l, $.APIUserAbortError = s, $.NotFoundError = p, $.ConflictError = m, $.RateLimitError = g, $.BadRequestError = u, $.AuthenticationError = d, $.InternalServerError = _, $.PermissionDeniedError = f, $.UnprocessableEntityError = h, $.InvalidWebhookSignatureError = b, $.toFile =
|
|
4091
|
+
}, $.OpenAI = Hi, $.DEFAULT_TIMEOUT = 6e5, $.OpenAIError = a, $.APIError = o, $.APIConnectionError = c, $.APIConnectionTimeoutError = l, $.APIUserAbortError = s, $.NotFoundError = p, $.ConflictError = m, $.RateLimitError = g, $.BadRequestError = u, $.AuthenticationError = d, $.InternalServerError = _, $.PermissionDeniedError = f, $.UnprocessableEntityError = h, $.InvalidWebhookSignatureError = b, $.toFile = Ot, $.Completions = Pr, $.Chat = Xn, $.Embeddings = Br, $.Files = Wr, $.Images = ti, $.Audio = nr, $.Moderations = ri, $.Models = ni, $.FineTuning = Qr, $.Graders = ei, $.VectorStores = Ii, $.Webhooks = Bi, $.Beta = Nr, $.Batches = rr, $.Uploads = Mi, $.Responses = Ei, $.Realtime = oi, $.Conversations = zr, $.Evals = Ur, $.Containers = Lr, $.Skills = Ai, $.Videos = Li;
|
|
4070
4092
|
//#endregion
|
|
4071
4093
|
//#region node_modules/openai/azure.mjs
|
|
4072
4094
|
var Gi = class extends $ {
|
|
@@ -4090,7 +4112,7 @@ var Gi = class extends $ {
|
|
|
4090
4112
|
}
|
|
4091
4113
|
async buildRequest(e, t = {}) {
|
|
4092
4114
|
if (Ki.has(e.path) && e.method === "post" && e.body !== void 0) {
|
|
4093
|
-
if (!
|
|
4115
|
+
if (!T(e.body)) throw Error("Expected request body to be an object");
|
|
4094
4116
|
let t = this.deploymentName || e.body.model || e.__metadata?.model;
|
|
4095
4117
|
t !== void 0 && !this.baseURL.includes("/deployments") && (e.path = `/deployments/${t}${e.path}`);
|
|
4096
4118
|
}
|
|
@@ -4111,4 +4133,4 @@ var Gi = class extends $ {
|
|
|
4111
4133
|
"/images/edits"
|
|
4112
4134
|
]);
|
|
4113
4135
|
//#endregion
|
|
4114
|
-
export { c as APIConnectionError, l as APIConnectionTimeoutError, o as APIError,
|
|
4136
|
+
export { c as APIConnectionError, l as APIConnectionTimeoutError, o as APIError, st as APIPromise, s as APIUserAbortError, d as AuthenticationError, Gi as AzureOpenAI, u as BadRequestError, m as ConflictError, _ as InternalServerError, b as InvalidWebhookSignatureError, p as NotFoundError, $ as OpenAI, $ as default, a as OpenAIError, ut as PagePromise, f as PermissionDeniedError, g as RateLimitError, h as UnprocessableEntityError, Ot as toFile };
|