File tree Expand file tree Collapse file tree 3 files changed +20
-7
lines changed 
models/spring-ai-vertex-ai-gemini/src 
main/java/org/springframework/ai/vertexai/gemini 
test/java/org/springframework/ai/vertexai/gemini Expand file tree Collapse file tree 3 files changed +20
-7
lines changed Original file line number Diff line number Diff line change 1616
1717package  org .springframework .ai .vertexai .gemini ;
1818
19+ import  com .google .cloud .vertexai .api .Tool .GoogleSearch ;
1920import  java .util .ArrayList ;
2021import  java .util .Collection ;
2122import  java .util .List ;
@@ -713,9 +714,10 @@ GeminiRequest createGeminiRequest(Prompt prompt) {
713714		}
714715
715716		if  (prompt .getOptions () instanceof  VertexAiGeminiChatOptions  options  && options .getGoogleSearchRetrieval ()) {
716- 			final  var  googleSearchRetrieval  = GoogleSearchRetrieval .newBuilder ().getDefaultInstanceForType ();
717+ 			// final var googleSearchRetrieval = GoogleSearchRetrieval.newBuilder().getDefaultInstanceForType(); 
718+ 			var  googleSearch  = GoogleSearch .newBuilder ().getDefaultInstanceForType ();
717719			final  var  googleSearchRetrievalTool  = Tool .newBuilder ()
718- 				.setGoogleSearchRetrieval ( googleSearchRetrieval )
720+ 				.setGoogleSearch ( googleSearch )
719721				.build ();
720722			tools .add (googleSearchRetrievalTool );
721723		}
@@ -969,7 +971,7 @@ public enum ChatModel implements ChatModelDescription {
969971
970972		GEMINI_2_0_FLASH_LIGHT ("gemini-2.0-flash-lite" ),
971973
972- 		GEMINI_2_5_PRO ("gemini-2.5-pro-exp-03-28 " );
974+ 		GEMINI_2_5_PRO ("gemini-2.5-pro-exp-03-25 " );
973975
974976		public  final  String  value ;
975977
Original file line number Diff line number Diff line change @@ -88,17 +88,28 @@ void testMessageHistory() {
8888		assertThat (response .getResult ().getOutput ().getText ()).containsAnyOf ("Blackbeard" , "Bartholomew" );
8989	}
9090
91+ 	// Disabled until Gemini 2.5 PRO has an official release 
92+ 	@ Disabled 
9193	@ Test 
92- 	void  googleSearchTool () {
94+ 	void  googleSearchToolPro () {
9395		Prompt  prompt  = createPrompt (VertexAiGeminiChatOptions .builder ()
94- 			.model (ChatModel .GEMINI_1_5_PRO ) // Only the pro model supports the google 
95- 												// search tool 
96+ 			.model (ChatModel .GEMINI_2_5_PRO )
9697			.googleSearchRetrieval (true )
9798			.build ());
9899		ChatResponse  response  = this .chatModel .call (prompt );
99100		assertThat (response .getResult ().getOutput ().getText ()).containsAnyOf ("Blackbeard" , "Bartholomew" );
100101	}
101102
103+ 	@ Test 
104+ 	void  googleSearchToolFlash () {
105+ 		Prompt  prompt  = createPrompt (VertexAiGeminiChatOptions .builder ()
106+ 				.model (ChatModel .GEMINI_2_0_FLASH )
107+ 				.googleSearchRetrieval (true )
108+ 				.build ());
109+ 		ChatResponse  response  = this .chatModel .call (prompt );
110+ 		assertThat (response .getResult ().getOutput ().getText ()).containsAnyOf ("Blackbeard" , "Bartholomew" , "Bob" );
111+ 	}
112+ 
102113	@ Test 
103114	@ Disabled 
104115	void  testSafetySettings () {
Original file line number Diff line number Diff line change 268268		<djl .version>0.30.0</djl .version>
269269		<onnxruntime .version>1.19.2</onnxruntime .version>
270270		<oci-sdk-version >3.51.0</oci-sdk-version >
271- 		<com .google.cloud.version>26.48 .0</com .google.cloud.version>
271+ 		<com .google.cloud.version>26.59 .0</com .google.cloud.version>
272272		<ibm .sdk.version>9.20.0</ibm .sdk.version>
273273		<jsonschema .version>4.37.0</jsonschema .version>
274274		<swagger-annotations .version>2.2.25</swagger-annotations .version>
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments