Discover and explore top open-source AI tools and projects—updated daily.
googleapisJava SDK for Google's generative AI models
Top 98.1% on SourcePulse
This Java SDK provides a Java-idiomatic interface for integrating Google's generative AI models, specifically the Gemini Developer APIs and Vertex AI APIs, into Java applications. It targets Java developers looking to leverage advanced AI capabilities like text generation, multimodal understanding, image generation, and video generation. The primary benefit is a unified client that allows seamless switching between Gemini and Vertex AI backends without code refactoring.
How It Works
The SDK centers around a Client class, which acts as a facade for interacting with Google's generative AI services. Using a builder pattern, developers can configure the client to target either the Gemini API or Vertex AI, specifying authentication details like API keys or GCP project and location. This abstraction simplifies backend management and allows for flexible deployment strategies. The SDK handles underlying HTTP requests, retries, and API versioning, offering a streamlined developer experience.
Quick Start & Requirements
pom.xml:
<dependency>
<groupId>com.google.genai</groupId>
<artifactId>google-genai</artifactId>
<version>1.24.0</version>
</dependency>
apiKey, project, location, vertexAI(true)) or environment variables (GOOGLE_API_KEY, GOOGLE_GENAI_USE_VERTEXAI, GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION).v1) or specific alpha versions can be selected via HttpOptions.Highlighted Details
-parameters).countTokens) and computing token details (computeTokens, Vertex AI only).embedContent.Maintenance & Community
The library follows Semantic Versioning. Contributions are expected to be accepted in the future. No specific community channels (e.g., Discord, Slack) or roadmap links are provided in the README.
Licensing & Compatibility
The SDK is licensed under the Apache 2.0 license, which is permissive for commercial use and integration into closed-source projects.
Limitations & Caveats
Certain advanced features like computeTokens, upscaleImage, and editImage are exclusively supported on Vertex AI. The SDK defaults to beta API endpoints, requiring explicit configuration for stable versions. Video generation and some image operations return asynchronous operations that necessitate polling for completion. Automatic Function Calling requires specific compiler configurations.
20 hours ago
Inactive
sgomez
googleapis