modelmix 5.2.1 → 5.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/README.md CHANGED
@@ -193,6 +193,7 @@ ModelMix provides convenient shorthand methods for quickly accessing different A
193
193
  | `gemini35flash()` | Google | gemini-3.5-flash | [\$0.75][3] | [\$4.50][3] |
194
194
  | `gemini35flashLite()` | Google | gemini-3.5-flash-lite | [\$0.30][3] | [\$2.50][3] |
195
195
  | `gemini31flashLite()` | Google | gemini-3.1-flash-lite-preview | [\$0.25][3] | [\$1.50][3] |
196
+ | `grok47()` | Grok | grok-4.7 | — | — |
196
197
  | `grok46()` | Grok | grok-4.6 | [\$2.00][6] | [\$6.00][6] |
197
198
  | `grok45()` | Grok | grok-4.5 | [\$2.00][6] | [\$6.00][6] |
198
199
  | `grok43()` | Grok | grok-4.3 | [\$1.25][6] | [\$2.50][6] |
package/demo/grok.js CHANGED
@@ -13,7 +13,7 @@ const mmix = new ModelMix({
13
13
  });
14
14
 
15
15
 
16
- const r = await mmix.grok46()
16
+ const r = await mmix.grok47()
17
17
  .addText('hi there!')
18
18
  .addText('do you like cats?')
19
19
  .raw();
package/index.d.ts CHANGED
@@ -495,6 +495,7 @@ export declare class ModelMix {
495
495
  sonar(args?: ModelAttachArgs): this;
496
496
 
497
497
  // Grok
498
+ grok47(args?: ModelAttachArgs): this;
498
499
  grok46(args?: ModelAttachArgs): this;
499
500
  grok45(args?: ModelAttachArgs): this;
500
501
  grok43(args?: ModelAttachArgs): this;
package/index.js CHANGED
@@ -603,6 +603,9 @@ class ModelMix {
603
603
  return this.attach('sonar', new MixPerplexity({ options, config }));
604
604
  }
605
605
 
606
+ grok47({ options = {}, config = {} } = {}) {
607
+ return this.attach('grok-4.7', new MixGrok({ options, config }));
608
+ }
606
609
  grok46({ options = {}, config = {} } = {}) {
607
610
  return this.attach('grok-4.6', new MixGrok({ options, config }));
608
611
  }
@@ -9,7 +9,7 @@ const CHAIN_MODEL_SHORTCUTS = new Set([
9
9
  'sonnet50', 'sonnet5', 'sonnet46', 'sonnet45', 'haiku45',
10
10
  'gemini31pro', 'gemini38flash', 'gemini37flash', 'gemini36flash', 'gemini35flash',
11
11
  'gemini35flashLite', 'gemini31flashLite', 'sonarPro', 'sonar',
12
- 'grok46', 'grok45', 'grok43', 'grok420multiAgent', 'grok420',
12
+ 'grok47', 'grok46', 'grok45', 'grok43', 'grok420multiAgent', 'grok420',
13
13
  'museGlimmer30b', 'museSpark12', 'museSpark12c', 'museSpark13', 'museSpark13c',
14
14
  'qwen35397b', 'qwen36plus', 'qwen37plus', 'qwen38max', 'qwen3827b', 'qwen38flash',
15
15
  'hermes470b', 'hermes4405b', 'hermes3',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "modelmix",
3
- "version": "5.2.1",
3
+ "version": "5.2.2",
4
4
  "description": "🧬 Reliable interface with automatic fallback for AI LLMs.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -187,7 +187,7 @@ Use `.effort(n)` (or `config.effort`) to enable Anthropic thinking — e.g. `.ef
187
187
  `gemini31pro()` `gemini38flash()` `gemini37flash()` `gemini36flash()` `gemini35flash()` `gemini35flashLite()` `gemini31flashLite()`
188
188
 
189
189
  ### Grok
190
- `grok46()` `grok45()` `grok43()` `grok420multiAgent()` `grok420()`
190
+ `grok47()` `grok46()` `grok45()` `grok43()` `grok420multiAgent()` `grok420()`
191
191
 
192
192
  ### Perplexity
193
193
  `sonar()` `sonarPro()`
package/test/grok.test.js CHANGED
@@ -11,6 +11,7 @@ const {
11
11
 
12
12
  describe('Grok Model Registration Tests', () => {
13
13
  const grokModels = [
14
+ { method: 'grok47', key: 'grok-4.7' },
14
15
  { method: 'grok46', key: 'grok-4.6' },
15
16
  { method: 'grok45', key: 'grok-4.5' },
16
17
  { method: 'grok43', key: 'grok-4.3' },
@@ -38,6 +39,38 @@ describe('Grok Model Registration Tests', () => {
38
39
  expect(model.models[0].provider.config).to.include(config);
39
40
  });
40
41
 
42
+ it('supports Grok 4.7 in chain() and preserves attachment options', () => {
43
+ const options = { temperature: 0.5 };
44
+ const config = { max_history: 3 };
45
+ const model = ModelMix.new().grok47({ options, config });
46
+
47
+ expect(model.models[0].provider).to.be.instanceOf(MixGrok);
48
+ expect(model.models[0].provider.options).to.deep.equal(options);
49
+ expect(model.models[0].provider.config).to.include(config);
50
+ expect(ModelMix.new().chain('grok47').models[0].key).to.equal('grok-4.7');
51
+ });
52
+
53
+ it('sends Grok 4.7 requests to xAI', async () => {
54
+ const api = nock('https://api.x.ai')
55
+ .post('/v1/chat/completions', body => {
56
+ expect(body.model).to.equal('grok-4.7');
57
+ expect(body.temperature).to.equal(0.5);
58
+ return true;
59
+ })
60
+ .reply(200, {
61
+ choices: [{ message: { content: 'ok' } }],
62
+ usage: { prompt_tokens: 1, completion_tokens: 1, total_tokens: 2 }
63
+ });
64
+
65
+ const response = await ModelMix.new()
66
+ .grok47({ options: { temperature: 0.5 }, config: { apiKey: 'test-key' } })
67
+ .addText('Hi')
68
+ .message();
69
+
70
+ expect(response).to.equal('ok');
71
+ api.done();
72
+ });
73
+
41
74
  it('maps unified effort to Grok 4.6 supported levels', () => {
42
75
  expect(mapEffort('openai', 0, 'grok-4.6')).to.deep.equal({ reasoning_effort: 'low' });
43
76
  expect(mapEffort('openai', 39, 'grok-4.6')).to.deep.equal({ reasoning_effort: 'low' });