Repository navigation
Gemini Interactions API Java SDK v2.2.0
This release introduces full support for the Gemini Decisions API (POST /v1beta/decisions with gemini-decision-1) for fast, calibrated, zero-output-token structured classification and scoring, alongside new Gemini 4 / Omni / Transcribe model constants and model/agent deprecation metadata.
🚀 Key Highlights
⚖️ Gemini Decisions API (gemini-decision-1)
Evaluate up to 1,000 independent structured decision questions over shared text or multimodal context (TextContent, ImageContent, AudioContent, VideoContent, and PDF DocumentContent) in a single non-autoregressive pass with calibrated probabilities and zero output tokens (total_output_tokens = 0):
- Client & Server Endpoints:
GeminiInteractionsClient.createDecision(DecisionParams)(POST /{version}/decisions)InteractionsHandler.createDecision(DecisionParams)for server-side HTTP routing (POST .../decisions)
- Fluent Request Builder (
DecisionParams):- Defaults
modeltoModelOption.GEMINI_DECISION_1("gemini-decision-1"). - Overloaded
.input(...)methods accepting plain text or multimodalContentblocks (validating at construction time that conversationturns/stepsare rejected). - Ergonomic question builders
.noul(...),.choice(...),.score(...), and.question(...).
- Defaults
- Type-Safe Sealed
Question&AnswerHierarchies:- Binary (
noul):Question.NoulQuestion/Answer.NoulAnswer— returns calibrated probability of yesnoul()(0.01..0.99),confidence(), and convenience helpersyesProbability()/noProbability(), with optionalQuestion.NoulCriteria(true_description,false_description). - Categorical (
choice):Question.ChoiceQuestion/Answer.ChoiceAnswer— mutually exclusive classification across 2–20 options (either self-explanatory option names orMap<String, String>option descriptions), returning winningchoice(), per-optionprobabilities(), andconfidence(). - Ordinal (
score):Question.ScoreQuestion/Answer.ScoreAnswer— ordered rubric evaluation across 2–20 criteria levels (0..N-1), returning probability-weighted expected levelscore(),legend(), per-levelprobabilities(),confidence(), and convenience helperstopLevelKey(),topLevelDescription(), andnormalizedScore()([0.0, 1.0]). - Forward Compatibility: Sealed hierarchies include
UnknownQuestionandUnknownAnswerfallbacks so future question/answer variants deserialize cleanly without breaking existing callers.
- Binary (
- Type-Safe Instructions Union (
DecisionInstructions): Supports plain string instructions (DecisionInstructions.of("...")) or structuredContent.TextContentblock arrays (DecisionInstructions.ofBlocks(...)). - Safety & Content Filtering (
Decision.PromptFeedback): ExposespromptFeedback()(BlockReasonopen-safe enum +blockReasonMessage()) anddecision.isBlocked().
import io.github.glaforge.gemini.interactions.model.Answer;
import io.github.glaforge.gemini.interactions.model.Decision;
import io.github.glaforge.gemini.interactions.model.DecisionParams;
import java.util.Map;
DecisionParams params = DecisionParams.builder()
.input("The blue ceramic mug I ordered arrived shattered in pieces, and I was charged twice.")
.noul("is_damaged", "Did the item arrive physically damaged?")
.choice("department", "Which department should handle the duplicate charge?", Map.of(
"billing", "Payments, invoices, duplicate charges, and refunds.",
"technical", "Software or technical product usage issues.",
"other", "Anything outside these categories."
))
.score(
"severity",
"How severe is the physical condition of the delivered mug?",
"Intact: no visible damage.",
"Minor blemish: small scratch, still usable.",
"Destroyed: broken or shattered, completely unusable."
)
.build();
Decision decision = client.createDecision(params);
if (!decision.isBlocked()) {
Answer.NoulAnswer damaged = decision.noulAnswer("is_damaged");
System.out.printf("P(damaged)=%.3f (confidence=%.3f)%n", damaged.yesProbability(), damaged.confidence());
Answer.ChoiceAnswer dept = decision.choiceAnswer("department");
System.out.printf("Department: %s (confidence=%.3f)%n", dept.choice(), dept.confidence());
Answer.ScoreAnswer severity = decision.scoreAnswer("severity");
System.out.printf("Severity: %.2f / 2.00 (normalized=%.2f, top=%s)%n",
severity.score(), severity.normalizedScore(), severity.topLevelDescription());
}🆕 New Model Constants & Deprecation Updates
Synchronized ModelOption and AgentOption with the latest Gemini API model catalog and lifecycle status:
- New Model Constants (
ModelOption):GEMINI_4_CARBON("gemini-4-carbon") — Frontier Gemini 4 modelGEMINI_DECISION_1("gemini-decision-1") — Structured classification & scoring model for/v1beta/decisionsGEMINI_OMNI_1_2_FLASH("gemini-omni-1.2-flash") — Multimodal Omni Flash generation modelGEMINI_3_5_TRANSCRIBE("gemini-3.5-transcribe") — Dedicated speech transcription model
- General Availability & Lifecycle Annotations:
- Un-deprecated
ModelOption.GEMINI_4_ARGON("gemini-4-argon"). - Annotated shut-down / superseded models and preview agents (
gemini-2.0-*,gemini-2.5-*,imagen-4.0-*,veo-2.0-*/veo-3.0-*/veo-3.1-*,antigravity-preview-05-2026,deep-research-pro-preview-12-2025, etc.) with@Deprecatedand Javadoc migration pointers to their current replacements.
- Un-deprecated
🛠️ SDK Ergonomics & Documentation
Content.ImageContentOverloads: Added convenience constructors accepting(byte[], String, Resolution),(String, String), and(String, String, Resolution)so multimodal callers can set media processingResolution(LOW,MEDIUM,HIGH,ULTRA_HIGH) directly without passingnullplaceholders.- Documentation & Agent Skill: Updated
README.mdandskills/gemini-interactions-java-api/SKILL.mdwith comprehensive Decisions API usage examples,DecisionInstructionsunion documentation, and updated model tables.
📦 Artifacts Published to Maven Central
<dependency>
<groupId>io.github.glaforge</groupId>
<artifactId>gemini-interactions-api-sdk</artifactId>
<version>2.2.0</version>
</dependency>io.github.glaforge:gemini-interactions-parent:2.2.0io.github.glaforge:gemini-interactions-api-sdk:2.2.0io.github.glaforge:gemini-interactions-server:2.2.0
Full Changelog: v2.1.2...v2.2.0