@@ -219,7 +219,7 @@ describe("Google provider tool call formatting", () => {
219219 expect ( capturedBody . contents [ 0 ] . parts [ 0 ] . text ) . toBe ( "Do something" ) ;
220220 } ) ;
221221
222- it ( "includes instructions as initial user/model exchange " , async ( ) => {
222+ it ( "passes instructions as systemInstruction " , async ( ) => {
223223 const ctx : ConversationContext = {
224224 history : [ { role : "user" , content : "Hello" } ] ,
225225 tools : [ ] ,
@@ -230,10 +230,23 @@ describe("Google provider tool call formatting", () => {
230230 ctx
231231 ) ;
232232
233- expect ( capturedBody . contents ) . toHaveLength ( 3 ) ;
234- expect ( capturedBody . contents [ 0 ] . parts [ 0 ] . text ) . toBe ( "You are helpful" ) ;
235- expect ( capturedBody . contents [ 1 ] . parts [ 0 ] . text ) . toBe ( "I understand." ) ;
236- expect ( capturedBody . contents [ 2 ] . parts [ 0 ] . text ) . toBe ( "Hello" ) ;
233+ expect ( capturedBody . contents ) . toHaveLength ( 1 ) ;
234+ expect ( capturedBody . contents [ 0 ] . parts [ 0 ] . text ) . toBe ( "Hello" ) ;
235+ expect ( capturedBody . systemInstruction ) . toEqual ( {
236+ parts : [ { text : "You are helpful" } ] ,
237+ } ) ;
238+ } ) ;
239+
240+ it ( "omits systemInstruction when no instructions provided" , async ( ) => {
241+ const ctx : ConversationContext = {
242+ history : [ { role : "user" , content : "Hello" } ] ,
243+ tools : [ ] ,
244+ } ;
245+
246+ await callGoogle ( { model : "gemini-2.0-flash" } , ctx ) ;
247+
248+ expect ( capturedBody . systemInstruction ) . toBeUndefined ( ) ;
249+ expect ( capturedBody . contents ) . toHaveLength ( 1 ) ;
237250 } ) ;
238251
239252 it ( "streaming: formats tool results correctly" , async ( ) => {
0 commit comments