supercompat 2.6.0 → 2.7.0
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 +26 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +23 -30
- package/dist/index.js.map +1 -1
- package/dist/supercompat.cjs +9 -20
- package/dist/supercompat.cjs.map +1 -1
- package/dist/supercompat.js +9 -20
- package/dist/supercompat.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -352,6 +352,9 @@ __export(src_exports, {
|
|
|
352
352
|
anthropicClientAdapter: function() {
|
|
353
353
|
return anthropicClientAdapter;
|
|
354
354
|
},
|
|
355
|
+
azureOpenaiClientAdapter: function() {
|
|
356
|
+
return azureOpenaiClientAdapter;
|
|
357
|
+
},
|
|
355
358
|
completionsRunAdapter: function() {
|
|
356
359
|
return completionsRunAdapter;
|
|
357
360
|
},
|
|
@@ -402,10 +405,6 @@ var requestHandlers = function(param) {
|
|
|
402
405
|
var findRequestHandler = function(param) {
|
|
403
406
|
var url = param.url, requestHandlers2 = param.requestHandlers;
|
|
404
407
|
var pathname = new URL(url).pathname;
|
|
405
|
-
console.log({
|
|
406
|
-
pathname: pathname,
|
|
407
|
-
requestHandlers: requestHandlers2
|
|
408
|
-
});
|
|
409
408
|
for(var key in requestHandlers2){
|
|
410
409
|
var regex = new RegExp(key);
|
|
411
410
|
if (regex.test(pathname)) {
|
|
@@ -445,17 +444,10 @@ var supercompatFetch = function(param) {
|
|
|
445
444
|
args[_key] = _arguments[_key];
|
|
446
445
|
}
|
|
447
446
|
_args = _sliced_to_array(args, 2), url = _args[0], options = _args[1];
|
|
448
|
-
console.log({
|
|
449
|
-
url: url
|
|
450
|
-
});
|
|
451
447
|
pathHandler = findRequestHandler({
|
|
452
448
|
url: url,
|
|
453
449
|
requestHandlers: requestHandlers2
|
|
454
450
|
});
|
|
455
|
-
console.log({
|
|
456
|
-
pathHandler: pathHandler,
|
|
457
|
-
options: options
|
|
458
|
-
});
|
|
459
451
|
if (!pathHandler) {
|
|
460
452
|
return [
|
|
461
453
|
2,
|
|
@@ -475,9 +467,6 @@ var supercompatFetch = function(param) {
|
|
|
475
467
|
})
|
|
476
468
|
];
|
|
477
469
|
}
|
|
478
|
-
console.log({
|
|
479
|
-
requestHandler: requestHandler
|
|
480
|
-
});
|
|
481
470
|
return [
|
|
482
471
|
2,
|
|
483
472
|
requestHandler.apply(void 0, _to_consumable_array(args))
|
|
@@ -485,18 +474,21 @@ var supercompatFetch = function(param) {
|
|
|
485
474
|
});
|
|
486
475
|
});
|
|
487
476
|
};
|
|
477
|
+
// src/lib/azureOpenai/endpointFromBaseUrl.ts
|
|
478
|
+
var endpointFromBaseUrl = function(param) {
|
|
479
|
+
var baseURL = param.baseURL;
|
|
480
|
+
return baseURL.replace(/\/+openai$/, "");
|
|
481
|
+
};
|
|
488
482
|
// src/supercompat.ts
|
|
489
483
|
var supercompat = function(param) {
|
|
490
484
|
var client = param.client, storage = param.storage, runAdapter = param.runAdapter;
|
|
491
|
-
if (client.
|
|
492
|
-
console.log({
|
|
493
|
-
client: client
|
|
494
|
-
});
|
|
485
|
+
if (client.type === "AZURE_OPENAI") {
|
|
495
486
|
return new import_openai.AzureOpenAI({
|
|
496
487
|
apiKey: client.client.apiKey,
|
|
497
488
|
apiVersion: client.client.apiVersion,
|
|
498
|
-
endpoint:
|
|
499
|
-
|
|
489
|
+
endpoint: endpointFromBaseUrl({
|
|
490
|
+
baseURL: client.client.baseURL
|
|
491
|
+
}),
|
|
500
492
|
fetch: supercompatFetch({
|
|
501
493
|
client: client,
|
|
502
494
|
storage: storage,
|
|
@@ -716,10 +708,6 @@ var post2 = function(param) {
|
|
|
716
708
|
switch(_state.label){
|
|
717
709
|
case 0:
|
|
718
710
|
body = JSON.parse(options.body);
|
|
719
|
-
console.log({
|
|
720
|
-
body: body,
|
|
721
|
-
openai: openai
|
|
722
|
-
});
|
|
723
711
|
if (!body.stream) return [
|
|
724
712
|
3,
|
|
725
713
|
2
|
|
@@ -903,6 +891,19 @@ var openaiClientAdapter = function(param) {
|
|
|
903
891
|
}
|
|
904
892
|
};
|
|
905
893
|
};
|
|
894
|
+
// src/adapters/client/azureOpenaiClientAdapter/index.ts
|
|
895
|
+
var azureOpenaiClientAdapter = function(param) {
|
|
896
|
+
var azureOpenai = param.azureOpenai;
|
|
897
|
+
return {
|
|
898
|
+
type: "AZURE_OPENAI",
|
|
899
|
+
client: azureOpenai,
|
|
900
|
+
requestHandlers: {
|
|
901
|
+
"^/(?:v1|/?openai)/chat/completions$": completions2({
|
|
902
|
+
openai: azureOpenai
|
|
903
|
+
})
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
};
|
|
906
907
|
// src/adapters/client/mistralClientAdapter/completions/post.ts
|
|
907
908
|
var post3 = function(param) {
|
|
908
909
|
var mistral = param.mistral;
|
|
@@ -2377,11 +2378,6 @@ var post7 = function(param) {
|
|
|
2377
2378
|
case 0:
|
|
2378
2379
|
url = new URL(urlString);
|
|
2379
2380
|
_url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(messagesRegexp)), 2), threadId = _url_pathname_match[1];
|
|
2380
|
-
console.log({
|
|
2381
|
-
threadId: threadId,
|
|
2382
|
-
url: url,
|
|
2383
|
-
messagesRegexp: messagesRegexp
|
|
2384
|
-
});
|
|
2385
2381
|
body = JSON.parse(options.body);
|
|
2386
2382
|
role = body.role, content = body.content;
|
|
2387
2383
|
return [
|
|
@@ -3647,6 +3643,7 @@ var prismaStorageAdapter = function(param) {
|
|
|
3647
3643
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3648
3644
|
0 && (module.exports = {
|
|
3649
3645
|
anthropicClientAdapter: anthropicClientAdapter,
|
|
3646
|
+
azureOpenaiClientAdapter: azureOpenaiClientAdapter,
|
|
3650
3647
|
completionsRunAdapter: completionsRunAdapter,
|
|
3651
3648
|
groqClientAdapter: groqClientAdapter,
|
|
3652
3649
|
mistralClientAdapter: mistralClientAdapter,
|