feat(integrations): add a Gemini Decisions classifier

Offen
#8,320 0 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

Maintainer antworten meist innerhalb von 3 Tagen

@llalitkumarrr arbeitet bereits daran.

Seit 24.11.2026.

  • #8321 von @vishal-bulbule — offen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

Problem

ADK's classifier interface (BaseClassifier, ClassifierNode) has first-party support for generative classification (LlmClassifier) and for third-party decision models (TypesafeClassifier, OpenAIDecisionsClassifier). There is no integration for Google's own decision model. Users who want calibrated probabilities for routing and gating, without a generation step, cannot use Gemini Decision 1 through ADK.

Proposal

Add GeminiDecisionsClassifier in google.adk.integrations.gemini_decisions. It implements BaseClassifier over the public Gemini Decisions API.

API summary

  • POST https://generativelanguage.googleapis.com/v1beta/decisions, model gemini-decision-1, x-goog-api-key header.
  • Binary maps to noul, Choice to choice, and Score to score. All questions go in one request, and answers come back as calibrated probabilities with a confidence value.
  • A request blocked by the input safety filters returns HTTP 400 with a code such as safety. The classifier returns a RefusalAnswer for every question.

google-genai version note

The Decisions API in the google-genai SDK needs google-genai >= 3.2, but every google-adk release up to 2.15.0 pins google-genai >= 2.34, < 3. So the classifier calls the REST API directly with httpx, as TypesafeClassifier does. It adds no dependency, and can move to the SDK once the pin allows it.

Design notes

  • base_url, timeout, max_attempts and http_client mirror TypesafeClassifier. Retries cover 429, 5xx, timeouts and dropped connections, and honour retry-after.
  • The default client uses ADK's mTLS helpers.
  • Input can be text, JSON, or a types.Content with inline image, audio, video or PDF parts.
  • The docs will state that the API sorts option keys alphabetically, that confidence is the top probability, and that input is untrusted, so a classifier should not be the only gate on an action that changes access.
  • It targets the public Gemini API only. base_url leaves room for other endpoints later.

Question

Is integrations/gemini_decisions/ the right home, or would maintainers prefer labs/classifiers/ for a first-party Google model?

I have a working branch with unit tests and a unit guide, and I am happy to open a PR.

Vorherrschende Sprache
Python
Sterne
22.3k
Forks
4.4k
Ø Merge
1 T. 2 Std.
Gemergte PRs (30 T.)
6

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus google/adk-python

Alle Issues in google/adk-python

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.