Merge pull request #2602 from Succubyss/gemini-again

Gemini max context size corrections, option selector update
This commit is contained in:
Cohee 2024-08-02 23:41:10 +03:00 committed by GitHub
commit 73e3acbd51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 36 additions and 25 deletions

View File

@ -2802,23 +2802,26 @@
<div>
<h4 data-i18n="Google Model">Google Model</h4>
<select id="model_google_select">
<optgroup label="Latest">
<!-- Doesn't work without "latest". Maybe my key is scuffed? -->
<option value="gemini-1.5-flash-latest">Gemini 1.5 Flash</option>
<option value="gemini-1.5-pro-latest">Gemini 1.5 Pro</option>
<!-- Points to 1.0, no default 1.5 endpoint -->
<option value="gemini-pro">Gemini Pro</option>
<option value="gemini-pro-vision">Gemini Pro Vision</option>
<option value="gemini-ultra">Gemini Ultra</option>
<option value="text-bison-001">Bison Text</option>
<option value="chat-bison-001">Bison Chat</option>
</optgroup>
<optgroup label="Sub-versions">
<option value="gemini-1.5-pro-exp-0801">Gemini 1.5 Pro Experiment 2024-08-01</option>
<option value="gemini-1.5-pro-latest">Gemini 1.5 Pro</option>
<option value="gemini-1.0-pro-latest">Gemini 1.0 Pro</option>
<option value="gemini-1.0-pro-vision-latest">Gemini 1.0 Pro Vision</option>
<optgroup label="Primary">
<option value="gemini-1.5-pro">Gemini 1.5 Pro</option>
<option value="gemini-1.5-flash">Gemini 1.5 Flash</option>
<option value="gemini-1.0-pro">Gemini 1.0 Pro</option>
<option value="gemini-pro">Gemini Pro (1.0)</option>
<option value="gemini-pro-vision">Gemini Pro Vision (1.0)</option>
<option value="gemini-ultra">Gemini Ultra (1.0)</option>
<option value="gemini-1.0-ultra-latest">Gemini 1.0 Ultra</option>
<option value="text-bison-001">PaLM 2 (Legacy)</option>
<option value="chat-bison-001">PaLM 2 Chat (Legacy)</option>
</optgroup>
<optgroup label="Subversions">
<option value="gemini-1.5-pro-exp-0801">Gemini 1.5 Pro Experiment 2024-08-01</option>
<option value="gemini-1.5-pro-latest">Gemini 1.5 Pro [latest]</option>
<option value="gemini-1.5-pro-001">Gemini 1.5 Pro [001]</option>
<option value="gemini-1.5-flash-latest">Gemini 1.5 Flash [latest]</option>
<option value="gemini-1.5-flash-001">Gemini 1.5 Flash [001]</option>
<option value="gemini-1.0-pro-latest">Gemini 1.0 Pro [latest]</option>
<option value="gemini-1.0-pro-001">Gemini 1.0 Pro (Tuning) [001]</option>
<option value="gemini-1.0-pro-vision-latest">Gemini 1.0 Pro Vision [latest]</option>
</optgroup>
</select>
</div>

View File

@ -127,6 +127,7 @@ const max_128k = 128 * 1000;
const max_200k = 200 * 1000;
const max_256k = 256 * 1000;
const max_1mil = 1000 * 1000;
const max_2mil = 2000 * 1000;
const scale_max = 8191;
const claude_max = 9000; // We have a proper tokenizer, so theoretically could be larger (up to 9k)
const claude_100k_max = 99000;
@ -260,7 +261,7 @@ const default_settings = {
personality_format: default_personality_format,
openai_model: 'gpt-4-turbo',
claude_model: 'claude-3-5-sonnet-20240620',
google_model: 'gemini-pro',
google_model: 'gemini-1.5-pro',
ai21_model: 'j2-ultra',
mistralai_model: 'mistral-large-latest',
cohere_model: 'command-r-plus',
@ -340,7 +341,7 @@ const oai_settings = {
personality_format: default_personality_format,
openai_model: 'gpt-4-turbo',
claude_model: 'claude-3-5-sonnet-20240620',
google_model: 'gemini-pro',
google_model: 'gemini-1.5-pro',
ai21_model: 'j2-ultra',
mistralai_model: 'mistral-large-latest',
cohere_model: 'command-r-plus',
@ -4056,15 +4057,22 @@ async function onModelChange() {
if (oai_settings.chat_completion_source == chat_completion_sources.MAKERSUITE) {
if (oai_settings.max_context_unlocked) {
$('#openai_max_context').attr('max', max_2mil);
} else if (value.includes('gemini-1.5-pro')) {
$('#openai_max_context').attr('max', max_2mil);
} else if (value.includes('gemini-1.5-flash')) {
$('#openai_max_context').attr('max', max_1mil);
} else if (value === 'gemini-1.5-pro-latest' || value.includes('gemini-1.5-flash')) {
$('#openai_max_context').attr('max', max_1mil);
} else if (value === 'gemini-ultra' || value === 'gemini-1.0-pro-latest' || value === 'gemini-pro' || value === 'gemini-1.0-ultra-latest') {
$('#openai_max_context').attr('max', max_32k);
} else if (value === 'gemini-1.0-pro-vision-latest' || value === 'gemini-pro-vision') {
} else if (value.includes('gemini-1.0-pro-vision') || value === 'gemini-pro-vision') {
$('#openai_max_context').attr('max', max_16k);
} else {
} else if (value.includes('gemini-1.0-pro') || value === 'gemini-pro') {
$('#openai_max_context').attr('max', max_32k);
} else if (value === 'text-bison-001') {
$('#openai_max_context').attr('max', max_8k);
// The ultra endpoints are possibly dead:
} else if (value.includes('gemini-1.0-ultra') || value === 'gemini-ultra') {
$('#openai_max_context').attr('max', max_32k);
} else {
$('#openai_max_context').attr('max', max_4k);
}
let makersuite_max_temp = (value.includes('vision') || value.includes('ultra')) ? 1.0 : 2.0;
oai_settings.temp_openai = Math.min(makersuite_max_temp, oai_settings.temp_openai);

View File

@ -271,7 +271,7 @@ async function sendMakerSuiteRequest(request, response) {
};
function getGeminiBody() {
const should_use_system_prompt = ['gemini-1.5-flash', 'gemini-1.5-pro'].includes(model) && request.body.use_makersuite_sysprompt;
const should_use_system_prompt = (model.includes('gemini-1.5-flash') || model.includes('gemini-1.5-pro')) && request.body.use_makersuite_sysprompt;
const prompt = convertGooglePrompt(request.body.messages, model, should_use_system_prompt, request.body.char_name, request.body.user_name);
let body = {
contents: prompt.contents,