modelmix 4.4.8 → 4.4.12

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 CHANGED
@@ -42,8 +42,8 @@ For environment variables, use `dotenv` or Node's built-in `process.loadEnvFile(
42
42
  3. **Create and configure your models**:
43
43
 
44
44
  ```javascript
45
- import 'dotenv/config';
46
45
  import { ModelMix } from 'modelmix';
46
+ try { process.loadEnvFile(); } catch {}
47
47
 
48
48
  // Get structured JSON responses
49
49
  const model = ModelMix.new()
package/demo/custom.js CHANGED
@@ -1,6 +1,5 @@
1
- import 'dotenv/config'
2
-
3
1
  import { ModelMix, MixCustom } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
4
3
 
5
4
  const mmix = new ModelMix({
6
5
  options: {
package/demo/demo.js CHANGED
@@ -1,6 +1,5 @@
1
- import 'dotenv/config';
2
1
  import { ModelMix } from '../index.js';
3
-
2
+ try { process.loadEnvFile(); } catch {}
4
3
 
5
4
  const mmix = new ModelMix({
6
5
  options: {
@@ -14,7 +13,6 @@ const mmix = new ModelMix({
14
13
  }
15
14
  });
16
15
 
17
-
18
16
  const pplxSettings = {
19
17
  config: {
20
18
  apiKey: process.env.PPLX_API_KEY,
package/demo/fallback.js CHANGED
@@ -1,6 +1,5 @@
1
- import { ModelMix, MixOpenAI, MixAnthropic, MixGrok } from '../index.js';
2
- import dotenv from 'dotenv';
3
- dotenv.config();
1
+ import { ModelMix } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
4
3
 
5
4
  const mmix = new ModelMix({
6
5
  config: {
package/demo/fireworks.js CHANGED
@@ -1,5 +1,5 @@
1
- process.loadEnvFile();
2
1
  import { ModelMix } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
3
3
 
4
4
  async function main() {
5
5
  try {
package/demo/free.js CHANGED
@@ -1,5 +1,5 @@
1
- process.loadEnvFile();
2
1
  import { ModelMix } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
3
3
 
4
4
  const ai = ModelMix.new({ config: { debug: 2 } })
5
5
  .gptOss()
package/demo/gemini.js CHANGED
@@ -1,6 +1,6 @@
1
- process.loadEnvFile();
2
-
3
1
  import { ModelMix, MixGoogle } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
3
+
4
4
  const mmix = new ModelMix({
5
5
  options: {
6
6
  max_tokens: 2000,
package/demo/gpt51.js CHANGED
@@ -1,5 +1,6 @@
1
- process.loadEnvFile();
2
1
  import { ModelMix } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
3
+
3
4
 
4
5
  const mmix = new ModelMix({
5
6
  config: {
package/demo/grok.js CHANGED
@@ -1,6 +1,5 @@
1
- process.loadEnvFile();
2
-
3
1
  import { ModelMix } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
4
3
 
5
4
  const mmix = new ModelMix({
6
5
  options: {
package/demo/groq.js CHANGED
@@ -1,6 +1,5 @@
1
- process.loadEnvFile();
2
-
3
1
  import { ModelMix, MixGroq } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
4
3
 
5
4
  const env = process.env;
6
5
 
package/demo/images.js CHANGED
@@ -1,5 +1,5 @@
1
- process.loadEnvFile();
2
1
  import { ModelMix } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
3
3
 
4
4
  const model = ModelMix.new({ config: { max_history: 2, debug: 2 } }).maverick()
5
5
  // model.addImageFromUrl('https://pbs.twimg.com/media/F6-GsjraAAADDGy?format=jpg');
package/demo/json.js CHANGED
@@ -1,5 +1,5 @@
1
- process.loadEnvFile();
2
1
  import { ModelMix } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
3
3
 
4
4
  const model = await ModelMix.new({ options: { max_tokens: 10000 }, config: { debug: 3 } })
5
5
  .sonnet46()
@@ -1,5 +1,5 @@
1
- process.loadEnvFile();
2
1
  import { ModelMix } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
3
3
 
4
4
  console.log('🧬 ModelMix - Simple MCP Tools Demo');
5
5
 
package/demo/mcp-tools.js CHANGED
@@ -1,7 +1,7 @@
1
- process.loadEnvFile();
2
1
  import { ModelMix } from '../index.js';
3
2
  import fs from 'fs';
4
3
  import axios from 'axios';
4
+ try { process.loadEnvFile(); } catch {}
5
5
 
6
6
  console.log('🧬 ModelMix - MCP Tools Demo with Callbacks');
7
7
 
package/demo/mcp.js CHANGED
@@ -1,5 +1,5 @@
1
- process.loadEnvFile();
2
1
  import { ModelMix } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
3
3
 
4
4
  const mmix = ModelMix.new({ config: { max_history: 10 } }).gpt41nano();
5
5
  mmix.setSystem('You are an assistant and today is ' + new Date().toISOString());
package/demo/minimax.js CHANGED
@@ -1,7 +1,5 @@
1
1
  import { ModelMix } from '../index.js';
2
- process.loadEnvFile();
3
-
4
-
2
+ try { process.loadEnvFile(); } catch {}
5
3
 
6
4
  const main = async () => {
7
5
 
@@ -23,8 +23,8 @@
23
23
  * This is GENERIC - works with any data structure, not hardcoded for specific use cases.
24
24
  */
25
25
 
26
- process.loadEnvFile();
27
26
  import { ModelMix } from '../index.js';
27
+ try { process.loadEnvFile(); } catch {}
28
28
 
29
29
  console.log('🧬 ModelMix - RLM (Recursive Language Models) Demo');
30
30
  console.log('🎯 Generic parallel strategy with environment variables\n');
package/demo/parallel.js CHANGED
@@ -1,5 +1,5 @@
1
- import 'dotenv/config';
2
- import { ModelMix, MixOpenAI } from '../index.js';
1
+ import { ModelMix } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
3
3
 
4
4
  const mix = new ModelMix({
5
5
  options: {
@@ -1,6 +1,6 @@
1
- process.loadEnvFile();
2
1
  import { ModelMix } from '../index.js';
3
2
  import ivm from 'isolated-vm';
3
+ try { process.loadEnvFile(); } catch {}
4
4
 
5
5
  console.log('🧬 ModelMix - JavaScript REPL Tool Demo');
6
6
 
package/demo/rlm-basic.js CHANGED
@@ -1,5 +1,5 @@
1
- process.loadEnvFile();
2
1
  import { ModelMix } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
3
3
 
4
4
  console.log('🧬 RLM Basic Demo - Recursive Language Model');
5
5
  console.log('📖 Inspired by: https://arxiv.org/html/2512.24601v1\n');
package/demo/rlm-fast.js CHANGED
@@ -1,6 +1,6 @@
1
- process.loadEnvFile();
2
1
  import { ModelMix } from '../index.js';
3
2
  import ivm from 'isolated-vm';
3
+ try { process.loadEnvFile(); } catch {}
4
4
 
5
5
  console.log('🧬 ModelMix - IVM + mmix Callback Demo');
6
6
 
@@ -1,6 +1,6 @@
1
- process.loadEnvFile();
2
1
  import { ModelMix } from '../index.js';
3
2
  import ivm from 'isolated-vm';
3
+ try { process.loadEnvFile(); } catch {}
4
4
 
5
5
  console.log('🧬 ModelMix - RLM (Recursive Language Model) Demo');
6
6
  console.log('📄 Basado en: https://arxiv.org/html/2512.24601v1\n');
@@ -1,5 +1,5 @@
1
- process.loadEnvFile();
2
1
  import { ModelMix } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
3
3
 
4
4
  console.log('\n=== Round Robin Simple Demo ===\n');
5
5
 
package/demo/short.js CHANGED
@@ -1,6 +1,5 @@
1
- process.loadEnvFile();
2
-
3
1
  import { ModelMix } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
4
3
 
5
4
  const setup = {
6
5
  config: {
package/demo/stream.js CHANGED
@@ -1,5 +1,5 @@
1
- import 'dotenv/config'
2
1
  import { ModelMix } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
3
3
 
4
4
  await ModelMix.new().gpt41nano()
5
5
  .addImageFromUrl('https://pbs.twimg.com/media/F6-GsjraAAADDGy?format=jpg')
package/demo/together.js CHANGED
@@ -1,5 +1,5 @@
1
- import 'dotenv/config'
2
1
  import { ModelMix, MixTogether } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
3
3
 
4
4
  const setup = { config: { system: "You are ALF from Melmac." } };
5
5
 
@@ -1,5 +1,5 @@
1
- process.loadEnvFile();
2
1
  import { ModelMix } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
3
3
 
4
4
  // Ejemplo simple: obtener información de tokens
5
5
  const model = ModelMix.new()
package/demo/tokens.js CHANGED
@@ -1,5 +1,5 @@
1
- process.loadEnvFile();
2
1
  import { ModelMix } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
3
3
 
4
4
  console.log('\n🔢 Token Usage Tracking Demo\n');
5
5
  console.log('='.repeat(60));
package/demo/verbose.js CHANGED
@@ -1,5 +1,5 @@
1
- process.loadEnvFile();
2
1
  import { ModelMix, MixOpenAI } from '../index.js';
2
+ try { process.loadEnvFile(); } catch {}
3
3
 
4
4
  const prompt = "Say 'Hello World' in exactly 2 words.";
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "modelmix",
3
- "version": "4.4.8",
3
+ "version": "4.4.12",
4
4
  "description": "🧬 Reliable interface with automatic fallback for AI LLMs.",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -56,21 +56,20 @@
56
56
  },
57
57
  "devDependencies": {
58
58
  "chai": "^5.2.1",
59
- "dotenv": "^17.2.1",
60
59
  "mocha": "^11.3.0",
61
60
  "nock": "^14.0.9",
62
61
  "sinon": "^21.0.0"
63
62
  },
64
63
  "scripts": {
65
- "test": "mocha test/**/*.js --timeout 10000 --require dotenv/config --require test/setup.js",
64
+ "test": "mocha test/**/*.js --timeout 10000 --require test/setup.js",
66
65
  "test:watch": "mocha test/**/*.js --watch --timeout 10000 --require test/setup.js",
67
66
  "test:json": "mocha test/json.test.js --timeout 10000 --require test/setup.js",
68
67
  "test:fallback": "mocha test/fallback.test.js --timeout 10000 --require test/setup.js",
69
68
  "test:templates": "mocha test/templates.test.js --timeout 10000 --require test/setup.js",
70
69
  "test:images": "mocha test/images.test.js --timeout 10000 --require test/setup.js",
71
70
  "test:bottleneck": "mocha test/bottleneck.test.js --timeout 10000 --require test/setup.js",
72
- "test:live": "mocha test/live.test.js --timeout 10000 --require dotenv/config --require test/setup.js",
73
- "test:live.mcp": "mocha test/live.mcp.js --timeout 60000 --require dotenv/config --require test/setup.js",
74
- "test:tokens": "mocha test/tokens.test.js --timeout 10000 --require dotenv/config --require test/setup.js"
71
+ "test:live": "mocha test/live.test.js --timeout 10000 --require test/setup.js",
72
+ "test:live.mcp": "mocha test/live.mcp.js --timeout 60000 --require test/setup.js",
73
+ "test:tokens": "mocha test/tokens.test.js --timeout 10000 --require test/setup.js"
75
74
  }
76
75
  }
package/test/setup.js CHANGED
@@ -5,6 +5,9 @@
5
5
  * It runs before each test suite and sets up the testing environment.
6
6
  */
7
7
 
8
+ // Load .env file if present (native Node.js, no dotenv dependency required)
9
+ try { process.loadEnvFile(); } catch {}
10
+
8
11
  // Set dummy environment variables for testing to prevent library errors
9
12
 
10
13
  const chai = require('chai');