supercompat 2.19.2 → 2.20.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 +73 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +49 -36
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1695,38 +1695,20 @@ var models7 = function(param) {
|
|
|
1695
1695
|
};
|
|
1696
1696
|
};
|
|
1697
1697
|
// src/adapters/client/anthropicClientAdapter/completions/post.ts
|
|
1698
|
-
import { uid, fork, omit as omit2, isEmpty
|
|
1698
|
+
import { uid, fork, omit as omit2, isEmpty } from "radash";
|
|
1699
1699
|
// src/lib/messages/nonEmptyMessages.ts
|
|
1700
|
-
import { isEmpty, isArray } from "radash";
|
|
1701
1700
|
var nonEmptyContent = function(param) {
|
|
1702
1701
|
var message = param.message;
|
|
1703
|
-
if (
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
return message.content.map(function(content) {
|
|
1708
|
-
if (content.type === "text") {
|
|
1709
|
-
if (isEmpty(content.text)) {
|
|
1710
|
-
return {
|
|
1711
|
-
type: "text",
|
|
1712
|
-
text: "-"
|
|
1713
|
-
};
|
|
1714
|
-
} else {
|
|
1715
|
-
return content;
|
|
1716
|
-
}
|
|
1717
|
-
} else {
|
|
1718
|
-
return content;
|
|
1719
|
-
}
|
|
1720
|
-
});
|
|
1702
|
+
if (typeof message.content === "string") {
|
|
1703
|
+
if (!/\S/.test(message.content)) {
|
|
1704
|
+
return "-";
|
|
1705
|
+
}
|
|
1721
1706
|
}
|
|
1722
1707
|
return message.content;
|
|
1723
1708
|
};
|
|
1724
1709
|
var nonEmptyMessages = function(param) {
|
|
1725
1710
|
var messages3 = param.messages;
|
|
1726
1711
|
var result = [];
|
|
1727
|
-
console.log({
|
|
1728
|
-
messages: messages3
|
|
1729
|
-
});
|
|
1730
1712
|
messages3.forEach(function(message) {
|
|
1731
1713
|
return result.push(_object_spread_props(_object_spread({}, message), {
|
|
1732
1714
|
content: nonEmptyContent({
|
|
@@ -1734,9 +1716,6 @@ var nonEmptyMessages = function(param) {
|
|
|
1734
1716
|
})
|
|
1735
1717
|
}));
|
|
1736
1718
|
});
|
|
1737
|
-
console.log({
|
|
1738
|
-
result: result
|
|
1739
|
-
});
|
|
1740
1719
|
return result;
|
|
1741
1720
|
};
|
|
1742
1721
|
// src/lib/messages/firstUserMessages.ts
|
|
@@ -1846,7 +1825,7 @@ var post5 = function(param) {
|
|
|
1846
1825
|
resultOptions = _object_spread_props(_object_spread({}, omit2(body, [
|
|
1847
1826
|
"response_format"
|
|
1848
1827
|
])), {
|
|
1849
|
-
stream: body.stream ?
|
|
1828
|
+
stream: body.stream ? isEmpty(body.tools) : false,
|
|
1850
1829
|
system: system,
|
|
1851
1830
|
messages: serializeMessages({
|
|
1852
1831
|
messages: chatMessages
|
|
@@ -2375,10 +2354,11 @@ var togetherClientAdapter = function(param) {
|
|
|
2375
2354
|
// src/adapters/client/googleClientAdapter/models/get.ts
|
|
2376
2355
|
var models9 = [
|
|
2377
2356
|
"gemini-2.0-flash-exp",
|
|
2357
|
+
"gemini-2.0-flash",
|
|
2358
|
+
"gemini-2.0-flash-lite-preview-02-05",
|
|
2378
2359
|
"gemini-1.5-flash",
|
|
2379
2360
|
"gemini-1.5-flash-8b",
|
|
2380
2361
|
"gemini-1.5-pro",
|
|
2381
|
-
"gemini-1.0-pro",
|
|
2382
2362
|
"text-embedding-004",
|
|
2383
2363
|
"aqa"
|
|
2384
2364
|
];
|
|
@@ -2438,29 +2418,35 @@ var models10 = function(param) {
|
|
|
2438
2418
|
};
|
|
2439
2419
|
};
|
|
2440
2420
|
// src/adapters/client/googleClientAdapter/completions/post.ts
|
|
2421
|
+
import { createId } from "@paralleldrive/cuid2";
|
|
2441
2422
|
var post7 = function(param) {
|
|
2442
2423
|
var google = param.google;
|
|
2443
2424
|
return /*#__PURE__*/ function() {
|
|
2444
2425
|
var _ref = _async_to_generator(function(_url, options) {
|
|
2445
|
-
var body, response, stream, data, error;
|
|
2426
|
+
var body, resultOptions, response, stream, data, error;
|
|
2446
2427
|
return _ts_generator(this, function(_state) {
|
|
2447
2428
|
switch(_state.label){
|
|
2448
2429
|
case 0:
|
|
2449
2430
|
body = JSON.parse(options.body);
|
|
2431
|
+
resultOptions = _object_spread_props(_object_spread({}, body), {
|
|
2432
|
+
messages: nonEmptyMessages({
|
|
2433
|
+
messages: body.messages
|
|
2434
|
+
})
|
|
2435
|
+
});
|
|
2450
2436
|
if (!body.stream) return [
|
|
2451
2437
|
3,
|
|
2452
2438
|
2
|
|
2453
2439
|
];
|
|
2454
2440
|
return [
|
|
2455
2441
|
4,
|
|
2456
|
-
google.chat.completions.create(
|
|
2442
|
+
google.chat.completions.create(resultOptions)
|
|
2457
2443
|
];
|
|
2458
2444
|
case 1:
|
|
2459
2445
|
response = _state.sent();
|
|
2460
2446
|
stream = new ReadableStream({
|
|
2461
2447
|
start: function start(controller) {
|
|
2462
2448
|
return _async_to_generator(function() {
|
|
2463
|
-
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, err;
|
|
2449
|
+
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, resultChunk, newChoices, err;
|
|
2464
2450
|
return _ts_generator(this, function(_state) {
|
|
2465
2451
|
switch(_state.label){
|
|
2466
2452
|
case 0:
|
|
@@ -2487,7 +2473,34 @@ var post7 = function(param) {
|
|
|
2487
2473
|
];
|
|
2488
2474
|
_value = _step.value;
|
|
2489
2475
|
chunk = _value;
|
|
2490
|
-
|
|
2476
|
+
resultChunk = void 0;
|
|
2477
|
+
if (chunk.choices) {
|
|
2478
|
+
newChoices = chunk.choices.map(function(choice) {
|
|
2479
|
+
var _choice_delta;
|
|
2480
|
+
if ((_choice_delta = choice.delta) === null || _choice_delta === void 0 ? void 0 : _choice_delta.tool_calls) {
|
|
2481
|
+
return _object_spread_props(_object_spread({}, choice), {
|
|
2482
|
+
delta: _object_spread_props(_object_spread({}, choice.delta), {
|
|
2483
|
+
tool_calls: choice.delta.tool_calls.map(function(toolCall) {
|
|
2484
|
+
if (toolCall.id === "") {
|
|
2485
|
+
return _object_spread_props(_object_spread({}, toolCall), {
|
|
2486
|
+
id: "call_".concat(createId())
|
|
2487
|
+
});
|
|
2488
|
+
}
|
|
2489
|
+
return toolCall;
|
|
2490
|
+
})
|
|
2491
|
+
})
|
|
2492
|
+
});
|
|
2493
|
+
} else {
|
|
2494
|
+
return choice;
|
|
2495
|
+
}
|
|
2496
|
+
});
|
|
2497
|
+
resultChunk = _object_spread_props(_object_spread({}, chunk), {
|
|
2498
|
+
choices: newChoices
|
|
2499
|
+
});
|
|
2500
|
+
} else {
|
|
2501
|
+
resultChunk = chunk;
|
|
2502
|
+
}
|
|
2503
|
+
controller.enqueue("data: ".concat(JSON.stringify(resultChunk), "\n\n"));
|
|
2491
2504
|
_state.label = 4;
|
|
2492
2505
|
case 4:
|
|
2493
2506
|
_iteratorAbruptCompletion = false;
|
|
@@ -2569,7 +2582,7 @@ var post7 = function(param) {
|
|
|
2569
2582
|
]);
|
|
2570
2583
|
return [
|
|
2571
2584
|
4,
|
|
2572
|
-
google.chat.completions.create(
|
|
2585
|
+
google.chat.completions.create(resultOptions)
|
|
2573
2586
|
];
|
|
2574
2587
|
case 3:
|
|
2575
2588
|
data = _state.sent();
|
|
@@ -3088,7 +3101,7 @@ var ollamaClientAdapter = function(param) {
|
|
|
3088
3101
|
};
|
|
3089
3102
|
// src/adapters/run/completionsRunAdapter/index.ts
|
|
3090
3103
|
import _ from "lodash";
|
|
3091
|
-
import { uid as uid2, omit as omit3, isEmpty as
|
|
3104
|
+
import { uid as uid2, omit as omit3, isEmpty as isEmpty2 } from "radash";
|
|
3092
3105
|
import dayjs from "dayjs";
|
|
3093
3106
|
// src/adapters/run/completionsRunAdapter/messages/index.ts
|
|
3094
3107
|
import { flat } from "radash";
|
|
@@ -3290,7 +3303,7 @@ var completionsRunAdapter = function() {
|
|
|
3290
3303
|
case 1:
|
|
3291
3304
|
opts = _object_spread.apply(void 0, [
|
|
3292
3305
|
(_tmp.messages = _state.sent(), _tmp.model = run2.model, _tmp.stream = true, _tmp.response_format = run2.response_format, _tmp),
|
|
3293
|
-
|
|
3306
|
+
isEmpty2(run2.tools) ? {} : {
|
|
3294
3307
|
tools: run2.tools
|
|
3295
3308
|
}
|
|
3296
3309
|
]);
|
|
@@ -3582,7 +3595,7 @@ var completionsRunAdapter = function() {
|
|
|
3582
3595
|
];
|
|
3583
3596
|
case 22:
|
|
3584
3597
|
message = _state.sent();
|
|
3585
|
-
if (
|
|
3598
|
+
if (isEmpty2(message.toolCalls)) {
|
|
3586
3599
|
return [
|
|
3587
3600
|
2,
|
|
3588
3601
|
onEvent2({
|