Merge pull request #3537 from Kas1o/staging Updated Groq model options to sync with official playground
Signed| @@ -3186,21 +3186,33 @@ | |||
| 3186 | </div> | 3186 | </div> |
| 3187 | <h4 data-i18n="Groq Model">Groq Model</h4> | 3187 | <h4 data-i18n="Groq Model">Groq Model</h4> |
| 3188 | <select id="model_groq_select"> | 3188 | <select id="model_groq_select"> |
| 3189 | <optgroup label="Production Models"> | 3189 | <optgroup label="Alibaba Cloud"> |
| 3190 | <option value="gemma2-9b-it">gemma2-9b-it</option> | 3190 | <option value="qwen-2.5-32b">qwen-2.5-32b</option> |
| 3191 | <option value="llama-3.3-70b-versatile">llama-3.3-70b-versatile</option> | 3191 | <option value="qwen-2.5-coder-32b">qwen-2.5-coder-32b</option> |
| 3192 | <option value="llama-3.1-8b-instant">llama-3.1-8b-instant</option> | ||
| 3193 | <option value="llama3-70b-8192">llama3-70b-8192</option> | ||
| 3194 | <option value="llama3-8b-8192">llama3-8b-8192</option> | ||
| 3195 | <option value="mixtral-8x7b-32768">mixtral-8x7b-32768</option> | ||
| 3196 | </optgroup> | 3192 | </optgroup> |
| 3197 | <optgroup label="Preview Models"> | 3193 | <optgroup label="DeepSeek / Alibaba Cloud"> |
| 3194 | <option value="deepseek-r1-distill-qwen-32b">deepseek-r1-distill-qwen-32b</option> | ||
| 3195 | </optgroup> | ||
| 3196 | <optgroup label="DeepSeek / Meta"> | ||
| 3198 | <option value="deepseek-r1-distill-llama-70b">deepseek-r1-distill-llama-70b</option> | 3197 | <option value="deepseek-r1-distill-llama-70b">deepseek-r1-distill-llama-70b</option> |
| 3199 | <option value="llama-3.3-70b-specdec">llama-3.3-70b-specdec</option> | 3198 | </optgroup> |
| 3200 | <option value="llama-3.2-1b-preview">llama-3.2-1b-preview</option> | 3199 | <optgroup label="Google"> |
| 3201 | <option value="llama-3.2-3b-preview">llama-3.2-3b-preview</option> | 3200 | <option value="gemma2-9b-it">gemma2-9b-it</option> |
| 3202 | <option value="llama-3.2-11b-vision-preview">llama-3.2-11b-vision-preview</option> | 3201 | </optgroup> |
| 3203 | <option value="llama-3.2-90b-vision-preview">llama-3.2-90b-vision-preview</option> | 3202 | <optgroup label="Meta"> |
| 3203 | <option value="llama-3.1-8b-instant">llama-3.1-8b-instant </option> | ||
| 3204 | <option value="llama-3.2-11b-vision-preview">llama-3.2-11b-vision-preview </option> | ||
| 3205 | <option value="llama-3.2-1b-preview">llama-3.2-1b-preview </option> | ||
| 3206 | <option value="llama-3.2-3b-preview">llama-3.2-3b-preview </option> | ||
| 3207 | <option value="llama-3.2-90b-vision-preview">llama-3.2-90b-vision-preview </option> | ||
| 3208 | <option value="llama-3.3-70b-specdec">llama-3.3-70b-specdec </option> | ||
| 3209 | <option value="llama-3.3-70b-versatile">llama-3.3-70b-versatile </option> | ||
| 3210 | <option value="llama-guard-3-8b">llama-guard-3-8b </option> | ||
| 3211 | <option value="llama3-70b-8192">llama3-70b-8192 </option> | ||
| 3212 | <option value="llama3-8b-8192">llama3-8b-8192 </option> | ||
| 3213 | </optgroup> | ||
| 3214 | <optgroup label="Mistral AI"> | ||
| 3215 | <option value="mixtral-8x7b-32768">mixtral-8x7b-32768</option> | ||
| 3204 | </optgroup> | 3216 | </optgroup> |
| 3205 | </select> | 3217 | </select> |
| 3206 | </div> | 3218 | </div> |
| @@ -4115,6 +4115,40 @@ function getMaxContextWindowAI(value) { | |||
| 4115 | } | 4115 | } |
| 4116 | } | 4116 | } |
| 4117 | 4117 | ||
| 4118 | /** | ||
| 4119 | * Get the maximum context size for the Groq model | ||
| 4120 | * @param {string} model Model identifier | ||
| 4121 | * @param {boolean} isUnlocked Whether context limits are unlocked | ||
| 4122 | * @returns {number} Maximum context size in tokens | ||
| 4123 | */ | ||
| 4124 | function getGroqMaxContext(model, isUnlocked) { | ||
| 4125 | if (isUnlocked) { | ||
| 4126 | return unlocked_max; | ||
| 4127 | } | ||
| 4128 | |||
| 4129 | const contextMap = { | ||
| 4130 | 'gemma2-9b-it': max_8k, | ||
| 4131 | 'llama-3.3-70b-versatile': max_128k, | ||
| 4132 | 'llama-3.1-8b-instant': max_128k, | ||
| 4133 | 'llama3-70b-8192': max_8k, | ||
| 4134 | 'llama3-8b-8192': max_8k, | ||
| 4135 | 'llama-guard-3-8b': max_8k, | ||
| 4136 | 'mixtral-8x7b-32768': max_32k, | ||
| 4137 | 'deepseek-r1-distill-llama-70b': max_128k, | ||
| 4138 | 'llama-3.3-70b-specdec': max_8k, | ||
| 4139 | 'llama-3.2-1b-preview': max_128k, | ||
| 4140 | 'llama-3.2-3b-preview': max_128k, | ||
| 4141 | 'llama-3.2-11b-vision-preview': max_128k, | ||
| 4142 | 'llama-3.2-90b-vision-preview': max_128k, | ||
| 4143 | 'qwen-2.5-32b': max_128k, | ||
| 4144 | 'deepseek-r1-distill-qwen-32b': max_128k, | ||
| 4145 | 'deepseek-r1-distill-llama-70b-specdec': max_128k, | ||
| 4146 | }; | ||
| 4147 | |||
| 4148 | // Return context size if model found, otherwise default to 128k | ||
| 4149 | return Object.entries(contextMap).find(([key]) => model.includes(key))?.[1] || max_128k; | ||
| 4150 | } | ||
| 4151 | |||
| 4118 | async function onModelChange() { | 4152 | async function onModelChange() { |
| 4119 | biasCache = undefined; | 4153 | biasCache = undefined; |
| 4120 | let value = String($(this).val() || ''); | 4154 | let value = String($(this).val() || ''); |
| @@ -4416,33 +4450,8 @@ async function onModelChange() { | |||
| 4416 | } | 4450 | } |
| 4417 | 4451 | ||
| 4418 | if (oai_settings.chat_completion_source == chat_completion_sources.GROQ) { | 4452 | if (oai_settings.chat_completion_source == chat_completion_sources.GROQ) { |
| 4419 | if (oai_settings.max_context_unlocked) { | 4453 | const maxContext = getGroqMaxContext(oai_settings.groq_model, oai_settings.max_context_unlocked); |
| 4420 | $('#openai_max_context').attr('max', unlocked_max); | 4454 | $('#openai_max_context').attr('max', maxContext); |
| 4421 | } else if (oai_settings.groq_model.includes('gemma2-9b-it')) { | ||
| 4422 | $('#openai_max_context').attr('max', max_8k); | ||
| 4423 | } else if (oai_settings.groq_model.includes('llama-3.3-70b-versatile')) { | ||
| 4424 | $('#openai_max_context').attr('max', max_128k); | ||
| 4425 | } else if (oai_settings.groq_model.includes('llama-3.1-8b-instant')) { | ||
| 4426 | $('#openai_max_context').attr('max', max_128k); | ||
| 4427 | } else if (oai_settings.groq_model.includes('llama3-70b-8192')) { | ||
| 4428 | $('#openai_max_context').attr('max', max_8k); | ||
| 4429 | } else if (oai_settings.groq_model.includes('llama3-8b-8192')) { | ||
| 4430 | $('#openai_max_context').attr('max', max_8k); | ||
| 4431 | } else if (oai_settings.groq_model.includes('mixtral-8x7b-32768')) { | ||
| 4432 | $('#openai_max_context').attr('max', max_32k); | ||
| 4433 | } else if (oai_settings.groq_model.includes('deepseek-r1-distill-llama-70b')) { | ||
| 4434 | $('#openai_max_context').attr('max', max_128k); | ||
| 4435 | } else if (oai_settings.groq_model.includes('llama-3.3-70b-specdec')) { | ||
| 4436 | $('#openai_max_context').attr('max', max_8k); | ||
| 4437 | } else if (oai_settings.groq_model.includes('llama-3.2-1b-preview')) { | ||
| 4438 | $('#openai_max_context').attr('max', max_128k); | ||
| 4439 | } else if (oai_settings.groq_model.includes('llama-3.2-3b-preview')) { | ||
| 4440 | $('#openai_max_context').attr('max', max_128k); | ||
| 4441 | } else if (oai_settings.groq_model.includes('llama-3.2-11b-vision-preview')) { | ||
| 4442 | $('#openai_max_context').attr('max', max_128k); | ||
| 4443 | } else if (oai_settings.groq_model.includes('llama-3.2-90b-vision-preview')) { | ||
| 4444 | $('#openai_max_context').attr('max', max_128k); | ||
| 4445 | } | ||
| 4446 | oai_settings.openai_max_context = Math.min(Number($('#openai_max_context').attr('max')), oai_settings.openai_max_context); | 4455 | oai_settings.openai_max_context = Math.min(Number($('#openai_max_context').attr('max')), oai_settings.openai_max_context); |
| 4447 | $('#openai_max_context').val(oai_settings.openai_max_context).trigger('input'); | 4456 | $('#openai_max_context').val(oai_settings.openai_max_context).trigger('input'); |
| 4448 | oai_settings.temp_openai = Math.min(oai_max_temp, oai_settings.temp_openai); | 4457 | oai_settings.temp_openai = Math.min(oai_max_temp, oai_settings.temp_openai); |
| @@ -694,6 +694,9 @@ export function getTokenizerModel() { | |||
| 694 | } | 694 | } |
| 695 | 695 | ||
| 696 | if (oai_settings.chat_completion_source === chat_completion_sources.GROQ) { | 696 | if (oai_settings.chat_completion_source === chat_completion_sources.GROQ) { |
| 697 | if (oai_settings.groq_model.includes('qwen')) { | ||
| 698 | return qwen2Tokenizer; | ||
| 699 | } | ||
| 697 | if (oai_settings.groq_model.includes('llama-3') || oai_settings.groq_model.includes('llama3')) { | 700 | if (oai_settings.groq_model.includes('llama-3') || oai_settings.groq_model.includes('llama3')) { |
| 698 | return llama3Tokenizer; | 701 | return llama3Tokenizer; |
| 699 | } | 702 | } |