Skip to content

Commit 7ca5650

Browse files
authored
🔧 fix: Mistral type strictness for usage & update token values/windows (#6562)
* 🔧 fix: Resolve Mistral type strictness for OpenAI usage field * chore: Enable usage tracking for Mistral endpoint in OpenAI configuration * chore: Add new token values and context windows for latest premier Mistral models
1 parent 3ba7c4e commit 7ca5650

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

‎api/models/tx.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ const tokenValues = Object.assign(
122122
'grok-2-latest': { prompt: 2.0, completion: 10.0 },
123123
'grok-2': { prompt: 2.0, completion: 10.0 },
124124
'grok-beta': { prompt: 5.0, completion: 15.0 },
125+
'mistral-large': { prompt: 2.0, completion: 6.0 },
126+
'pixtral-large': { prompt: 2.0, completion: 6.0 },
127+
'mistral-saba': { prompt: 0.2, completion: 0.6 },
128+
codestral: { prompt: 0.3, completion: 0.9 },
129+
'ministral-8b': { prompt: 0.1, completion: 0.1 },
130+
'ministral-3b': { prompt: 0.04, completion: 0.04 },
125131
},
126132
bedrockValues,
127133
);

‎api/server/controllers/agents/run.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ async function createRun({
4343
agent.model_parameters,
4444
);
4545

46+
/** Resolves Mistral type strictness due to new OpenAI usage field */
47+
if (agent.endpoint?.toLowerCase().includes(KnownEndpoints.mistral)) {
48+
llmConfig.streamUsage = false;
49+
llmConfig.usage = true;
50+
}
51+
4652
/** @type {'reasoning_content' | 'reasoning'} */
4753
let reasoningKey;
4854
if (

‎api/utils/tokens.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@ const mistralModels = {
3434
'mistral-7b': 31990, // -10 from max
3535
'mistral-small': 31990, // -10 from max
3636
'mixtral-8x7b': 31990, // -10 from max
37+
'mistral-large': 131000,
3738
'mistral-large-2402': 127500,
3839
'mistral-large-2407': 127500,
40+
'pixtral-large': 131000,
41+
'mistral-saba': 32000,
42+
codestral: 256000,
43+
'ministral-8b': 131000,
44+
'ministral-3b': 131000,
3945
};
4046

4147
const cohereModels = {

0 commit comments

Comments
 (0)