Gemini Decision 1: Beginners Guide (Complete Setup)

From the creator

Gemini Decision 1 for beginners: Google's new AI (the Gemini Decisions API) reads a customer email and picks one answer from your list, with how sure it is. "Oh great, third week waiting for my refund. Fantastic service." Its answer: angry, 96% sure. Set it up free, step by step, no coding knowledge needed. Setup on a Mac: 1. Key: aistudio.google.com, Create API key. Keep it secret. 2. Python 3.11+ from python.org (the Mac's own is too old). 3. VS Code. 4. In Terminal, line by line: mkdir decisions-demo cd decisions-demo python3 -m venv .venv source .venv/bin/activate pip install google-genai 5. Your key: export GEMINI_API_KEY="your-key-here" Windows (not tested): same mkdir, cd, then py -m venv .venv .venv\Scripts\Activate.ps1 pip install google-genai $env:GEMINI_API_KEY="your-key-here" Run: save decide.py in decisions-demo, then: python decide.py # decide.py: ask the Decisions API one question about one customer message import os from google import genai # The Decisions API only works on the v1beta version of the API client = genai.Client(api_key=os.environ["GEMINI_API_KEY"], http_options={"api_version": "v1beta"}) message = "Oh great, third week waiting for my refund. Fantastic service." result = client.decisions.create( model="gemini-decision-1", input=message, questions={ "mood": { "type": "choice", "instructions": "Is this customer happy, neutral or angry?", "criteria": {"happy": "", "neutral": "", "angry": ""}, }, }, ) mood = result.answers["mood"] print("Mood:", mood.choice) print("How sure:", f"{mood.confidence:.0%}") print("Output tokens:", result.usage.total_output_tokens) full.py sorts all five emails (run python full.py): # full.py: sort five customer messages, three questions in one request each import os from google import genai # The Decisions API only works on the v1beta version of the API client = genai.Client(api_key=os.environ["GEMINI_API_KEY"], http_options={"api_version": "v1beta"}) messages = [ "Thank you! The shoes fit perfectly and came a day early.", "Hi, can I change the delivery address for order 4471?", "The parcel arrived broken and nobody answers my emails.", "Oh great, third week waiting for my refund. Fantastic service.", "The jacket is nice, but the zip broke on day two. I want my money back.", ] questions = { "mood": {"type": "choice", "instructions": "Is this customer happy, neutral or angry?", "criteria": {"happy": "", "neutral": "", "angry": ""}}, "refund": {"type": "noul", "instructions": "Is the customer asking for their money back?"}, "reply": {"type": "score", "instructions": "How quickly does the support team need to reply?", "criteria": ["In a few days: nothing needs fixing", "Today: a question or a small request", "Right now: the customer has a problem and is upset"]}, } print("MOOD".ljust(12), "REFUND?".ljust(9), "REPLY".ljust(14), "MESSAGE") for message in messages: result = client.decisions.create(model="gemini-decision-1", input=message, questions=questions) mood = result.answers["mood"] refund = result.answers["refund"] reply = result.answers["reply"] # noul is the chance of "yes", from 0 to 1. round() makes it 0 (no) or 1 (yes) refund_word = "yes" if round(refund.noul) else "no" # Reply levels are numbered 0, 1, 2. Take the most likely one, keep its first words level = max(reply.probabilities, key=reply.probabilities.get) when = reply.legend[level].split(":")[0] mood_text = f"{mood.choice} {mood.confidence:.0%}" refund_text = f"{refund_word} {refund.confidence:.0%}" print(mood_text.ljust(12), refund_text.ljust(9), when.ljust(14), message[:32]) Expect: angry, 96%, Output tokens: 0. Free tier: Google may use what you send, so test with made-up messages. Chapters 0:00 Google's new AI that sorts for you 0:28 What Gemini Decision 1 is 1:00 What you'll learn 1:32 Gemini Decision 1 vs ChatGPT 2:38 Five shop emails to sort 3:52 Set up your computer in five steps 5:38 The code in four plain parts 6:49 Normal Gemini vs Gemini Decision 1 8:06 What 96% sure means 8:39 Two rules for beginners 9:36 What Gemini Decision 1 costs 10:14 Where else to use Gemini Decision 1 11:04 Recap Sources Blog: https://blog.google/innovation-and-ai/technology/developers-tools/gemini-decisions-api/ Docs: https://aistudio.google.com/docs/decisions-api Pricing: https://aistudio.google.com/docs/pricing 1 billion users: https://blog.google/innovation-and-ai/products/gemini-app/one-billion-monthly-users/ Amazon: https://strandsagents.com/blog/amazon-saves-millions-replacing-sonnet-with-strands-decider/

Find a job · 1 live role

Jobs in AI.
Apply now.

Apply once › get screened › meet the company

See all roles

More like this

Running one yourself?

List your AI event,
wherever it is.

A meetup, a workshop, a hackathon, a conference. Any city, or online. Tell us about it and it lands in front of people already learning this stuff.