modelmix 5.1.12 → 5.1.16
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/README.md +30 -9
- package/demo/gemini.js +3 -3
- package/demo/short.js +1 -1
- package/effort.js +2 -1
- package/http-client.js +6 -6
- package/index.d.ts +11 -6
- package/index.js +136 -73
- package/lib/abort-signal.js +57 -0
- package/lib/model-chain.js +1 -1
- package/lib/providers/anthropic.js +2 -2
- package/lib/providers/base.js +17 -6
- package/lib/providers/google.js +9 -2
- package/lib/providers/openai-compatible.js +8 -8
- package/lib/providers/openai.js +32 -10
- package/lib/token-usage.js +1 -0
- package/mcp-tools.js +5 -2
- package/package.json +2 -2
- package/plugins/rlm/index.d.ts +1 -0
- package/plugins/rlm/lib/isolated-vm-sandbox.js +8 -1
- package/plugins/rlm/lib/plugin.js +23 -5
- package/plugins/rlm/test/isolated-vm-sandbox.test.js +23 -0
- package/skills/modelmix/SKILL.md +30 -12
- package/test/abort.test.js +517 -0
- package/test/effort.test.js +13 -0
- package/test/fallback.test.js +2 -2
- package/test/live.mcp.js +6 -6
- package/test/live.test.js +11 -6
- package/test/tokens.test.js +9 -6
package/test/tokens.test.js
CHANGED
|
@@ -517,26 +517,29 @@ describe('Token Usage Tracking', () => {
|
|
|
517
517
|
|
|
518
518
|
it('should register Gemini Flash shortcuts with Google provider', function () {
|
|
519
519
|
const model = ModelMix.new()
|
|
520
|
+
.gemini38flash()
|
|
520
521
|
.gemini37flash()
|
|
521
522
|
.gemini36flash()
|
|
522
523
|
.gemini35flash()
|
|
523
524
|
.gemini35flashLite();
|
|
524
525
|
|
|
525
526
|
expect(model.models.map(({ key }) => key)).to.deep.equal([
|
|
527
|
+
'gemini-3.8-flash',
|
|
526
528
|
'gemini-3.7-flash',
|
|
527
529
|
'gemini-3.6-flash',
|
|
528
530
|
'gemini-3.5-flash',
|
|
529
531
|
'gemini-3.5-flash-lite'
|
|
530
532
|
]);
|
|
531
533
|
expect(model.models.every(({ provider }) => provider instanceof MixGoogle)).to.equal(true);
|
|
534
|
+
expect(ModelMix.calculateCost('gemini-3.8-flash', { input: 1_000_000, output: 1_000_000 })).to.equal(4.5);
|
|
532
535
|
expect(ModelMix.calculateCost('gemini-3.7-flash', { input: 1_000_000, output: 1_000_000 })).to.equal(4.5);
|
|
533
536
|
expect(ModelMix.calculateCost('gemini-3.6-flash', { input: 1_000_000, output: 1_000_000 })).to.equal(4.5);
|
|
534
537
|
expect(ModelMix.calculateCost('gemini-3.5-flash', { input: 1_000_000, output: 1_000_000 })).to.equal(5.25);
|
|
535
538
|
expect(ModelMix.calculateCost('gemini-3.5-flash-lite', { input: 1_000_000, output: 1_000_000 })).to.equal(2.8);
|
|
536
539
|
});
|
|
537
540
|
|
|
538
|
-
it('should calculate Gemini 3.
|
|
539
|
-
expect(ModelMix.calculateCostBreakdown('gemini-3.
|
|
541
|
+
it('should calculate Gemini 3.8 Flash cache reads and thinking at the introductory rate', function () {
|
|
542
|
+
expect(ModelMix.calculateCostBreakdown('gemini-3.8-flash', {
|
|
540
543
|
input: 1_000_000,
|
|
541
544
|
output: 1_000_000,
|
|
542
545
|
thinking: 500_000,
|
|
@@ -552,10 +555,10 @@ describe('Token Usage Tracking', () => {
|
|
|
552
555
|
});
|
|
553
556
|
});
|
|
554
557
|
|
|
555
|
-
it('should forward options and config through
|
|
558
|
+
it('should forward options and config through gemini38flash()', function () {
|
|
556
559
|
const options = { thinkingLevel: 'high' };
|
|
557
560
|
const config = { max_history: 3 };
|
|
558
|
-
const model = ModelMix.new().
|
|
561
|
+
const model = ModelMix.new().gemini38flash({ options, config });
|
|
559
562
|
|
|
560
563
|
expect(model.models[0].provider).to.be.instanceOf(MixGoogle);
|
|
561
564
|
expect(model.models[0].provider.options).to.deep.equal(options);
|
|
@@ -687,7 +690,7 @@ describe('Token Usage Tracking', () => {
|
|
|
687
690
|
this.timeout(30000);
|
|
688
691
|
|
|
689
692
|
const model = ModelMix.new()
|
|
690
|
-
.
|
|
693
|
+
.gemini38flash()
|
|
691
694
|
.addText('Say hi');
|
|
692
695
|
|
|
693
696
|
const result = await model.raw();
|
|
@@ -750,7 +753,7 @@ describe('Token Usage Tracking', () => {
|
|
|
750
753
|
const providers = [
|
|
751
754
|
{ name: 'OpenAI', create: (m) => m.gpt56luna() },
|
|
752
755
|
{ name: 'Anthropic', create: (m) => m.haiku45() },
|
|
753
|
-
{ name: 'Google', create: (m) => m.
|
|
756
|
+
{ name: 'Google', create: (m) => m.gemini38flash() }
|
|
754
757
|
];
|
|
755
758
|
|
|
756
759
|
for (const provider of providers) {
|