AI Studio/Vertex AI: add seed param (#4314) * AI Studio/Vertex AI: add freq.pen, pres.pen and seed params * Update src/endpoints/backends/chat-completions.js Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Add missing models to Google lists * Do not send penalties to gemma and learnlm * Disable penalties * Fix not sending seed to Groq --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed| @@ -980,7 +980,7 @@ | ||
| 980 | 980 | </div> |
| 981 | 981 | </div> |
| 982 | 982 | </div> |
| 983 | 983 | <div class="range-block" data-source="openai,openrouter,mistralai,custom,cohere,groq,nanogpt,xai,pollinations,aimlapi,makersuite,vertexai"> |
| 984 | 984 | <div class="range-block-title justifyLeft" data-i18n="Seed"> |
| 985 | 985 | Seed |
| 986 | 986 | </div> |
| @@ -3150,6 +3150,7 @@ | ||
| 3150 | 3150 | <option value="gemini-2.5-flash">gemini-2.5-flash</option> |
| 3151 | 3151 | <option value="gemini-2.5-flash-preview-05-20">gemini-2.5-flash-preview-05-20</option> |
| 3152 | 3152 | <option value="gemini-2.5-flash-preview-04-17">gemini-2.5-flash-preview-04-17</option> |
| 3153 | + <option value="gemini-2.5-flash-lite">gemini-2.5-flash-lite</option> | |
| 3153 | 3154 | <option value="gemini-2.5-flash-lite-preview-06-17">gemini-2.5-flash-lite-preview-06-17</option> |
| 3154 | 3155 | </optgroup> |
| 3155 | 3156 | <optgroup label="Gemini 2.0"> |
| @@ -3158,6 +3159,7 @@ | ||
| 3158 | 3159 | <option value="gemini-exp-1206">gemini-exp-1206 → 2.5-pro-exp-03-25</option> |
| 3159 | 3160 | <option value="gemini-2.0-flash-001">gemini-2.0-flash-001</option> |
| 3160 | 3161 | <option value="gemini-2.0-flash-exp-image-generation">gemini-2.0-flash-exp-image-generation</option> |
| 3162 | + <option value="gemini-2.0-flash-preview-image-generation">gemini-2.0-flash-preview-image-generation</option> | |
| 3161 | 3163 | <option value="gemini-2.0-flash-exp">gemini-2.0-flash-exp</option> |
| 3162 | 3164 | <option value="gemini-2.0-flash">gemini-2.0-flash</option> |
| 3163 | 3165 | <option value="gemini-2.0-flash-thinking-exp-01-21">gemini-2.0-flash-thinking-exp-01-21 → 2.5-flash-preview-04-17</option> |
| @@ -3166,6 +3168,7 @@ | ||
| 3166 | 3168 | <option value="gemini-2.0-flash-lite-001">gemini-2.0-flash-lite-001</option> |
| 3167 | 3169 | <option value="gemini-2.0-flash-lite-preview-02-05">gemini-2.0-flash-lite-preview-02-05</option> |
| 3168 | 3170 | <option value="gemini-2.0-flash-lite-preview">gemini-2.0-flash-lite-preview</option> |
| 3171 | + <option value="gemini-2.0-flash-lite">gemini-2.0-flash-lite</option> | |
| 3169 | 3172 | </optgroup> |
| 3170 | 3173 | <optgroup label="Gemini 1.5"> |
| 3171 | 3174 | <option value="gemini-1.5-pro-latest">gemini-1.5-pro-latest</option> |
| @@ -3176,6 +3179,7 @@ | ||
| 3176 | 3179 | <option value="gemini-1.5-flash-002">gemini-1.5-flash-002</option> |
| 3177 | 3180 | <option value="gemini-1.5-flash-001">gemini-1.5-flash-001</option> |
| 3178 | 3181 | <option value="gemini-1.5-flash">gemini-1.5-flash</option> |
| 3182 | + <option value="gemini-1.5-flash-8b-latest">gemini-1.5-flash-8b-latest</option> | |
| 3179 | 3183 | <option value="gemini-1.5-flash-8b-001">gemini-1.5-flash-8b-001</option> |
| 3180 | 3184 | <option value="gemini-1.5-flash-8b-exp-0924">gemini-1.5-flash-8b-exp-0924</option> |
| 3181 | 3185 | <option value="gemini-1.5-flash-8b-exp-0827">gemini-1.5-flash-8b-exp-0827</option> |
| @@ -3183,6 +3187,7 @@ | ||
| 3183 | 3187 | </optgroup> |
| 3184 | 3188 | <optgroup label="Gemma"> |
| 3185 | 3189 | <option value="gemma-3n-e4b-it">gemma-3n-e4b-it</option> |
| 3190 | + <option value="gemma-3n-e2b-it">gemma-3n-e2b-it</option> | |
| 3186 | 3191 | <option value="gemma-3-27b-it">gemma-3-27b-it</option> |
| 3187 | 3192 | <option value="gemma-3-12b-it">gemma-3-12b-it</option> |
| 3188 | 3193 | <option value="gemma-3-4b-it">gemma-3-4b-it</option> |
| @@ -3323,6 +3328,7 @@ | ||
| 3323 | 3328 | <option value="gemini-2.5-flash">gemini-2.5-flash</option> |
| 3324 | 3329 | <option value="gemini-2.5-flash-preview-05-20">gemini-2.5-flash-preview-05-20</option> |
| 3325 | 3330 | <option value="gemini-2.5-flash-preview-04-17">gemini-2.5-flash-preview-04-17</option> |
| 3331 | + <option value="gemini-2.5-flash-lite">gemini-2.5-flash-lite</option> | |
| 3326 | 3332 | <option value="gemini-2.5-flash-lite-preview-06-17">gemini-2.5-flash-lite-preview-06-17</option> |
| 3327 | 3333 | </optgroup> |
| 3328 | 3334 | <optgroup label="Gemini 2.0"> |
| @@ -94,6 +94,7 @@ | ||
| 94 | 94 | <option data-type="google" value="gemini-2.5-flash">gemini-2.5-flash</option> |
| 95 | 95 | <option data-type="google" value="gemini-2.5-flash-preview-05-20">gemini-2.5-flash-preview-05-20</option> |
| 96 | 96 | <option data-type="google" value="gemini-2.5-flash-preview-04-17">gemini-2.5-flash-preview-04-17</option> |
| 97 | + <option data-type="google" value="gemini-2.5-flash-lite">gemini-2.5-flash-lite</option> | |
| 97 | 98 | <option data-type="google" value="gemini-2.5-flash-lite-preview-06-17">gemini-2.5-flash-lite-preview-06-17</option> |
| 98 | 99 | <option data-type="google" value="gemini-2.0-pro-exp-02-05">gemini-2.0-pro-exp-02-05 → 2.5-pro-exp-03-25</option> |
| 99 | 100 | <option data-type="google" value="gemini-2.0-pro-exp">gemini-2.0-pro-exp → 2.5-pro-exp-03-25</option> |
| @@ -116,6 +117,7 @@ | ||
| 116 | 117 | <option data-type="google" value="gemini-1.5-flash-002">gemini-1.5-flash-002</option> |
| 117 | 118 | <option data-type="google" value="gemini-1.5-flash-001">gemini-1.5-flash-001</option> |
| 118 | 119 | <option data-type="google" value="gemini-1.5-flash">gemini-1.5-flash</option> |
| 120 | + <option data-type="google" value="gemini-1.5-flash-8b-latest">gemini-1.5-flash-8b-latest</option> | |
| 119 | 121 | <option data-type="google" value="gemini-1.5-flash-8b-001">gemini-1.5-flash-8b-001</option> |
| 120 | 122 | <option data-type="google" value="gemini-1.5-flash-8b-exp-0924">gemini-1.5-flash-8b-exp-0924</option> |
| 121 | 123 | <option data-type="google" value="gemini-1.5-flash-8b-exp-0827">gemini-1.5-flash-8b-exp-0827</option> |
| @@ -128,6 +130,7 @@ | ||
| 128 | 130 | <option data-type="vertexai" value="gemini-2.5-flash">gemini-2.5-flash</option> |
| 129 | 131 | <option data-type="vertexai" value="gemini-2.5-flash-preview-05-20">gemini-2.5-flash-preview-05-20</option> |
| 130 | 132 | <option data-type="vertexai" value="gemini-2.5-flash-preview-04-17">gemini-2.5-flash-preview-04-17</option> |
| 133 | + <option data-type="vertexai" value="gemini-2.5-flash-lite">gemini-2.5-flash-lite</option> | |
| 131 | 134 | <option data-type="vertexai" value="gemini-2.5-flash-lite-preview-06-17">gemini-2.5-flash-lite-preview-06-17</option> |
| 132 | 135 | <option data-type="vertexai" value="gemini-2.0-flash-001">gemini-2.0-flash-001</option> |
| 133 | 136 | <option data-type="vertexai" value="gemini-2.0-flash-lite-001">gemini-2.0-flash-lite-001</option> |
| @@ -2058,7 +2058,6 @@ async function sendOpenAIRequest(type, messages, signal, { jsonSchema = null } = | ||
| 2058 | 2058 | const isPerplexity = oai_settings.chat_completion_source == chat_completion_sources.PERPLEXITY; |
| 2059 | 2059 | const isGroq = oai_settings.chat_completion_source == chat_completion_sources.GROQ; |
| 2060 | 2060 | const is01AI = oai_settings.chat_completion_source == chat_completion_sources.ZEROONEAI; |
| 2061 | - const isNano = oai_settings.chat_completion_source == chat_completion_sources.NANOGPT; | |
| 2062 | 2061 | const isDeepSeek = oai_settings.chat_completion_source == chat_completion_sources.DEEPSEEK; |
| 2063 | 2062 | const isAimlapi = oai_settings.chat_completion_source == chat_completion_sources.AIMLAPI; |
| 2064 | 2063 | const isXAI = oai_settings.chat_completion_source == chat_completion_sources.XAI; |
| @@ -2263,7 +2262,21 @@ async function sendOpenAIRequest(type, messages, signal, { jsonSchema = null } = | ||
| 2263 | 2262 | delete generate_data.max_tokens; |
| 2264 | 2263 | } |
| 2265 | 2264 | |
| 2266 | - if ((isOAI || isOpenRouter || isMistral || isCustom || isCohere || isNano || isXAI || isPollinations || isAimlapi) && oai_settings.seed >= 0) { | |
| 2265 | + const seedSupportedSources = [ | |
| 2266 | + chat_completion_sources.OPENAI, | |
| 2267 | + chat_completion_sources.OPENROUTER, | |
| 2268 | + chat_completion_sources.MISTRALAI, | |
| 2269 | + chat_completion_sources.CUSTOM, | |
| 2270 | + chat_completion_sources.COHERE, | |
| 2271 | + chat_completion_sources.GROQ, | |
| 2272 | + chat_completion_sources.NANOGPT, | |
| 2273 | + chat_completion_sources.XAI, | |
| 2274 | + chat_completion_sources.POLLINATIONS, | |
| 2275 | + chat_completion_sources.AIMLAPI, | |
| 2276 | + chat_completion_sources.VERTEXAI, | |
| 2277 | + chat_completion_sources.MAKERSUITE, | |
| 2278 | + ]; | |
| 2279 | + if (seedSupportedSources.includes(oai_settings.chat_completion_source) && oai_settings.seed >= 0) { | |
| 2267 | 2280 | generate_data['seed'] = oai_settings.seed; |
| 2268 | 2281 | } |
| 2269 | 2282 | |
| @@ -334,6 +334,7 @@ async function sendMakerSuiteRequest(request, response) { | ||
| 334 | 334 | topK: request.body.top_k || undefined, |
| 335 | 335 | responseMimeType: responseMimeType, |
| 336 | 336 | responseSchema: responseSchema, |
| 337 | + seed: request.body.seed, | |
| 337 | 338 | }; |
| 338 | 339 | |
| 339 | 340 | function getGeminiBody() { |