@@ -185,50 +185,6 @@ export class GeminiHandler extends BaseProvider implements SingleCompletionHandl
185185 }
186186 }
187187
188- // Check if the model is a Gemma 3 model
189- const isGemma3 = model . includes ( "gemma-3" )
190-
191- // Prepend system instruction to the first user message if it's a Gemma 3 model,
192- // as they don't support the system instruction parameter.
193- if ( isGemma3 && systemInstruction ) {
194- if ( contents . length > 0 && contents [ 0 ] . role === "user" ) {
195- const firstMessage = contents [ 0 ]
196- // Create a new text part for the system instruction
197- const systemPart = { text : systemInstruction }
198- // Prepend it to the existing parts
199- firstMessage . parts = [ systemPart , ...( firstMessage . parts || [ ] ) ]
200- } else {
201- // If no messages or first message is not user (e.g. starts with model),
202- // prepend a new user message with the system instruction.
203- contents . unshift ( {
204- role : "user" ,
205- parts : [ { text : systemInstruction } ] ,
206- } )
207- }
208- }
209-
210- // Check if the model is a Gemma 3 model
211- const isGemma3 = model . includes ( "gemma-3" )
212-
213- // Prepend system instruction to the first user message if it's a Gemma 3 model,
214- // as they don't support the system instruction parameter.
215- if ( isGemma3 && systemInstruction ) {
216- if ( contents . length > 0 && contents [ 0 ] . role === "user" ) {
217- const firstMessage = contents [ 0 ]
218- // Create a new text part for the system instruction
219- const systemPart = { text : systemInstruction }
220- // Prepend it to the existing parts
221- firstMessage . parts = [ systemPart , ...( firstMessage . parts || [ ] ) ]
222- } else {
223- // If no messages or first message is not user (e.g. starts with model),
224- // prepend a new user message with the system instruction.
225- contents . unshift ( {
226- role : "user" ,
227- parts : [ { text : systemInstruction } ] ,
228- } )
229- }
230- }
231-
232188 const config : GenerateContentConfig = {
233189 ...( isGemma3 ? { } : { systemInstruction } ) ,
234190 httpOptions : this . options . googleGeminiBaseUrl ? { baseUrl : this . options . googleGeminiBaseUrl } : undefined ,
0 commit comments