Add Mistral Nemo and Codestral Mamba models

This commit is contained in:
Cohee 2024-07-18 16:37:12 +00:00
parent a2c9e70082
commit b9e03e9cb1
2 changed files with 11 additions and 1 deletions

View File

@ -2821,15 +2821,19 @@
<h4 data-i18n="MistralAI Model">MistralAI Model</h4>
<select id="model_mistralai_select">
<optgroup label="Latest">
<option value="open-mistral-nemo">open-mistral-nemo</option>
<option value="open-mistral-7b">open-mistral-7b</option>
<option value="open-mixtral-8x7b">open-mixtral-8x7b</option>
<option value="open-mixtral-8x22b">open-mixtral-8x22b</option>
<option value="open-codestral-mamba">open-codestral-mamba</option>
<option value="mistral-small-latest">mistral-small-latest</option>
<option value="mistral-medium-latest">mistral-medium-latest</option>
<option value="mistral-large-latest">mistral-large-latest</option>
<option value="codestral-latest">codestral-latest</option>
<option value="codestral-mamba-latest">codestral-mamba-latest</option>
</optgroup>
<optgroup label="Sub-versions">
<option value="open-mistral-nemo-2407">open-mistral-nemo-2407</option>
<option value="open-mixtral-8x22b-2404">open-mixtral-8x22b-2404</option>
<option value="mistral-tiny-2312">mistral-tiny-2312</option>
<option value="mistral-small-2312">mistral-small-2312</option>
@ -2837,6 +2841,7 @@
<option value="mistral-medium-2312">mistral-medium-2312</option>
<option value="mistral-large-2402">mistral-large-2402</option>
<option value="codestral-2405">codestral-2405</option>
<option value="codestral-mamba-2407">codestral-mamba-2407</option>
</optgroup>
</select>
</div>

View File

@ -125,6 +125,7 @@ const max_32k = 32767;
const max_64k = 65535;
const max_128k = 128 * 1000;
const max_200k = 200 * 1000;
const max_256k = 256 * 1000;
const max_1mil = 1000 * 1000;
const scale_max = 8191;
const claude_max = 9000; // We have a proper tokenizer, so theoretically could be larger (up to 9k)
@ -3992,7 +3993,7 @@ async function onModelChange() {
if ($(this).is('#model_mistralai_select')) {
// Upgrade old mistral models to new naming scheme
// would have done this in loadOpenAISettings, but it wasn't updating on preset change?
if (value === 'mistral-medium' || value === 'mistral-small' || value === 'mistral-tiny') {
if (value === 'mistral-medium' || value === 'mistral-small') {
value = value + '-latest';
} else if (value === '') {
value = default_settings.mistralai_model;
@ -4139,6 +4140,10 @@ async function onModelChange() {
if (oai_settings.chat_completion_source === chat_completion_sources.MISTRALAI) {
if (oai_settings.max_context_unlocked) {
$('#openai_max_context').attr('max', unlocked_max);
} else if (oai_settings.mistralai_model.includes('codestral-mamba')) {
$('#openai_max_context').attr('max', max_256k);
} else if (oai_settings.mistralai_model.includes('mistral-nemo')) {
$('#openai_max_context').attr('max', max_128k);
} else if (oai_settings.mistralai_model.includes('mixtral-8x22b')) {
$('#openai_max_context').attr('max', max_64k);
} else {