Skip to content

v2.2.0 — Gemini Decisions API Support & Model Updates

Latest

Choose a tag to compare

@github-actions github-actions released this 12 Nov 12:38
· 1 commit to main since this release

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 model to ModelOption.GEMINI_DECISION_1 ("gemini-decision-1").
    • Overloaded .input(...) methods accepting plain text or multimodal Content blocks (validating at construction time that conversation turns/steps are rejected).
    • Ergonomic question builders .noul(...), .choice(...), .score(...), and .question(...).
  • Type-Safe Sealed Question & Answer Hierarchies:
    • Binary (noul): Question.NoulQuestion / Answer.NoulAnswer — returns calibrated probability of yes noul() (0.01..0.99), confidence(), and convenience helpers yesProbability() / noProbability(), with optional Question.NoulCriteria (true_description, false_description).
    • Categorical (choice): Question.ChoiceQuestion / Answer.ChoiceAnswer — mutually exclusive classification across 2–20 options (either self-explanatory option names or Map<String, String> option descriptions), returning winning choice(), per-option probabilities(), and confidence().
    • Ordinal (score): Question.ScoreQuestion / Answer.ScoreAnswer — ordered rubric evaluation across 2–20 criteria levels (0..N-1), returning probability-weighted expected level score(), legend(), per-level probabilities(), confidence(), and convenience helpers topLevelKey(), topLevelDescription(), and normalizedScore() ([0.0, 1.0]).
    • Forward Compatibility: Sealed hierarchies include UnknownQuestion and UnknownAnswer fallbacks so future question/answer variants deserialize cleanly without breaking existing callers.
  • Type-Safe Instructions Union (DecisionInstructions): Supports plain string instructions (DecisionInstructions.of("...")) or structured Content.TextContent block arrays (DecisionInstructions.ofBlocks(...)).
  • Safety & Content Filtering (Decision.PromptFeedback): Exposes promptFeedback() (BlockReason open-safe enum + blockReasonMessage()) and decision.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 model
    • GEMINI_DECISION_1 ("gemini-decision-1") — Structured classification & scoring model for /v1beta/decisions
    • GEMINI_OMNI_1_2_FLASH ("gemini-omni-1.2-flash") — Multimodal Omni Flash generation model
    • GEMINI_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 @Deprecated and Javadoc migration pointers to their current replacements.

🛠️ SDK Ergonomics & Documentation

  • Content.ImageContent Overloads: Added convenience constructors accepting (byte[], String, Resolution), (String, String), and (String, String, Resolution) so multimodal callers can set media processing Resolution (LOW, MEDIUM, HIGH, ULTRA_HIGH) directly without passing null placeholders.
  • Documentation & Agent Skill: Updated README.md and skills/gemini-interactions-java-api/SKILL.md with comprehensive Decisions API usage examples, DecisionInstructions union 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.0
  • io.github.glaforge:gemini-interactions-api-sdk:2.2.0
  • io.github.glaforge:gemini-interactions-server:2.2.0

Full Changelog: v2.1.2...v2.2.0