Skip to main content

gemmadecision

Small, local decisions in one Python call. Available on PyPI. Powered by GemmaDecision-270M.

Documentation · Quickstart · 10 use-case recipes · API reference

Install

pip install gemmadecision

Python 3.11+. No API key or server needed. Version 0.2.0 runs on CPU with ONNX Runtime by default; installing it does not install Torch or Transformers. The first call downloads the pinned runtime model; later calls reuse it. After downloading, inference runs locally.

Upgrading from 0.1.0 in a notebook? Run pip install -U gemmadecision, then restart the kernel. The new default avoids importing optional Torch vision/audio packages. Notebook upgrade guide.

Use it in your code

from gemmadecision import decide

team = decide("I was charged twice", choices=["billing", "technical"])
print(team)  # selected choice, as a string

For more specific decisions, give each choice a description:

team = decide(
    "The same payment appears twice on my statement.",
    choices={
        "billing": "Handle charges, payments and refunds",
        "technical": "Handle crashes, login errors and app problems",
    },
    question="Which support team should handle this request?",
)

Need the full ranking? Use rank(...) with the same arguments. It returns ordered candidates, scores and derived probabilities.

PydanticAI

pip install 'gemmadecision[pydantic-ai]'
from typing import Literal
from pydantic_ai import Agent
from gemmadecision import GemmaDecisionModel

agent = Agent(
    GemmaDecisionModel.local(),
    output_type=Literal["billing", "technical"],
)
result = agent.run_sync("I was charged twice")
print(result.output)

This uses PydanticAI's native decision-model interface. Boolean, enum, rubric and finite Pydantic fields are supported. More PydanticAI examples.

Serve it

pip install 'gemmadecision[serve]'
gemmadecision serve

That starts the Rust-powered Granian HTTP server at http://127.0.0.1:8700. Interactive API documentation is available at /docs.

from gemmadecision import DecisionClient

with DecisionClient() as client:
    result = client.decide(
        "I was charged twice",
        candidates={"billing": "Payments and refunds", "technical": "App problems"},
    )
    print(result.choice)

AsyncDecisionClient works with await. To connect PydanticAI to the server, use GemmaDecisionModel() instead of .local().

More control when you need it

The historical 0.1.0 wheel passed fresh Modal CPU and H100 GPU checks for local APIs, PydanticAI and HTTP serving. These checks used Torch and do not measure the 0.2.0 ONNX default. Installation validation.

The default uses ONNX Runtime on CPU. Add only the integrations you need:

Use Install
Local CPU decisions pip install gemmadecision
Rust HTTP server pip install 'gemmadecision[serve]'
Native PydanticAI pip install 'gemmadecision[pydantic-ai]'
Native Torch, CUDA or Apple MPS pip install 'gemmadecision[torch]'
vLLM on supported Linux/CUDA pip install 'gemmadecision[vllm]'

Extras combine: pip install 'gemmadecision[serve,torch]' adds a GPU-capable server. Select --device cuda or --device mps explicitly; in Python use DecisionEngine.from_pretrained(device="cuda"). The default auto path uses ONNX on CPU. No Rust compiler is needed for the HTTP server.

This model chooses among supplied options; it does not generate open-ended text. Its scores are rankings, and the derived probabilities are not a guarantee of correctness. Maximums are 2,048 state/question tokens, 768 tokens per choice and 64 choices. See the model card for evaluation and limitations.

Code: Apache-2.0. Model weights: separate Gemma terms. See NOTICE.

Metadata

Release files for gemmadecision 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gemmadecision 0.2.0
File Size Uploaded
gemmadecision-0.2.0.tar.gz 217.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gemmadecision 0.2.0
File Interpreter ABI Platform
gemmadecision-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 265.3 kB

Release files / gemmadecision-0.2.0.tar.gz

Download URL gemmadecision-0.2.0.tar.gz
Size 217.7 kB
Tags Source
SHA-256 checksum
How to use checksums
68f25a4630821b6e3b78d49f74b82ce71f92c1c2a91426230453465761874f82
BLAKE2b-256 checksum
How to use checksums
bb29e71cd7d1f87a05ea88b4e7b98db49021fef48c2b4a0f48ae545f6f5b886c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release files / gemmadecision-0.2.0-py3-none-any.whl

Download URL gemmadecision-0.2.0-py3-none-any.whl
Size 47.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b72a2bd3f0831ef623a96d5f9580c7829cbc0bae48a7af93d937029b9afae1d
BLAKE2b-256 checksum
How to use checksums
000bb520ed9dd45b2f0896139fe1621ffaaea1b567628ac913b162a1fef2740c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page