Instantiation

GeminiLLM llm = GeminiLLM.builder()
    .apiKey(System.getenv("GEMINI_API_KEY"))
    .model("gemini-2.5-pro")
    .location("asia-south1")
    .build();
Advertisement

Under the hood

Wraps the official Vertex AI Java client. Adds ADK-specific translation for tool calls, streaming, and safety settings.

Advertisement

Prompt translation

Gemini uses Content/Part objects. ADK's Message/MessagePart gets converted here. Unsupported message types (e.g., very long system prompts) are handled by moving to a system_instruction field.