supercompat 2.2.0 → 2.2.2
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/index.cjs +24 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +24 -15
- package/dist/index.js.map +1 -1
- package/dist/supercompat.cjs +17 -5
- package/dist/supercompat.cjs.map +1 -1
- package/dist/supercompat.js +17 -5
- package/dist/supercompat.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -15,7 +15,7 @@ declare const groqClientAdapter: ({ groq, }: {
|
|
|
15
15
|
groq: any;
|
|
16
16
|
}) => {
|
|
17
17
|
client: any;
|
|
18
|
-
|
|
18
|
+
requestHandlers: {
|
|
19
19
|
'^/v1/chat/completions$': {
|
|
20
20
|
post: (_url: string, options: any) => Promise<Response>;
|
|
21
21
|
};
|
|
@@ -37,7 +37,7 @@ declare const mistralClientAdapter: ({ mistral, }: {
|
|
|
37
37
|
mistral: Mistral;
|
|
38
38
|
}) => {
|
|
39
39
|
client: Mistral;
|
|
40
|
-
|
|
40
|
+
requestHandlers: {
|
|
41
41
|
'^/v1/chat/completions$': {
|
|
42
42
|
post: (_url: string, options: any) => Promise<Response>;
|
|
43
43
|
};
|
|
@@ -48,7 +48,7 @@ declare const perplexityClientAdapter: ({ perplexity, }: {
|
|
|
48
48
|
perplexity: OpenAI;
|
|
49
49
|
}) => {
|
|
50
50
|
client: OpenAI;
|
|
51
|
-
|
|
51
|
+
requestHandlers: {
|
|
52
52
|
'^/v1/chat/completions$': {
|
|
53
53
|
post: (_url: string, options: any) => Promise<Response>;
|
|
54
54
|
};
|
|
@@ -59,7 +59,7 @@ declare const anthropicClientAdapter: ({ anthropic, }: {
|
|
|
59
59
|
anthropic: Anthropic;
|
|
60
60
|
}) => {
|
|
61
61
|
client: Anthropic;
|
|
62
|
-
|
|
62
|
+
requestHandlers: {
|
|
63
63
|
'^/v1/chat/completions$': {
|
|
64
64
|
post: (_url: string, options: any) => Promise<Response>;
|
|
65
65
|
};
|
|
@@ -76,7 +76,7 @@ declare const completionsRunAdapter: () => ({ client: clientAdapter, run, onEven
|
|
|
76
76
|
declare const prismaStorageAdapter: ({ prisma, }: {
|
|
77
77
|
prisma: PrismaClient;
|
|
78
78
|
}) => ({ runAdapter, }: StorageAdapterArgs) => {
|
|
79
|
-
|
|
79
|
+
requestHandlers: {
|
|
80
80
|
'^/v1/threads$': {
|
|
81
81
|
post: (options?: openai_core_mjs.RequestOptions<unknown> | undefined) => Promise<Response & {
|
|
82
82
|
json: () => Promise<{
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ declare const groqClientAdapter: ({ groq, }: {
|
|
|
15
15
|
groq: any;
|
|
16
16
|
}) => {
|
|
17
17
|
client: any;
|
|
18
|
-
|
|
18
|
+
requestHandlers: {
|
|
19
19
|
'^/v1/chat/completions$': {
|
|
20
20
|
post: (_url: string, options: any) => Promise<Response>;
|
|
21
21
|
};
|
|
@@ -37,7 +37,7 @@ declare const mistralClientAdapter: ({ mistral, }: {
|
|
|
37
37
|
mistral: Mistral;
|
|
38
38
|
}) => {
|
|
39
39
|
client: Mistral;
|
|
40
|
-
|
|
40
|
+
requestHandlers: {
|
|
41
41
|
'^/v1/chat/completions$': {
|
|
42
42
|
post: (_url: string, options: any) => Promise<Response>;
|
|
43
43
|
};
|
|
@@ -48,7 +48,7 @@ declare const perplexityClientAdapter: ({ perplexity, }: {
|
|
|
48
48
|
perplexity: OpenAI;
|
|
49
49
|
}) => {
|
|
50
50
|
client: OpenAI;
|
|
51
|
-
|
|
51
|
+
requestHandlers: {
|
|
52
52
|
'^/v1/chat/completions$': {
|
|
53
53
|
post: (_url: string, options: any) => Promise<Response>;
|
|
54
54
|
};
|
|
@@ -59,7 +59,7 @@ declare const anthropicClientAdapter: ({ anthropic, }: {
|
|
|
59
59
|
anthropic: Anthropic;
|
|
60
60
|
}) => {
|
|
61
61
|
client: Anthropic;
|
|
62
|
-
|
|
62
|
+
requestHandlers: {
|
|
63
63
|
'^/v1/chat/completions$': {
|
|
64
64
|
post: (_url: string, options: any) => Promise<Response>;
|
|
65
65
|
};
|
|
@@ -76,7 +76,7 @@ declare const completionsRunAdapter: () => ({ client: clientAdapter, run, onEven
|
|
|
76
76
|
declare const prismaStorageAdapter: ({ prisma, }: {
|
|
77
77
|
prisma: PrismaClient;
|
|
78
78
|
}) => ({ runAdapter, }: StorageAdapterArgs) => {
|
|
79
|
-
|
|
79
|
+
requestHandlers: {
|
|
80
80
|
'^/v1/threads$': {
|
|
81
81
|
post: (options?: openai_core_mjs.RequestOptions<unknown> | undefined) => Promise<Response & {
|
|
82
82
|
json: () => Promise<{
|
package/dist/index.js
CHANGED
|
@@ -291,13 +291,24 @@ function _ts_values(o) {
|
|
|
291
291
|
import OpenAI from "openai";
|
|
292
292
|
// src/supercompatFetch/requestHandlers.ts
|
|
293
293
|
import { assign, partob } from "radash";
|
|
294
|
-
var
|
|
295
|
-
var
|
|
296
|
-
|
|
294
|
+
var storageRequestHandlers = function(param) {
|
|
295
|
+
var storage = param.storage, runAdapter = param.runAdapter, client = param.client;
|
|
296
|
+
if (!storage) return {};
|
|
297
|
+
if (!runAdapter) return {};
|
|
298
|
+
var result = storage({
|
|
297
299
|
runAdapter: partob(runAdapter, {
|
|
298
300
|
client: client
|
|
299
301
|
})
|
|
300
|
-
})
|
|
302
|
+
});
|
|
303
|
+
return result.requestHandlers;
|
|
304
|
+
};
|
|
305
|
+
var requestHandlers = function(param) {
|
|
306
|
+
var client = param.client, storage = param.storage, runAdapter = param.runAdapter;
|
|
307
|
+
return assign(client.requestHandlers, storageRequestHandlers({
|
|
308
|
+
storage: storage,
|
|
309
|
+
runAdapter: runAdapter,
|
|
310
|
+
client: client
|
|
311
|
+
}));
|
|
301
312
|
};
|
|
302
313
|
// src/supercompatFetch/findRequestHandler.ts
|
|
303
314
|
var findRequestHandler = function(param) {
|
|
@@ -313,7 +324,8 @@ var findRequestHandler = function(param) {
|
|
|
313
324
|
// src/supercompatFetch/originalFetch.ts
|
|
314
325
|
var originalFetch = function(param) {
|
|
315
326
|
var args = param.args, client = param.client;
|
|
316
|
-
|
|
327
|
+
var _client_client;
|
|
328
|
+
if ((_client_client = client.client) === null || _client_client === void 0 ? void 0 : _client_client.fetch) {
|
|
317
329
|
var _args = _sliced_to_array(args, 2), url = _args[0], options = _args[1];
|
|
318
330
|
var headers = _object_spread_props(_object_spread({}, options.headers), {
|
|
319
331
|
authorization: client.client.defaultHeaders().Authorization
|
|
@@ -569,7 +581,7 @@ var groqClientAdapter = function(param) {
|
|
|
569
581
|
var groq = param.groq;
|
|
570
582
|
return {
|
|
571
583
|
client: groq,
|
|
572
|
-
|
|
584
|
+
requestHandlers: {
|
|
573
585
|
"^/v1/chat/completions$": completions({
|
|
574
586
|
groq: groq
|
|
575
587
|
})
|
|
@@ -955,7 +967,7 @@ var mistralClientAdapter = function(param) {
|
|
|
955
967
|
var mistral = param.mistral;
|
|
956
968
|
return {
|
|
957
969
|
client: mistral,
|
|
958
|
-
|
|
970
|
+
requestHandlers: {
|
|
959
971
|
"^/v1/chat/completions$": completions3({
|
|
960
972
|
mistral: mistral
|
|
961
973
|
})
|
|
@@ -1169,7 +1181,7 @@ var perplexityClientAdapter = function(param) {
|
|
|
1169
1181
|
var perplexity = param.perplexity;
|
|
1170
1182
|
return {
|
|
1171
1183
|
client: perplexity,
|
|
1172
|
-
|
|
1184
|
+
requestHandlers: {
|
|
1173
1185
|
"^/v1/chat/completions$": completions4({
|
|
1174
1186
|
perplexity: perplexity
|
|
1175
1187
|
})
|
|
@@ -1181,7 +1193,7 @@ import { uid, fork, omit, isEmpty } from "radash";
|
|
|
1181
1193
|
// src/adapters/client/anthropicClientAdapter/completions/serializeTools.ts
|
|
1182
1194
|
var serializeTools = function(param) {
|
|
1183
1195
|
var tools = param.tools;
|
|
1184
|
-
return tools.map(function(tool) {
|
|
1196
|
+
return (tools !== null && tools !== void 0 ? tools : []).map(function(tool) {
|
|
1185
1197
|
if (tool.type === "function") {
|
|
1186
1198
|
return {
|
|
1187
1199
|
name: tool.function.name,
|
|
@@ -1518,7 +1530,7 @@ var anthropicClientAdapter = function(param) {
|
|
|
1518
1530
|
var anthropic = param.anthropic;
|
|
1519
1531
|
return {
|
|
1520
1532
|
client: anthropic,
|
|
1521
|
-
|
|
1533
|
+
requestHandlers: {
|
|
1522
1534
|
"^/v1/chat/completions$": completions5({
|
|
1523
1535
|
anthropic: anthropic
|
|
1524
1536
|
})
|
|
@@ -1710,10 +1722,7 @@ var completionsRunAdapter = function() {
|
|
|
1710
1722
|
2
|
|
1711
1723
|
];
|
|
1712
1724
|
client = supercompat({
|
|
1713
|
-
client: clientAdapter
|
|
1714
|
-
storage: function() {},
|
|
1715
|
-
// @ts-ignore-next-line
|
|
1716
|
-
runAdapter: {}
|
|
1725
|
+
client: clientAdapter
|
|
1717
1726
|
});
|
|
1718
1727
|
onEvent2({
|
|
1719
1728
|
event: "thread.run.in_progress",
|
|
@@ -3393,7 +3402,7 @@ var prismaStorageAdapter = function(param) {
|
|
|
3393
3402
|
return function(param) {
|
|
3394
3403
|
var runAdapter = param.runAdapter;
|
|
3395
3404
|
return {
|
|
3396
|
-
|
|
3405
|
+
requestHandlers: {
|
|
3397
3406
|
"^/v1/threads$": threads({
|
|
3398
3407
|
prisma: prisma
|
|
3399
3408
|
}),
|