@kevisual/ai 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-provider-browser.js +494 -198
- package/dist/ai-provider.js +494 -198
- package/package.json +17 -17
- package/src/provider/knowledge.ts +4 -3
- package/src/test/aliyun/test.ts +26 -0
- package/src/test/func-call/demo.ts +2 -2
- package/src/test/model-scope/index.ts +4 -4
package/dist/ai-provider.js
CHANGED
|
@@ -1235,7 +1235,7 @@ var require_enc_utf8 = __commonJS((exports, module) => {
|
|
|
1235
1235
|
});
|
|
1236
1236
|
});
|
|
1237
1237
|
|
|
1238
|
-
// node_modules/.pnpm/openai@
|
|
1238
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/tslib.mjs
|
|
1239
1239
|
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
1240
1240
|
if (kind === "m")
|
|
1241
1241
|
throw new TypeError("Private method is not writable");
|
|
@@ -1253,7 +1253,7 @@ function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
|
1253
1253
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
1254
1254
|
}
|
|
1255
1255
|
|
|
1256
|
-
// node_modules/.pnpm/openai@
|
|
1256
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/utils/uuid.mjs
|
|
1257
1257
|
var uuid4 = function() {
|
|
1258
1258
|
const { crypto: crypto2 } = globalThis;
|
|
1259
1259
|
if (crypto2?.randomUUID) {
|
|
@@ -1265,7 +1265,7 @@ var uuid4 = function() {
|
|
|
1265
1265
|
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c) => (+c ^ randomByte() & 15 >> +c / 4).toString(16));
|
|
1266
1266
|
};
|
|
1267
1267
|
|
|
1268
|
-
// node_modules/.pnpm/openai@
|
|
1268
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/errors.mjs
|
|
1269
1269
|
function isAbortError(err) {
|
|
1270
1270
|
return typeof err === "object" && err !== null && (("name" in err) && err.name === "AbortError" || ("message" in err) && String(err.message).includes("FetchRequestCanceledException"));
|
|
1271
1271
|
}
|
|
@@ -1292,7 +1292,7 @@ var castToError = (err) => {
|
|
|
1292
1292
|
return new Error(err);
|
|
1293
1293
|
};
|
|
1294
1294
|
|
|
1295
|
-
// node_modules/.pnpm/openai@
|
|
1295
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/core/error.mjs
|
|
1296
1296
|
class OpenAIError extends Error {
|
|
1297
1297
|
}
|
|
1298
1298
|
|
|
@@ -1416,7 +1416,7 @@ class InvalidWebhookSignatureError extends Error {
|
|
|
1416
1416
|
}
|
|
1417
1417
|
}
|
|
1418
1418
|
|
|
1419
|
-
// node_modules/.pnpm/openai@
|
|
1419
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/utils/values.mjs
|
|
1420
1420
|
var startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i;
|
|
1421
1421
|
var isAbsoluteURL = (url) => {
|
|
1422
1422
|
return startsWithSchemeRegexp.test(url);
|
|
@@ -1459,13 +1459,13 @@ var safeJSON = (text) => {
|
|
|
1459
1459
|
}
|
|
1460
1460
|
};
|
|
1461
1461
|
|
|
1462
|
-
// node_modules/.pnpm/openai@
|
|
1462
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/utils/sleep.mjs
|
|
1463
1463
|
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
1464
1464
|
|
|
1465
|
-
// node_modules/.pnpm/openai@
|
|
1466
|
-
var VERSION = "
|
|
1465
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/version.mjs
|
|
1466
|
+
var VERSION = "6.6.0";
|
|
1467
1467
|
|
|
1468
|
-
// node_modules/.pnpm/openai@
|
|
1468
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/detect-platform.mjs
|
|
1469
1469
|
var isRunningInBrowser = () => {
|
|
1470
1470
|
return typeof window !== "undefined" && typeof window.document !== "undefined" && typeof navigator !== "undefined";
|
|
1471
1471
|
};
|
|
@@ -1594,7 +1594,7 @@ var getPlatformHeaders = () => {
|
|
|
1594
1594
|
return _platformHeaders ?? (_platformHeaders = getPlatformProperties());
|
|
1595
1595
|
};
|
|
1596
1596
|
|
|
1597
|
-
// node_modules/.pnpm/openai@
|
|
1597
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/shims.mjs
|
|
1598
1598
|
function getDefaultFetch() {
|
|
1599
1599
|
if (typeof fetch !== "undefined") {
|
|
1600
1600
|
return fetch;
|
|
@@ -1665,7 +1665,7 @@ async function CancelReadableStream(stream) {
|
|
|
1665
1665
|
await cancelPromise;
|
|
1666
1666
|
}
|
|
1667
1667
|
|
|
1668
|
-
// node_modules/.pnpm/openai@
|
|
1668
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/request-options.mjs
|
|
1669
1669
|
var FallbackEncoder = ({ headers, body }) => {
|
|
1670
1670
|
return {
|
|
1671
1671
|
bodyHeaders: {
|
|
@@ -1675,7 +1675,7 @@ var FallbackEncoder = ({ headers, body }) => {
|
|
|
1675
1675
|
};
|
|
1676
1676
|
};
|
|
1677
1677
|
|
|
1678
|
-
// node_modules/.pnpm/openai@
|
|
1678
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/qs/formats.mjs
|
|
1679
1679
|
var default_format = "RFC3986";
|
|
1680
1680
|
var default_formatter = (v) => String(v);
|
|
1681
1681
|
var formatters = {
|
|
@@ -1684,7 +1684,7 @@ var formatters = {
|
|
|
1684
1684
|
};
|
|
1685
1685
|
var RFC1738 = "RFC1738";
|
|
1686
1686
|
|
|
1687
|
-
// node_modules/.pnpm/openai@
|
|
1687
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/qs/utils.mjs
|
|
1688
1688
|
var has = (obj, key) => (has = Object.hasOwn ?? Function.prototype.call.bind(Object.prototype.hasOwnProperty), has(obj, key));
|
|
1689
1689
|
var hex_table = /* @__PURE__ */ (() => {
|
|
1690
1690
|
const array = [];
|
|
@@ -1756,7 +1756,7 @@ function maybe_map(val, fn) {
|
|
|
1756
1756
|
return fn(val);
|
|
1757
1757
|
}
|
|
1758
1758
|
|
|
1759
|
-
// node_modules/.pnpm/openai@
|
|
1759
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/qs/stringify.mjs
|
|
1760
1760
|
var array_prefix_generators = {
|
|
1761
1761
|
brackets(prefix) {
|
|
1762
1762
|
return String(prefix) + "[]";
|
|
@@ -1983,7 +1983,7 @@ function stringify(object, opts = {}) {
|
|
|
1983
1983
|
}
|
|
1984
1984
|
return joined.length > 0 ? prefix + joined : "";
|
|
1985
1985
|
}
|
|
1986
|
-
// node_modules/.pnpm/openai@
|
|
1986
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/utils/bytes.mjs
|
|
1987
1987
|
function concatBytes(buffers) {
|
|
1988
1988
|
let length = 0;
|
|
1989
1989
|
for (const buffer of buffers) {
|
|
@@ -2008,7 +2008,7 @@ function decodeUTF8(bytes) {
|
|
|
2008
2008
|
return (decodeUTF8_ ?? (decoder = new globalThis.TextDecoder, decodeUTF8_ = decoder.decode.bind(decoder)))(bytes);
|
|
2009
2009
|
}
|
|
2010
2010
|
|
|
2011
|
-
// node_modules/.pnpm/openai@
|
|
2011
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/decoders/line.mjs
|
|
2012
2012
|
var _LineDecoder_buffer;
|
|
2013
2013
|
var _LineDecoder_carriageReturnIndex;
|
|
2014
2014
|
|
|
@@ -2088,7 +2088,7 @@ function findDoubleNewlineIndex(buffer) {
|
|
|
2088
2088
|
return -1;
|
|
2089
2089
|
}
|
|
2090
2090
|
|
|
2091
|
-
// node_modules/.pnpm/openai@
|
|
2091
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/utils/log.mjs
|
|
2092
2092
|
var levelNumbers = {
|
|
2093
2093
|
off: 0,
|
|
2094
2094
|
error: 200,
|
|
@@ -2160,7 +2160,7 @@ var formatRequestDetails = (details) => {
|
|
|
2160
2160
|
return details;
|
|
2161
2161
|
};
|
|
2162
2162
|
|
|
2163
|
-
// node_modules/.pnpm/openai@
|
|
2163
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/core/streaming.mjs
|
|
2164
2164
|
var _Stream_client;
|
|
2165
2165
|
|
|
2166
2166
|
class Stream {
|
|
@@ -2409,7 +2409,7 @@ function partition(str, delimiter) {
|
|
|
2409
2409
|
return [str, "", ""];
|
|
2410
2410
|
}
|
|
2411
2411
|
|
|
2412
|
-
// node_modules/.pnpm/openai@
|
|
2412
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/parse.mjs
|
|
2413
2413
|
async function defaultParseResponse(client, props) {
|
|
2414
2414
|
const { response, requestLogID, retryOfRequestLogID, startTime } = props;
|
|
2415
2415
|
const body = await (async () => {
|
|
@@ -2455,7 +2455,7 @@ function addRequestID(value, response) {
|
|
|
2455
2455
|
});
|
|
2456
2456
|
}
|
|
2457
2457
|
|
|
2458
|
-
// node_modules/.pnpm/openai@
|
|
2458
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/core/api-promise.mjs
|
|
2459
2459
|
var _APIPromise_client;
|
|
2460
2460
|
|
|
2461
2461
|
class APIPromise extends Promise {
|
|
@@ -2496,7 +2496,7 @@ class APIPromise extends Promise {
|
|
|
2496
2496
|
}
|
|
2497
2497
|
_APIPromise_client = new WeakMap;
|
|
2498
2498
|
|
|
2499
|
-
// node_modules/.pnpm/openai@
|
|
2499
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/core/pagination.mjs
|
|
2500
2500
|
var _AbstractPage_client;
|
|
2501
2501
|
|
|
2502
2502
|
class AbstractPage {
|
|
@@ -2594,7 +2594,38 @@ class CursorPage extends AbstractPage {
|
|
|
2594
2594
|
}
|
|
2595
2595
|
}
|
|
2596
2596
|
|
|
2597
|
-
|
|
2597
|
+
class ConversationCursorPage extends AbstractPage {
|
|
2598
|
+
constructor(client, response, body, options) {
|
|
2599
|
+
super(client, response, body, options);
|
|
2600
|
+
this.data = body.data || [];
|
|
2601
|
+
this.has_more = body.has_more || false;
|
|
2602
|
+
this.last_id = body.last_id || "";
|
|
2603
|
+
}
|
|
2604
|
+
getPaginatedItems() {
|
|
2605
|
+
return this.data ?? [];
|
|
2606
|
+
}
|
|
2607
|
+
hasNextPage() {
|
|
2608
|
+
if (this.has_more === false) {
|
|
2609
|
+
return false;
|
|
2610
|
+
}
|
|
2611
|
+
return super.hasNextPage();
|
|
2612
|
+
}
|
|
2613
|
+
nextPageRequestOptions() {
|
|
2614
|
+
const cursor = this.last_id;
|
|
2615
|
+
if (!cursor) {
|
|
2616
|
+
return null;
|
|
2617
|
+
}
|
|
2618
|
+
return {
|
|
2619
|
+
...this.options,
|
|
2620
|
+
query: {
|
|
2621
|
+
...maybeObj(this.options.query),
|
|
2622
|
+
after: cursor
|
|
2623
|
+
}
|
|
2624
|
+
};
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
|
|
2628
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/uploads.mjs
|
|
2598
2629
|
var checkFileSupport = () => {
|
|
2599
2630
|
if (typeof File === "undefined") {
|
|
2600
2631
|
const { process: process2 } = globalThis;
|
|
@@ -2610,6 +2641,11 @@ function getName(value) {
|
|
|
2610
2641
|
return (typeof value === "object" && value !== null && (("name" in value) && value.name && String(value.name) || ("url" in value) && value.url && String(value.url) || ("filename" in value) && value.filename && String(value.filename) || ("path" in value) && value.path && String(value.path)) || "").split(/[\\/]/).pop() || undefined;
|
|
2611
2642
|
}
|
|
2612
2643
|
var isAsyncIterable = (value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function";
|
|
2644
|
+
var maybeMultipartFormRequestOptions = async (opts, fetch2) => {
|
|
2645
|
+
if (!hasUploadableValue(opts.body))
|
|
2646
|
+
return opts;
|
|
2647
|
+
return { ...opts, body: await createForm(opts.body, fetch2) };
|
|
2648
|
+
};
|
|
2613
2649
|
var multipartFormRequestOptions = async (opts, fetch2) => {
|
|
2614
2650
|
return { ...opts, body: await createForm(opts.body, fetch2) };
|
|
2615
2651
|
};
|
|
@@ -2643,6 +2679,20 @@ var createForm = async (body, fetch2) => {
|
|
|
2643
2679
|
return form;
|
|
2644
2680
|
};
|
|
2645
2681
|
var isNamedBlob = (value) => value instanceof Blob && ("name" in value);
|
|
2682
|
+
var isUploadable = (value) => typeof value === "object" && value !== null && (value instanceof Response || isAsyncIterable(value) || isNamedBlob(value));
|
|
2683
|
+
var hasUploadableValue = (value) => {
|
|
2684
|
+
if (isUploadable(value))
|
|
2685
|
+
return true;
|
|
2686
|
+
if (Array.isArray(value))
|
|
2687
|
+
return value.some(hasUploadableValue);
|
|
2688
|
+
if (value && typeof value === "object") {
|
|
2689
|
+
for (const k in value) {
|
|
2690
|
+
if (hasUploadableValue(value[k]))
|
|
2691
|
+
return true;
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
return false;
|
|
2695
|
+
};
|
|
2646
2696
|
var addFormValue = async (form, key, value) => {
|
|
2647
2697
|
if (value === undefined)
|
|
2648
2698
|
return;
|
|
@@ -2666,7 +2716,7 @@ var addFormValue = async (form, key, value) => {
|
|
|
2666
2716
|
}
|
|
2667
2717
|
};
|
|
2668
2718
|
|
|
2669
|
-
// node_modules/.pnpm/openai@
|
|
2719
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/to-file.mjs
|
|
2670
2720
|
var isBlobLike = (value) => value != null && typeof value === "object" && typeof value.size === "number" && typeof value.type === "string" && typeof value.text === "function" && typeof value.slice === "function" && typeof value.arrayBuffer === "function";
|
|
2671
2721
|
var isFileLike = (value) => value != null && typeof value === "object" && typeof value.name === "string" && typeof value.lastModified === "number" && isBlobLike(value);
|
|
2672
2722
|
var isResponseLike = (value) => value != null && typeof value === "object" && typeof value.url === "string" && typeof value.blob === "function";
|
|
@@ -2716,14 +2766,14 @@ function propsForError(value) {
|
|
|
2716
2766
|
const props = Object.getOwnPropertyNames(value);
|
|
2717
2767
|
return `; props: [${props.map((p) => `"${p}"`).join(", ")}]`;
|
|
2718
2768
|
}
|
|
2719
|
-
// node_modules/.pnpm/openai@
|
|
2769
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/core/resource.mjs
|
|
2720
2770
|
class APIResource {
|
|
2721
2771
|
constructor(client) {
|
|
2722
2772
|
this._client = client;
|
|
2723
2773
|
}
|
|
2724
2774
|
}
|
|
2725
2775
|
|
|
2726
|
-
// node_modules/.pnpm/openai@
|
|
2776
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/utils/path.mjs
|
|
2727
2777
|
function encodeURIPath(str) {
|
|
2728
2778
|
return str.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
|
|
2729
2779
|
}
|
|
@@ -2778,18 +2828,120 @@ ${underline}`);
|
|
|
2778
2828
|
};
|
|
2779
2829
|
var path = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
|
|
2780
2830
|
|
|
2781
|
-
// node_modules/.pnpm/openai@
|
|
2831
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/chat/completions/messages.mjs
|
|
2782
2832
|
class Messages extends APIResource {
|
|
2783
2833
|
list(completionID, query = {}, options) {
|
|
2784
2834
|
return this._client.getAPIList(path`/chat/completions/${completionID}/messages`, CursorPage, { query, ...options });
|
|
2785
2835
|
}
|
|
2786
2836
|
}
|
|
2787
|
-
// node_modules/.pnpm/openai@
|
|
2788
|
-
function
|
|
2789
|
-
return
|
|
2837
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/lib/parser.mjs
|
|
2838
|
+
function isChatCompletionFunctionTool(tool) {
|
|
2839
|
+
return tool !== undefined && "function" in tool && tool.function !== undefined;
|
|
2840
|
+
}
|
|
2841
|
+
function isAutoParsableResponseFormat(response_format) {
|
|
2842
|
+
return response_format?.["$brand"] === "auto-parseable-response-format";
|
|
2843
|
+
}
|
|
2844
|
+
function isAutoParsableTool(tool) {
|
|
2845
|
+
return tool?.["$brand"] === "auto-parseable-tool";
|
|
2846
|
+
}
|
|
2847
|
+
function maybeParseChatCompletion(completion, params) {
|
|
2848
|
+
if (!params || !hasAutoParseableInput(params)) {
|
|
2849
|
+
return {
|
|
2850
|
+
...completion,
|
|
2851
|
+
choices: completion.choices.map((choice) => {
|
|
2852
|
+
assertToolCallsAreChatCompletionFunctionToolCalls(choice.message.tool_calls);
|
|
2853
|
+
return {
|
|
2854
|
+
...choice,
|
|
2855
|
+
message: {
|
|
2856
|
+
...choice.message,
|
|
2857
|
+
parsed: null,
|
|
2858
|
+
...choice.message.tool_calls ? {
|
|
2859
|
+
tool_calls: choice.message.tool_calls
|
|
2860
|
+
} : undefined
|
|
2861
|
+
}
|
|
2862
|
+
};
|
|
2863
|
+
})
|
|
2864
|
+
};
|
|
2865
|
+
}
|
|
2866
|
+
return parseChatCompletion(completion, params);
|
|
2867
|
+
}
|
|
2868
|
+
function parseChatCompletion(completion, params) {
|
|
2869
|
+
const choices = completion.choices.map((choice) => {
|
|
2870
|
+
if (choice.finish_reason === "length") {
|
|
2871
|
+
throw new LengthFinishReasonError;
|
|
2872
|
+
}
|
|
2873
|
+
if (choice.finish_reason === "content_filter") {
|
|
2874
|
+
throw new ContentFilterFinishReasonError;
|
|
2875
|
+
}
|
|
2876
|
+
assertToolCallsAreChatCompletionFunctionToolCalls(choice.message.tool_calls);
|
|
2877
|
+
return {
|
|
2878
|
+
...choice,
|
|
2879
|
+
message: {
|
|
2880
|
+
...choice.message,
|
|
2881
|
+
...choice.message.tool_calls ? {
|
|
2882
|
+
tool_calls: choice.message.tool_calls?.map((toolCall) => parseToolCall(params, toolCall)) ?? undefined
|
|
2883
|
+
} : undefined,
|
|
2884
|
+
parsed: choice.message.content && !choice.message.refusal ? parseResponseFormat(params, choice.message.content) : null
|
|
2885
|
+
}
|
|
2886
|
+
};
|
|
2887
|
+
});
|
|
2888
|
+
return { ...completion, choices };
|
|
2889
|
+
}
|
|
2890
|
+
function parseResponseFormat(params, content) {
|
|
2891
|
+
if (params.response_format?.type !== "json_schema") {
|
|
2892
|
+
return null;
|
|
2893
|
+
}
|
|
2894
|
+
if (params.response_format?.type === "json_schema") {
|
|
2895
|
+
if ("$parseRaw" in params.response_format) {
|
|
2896
|
+
const response_format = params.response_format;
|
|
2897
|
+
return response_format.$parseRaw(content);
|
|
2898
|
+
}
|
|
2899
|
+
return JSON.parse(content);
|
|
2900
|
+
}
|
|
2901
|
+
return null;
|
|
2902
|
+
}
|
|
2903
|
+
function parseToolCall(params, toolCall) {
|
|
2904
|
+
const inputTool = params.tools?.find((inputTool2) => isChatCompletionFunctionTool(inputTool2) && inputTool2.function?.name === toolCall.function.name);
|
|
2905
|
+
return {
|
|
2906
|
+
...toolCall,
|
|
2907
|
+
function: {
|
|
2908
|
+
...toolCall.function,
|
|
2909
|
+
parsed_arguments: isAutoParsableTool(inputTool) ? inputTool.$parseRaw(toolCall.function.arguments) : inputTool?.function.strict ? JSON.parse(toolCall.function.arguments) : null
|
|
2910
|
+
}
|
|
2911
|
+
};
|
|
2912
|
+
}
|
|
2913
|
+
function shouldParseToolCall(params, toolCall) {
|
|
2914
|
+
if (!params || !("tools" in params) || !params.tools) {
|
|
2915
|
+
return false;
|
|
2916
|
+
}
|
|
2917
|
+
const inputTool = params.tools?.find((inputTool2) => isChatCompletionFunctionTool(inputTool2) && inputTool2.function?.name === toolCall.function.name);
|
|
2918
|
+
return isChatCompletionFunctionTool(inputTool) && (isAutoParsableTool(inputTool) || inputTool?.function.strict || false);
|
|
2919
|
+
}
|
|
2920
|
+
function hasAutoParseableInput(params) {
|
|
2921
|
+
if (isAutoParsableResponseFormat(params.response_format)) {
|
|
2922
|
+
return true;
|
|
2923
|
+
}
|
|
2924
|
+
return params.tools?.some((t) => isAutoParsableTool(t) || t.type === "function" && t.function.strict === true) ?? false;
|
|
2925
|
+
}
|
|
2926
|
+
function assertToolCallsAreChatCompletionFunctionToolCalls(toolCalls) {
|
|
2927
|
+
for (const toolCall of toolCalls || []) {
|
|
2928
|
+
if (toolCall.type !== "function") {
|
|
2929
|
+
throw new OpenAIError(`Currently only \`function\` tool calls are supported; Received \`${toolCall.type}\``);
|
|
2930
|
+
}
|
|
2931
|
+
}
|
|
2932
|
+
}
|
|
2933
|
+
function validateInputTools(tools) {
|
|
2934
|
+
for (const tool of tools ?? []) {
|
|
2935
|
+
if (tool.type !== "function") {
|
|
2936
|
+
throw new OpenAIError(`Currently only \`function\` tool types support auto-parsing; Received \`${tool.type}\``);
|
|
2937
|
+
}
|
|
2938
|
+
if (tool.function.strict !== true) {
|
|
2939
|
+
throw new OpenAIError(`The \`${tool.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`);
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2790
2942
|
}
|
|
2791
2943
|
|
|
2792
|
-
// node_modules/.pnpm/openai@
|
|
2944
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/lib/chatCompletionUtils.mjs
|
|
2793
2945
|
var isAssistantMessage = (message) => {
|
|
2794
2946
|
return message?.role === "assistant";
|
|
2795
2947
|
};
|
|
@@ -2797,7 +2949,7 @@ var isToolMessage = (message) => {
|
|
|
2797
2949
|
return message?.role === "tool";
|
|
2798
2950
|
};
|
|
2799
2951
|
|
|
2800
|
-
// node_modules/.pnpm/openai@
|
|
2952
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/lib/EventStream.mjs
|
|
2801
2953
|
var _EventStream_instances;
|
|
2802
2954
|
var _EventStream_connectedPromise;
|
|
2803
2955
|
var _EventStream_resolveConnectedPromise;
|
|
@@ -2950,100 +3102,12 @@ _EventStream_connectedPromise = new WeakMap, _EventStream_resolveConnectedPromis
|
|
|
2950
3102
|
return this._emit("error", new OpenAIError(String(error2)));
|
|
2951
3103
|
};
|
|
2952
3104
|
|
|
2953
|
-
// node_modules/.pnpm/openai@
|
|
2954
|
-
function
|
|
2955
|
-
return
|
|
2956
|
-
}
|
|
2957
|
-
function isAutoParsableTool(tool) {
|
|
2958
|
-
return tool?.["$brand"] === "auto-parseable-tool";
|
|
2959
|
-
}
|
|
2960
|
-
function maybeParseChatCompletion(completion, params) {
|
|
2961
|
-
if (!params || !hasAutoParseableInput(params)) {
|
|
2962
|
-
return {
|
|
2963
|
-
...completion,
|
|
2964
|
-
choices: completion.choices.map((choice) => ({
|
|
2965
|
-
...choice,
|
|
2966
|
-
message: {
|
|
2967
|
-
...choice.message,
|
|
2968
|
-
parsed: null,
|
|
2969
|
-
...choice.message.tool_calls ? {
|
|
2970
|
-
tool_calls: choice.message.tool_calls
|
|
2971
|
-
} : undefined
|
|
2972
|
-
}
|
|
2973
|
-
}))
|
|
2974
|
-
};
|
|
2975
|
-
}
|
|
2976
|
-
return parseChatCompletion(completion, params);
|
|
2977
|
-
}
|
|
2978
|
-
function parseChatCompletion(completion, params) {
|
|
2979
|
-
const choices = completion.choices.map((choice) => {
|
|
2980
|
-
if (choice.finish_reason === "length") {
|
|
2981
|
-
throw new LengthFinishReasonError;
|
|
2982
|
-
}
|
|
2983
|
-
if (choice.finish_reason === "content_filter") {
|
|
2984
|
-
throw new ContentFilterFinishReasonError;
|
|
2985
|
-
}
|
|
2986
|
-
return {
|
|
2987
|
-
...choice,
|
|
2988
|
-
message: {
|
|
2989
|
-
...choice.message,
|
|
2990
|
-
...choice.message.tool_calls ? {
|
|
2991
|
-
tool_calls: choice.message.tool_calls?.map((toolCall) => parseToolCall(params, toolCall)) ?? undefined
|
|
2992
|
-
} : undefined,
|
|
2993
|
-
parsed: choice.message.content && !choice.message.refusal ? parseResponseFormat(params, choice.message.content) : null
|
|
2994
|
-
}
|
|
2995
|
-
};
|
|
2996
|
-
});
|
|
2997
|
-
return { ...completion, choices };
|
|
2998
|
-
}
|
|
2999
|
-
function parseResponseFormat(params, content) {
|
|
3000
|
-
if (params.response_format?.type !== "json_schema") {
|
|
3001
|
-
return null;
|
|
3002
|
-
}
|
|
3003
|
-
if (params.response_format?.type === "json_schema") {
|
|
3004
|
-
if ("$parseRaw" in params.response_format) {
|
|
3005
|
-
const response_format = params.response_format;
|
|
3006
|
-
return response_format.$parseRaw(content);
|
|
3007
|
-
}
|
|
3008
|
-
return JSON.parse(content);
|
|
3009
|
-
}
|
|
3010
|
-
return null;
|
|
3011
|
-
}
|
|
3012
|
-
function parseToolCall(params, toolCall) {
|
|
3013
|
-
const inputTool = params.tools?.find((inputTool2) => inputTool2.function?.name === toolCall.function.name);
|
|
3014
|
-
return {
|
|
3015
|
-
...toolCall,
|
|
3016
|
-
function: {
|
|
3017
|
-
...toolCall.function,
|
|
3018
|
-
parsed_arguments: isAutoParsableTool(inputTool) ? inputTool.$parseRaw(toolCall.function.arguments) : inputTool?.function.strict ? JSON.parse(toolCall.function.arguments) : null
|
|
3019
|
-
}
|
|
3020
|
-
};
|
|
3021
|
-
}
|
|
3022
|
-
function shouldParseToolCall(params, toolCall) {
|
|
3023
|
-
if (!params) {
|
|
3024
|
-
return false;
|
|
3025
|
-
}
|
|
3026
|
-
const inputTool = params.tools?.find((inputTool2) => inputTool2.function?.name === toolCall.function.name);
|
|
3027
|
-
return isAutoParsableTool(inputTool) || inputTool?.function.strict || false;
|
|
3028
|
-
}
|
|
3029
|
-
function hasAutoParseableInput(params) {
|
|
3030
|
-
if (isAutoParsableResponseFormat(params.response_format)) {
|
|
3031
|
-
return true;
|
|
3032
|
-
}
|
|
3033
|
-
return params.tools?.some((t) => isAutoParsableTool(t) || t.type === "function" && t.function.strict === true) ?? false;
|
|
3034
|
-
}
|
|
3035
|
-
function validateInputTools(tools) {
|
|
3036
|
-
for (const tool of tools ?? []) {
|
|
3037
|
-
if (tool.type !== "function") {
|
|
3038
|
-
throw new OpenAIError(`Currently only \`function\` tool types support auto-parsing; Received \`${tool.type}\``);
|
|
3039
|
-
}
|
|
3040
|
-
if (tool.function.strict !== true) {
|
|
3041
|
-
throw new OpenAIError(`The \`${tool.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`);
|
|
3042
|
-
}
|
|
3043
|
-
}
|
|
3105
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/lib/RunnableFunction.mjs
|
|
3106
|
+
function isRunnableFunctionWithParse(fn) {
|
|
3107
|
+
return typeof fn.parse === "function";
|
|
3044
3108
|
}
|
|
3045
3109
|
|
|
3046
|
-
// node_modules/.pnpm/openai@
|
|
3110
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/lib/AbstractChatCompletionRunner.mjs
|
|
3047
3111
|
var _AbstractChatCompletionRunner_instances;
|
|
3048
3112
|
var _AbstractChatCompletionRunner_getFinalContent;
|
|
3049
3113
|
var _AbstractChatCompletionRunner_getFinalMessage;
|
|
@@ -3157,7 +3221,7 @@ class AbstractChatCompletionRunner extends EventStream {
|
|
|
3157
3221
|
async _runTools(client, params, options) {
|
|
3158
3222
|
const role = "tool";
|
|
3159
3223
|
const { tool_choice = "auto", stream, ...restParams } = params;
|
|
3160
|
-
const singleFunctionToCall = typeof tool_choice !== "string" && tool_choice?.function?.name;
|
|
3224
|
+
const singleFunctionToCall = typeof tool_choice !== "string" && tool_choice.type === "function" && tool_choice?.function?.name;
|
|
3161
3225
|
const { maxChatCompletions = DEFAULT_MAX_CHAT_COMPLETIONS } = options || {};
|
|
3162
3226
|
const inputTools = params.tools.map((tool) => {
|
|
3163
3227
|
if (isAutoParsableTool(tool)) {
|
|
@@ -3264,7 +3328,7 @@ _AbstractChatCompletionRunner_instances = new WeakSet, _AbstractChatCompletionRu
|
|
|
3264
3328
|
for (let i = this.messages.length - 1;i >= 0; i--) {
|
|
3265
3329
|
const message = this.messages[i];
|
|
3266
3330
|
if (isAssistantMessage(message) && message?.tool_calls?.length) {
|
|
3267
|
-
return message.tool_calls.at(-1)?.function;
|
|
3331
|
+
return message.tool_calls.filter((x) => x.type === "function").at(-1)?.function;
|
|
3268
3332
|
}
|
|
3269
3333
|
}
|
|
3270
3334
|
return;
|
|
@@ -3298,7 +3362,7 @@ _AbstractChatCompletionRunner_instances = new WeakSet, _AbstractChatCompletionRu
|
|
|
3298
3362
|
return typeof rawContent === "string" ? rawContent : rawContent === undefined ? "undefined" : JSON.stringify(rawContent);
|
|
3299
3363
|
};
|
|
3300
3364
|
|
|
3301
|
-
// node_modules/.pnpm/openai@
|
|
3365
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/lib/ChatCompletionRunner.mjs
|
|
3302
3366
|
class ChatCompletionRunner extends AbstractChatCompletionRunner {
|
|
3303
3367
|
static runTools(client, params, options) {
|
|
3304
3368
|
const runner = new ChatCompletionRunner;
|
|
@@ -3316,7 +3380,8 @@ class ChatCompletionRunner extends AbstractChatCompletionRunner {
|
|
|
3316
3380
|
}
|
|
3317
3381
|
}
|
|
3318
3382
|
}
|
|
3319
|
-
|
|
3383
|
+
|
|
3384
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/_vendor/partial-json-parser/parser.mjs
|
|
3320
3385
|
var STR = 1;
|
|
3321
3386
|
var NUM = 2;
|
|
3322
3387
|
var ARR = 4;
|
|
@@ -3529,8 +3594,7 @@ var _parseJSON = (jsonString, allow) => {
|
|
|
3529
3594
|
return parseAny();
|
|
3530
3595
|
};
|
|
3531
3596
|
var partialParse = (input) => parseJSON(input, Allow.ALL ^ Allow.NUM);
|
|
3532
|
-
|
|
3533
|
-
// node_modules/.pnpm/openai@5.12.0_ws@8.18.3_zod@3.25.76/node_modules/openai/lib/ChatCompletionStream.mjs
|
|
3597
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/lib/ChatCompletionStream.mjs
|
|
3534
3598
|
var _ChatCompletionStream_instances;
|
|
3535
3599
|
var _ChatCompletionStream_params;
|
|
3536
3600
|
var _ChatCompletionStream_choiceEventStates;
|
|
@@ -3708,7 +3772,7 @@ class ChatCompletionStream extends AbstractChatCompletionRunner {
|
|
|
3708
3772
|
throw new Error("tool call snapshot missing `type`");
|
|
3709
3773
|
}
|
|
3710
3774
|
if (toolCallSnapshot.type === "function") {
|
|
3711
|
-
const inputTool = __classPrivateFieldGet(this, _ChatCompletionStream_params, "f")?.tools?.find((tool) => tool
|
|
3775
|
+
const inputTool = __classPrivateFieldGet(this, _ChatCompletionStream_params, "f")?.tools?.find((tool) => isChatCompletionFunctionTool(tool) && tool.function.name === toolCallSnapshot.function.name);
|
|
3712
3776
|
this._emit("tool_calls.function.arguments.done", {
|
|
3713
3777
|
name: toolCallSnapshot.function.name,
|
|
3714
3778
|
index: toolCallIndex,
|
|
@@ -4003,7 +4067,7 @@ function assertIsEmpty(obj) {
|
|
|
4003
4067
|
}
|
|
4004
4068
|
function assertNever(_x) {}
|
|
4005
4069
|
|
|
4006
|
-
// node_modules/.pnpm/openai@
|
|
4070
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/lib/ChatCompletionStreamingRunner.mjs
|
|
4007
4071
|
class ChatCompletionStreamingRunner extends ChatCompletionStream {
|
|
4008
4072
|
static fromReadableStream(stream) {
|
|
4009
4073
|
const runner = new ChatCompletionStreamingRunner(null);
|
|
@@ -4021,7 +4085,7 @@ class ChatCompletionStreamingRunner extends ChatCompletionStream {
|
|
|
4021
4085
|
}
|
|
4022
4086
|
}
|
|
4023
4087
|
|
|
4024
|
-
// node_modules/.pnpm/openai@
|
|
4088
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/chat/completions/completions.mjs
|
|
4025
4089
|
class Completions extends APIResource {
|
|
4026
4090
|
constructor() {
|
|
4027
4091
|
super(...arguments);
|
|
@@ -4064,7 +4128,7 @@ class Completions extends APIResource {
|
|
|
4064
4128
|
}
|
|
4065
4129
|
Completions.Messages = Messages;
|
|
4066
4130
|
|
|
4067
|
-
// node_modules/.pnpm/openai@
|
|
4131
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/chat/chat.mjs
|
|
4068
4132
|
class Chat extends APIResource {
|
|
4069
4133
|
constructor() {
|
|
4070
4134
|
super(...arguments);
|
|
@@ -4072,7 +4136,7 @@ class Chat extends APIResource {
|
|
|
4072
4136
|
}
|
|
4073
4137
|
}
|
|
4074
4138
|
Chat.Completions = Completions;
|
|
4075
|
-
// node_modules/.pnpm/openai@
|
|
4139
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/headers.mjs
|
|
4076
4140
|
var brand_privateNullableHeaders = /* @__PURE__ */ Symbol("brand.privateNullableHeaders");
|
|
4077
4141
|
function* iterateHeaders(headers) {
|
|
4078
4142
|
if (!headers)
|
|
@@ -4135,7 +4199,7 @@ var buildHeaders = (newHeaders) => {
|
|
|
4135
4199
|
return { [brand_privateNullableHeaders]: true, values: targetHeaders, nulls: nullHeaders };
|
|
4136
4200
|
};
|
|
4137
4201
|
|
|
4138
|
-
// node_modules/.pnpm/openai@
|
|
4202
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/audio/speech.mjs
|
|
4139
4203
|
class Speech extends APIResource {
|
|
4140
4204
|
create(body, options) {
|
|
4141
4205
|
return this._client.post("/audio/speech", {
|
|
@@ -4147,7 +4211,7 @@ class Speech extends APIResource {
|
|
|
4147
4211
|
}
|
|
4148
4212
|
}
|
|
4149
4213
|
|
|
4150
|
-
// node_modules/.pnpm/openai@
|
|
4214
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/audio/transcriptions.mjs
|
|
4151
4215
|
class Transcriptions extends APIResource {
|
|
4152
4216
|
create(body, options) {
|
|
4153
4217
|
return this._client.post("/audio/transcriptions", multipartFormRequestOptions({
|
|
@@ -4159,14 +4223,14 @@ class Transcriptions extends APIResource {
|
|
|
4159
4223
|
}
|
|
4160
4224
|
}
|
|
4161
4225
|
|
|
4162
|
-
// node_modules/.pnpm/openai@
|
|
4226
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/audio/translations.mjs
|
|
4163
4227
|
class Translations extends APIResource {
|
|
4164
4228
|
create(body, options) {
|
|
4165
4229
|
return this._client.post("/audio/translations", multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }, this._client));
|
|
4166
4230
|
}
|
|
4167
4231
|
}
|
|
4168
4232
|
|
|
4169
|
-
// node_modules/.pnpm/openai@
|
|
4233
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/audio/audio.mjs
|
|
4170
4234
|
class Audio extends APIResource {
|
|
4171
4235
|
constructor() {
|
|
4172
4236
|
super(...arguments);
|
|
@@ -4178,7 +4242,7 @@ class Audio extends APIResource {
|
|
|
4178
4242
|
Audio.Transcriptions = Transcriptions;
|
|
4179
4243
|
Audio.Translations = Translations;
|
|
4180
4244
|
Audio.Speech = Speech;
|
|
4181
|
-
// node_modules/.pnpm/openai@
|
|
4245
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/batches.mjs
|
|
4182
4246
|
class Batches extends APIResource {
|
|
4183
4247
|
create(body, options) {
|
|
4184
4248
|
return this._client.post("/batches", { body, ...options });
|
|
@@ -4193,7 +4257,7 @@ class Batches extends APIResource {
|
|
|
4193
4257
|
return this._client.post(path`/batches/${batchID}/cancel`, options);
|
|
4194
4258
|
}
|
|
4195
4259
|
}
|
|
4196
|
-
// node_modules/.pnpm/openai@
|
|
4260
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/beta/assistants.mjs
|
|
4197
4261
|
class Assistants extends APIResource {
|
|
4198
4262
|
create(body, options) {
|
|
4199
4263
|
return this._client.post("/assistants", {
|
|
@@ -4230,7 +4294,7 @@ class Assistants extends APIResource {
|
|
|
4230
4294
|
}
|
|
4231
4295
|
}
|
|
4232
4296
|
|
|
4233
|
-
// node_modules/.pnpm/openai@
|
|
4297
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/beta/realtime/sessions.mjs
|
|
4234
4298
|
class Sessions extends APIResource {
|
|
4235
4299
|
create(body, options) {
|
|
4236
4300
|
return this._client.post("/realtime/sessions", {
|
|
@@ -4241,7 +4305,7 @@ class Sessions extends APIResource {
|
|
|
4241
4305
|
}
|
|
4242
4306
|
}
|
|
4243
4307
|
|
|
4244
|
-
// node_modules/.pnpm/openai@
|
|
4308
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/beta/realtime/transcription-sessions.mjs
|
|
4245
4309
|
class TranscriptionSessions extends APIResource {
|
|
4246
4310
|
create(body, options) {
|
|
4247
4311
|
return this._client.post("/realtime/transcription_sessions", {
|
|
@@ -4252,7 +4316,7 @@ class TranscriptionSessions extends APIResource {
|
|
|
4252
4316
|
}
|
|
4253
4317
|
}
|
|
4254
4318
|
|
|
4255
|
-
// node_modules/.pnpm/openai@
|
|
4319
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/beta/realtime/realtime.mjs
|
|
4256
4320
|
class Realtime extends APIResource {
|
|
4257
4321
|
constructor() {
|
|
4258
4322
|
super(...arguments);
|
|
@@ -4263,7 +4327,61 @@ class Realtime extends APIResource {
|
|
|
4263
4327
|
Realtime.Sessions = Sessions;
|
|
4264
4328
|
Realtime.TranscriptionSessions = TranscriptionSessions;
|
|
4265
4329
|
|
|
4266
|
-
// node_modules/.pnpm/openai@
|
|
4330
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/beta/chatkit/sessions.mjs
|
|
4331
|
+
class Sessions2 extends APIResource {
|
|
4332
|
+
create(body, options) {
|
|
4333
|
+
return this._client.post("/chatkit/sessions", {
|
|
4334
|
+
body,
|
|
4335
|
+
...options,
|
|
4336
|
+
headers: buildHeaders([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
|
|
4337
|
+
});
|
|
4338
|
+
}
|
|
4339
|
+
cancel(sessionID, options) {
|
|
4340
|
+
return this._client.post(path`/chatkit/sessions/${sessionID}/cancel`, {
|
|
4341
|
+
...options,
|
|
4342
|
+
headers: buildHeaders([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
|
|
4343
|
+
});
|
|
4344
|
+
}
|
|
4345
|
+
}
|
|
4346
|
+
|
|
4347
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/beta/chatkit/threads.mjs
|
|
4348
|
+
class Threads extends APIResource {
|
|
4349
|
+
retrieve(threadID, options) {
|
|
4350
|
+
return this._client.get(path`/chatkit/threads/${threadID}`, {
|
|
4351
|
+
...options,
|
|
4352
|
+
headers: buildHeaders([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
|
|
4353
|
+
});
|
|
4354
|
+
}
|
|
4355
|
+
list(query = {}, options) {
|
|
4356
|
+
return this._client.getAPIList("/chatkit/threads", ConversationCursorPage, {
|
|
4357
|
+
query,
|
|
4358
|
+
...options,
|
|
4359
|
+
headers: buildHeaders([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
|
|
4360
|
+
});
|
|
4361
|
+
}
|
|
4362
|
+
delete(threadID, options) {
|
|
4363
|
+
return this._client.delete(path`/chatkit/threads/${threadID}`, {
|
|
4364
|
+
...options,
|
|
4365
|
+
headers: buildHeaders([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
|
|
4366
|
+
});
|
|
4367
|
+
}
|
|
4368
|
+
listItems(threadID, query = {}, options) {
|
|
4369
|
+
return this._client.getAPIList(path`/chatkit/threads/${threadID}/items`, ConversationCursorPage, { query, ...options, headers: buildHeaders([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]) });
|
|
4370
|
+
}
|
|
4371
|
+
}
|
|
4372
|
+
|
|
4373
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/beta/chatkit/chatkit.mjs
|
|
4374
|
+
class ChatKit extends APIResource {
|
|
4375
|
+
constructor() {
|
|
4376
|
+
super(...arguments);
|
|
4377
|
+
this.sessions = new Sessions2(this._client);
|
|
4378
|
+
this.threads = new Threads(this._client);
|
|
4379
|
+
}
|
|
4380
|
+
}
|
|
4381
|
+
ChatKit.Sessions = Sessions2;
|
|
4382
|
+
ChatKit.Threads = Threads;
|
|
4383
|
+
|
|
4384
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/beta/threads/messages.mjs
|
|
4267
4385
|
class Messages2 extends APIResource {
|
|
4268
4386
|
create(threadID, body, options) {
|
|
4269
4387
|
return this._client.post(path`/threads/${threadID}/messages`, {
|
|
@@ -4303,7 +4421,7 @@ class Messages2 extends APIResource {
|
|
|
4303
4421
|
}
|
|
4304
4422
|
}
|
|
4305
4423
|
|
|
4306
|
-
// node_modules/.pnpm/openai@
|
|
4424
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/beta/threads/runs/steps.mjs
|
|
4307
4425
|
class Steps extends APIResource {
|
|
4308
4426
|
retrieve(stepID, params, options) {
|
|
4309
4427
|
const { thread_id, run_id, ...query } = params;
|
|
@@ -4322,7 +4440,7 @@ class Steps extends APIResource {
|
|
|
4322
4440
|
});
|
|
4323
4441
|
}
|
|
4324
4442
|
}
|
|
4325
|
-
// node_modules/.pnpm/openai@
|
|
4443
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/utils/base64.mjs
|
|
4326
4444
|
var toFloat32Array = (base64Str) => {
|
|
4327
4445
|
if (typeof Buffer !== "undefined") {
|
|
4328
4446
|
const buf = Buffer.from(base64Str, "base64");
|
|
@@ -4337,7 +4455,7 @@ var toFloat32Array = (base64Str) => {
|
|
|
4337
4455
|
return Array.from(new Float32Array(bytes.buffer));
|
|
4338
4456
|
}
|
|
4339
4457
|
};
|
|
4340
|
-
// node_modules/.pnpm/openai@
|
|
4458
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/internal/utils/env.mjs
|
|
4341
4459
|
var readEnv = (env) => {
|
|
4342
4460
|
if (typeof globalThis.process !== "undefined") {
|
|
4343
4461
|
return globalThis.process.env?.[env]?.trim() ?? undefined;
|
|
@@ -4347,7 +4465,7 @@ var readEnv = (env) => {
|
|
|
4347
4465
|
}
|
|
4348
4466
|
return;
|
|
4349
4467
|
};
|
|
4350
|
-
// node_modules/.pnpm/openai@
|
|
4468
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/lib/AssistantStream.mjs
|
|
4351
4469
|
var _AssistantStream_instances;
|
|
4352
4470
|
var _a;
|
|
4353
4471
|
var _AssistantStream_events;
|
|
@@ -4886,7 +5004,7 @@ _a = AssistantStream, _AssistantStream_addEvent = function _AssistantStream_addE
|
|
|
4886
5004
|
};
|
|
4887
5005
|
function assertNever2(_x) {}
|
|
4888
5006
|
|
|
4889
|
-
// node_modules/.pnpm/openai@
|
|
5007
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/beta/threads/runs/runs.mjs
|
|
4890
5008
|
class Runs extends APIResource {
|
|
4891
5009
|
constructor() {
|
|
4892
5010
|
super(...arguments);
|
|
@@ -5001,8 +5119,8 @@ class Runs extends APIResource {
|
|
|
5001
5119
|
}
|
|
5002
5120
|
Runs.Steps = Steps;
|
|
5003
5121
|
|
|
5004
|
-
// node_modules/.pnpm/openai@
|
|
5005
|
-
class
|
|
5122
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/beta/threads/threads.mjs
|
|
5123
|
+
class Threads2 extends APIResource {
|
|
5006
5124
|
constructor() {
|
|
5007
5125
|
super(...arguments);
|
|
5008
5126
|
this.runs = new Runs(this._client);
|
|
@@ -5050,28 +5168,30 @@ class Threads extends APIResource {
|
|
|
5050
5168
|
return AssistantStream.createThreadAssistantStream(body, this._client.beta.threads, options);
|
|
5051
5169
|
}
|
|
5052
5170
|
}
|
|
5053
|
-
|
|
5054
|
-
|
|
5171
|
+
Threads2.Runs = Runs;
|
|
5172
|
+
Threads2.Messages = Messages2;
|
|
5055
5173
|
|
|
5056
|
-
// node_modules/.pnpm/openai@
|
|
5174
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/beta/beta.mjs
|
|
5057
5175
|
class Beta extends APIResource {
|
|
5058
5176
|
constructor() {
|
|
5059
5177
|
super(...arguments);
|
|
5060
5178
|
this.realtime = new Realtime(this._client);
|
|
5179
|
+
this.chatkit = new ChatKit(this._client);
|
|
5061
5180
|
this.assistants = new Assistants(this._client);
|
|
5062
|
-
this.threads = new
|
|
5181
|
+
this.threads = new Threads2(this._client);
|
|
5063
5182
|
}
|
|
5064
5183
|
}
|
|
5065
5184
|
Beta.Realtime = Realtime;
|
|
5185
|
+
Beta.ChatKit = ChatKit;
|
|
5066
5186
|
Beta.Assistants = Assistants;
|
|
5067
|
-
Beta.Threads =
|
|
5068
|
-
// node_modules/.pnpm/openai@
|
|
5187
|
+
Beta.Threads = Threads2;
|
|
5188
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/completions.mjs
|
|
5069
5189
|
class Completions2 extends APIResource {
|
|
5070
5190
|
create(body, options) {
|
|
5071
5191
|
return this._client.post("/completions", { body, ...options, stream: body.stream ?? false });
|
|
5072
5192
|
}
|
|
5073
5193
|
}
|
|
5074
|
-
// node_modules/.pnpm/openai@
|
|
5194
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/containers/files/content.mjs
|
|
5075
5195
|
class Content extends APIResource {
|
|
5076
5196
|
retrieve(fileID, params, options) {
|
|
5077
5197
|
const { container_id } = params;
|
|
@@ -5083,7 +5203,7 @@ class Content extends APIResource {
|
|
|
5083
5203
|
}
|
|
5084
5204
|
}
|
|
5085
5205
|
|
|
5086
|
-
// node_modules/.pnpm/openai@
|
|
5206
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/containers/files/files.mjs
|
|
5087
5207
|
class Files extends APIResource {
|
|
5088
5208
|
constructor() {
|
|
5089
5209
|
super(...arguments);
|
|
@@ -5112,7 +5232,7 @@ class Files extends APIResource {
|
|
|
5112
5232
|
}
|
|
5113
5233
|
Files.Content = Content;
|
|
5114
5234
|
|
|
5115
|
-
// node_modules/.pnpm/openai@
|
|
5235
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/containers/containers.mjs
|
|
5116
5236
|
class Containers extends APIResource {
|
|
5117
5237
|
constructor() {
|
|
5118
5238
|
super(...arguments);
|
|
@@ -5135,7 +5255,50 @@ class Containers extends APIResource {
|
|
|
5135
5255
|
}
|
|
5136
5256
|
}
|
|
5137
5257
|
Containers.Files = Files;
|
|
5138
|
-
// node_modules/.pnpm/openai@
|
|
5258
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/conversations/items.mjs
|
|
5259
|
+
class Items extends APIResource {
|
|
5260
|
+
create(conversationID, params, options) {
|
|
5261
|
+
const { include, ...body } = params;
|
|
5262
|
+
return this._client.post(path`/conversations/${conversationID}/items`, {
|
|
5263
|
+
query: { include },
|
|
5264
|
+
body,
|
|
5265
|
+
...options
|
|
5266
|
+
});
|
|
5267
|
+
}
|
|
5268
|
+
retrieve(itemID, params, options) {
|
|
5269
|
+
const { conversation_id, ...query } = params;
|
|
5270
|
+
return this._client.get(path`/conversations/${conversation_id}/items/${itemID}`, { query, ...options });
|
|
5271
|
+
}
|
|
5272
|
+
list(conversationID, query = {}, options) {
|
|
5273
|
+
return this._client.getAPIList(path`/conversations/${conversationID}/items`, ConversationCursorPage, { query, ...options });
|
|
5274
|
+
}
|
|
5275
|
+
delete(itemID, params, options) {
|
|
5276
|
+
const { conversation_id } = params;
|
|
5277
|
+
return this._client.delete(path`/conversations/${conversation_id}/items/${itemID}`, options);
|
|
5278
|
+
}
|
|
5279
|
+
}
|
|
5280
|
+
|
|
5281
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/conversations/conversations.mjs
|
|
5282
|
+
class Conversations extends APIResource {
|
|
5283
|
+
constructor() {
|
|
5284
|
+
super(...arguments);
|
|
5285
|
+
this.items = new Items(this._client);
|
|
5286
|
+
}
|
|
5287
|
+
create(body = {}, options) {
|
|
5288
|
+
return this._client.post("/conversations", { body, ...options });
|
|
5289
|
+
}
|
|
5290
|
+
retrieve(conversationID, options) {
|
|
5291
|
+
return this._client.get(path`/conversations/${conversationID}`, options);
|
|
5292
|
+
}
|
|
5293
|
+
update(conversationID, body, options) {
|
|
5294
|
+
return this._client.post(path`/conversations/${conversationID}`, { body, ...options });
|
|
5295
|
+
}
|
|
5296
|
+
delete(conversationID, options) {
|
|
5297
|
+
return this._client.delete(path`/conversations/${conversationID}`, options);
|
|
5298
|
+
}
|
|
5299
|
+
}
|
|
5300
|
+
Conversations.Items = Items;
|
|
5301
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/embeddings.mjs
|
|
5139
5302
|
class Embeddings extends APIResource {
|
|
5140
5303
|
create(body, options) {
|
|
5141
5304
|
const hasUserProvidedEncodingFormat = !!body.encoding_format;
|
|
@@ -5165,7 +5328,7 @@ class Embeddings extends APIResource {
|
|
|
5165
5328
|
});
|
|
5166
5329
|
}
|
|
5167
5330
|
}
|
|
5168
|
-
// node_modules/.pnpm/openai@
|
|
5331
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/evals/runs/output-items.mjs
|
|
5169
5332
|
class OutputItems extends APIResource {
|
|
5170
5333
|
retrieve(outputItemID, params, options) {
|
|
5171
5334
|
const { eval_id, run_id } = params;
|
|
@@ -5177,7 +5340,7 @@ class OutputItems extends APIResource {
|
|
|
5177
5340
|
}
|
|
5178
5341
|
}
|
|
5179
5342
|
|
|
5180
|
-
// node_modules/.pnpm/openai@
|
|
5343
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/evals/runs/runs.mjs
|
|
5181
5344
|
class Runs2 extends APIResource {
|
|
5182
5345
|
constructor() {
|
|
5183
5346
|
super(...arguments);
|
|
@@ -5207,7 +5370,7 @@ class Runs2 extends APIResource {
|
|
|
5207
5370
|
}
|
|
5208
5371
|
Runs2.OutputItems = OutputItems;
|
|
5209
5372
|
|
|
5210
|
-
// node_modules/.pnpm/openai@
|
|
5373
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/evals/evals.mjs
|
|
5211
5374
|
class Evals extends APIResource {
|
|
5212
5375
|
constructor() {
|
|
5213
5376
|
super(...arguments);
|
|
@@ -5230,7 +5393,7 @@ class Evals extends APIResource {
|
|
|
5230
5393
|
}
|
|
5231
5394
|
}
|
|
5232
5395
|
Evals.Runs = Runs2;
|
|
5233
|
-
// node_modules/.pnpm/openai@
|
|
5396
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/files.mjs
|
|
5234
5397
|
class Files2 extends APIResource {
|
|
5235
5398
|
create(body, options) {
|
|
5236
5399
|
return this._client.post("/files", multipartFormRequestOptions({ body, ...options }, this._client));
|
|
@@ -5267,11 +5430,11 @@ class Files2 extends APIResource {
|
|
|
5267
5430
|
return file;
|
|
5268
5431
|
}
|
|
5269
5432
|
}
|
|
5270
|
-
// node_modules/.pnpm/openai@
|
|
5433
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/fine-tuning/methods.mjs
|
|
5271
5434
|
class Methods extends APIResource {
|
|
5272
5435
|
}
|
|
5273
5436
|
|
|
5274
|
-
// node_modules/.pnpm/openai@
|
|
5437
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/fine-tuning/alpha/graders.mjs
|
|
5275
5438
|
class Graders extends APIResource {
|
|
5276
5439
|
run(body, options) {
|
|
5277
5440
|
return this._client.post("/fine_tuning/alpha/graders/run", { body, ...options });
|
|
@@ -5281,7 +5444,7 @@ class Graders extends APIResource {
|
|
|
5281
5444
|
}
|
|
5282
5445
|
}
|
|
5283
5446
|
|
|
5284
|
-
// node_modules/.pnpm/openai@
|
|
5447
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/fine-tuning/alpha/alpha.mjs
|
|
5285
5448
|
class Alpha extends APIResource {
|
|
5286
5449
|
constructor() {
|
|
5287
5450
|
super(...arguments);
|
|
@@ -5290,7 +5453,7 @@ class Alpha extends APIResource {
|
|
|
5290
5453
|
}
|
|
5291
5454
|
Alpha.Graders = Graders;
|
|
5292
5455
|
|
|
5293
|
-
// node_modules/.pnpm/openai@
|
|
5456
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/fine-tuning/checkpoints/permissions.mjs
|
|
5294
5457
|
class Permissions extends APIResource {
|
|
5295
5458
|
create(fineTunedModelCheckpoint, body, options) {
|
|
5296
5459
|
return this._client.getAPIList(path`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, Page, { body, method: "post", ...options });
|
|
@@ -5307,7 +5470,7 @@ class Permissions extends APIResource {
|
|
|
5307
5470
|
}
|
|
5308
5471
|
}
|
|
5309
5472
|
|
|
5310
|
-
// node_modules/.pnpm/openai@
|
|
5473
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/fine-tuning/checkpoints/checkpoints.mjs
|
|
5311
5474
|
class Checkpoints extends APIResource {
|
|
5312
5475
|
constructor() {
|
|
5313
5476
|
super(...arguments);
|
|
@@ -5316,14 +5479,14 @@ class Checkpoints extends APIResource {
|
|
|
5316
5479
|
}
|
|
5317
5480
|
Checkpoints.Permissions = Permissions;
|
|
5318
5481
|
|
|
5319
|
-
// node_modules/.pnpm/openai@
|
|
5482
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/fine-tuning/jobs/checkpoints.mjs
|
|
5320
5483
|
class Checkpoints2 extends APIResource {
|
|
5321
5484
|
list(fineTuningJobID, query = {}, options) {
|
|
5322
5485
|
return this._client.getAPIList(path`/fine_tuning/jobs/${fineTuningJobID}/checkpoints`, CursorPage, { query, ...options });
|
|
5323
5486
|
}
|
|
5324
5487
|
}
|
|
5325
5488
|
|
|
5326
|
-
// node_modules/.pnpm/openai@
|
|
5489
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/fine-tuning/jobs/jobs.mjs
|
|
5327
5490
|
class Jobs extends APIResource {
|
|
5328
5491
|
constructor() {
|
|
5329
5492
|
super(...arguments);
|
|
@@ -5353,7 +5516,7 @@ class Jobs extends APIResource {
|
|
|
5353
5516
|
}
|
|
5354
5517
|
Jobs.Checkpoints = Checkpoints2;
|
|
5355
5518
|
|
|
5356
|
-
// node_modules/.pnpm/openai@
|
|
5519
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/fine-tuning/fine-tuning.mjs
|
|
5357
5520
|
class FineTuning extends APIResource {
|
|
5358
5521
|
constructor() {
|
|
5359
5522
|
super(...arguments);
|
|
@@ -5367,11 +5530,11 @@ FineTuning.Methods = Methods;
|
|
|
5367
5530
|
FineTuning.Jobs = Jobs;
|
|
5368
5531
|
FineTuning.Checkpoints = Checkpoints;
|
|
5369
5532
|
FineTuning.Alpha = Alpha;
|
|
5370
|
-
// node_modules/.pnpm/openai@
|
|
5533
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/graders/grader-models.mjs
|
|
5371
5534
|
class GraderModels extends APIResource {
|
|
5372
5535
|
}
|
|
5373
5536
|
|
|
5374
|
-
// node_modules/.pnpm/openai@
|
|
5537
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/graders/graders.mjs
|
|
5375
5538
|
class Graders2 extends APIResource {
|
|
5376
5539
|
constructor() {
|
|
5377
5540
|
super(...arguments);
|
|
@@ -5379,7 +5542,7 @@ class Graders2 extends APIResource {
|
|
|
5379
5542
|
}
|
|
5380
5543
|
}
|
|
5381
5544
|
Graders2.GraderModels = GraderModels;
|
|
5382
|
-
// node_modules/.pnpm/openai@
|
|
5545
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/images.mjs
|
|
5383
5546
|
class Images extends APIResource {
|
|
5384
5547
|
createVariation(body, options) {
|
|
5385
5548
|
return this._client.post("/images/variations", multipartFormRequestOptions({ body, ...options }, this._client));
|
|
@@ -5391,7 +5554,7 @@ class Images extends APIResource {
|
|
|
5391
5554
|
return this._client.post("/images/generations", { body, ...options, stream: body.stream ?? false });
|
|
5392
5555
|
}
|
|
5393
5556
|
}
|
|
5394
|
-
// node_modules/.pnpm/openai@
|
|
5557
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/models.mjs
|
|
5395
5558
|
class Models extends APIResource {
|
|
5396
5559
|
retrieve(model, options) {
|
|
5397
5560
|
return this._client.get(path`/models/${model}`, options);
|
|
@@ -5403,13 +5566,61 @@ class Models extends APIResource {
|
|
|
5403
5566
|
return this._client.delete(path`/models/${model}`, options);
|
|
5404
5567
|
}
|
|
5405
5568
|
}
|
|
5406
|
-
// node_modules/.pnpm/openai@
|
|
5569
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/moderations.mjs
|
|
5407
5570
|
class Moderations extends APIResource {
|
|
5408
5571
|
create(body, options) {
|
|
5409
5572
|
return this._client.post("/moderations", { body, ...options });
|
|
5410
5573
|
}
|
|
5411
5574
|
}
|
|
5412
|
-
// node_modules/.pnpm/openai@
|
|
5575
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/realtime/calls.mjs
|
|
5576
|
+
class Calls extends APIResource {
|
|
5577
|
+
accept(callID, body, options) {
|
|
5578
|
+
return this._client.post(path`/realtime/calls/${callID}/accept`, {
|
|
5579
|
+
body,
|
|
5580
|
+
...options,
|
|
5581
|
+
headers: buildHeaders([{ Accept: "*/*" }, options?.headers])
|
|
5582
|
+
});
|
|
5583
|
+
}
|
|
5584
|
+
hangup(callID, options) {
|
|
5585
|
+
return this._client.post(path`/realtime/calls/${callID}/hangup`, {
|
|
5586
|
+
...options,
|
|
5587
|
+
headers: buildHeaders([{ Accept: "*/*" }, options?.headers])
|
|
5588
|
+
});
|
|
5589
|
+
}
|
|
5590
|
+
refer(callID, body, options) {
|
|
5591
|
+
return this._client.post(path`/realtime/calls/${callID}/refer`, {
|
|
5592
|
+
body,
|
|
5593
|
+
...options,
|
|
5594
|
+
headers: buildHeaders([{ Accept: "*/*" }, options?.headers])
|
|
5595
|
+
});
|
|
5596
|
+
}
|
|
5597
|
+
reject(callID, body = {}, options) {
|
|
5598
|
+
return this._client.post(path`/realtime/calls/${callID}/reject`, {
|
|
5599
|
+
body,
|
|
5600
|
+
...options,
|
|
5601
|
+
headers: buildHeaders([{ Accept: "*/*" }, options?.headers])
|
|
5602
|
+
});
|
|
5603
|
+
}
|
|
5604
|
+
}
|
|
5605
|
+
|
|
5606
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/realtime/client-secrets.mjs
|
|
5607
|
+
class ClientSecrets extends APIResource {
|
|
5608
|
+
create(body, options) {
|
|
5609
|
+
return this._client.post("/realtime/client_secrets", { body, ...options });
|
|
5610
|
+
}
|
|
5611
|
+
}
|
|
5612
|
+
|
|
5613
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/realtime/realtime.mjs
|
|
5614
|
+
class Realtime2 extends APIResource {
|
|
5615
|
+
constructor() {
|
|
5616
|
+
super(...arguments);
|
|
5617
|
+
this.clientSecrets = new ClientSecrets(this._client);
|
|
5618
|
+
this.calls = new Calls(this._client);
|
|
5619
|
+
}
|
|
5620
|
+
}
|
|
5621
|
+
Realtime2.ClientSecrets = ClientSecrets;
|
|
5622
|
+
Realtime2.Calls = Calls;
|
|
5623
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/lib/ResponsesParser.mjs
|
|
5413
5624
|
function maybeParseResponse(response, params) {
|
|
5414
5625
|
if (!params || !hasAutoParseableInput2(params)) {
|
|
5415
5626
|
return {
|
|
@@ -5530,7 +5741,7 @@ function addOutputText(rsp) {
|
|
|
5530
5741
|
rsp.output_text = texts.join("");
|
|
5531
5742
|
}
|
|
5532
5743
|
|
|
5533
|
-
// node_modules/.pnpm/openai@
|
|
5744
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/lib/responses/ResponseStream.mjs
|
|
5534
5745
|
var _ResponseStream_instances;
|
|
5535
5746
|
var _ResponseStream_params;
|
|
5536
5747
|
var _ResponseStream_currentResponseSnapshot;
|
|
@@ -5665,8 +5876,15 @@ class ResponseStream extends EventStream {
|
|
|
5665
5876
|
if (!output) {
|
|
5666
5877
|
throw new OpenAIError(`missing output at index ${event.output_index}`);
|
|
5667
5878
|
}
|
|
5668
|
-
|
|
5669
|
-
|
|
5879
|
+
const type = output.type;
|
|
5880
|
+
const part = event.part;
|
|
5881
|
+
if (type === "message" && part.type !== "reasoning_text") {
|
|
5882
|
+
output.content.push(part);
|
|
5883
|
+
} else if (type === "reasoning" && part.type === "reasoning_text") {
|
|
5884
|
+
if (!output.content) {
|
|
5885
|
+
output.content = [];
|
|
5886
|
+
}
|
|
5887
|
+
output.content.push(part);
|
|
5670
5888
|
}
|
|
5671
5889
|
break;
|
|
5672
5890
|
}
|
|
@@ -5697,6 +5915,23 @@ class ResponseStream extends EventStream {
|
|
|
5697
5915
|
}
|
|
5698
5916
|
break;
|
|
5699
5917
|
}
|
|
5918
|
+
case "response.reasoning_text.delta": {
|
|
5919
|
+
const output = snapshot.output[event.output_index];
|
|
5920
|
+
if (!output) {
|
|
5921
|
+
throw new OpenAIError(`missing output at index ${event.output_index}`);
|
|
5922
|
+
}
|
|
5923
|
+
if (output.type === "reasoning") {
|
|
5924
|
+
const content = output.content?.[event.content_index];
|
|
5925
|
+
if (!content) {
|
|
5926
|
+
throw new OpenAIError(`missing content at index ${event.content_index}`);
|
|
5927
|
+
}
|
|
5928
|
+
if (content.type !== "reasoning_text") {
|
|
5929
|
+
throw new OpenAIError(`expected content to be 'reasoning_text', got ${content.type}`);
|
|
5930
|
+
}
|
|
5931
|
+
content.text += event.delta;
|
|
5932
|
+
}
|
|
5933
|
+
break;
|
|
5934
|
+
}
|
|
5700
5935
|
case "response.completed": {
|
|
5701
5936
|
__classPrivateFieldSet(this, _ResponseStream_currentResponseSnapshot, event.response, "f");
|
|
5702
5937
|
break;
|
|
@@ -5765,18 +6000,26 @@ function finalizeResponse(snapshot, params) {
|
|
|
5765
6000
|
return maybeParseResponse(snapshot, params);
|
|
5766
6001
|
}
|
|
5767
6002
|
|
|
5768
|
-
// node_modules/.pnpm/openai@
|
|
6003
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/responses/input-items.mjs
|
|
5769
6004
|
class InputItems extends APIResource {
|
|
5770
6005
|
list(responseID, query = {}, options) {
|
|
5771
6006
|
return this._client.getAPIList(path`/responses/${responseID}/input_items`, CursorPage, { query, ...options });
|
|
5772
6007
|
}
|
|
5773
6008
|
}
|
|
5774
6009
|
|
|
5775
|
-
// node_modules/.pnpm/openai@
|
|
6010
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/responses/input-tokens.mjs
|
|
6011
|
+
class InputTokens extends APIResource {
|
|
6012
|
+
count(body = {}, options) {
|
|
6013
|
+
return this._client.post("/responses/input_tokens", { body, ...options });
|
|
6014
|
+
}
|
|
6015
|
+
}
|
|
6016
|
+
|
|
6017
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/responses/responses.mjs
|
|
5776
6018
|
class Responses extends APIResource {
|
|
5777
6019
|
constructor() {
|
|
5778
6020
|
super(...arguments);
|
|
5779
6021
|
this.inputItems = new InputItems(this._client);
|
|
6022
|
+
this.inputTokens = new InputTokens(this._client);
|
|
5780
6023
|
}
|
|
5781
6024
|
create(body, options) {
|
|
5782
6025
|
return this._client.post("/responses", { body, ...options, stream: body.stream ?? false })._thenUnwrap((rsp) => {
|
|
@@ -5815,14 +6058,15 @@ class Responses extends APIResource {
|
|
|
5815
6058
|
}
|
|
5816
6059
|
}
|
|
5817
6060
|
Responses.InputItems = InputItems;
|
|
5818
|
-
|
|
6061
|
+
Responses.InputTokens = InputTokens;
|
|
6062
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/uploads/parts.mjs
|
|
5819
6063
|
class Parts extends APIResource {
|
|
5820
6064
|
create(uploadID, body, options) {
|
|
5821
6065
|
return this._client.post(path`/uploads/${uploadID}/parts`, multipartFormRequestOptions({ body, ...options }, this._client));
|
|
5822
6066
|
}
|
|
5823
6067
|
}
|
|
5824
6068
|
|
|
5825
|
-
// node_modules/.pnpm/openai@
|
|
6069
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/uploads/uploads.mjs
|
|
5826
6070
|
class Uploads extends APIResource {
|
|
5827
6071
|
constructor() {
|
|
5828
6072
|
super(...arguments);
|
|
@@ -5839,7 +6083,7 @@ class Uploads extends APIResource {
|
|
|
5839
6083
|
}
|
|
5840
6084
|
}
|
|
5841
6085
|
Uploads.Parts = Parts;
|
|
5842
|
-
// node_modules/.pnpm/openai@
|
|
6086
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/lib/Util.mjs
|
|
5843
6087
|
var allSettledWithThrow = async (promises) => {
|
|
5844
6088
|
const results = await Promise.allSettled(promises);
|
|
5845
6089
|
const rejected = results.filter((result) => result.status === "rejected");
|
|
@@ -5858,7 +6102,7 @@ var allSettledWithThrow = async (promises) => {
|
|
|
5858
6102
|
return values2;
|
|
5859
6103
|
};
|
|
5860
6104
|
|
|
5861
|
-
// node_modules/.pnpm/openai@
|
|
6105
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/vector-stores/file-batches.mjs
|
|
5862
6106
|
class FileBatches extends APIResource {
|
|
5863
6107
|
create(vectorStoreID, body, options) {
|
|
5864
6108
|
return this._client.post(path`/vector_stores/${vectorStoreID}/file_batches`, {
|
|
@@ -5948,7 +6192,7 @@ class FileBatches extends APIResource {
|
|
|
5948
6192
|
}
|
|
5949
6193
|
}
|
|
5950
6194
|
|
|
5951
|
-
// node_modules/.pnpm/openai@
|
|
6195
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/vector-stores/files.mjs
|
|
5952
6196
|
class Files3 extends APIResource {
|
|
5953
6197
|
create(vectorStoreID, body, options) {
|
|
5954
6198
|
return this._client.post(path`/vector_stores/${vectorStoreID}/files`, {
|
|
@@ -6039,7 +6283,7 @@ class Files3 extends APIResource {
|
|
|
6039
6283
|
}
|
|
6040
6284
|
}
|
|
6041
6285
|
|
|
6042
|
-
// node_modules/.pnpm/openai@
|
|
6286
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/vector-stores/vector-stores.mjs
|
|
6043
6287
|
class VectorStores extends APIResource {
|
|
6044
6288
|
constructor() {
|
|
6045
6289
|
super(...arguments);
|
|
@@ -6090,7 +6334,33 @@ class VectorStores extends APIResource {
|
|
|
6090
6334
|
}
|
|
6091
6335
|
VectorStores.Files = Files3;
|
|
6092
6336
|
VectorStores.FileBatches = FileBatches;
|
|
6093
|
-
// node_modules/.pnpm/openai@
|
|
6337
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/videos.mjs
|
|
6338
|
+
class Videos extends APIResource {
|
|
6339
|
+
create(body, options) {
|
|
6340
|
+
return this._client.post("/videos", maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
6341
|
+
}
|
|
6342
|
+
retrieve(videoID, options) {
|
|
6343
|
+
return this._client.get(path`/videos/${videoID}`, options);
|
|
6344
|
+
}
|
|
6345
|
+
list(query = {}, options) {
|
|
6346
|
+
return this._client.getAPIList("/videos", ConversationCursorPage, { query, ...options });
|
|
6347
|
+
}
|
|
6348
|
+
delete(videoID, options) {
|
|
6349
|
+
return this._client.delete(path`/videos/${videoID}`, options);
|
|
6350
|
+
}
|
|
6351
|
+
downloadContent(videoID, query = {}, options) {
|
|
6352
|
+
return this._client.get(path`/videos/${videoID}/content`, {
|
|
6353
|
+
query,
|
|
6354
|
+
...options,
|
|
6355
|
+
headers: buildHeaders([{ Accept: "application/binary" }, options?.headers]),
|
|
6356
|
+
__binaryResponse: true
|
|
6357
|
+
});
|
|
6358
|
+
}
|
|
6359
|
+
remix(videoID, body, options) {
|
|
6360
|
+
return this._client.post(path`/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
6361
|
+
}
|
|
6362
|
+
}
|
|
6363
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/resources/webhooks.mjs
|
|
6094
6364
|
var _Webhooks_instances;
|
|
6095
6365
|
var _Webhooks_validateSecret;
|
|
6096
6366
|
var _Webhooks_getRequiredHeader;
|
|
@@ -6156,7 +6426,7 @@ _Webhooks_instances = new WeakSet, _Webhooks_validateSecret = function _Webhooks
|
|
|
6156
6426
|
}
|
|
6157
6427
|
return value;
|
|
6158
6428
|
};
|
|
6159
|
-
// node_modules/.pnpm/openai@
|
|
6429
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/client.mjs
|
|
6160
6430
|
var _OpenAI_instances;
|
|
6161
6431
|
var _a2;
|
|
6162
6432
|
var _OpenAI_encoder;
|
|
@@ -6182,10 +6452,13 @@ class OpenAI {
|
|
|
6182
6452
|
this.batches = new Batches(this);
|
|
6183
6453
|
this.uploads = new Uploads(this);
|
|
6184
6454
|
this.responses = new Responses(this);
|
|
6455
|
+
this.realtime = new Realtime2(this);
|
|
6456
|
+
this.conversations = new Conversations(this);
|
|
6185
6457
|
this.evals = new Evals(this);
|
|
6186
6458
|
this.containers = new Containers(this);
|
|
6459
|
+
this.videos = new Videos(this);
|
|
6187
6460
|
if (apiKey === undefined) {
|
|
6188
|
-
throw new OpenAIError("
|
|
6461
|
+
throw new OpenAIError("Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.");
|
|
6189
6462
|
}
|
|
6190
6463
|
const options = {
|
|
6191
6464
|
apiKey,
|
|
@@ -6218,7 +6491,7 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
6218
6491
|
this.fetch = options.fetch ?? getDefaultFetch();
|
|
6219
6492
|
__classPrivateFieldSet(this, _OpenAI_encoder, FallbackEncoder, "f");
|
|
6220
6493
|
this._options = options;
|
|
6221
|
-
this.apiKey = apiKey;
|
|
6494
|
+
this.apiKey = typeof apiKey === "string" ? apiKey : "Missing Key";
|
|
6222
6495
|
this.organization = organization;
|
|
6223
6496
|
this.project = project;
|
|
6224
6497
|
this.webhookSecret = webhookSecret;
|
|
@@ -6262,6 +6535,24 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
6262
6535
|
makeStatusError(status, error2, message, headers) {
|
|
6263
6536
|
return APIError.generate(status, error2, message, headers);
|
|
6264
6537
|
}
|
|
6538
|
+
async _callApiKey() {
|
|
6539
|
+
const apiKey = this._options.apiKey;
|
|
6540
|
+
if (typeof apiKey !== "function")
|
|
6541
|
+
return false;
|
|
6542
|
+
let token;
|
|
6543
|
+
try {
|
|
6544
|
+
token = await apiKey();
|
|
6545
|
+
} catch (err) {
|
|
6546
|
+
if (err instanceof OpenAIError)
|
|
6547
|
+
throw err;
|
|
6548
|
+
throw new OpenAIError(`Failed to get token from 'apiKey' function: ${err.message}`, { cause: err });
|
|
6549
|
+
}
|
|
6550
|
+
if (typeof token !== "string" || !token) {
|
|
6551
|
+
throw new OpenAIError(`Expected 'apiKey' function argument to return a string but it returned ${token}`);
|
|
6552
|
+
}
|
|
6553
|
+
this.apiKey = token;
|
|
6554
|
+
return true;
|
|
6555
|
+
}
|
|
6265
6556
|
buildURL(path2, query, defaultBaseURL) {
|
|
6266
6557
|
const baseURL = !__classPrivateFieldGet(this, _OpenAI_instances, "m", _OpenAI_baseURLOverridden).call(this) && defaultBaseURL || this.baseURL;
|
|
6267
6558
|
const url = isAbsoluteURL(path2) ? new URL(path2) : new URL(baseURL + (baseURL.endsWith("/") && path2.startsWith("/") ? path2.slice(1) : path2));
|
|
@@ -6274,7 +6565,9 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
6274
6565
|
}
|
|
6275
6566
|
return url.toString();
|
|
6276
6567
|
}
|
|
6277
|
-
async prepareOptions(options) {
|
|
6568
|
+
async prepareOptions(options) {
|
|
6569
|
+
await this._callApiKey();
|
|
6570
|
+
}
|
|
6278
6571
|
async prepareRequest(request, { url, options }) {}
|
|
6279
6572
|
get(path2, opts) {
|
|
6280
6573
|
return this.methodRequest("get", path2, opts);
|
|
@@ -6326,7 +6619,7 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
6326
6619
|
const controller = new AbortController;
|
|
6327
6620
|
const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError);
|
|
6328
6621
|
const headersTime = Date.now();
|
|
6329
|
-
if (response instanceof Error) {
|
|
6622
|
+
if (response instanceof globalThis.Error) {
|
|
6330
6623
|
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
6331
6624
|
if (options.signal?.aborted) {
|
|
6332
6625
|
throw new APIUserAbortError;
|
|
@@ -6525,7 +6818,7 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
6525
6818
|
return { bodyHeaders: undefined, body: undefined };
|
|
6526
6819
|
}
|
|
6527
6820
|
const headers = buildHeaders([rawHeaders]);
|
|
6528
|
-
if (ArrayBuffer.isView(body) || body instanceof ArrayBuffer || body instanceof DataView || typeof body === "string" && headers.values.has("content-type") || body instanceof Blob || body instanceof FormData || body instanceof URLSearchParams || globalThis.ReadableStream && body instanceof globalThis.ReadableStream) {
|
|
6821
|
+
if (ArrayBuffer.isView(body) || body instanceof ArrayBuffer || body instanceof DataView || typeof body === "string" && headers.values.has("content-type") || globalThis.Blob && body instanceof globalThis.Blob || body instanceof FormData || body instanceof URLSearchParams || globalThis.ReadableStream && body instanceof globalThis.ReadableStream) {
|
|
6529
6822
|
return { bodyHeaders: undefined, body };
|
|
6530
6823
|
} else if (typeof body === "object" && ((Symbol.asyncIterator in body) || (Symbol.iterator in body) && ("next" in body) && typeof body.next === "function")) {
|
|
6531
6824
|
return { bodyHeaders: undefined, body: ReadableStreamFrom(body) };
|
|
@@ -6570,9 +6863,12 @@ OpenAI.Beta = Beta;
|
|
|
6570
6863
|
OpenAI.Batches = Batches;
|
|
6571
6864
|
OpenAI.Uploads = Uploads;
|
|
6572
6865
|
OpenAI.Responses = Responses;
|
|
6866
|
+
OpenAI.Realtime = Realtime2;
|
|
6867
|
+
OpenAI.Conversations = Conversations;
|
|
6573
6868
|
OpenAI.Evals = Evals;
|
|
6574
6869
|
OpenAI.Containers = Containers;
|
|
6575
|
-
|
|
6870
|
+
OpenAI.Videos = Videos;
|
|
6871
|
+
// node_modules/.pnpm/openai@6.6.0_ws@8.18.3_zod@3.25.76/node_modules/openai/azure.mjs
|
|
6576
6872
|
var _deployments_endpoints = new Set([
|
|
6577
6873
|
"/completions",
|
|
6578
6874
|
"/chat/completions",
|