Model variant

  • gemini-2.5-pro — highest quality, slowest, most expensive.
  • gemini-2.5-flash — good quality, fast, cheap.
  • gemini-2.5-flash-lite — cheapest, use for simple tasks.
Advertisement

Generation parameters

GeminiLLM llm = GeminiLLM.builder()
    .model("gemini-2.5-flash")
    .temperature(0.7)
    .topP(0.95)
    .topK(40)
    .maxOutputTokens(2048)
    .stopSequences(List.of("###"))
    .build();
Advertisement

Location + region

Set .location("asia-south1") for lowest latency to India. us-central1 is the default. Latency between regions can be 100-300ms.