Change the model client
// Before
BaseLLM llm = PaLMLLM.builder().model("chat-bison").build();
// After
BaseLLM llm = GeminiLLM.builder().model("gemini-2.5-flash").build();
agent.setModel(llm); // that's it — agent code unchangedAdvertisement
Prompt tuning
Gemini responds better to structured instructions. Add explicit sections: 'Goal', 'Constraints', 'Output format'. PaLM was more forgiving; Gemini rewards structure.
Advertisement
Tool calls now work
PaLM required prompt hacking for tool calls. Gemini has native function calling. Delete your prompt-level tool orchestration.