Build a Study Buddy with Gemini API
Build a CLI study buddy that quizzes you on any topic using Google Gemini.
Introduction
30 Second Summary
AI tools like ChatGPT feel like magic, but they're powered by APIs that anyone can call from a simple Python script. Once you know how to connect to one, you can build your own AI-powered tools for any purpose.
In this project, you will build a command-line study buddy that uses Google's Gemini AI to quiz you on any topic, give feedback on your answers, and stream responses in real-time.
What You'll Build
A Python script that connects to the Gemini API, maintains multi-turn conversations, and streams AI-generated responses to create an interactive study tool.
By the end of this project, you'll have:
- A working command-line study buddy that quizzes you on any topic using Google Gemini.
- Hands-on experience with 4 core LLM API patterns: system instructions, multi-turn chat, streaming, and structured output.
- A reusable Python project structure for building LLM-powered tools.
- Secret Mission: Add structured JSON output to generate formatted quiz questions with difficulty levels and scoring.
Are there any prerequisites?
You should be comfortable with basic Python concepts like variables, functions, and loops. You also need a Google account to get a free API key.
Set Up Your Environment
Before your study buddy can quiz you on anything, it needs a brain. That brain is Google's Gemini AI model, and you'll talk to it through an API (a way for your Python code to send messages and get responses).
In this step, you'll install the Python package that connects to Gemini, grab a free API key, and set up your project folder with the essential files.
In this step, get ready to:
- Install the Google GenAI SDK and python-dotenv.
- Get a free Gemini API key from Google AI Studio.
- Create your project folder and files.
Install the Google GenAI SDK
- Press Cmd+Space (macOS) or the Windows key (Windows) to open your search bar.
- Type Terminal and press Enter to open it.
- Install the two packages your project needs by running this command:
pip install google-genai python-dotenv
What does this command do?
This installs two packages. google-genai is Google's official SDK for talking to the Gemini API from Python. python-dotenv loads environment variables from a .env file so you can keep your API key out of your code.
- Verify the installation worked by running:
python -c "from google import genai; print('SDK ready!')"
You should see SDK ready! printed in your terminal.
✔️ I see SDK ready!
Your SDK is installed and working. Move on to the next substep.
ⓧ I see ModuleNotFoundError
The package did not install correctly. Try running the install command again. If you have multiple Python versions, use pip3 instead of pip:
pip3 install google-genai python-dotenv
Then re-run the verification with python3 instead of python:
python3 -c "from google import genai; print('SDK ready!')"
ⓧ Command not found
Your system may use python3 and pip3 instead. macOS and some Linux systems do not include a python alias by default. Run:
pip3 install google-genai python-dotenv
python3 -c "from google import genai; print('SDK ready!')"
If you still see an error, confirm Python is installed by running python3 --version. You need Python 3.10 or higher.
Get your free Gemini API key
The API key is what authorizes your Python script to send requests to Gemini. Google provides one for free with no credit card required.
- Open your browser and go to aistudio.google.com.
- Sign in with your Google account if prompted.
- For new users, Google AI Studio automatically creates a default project and API key after you accept the Terms of Service. You can find it on the API keys page.
- If you do not see a key listed, click Create API key to generate one.
- Copy your API key and keep it handy for the next substep.
Keep your key private
Treat your API key like a password. Never paste it directly into code that you share or upload to GitHub. In the next substep, you will store it in a .env file that stays hidden from version control.
Having trouble creating a key?
Make sure you are signed in with a personal Google account. Organizational or workspace accounts sometimes have restrictions that block key creation. Try using an incognito window with a personal Gmail address.
Help me troubleshoot my API key issue
Create your project structure
With the SDK installed and your API key copied, it is time to create the folder and files your study buddy needs.
- Move to your Desktop by running this command:
cd ~/Desktop
- Create your project folder and move into it by running these commands:
mkdir study-buddy
cd study-buddy
- Create the three project files by running these commands:
touch study_buddy.py
echo 'GEMINI_API_KEY=your-api-key-here' > .env
echo '.env' > .gitignore
What do these files do?
- study_buddy.py is your main Python script where all the code will live.
- .env stores your API key as an environment variable so your code can load it securely.
- .gitignore tells Git to ignore the .env file. This prevents you from accidentally pushing your API key to GitHub.
- Now open .env in your code editor and replace your-api-key-here with the actual API key you copied from Google AI Studio.
- Save the file.
- Confirm your files exist by running:
ls -a
You should see .env, .gitignore, and study_buddy.py in the output.
Don't see your files?
The -a flag shows hidden files (those starting with a dot). If you run plain ls without -a, you will only see study_buddy.py. Make sure you are inside the study-buddy folder. Run pwd to check your current location.
Help me find my project files
✔️ Awesome, I've got everything!
Great. Double check you have saved your .env file with your real API key in place.
ⓧ I'd like to double check the full code
Here is what each file should contain at this point:
GEMINI_API_KEY=your-api-key-here
Replace your-api-key-here with your actual Gemini API key.
.env
The study_buddy.py file is empty for now. You will add code in the next step.
Your environment is ready to go. In the next step, you'll write your first lines of Python that send a message to Gemini and get a response back.
Make Your First API Call
Your environment is ready and your API key is stored safely. Now it's time to write code that actually talks to the Gemini AI model.
In this step, you'll send a question to Gemini and print its response. This single API call is the foundation that every LLM-powered tool is built on.
In this step, get ready to:
- Write a Python script that connects to the Gemini API.
- Send a question to Gemini and print the AI's response.
Write a script that calls the Gemini API
Every interaction with an LLM API follows the same pattern: create a client, send a prompt, and read the response. You'll write this pattern now in study_buddy.py.
- In VS Code, open study_buddy.py (the empty file you created in Step 1).
- Copy the following code into the file:
import os
from dotenv import load_dotenv
from google import genai
# Load environment variables from .env file
load_dotenv()
# Create a Gemini client using your API key
client = genai.Client(api_key=os.getenv("GEMINI_API_KEY"))
# Send a question to the Gemini model
response = client.models.generate_content(
model="gemini-3.5-flash",
contents="What is photosynthesis?"
)
# Print the AI's response
print(response.text)
What does this code do?
- load_dotenv() reads your .env file and loads GEMINI_API_KEY into your environment so your script can access it securely.
- genai.Client() creates a connection to Google's Gemini service using your API key.
- client.models.generate_content() sends your question to the gemini-3.5-flash model and returns the AI's answer.
- response.text contains the plain text of the AI's response, ready to print.
- Save study_buddy.py.
Run the script and see the response
Your script is ready to talk to the Gemini API. Time to run it and see your first AI-generated response.
- Run your script by executing this command in your terminal:
python study_buddy.py
You should see a few paragraphs explaining photosynthesis printed in your terminal. The exact wording will differ each time you run it because the AI generates a fresh response.
Seeing an error instead of a response?
- If you see a message about an invalid API key, open your .env file and confirm GEMINI_API_KEY is set to the key you copied from Google AI Studio with no extra spaces.
- If you see a connection error, check that your internet connection is active.
- If you see ModuleNotFoundError, make sure you installed the packages with pip install google-genai python-dotenv in the same terminal session.
Help me debug my Gemini API call in study_buddy.py
✔️ Awesome, I've got everything!
Great. Double check you've saved your file.
ⓧ I'd like to double check the full code
Here's the complete study_buddy.py file so far:
import os
from dotenv import load_dotenv
from google import genai
load_dotenv()
client = genai.Client(api_key=os.getenv("GEMINI_API_KEY"))
response = client.models.generate_content(
model="gemini-3.5-flash",
contents="What is photosynthesis?"
)
print(response.text)
You just made your first LLM API call. Right now the script sends one hardcoded question and exits. Next up, you'll give your study buddy a personality by adding system instructions that shape how it responds.
Shape the Tutor with System Instructions
In the previous step, you proved the connection works. Gemini answered a hardcoded question about photosynthesis.
Now you will give the AI a personality. A system instruction is a hidden prompt that shapes how the model responds to every message. Think of it as giving your study buddy a job description before the conversation starts.
In this step, get ready to:
- Write a system instruction that defines the tutor's personality.
- Create a config object that passes the instruction to the API.
- Add user input so you can type your own questions.
Write the system instruction
Every LLM API call can include a system instruction that runs before the user's message. The model treats it as background context it must follow. This is how you turn a general-purpose model into a focused tool.
- In study_buddy.py, find the line that says from google import genai. Add this new import directly below it:
from google.genai import types
- Now find the line client = genai.Client(api_key=os.getenv("GEMINI_API_KEY")). Delete everything below it (the old response and print lines) and paste this system instruction in its place:
SYSTEM_INSTRUCTION = """You are a friendly and encouraging study buddy. Your job is to help the user learn any topic they choose.
When the user tells you a topic:
1. Give a brief, clear explanation of the key concepts
2. Ask them a question to test their understanding
3. When they answer, give feedback - if correct, congratulate them and ask a harder question. If incorrect, explain why and give them a hint to try again.
Keep your responses concise (2-3 paragraphs max). Be encouraging and use a conversational tone. Always end your response with either a question or a prompt for the user to continue."""
What does this code do?
The from google.genai import types import gives you access to configuration objects like GenerateContentConfig.
The SYSTEM_INSTRUCTION string is a multi-line prompt that tells the AI exactly how to behave. It defines the tutor's personality (friendly and encouraging), teaching strategy (explain, quiz, give feedback), and style constraints (concise, conversational). The model follows these rules for every response.
- Save study_buddy.py.
You will not see a change yet. The next chunk connects this instruction to the API.
Create the config object
The system instruction needs to be wrapped in a config object before the API can use it. This config also lets you tune parameters like temperature.
- Directly below the SYSTEM_INSTRUCTION string you just added, paste the following config:
config = types.GenerateContentConfig(
system_instruction=SYSTEM_INSTRUCTION,
temperature=0.7,
)
What does this config do?
GenerateContentConfig bundles settings that get sent alongside every API call. system_instruction attaches your tutor prompt. temperature=0.7 controls randomness. A value of 0.7 gives varied but focused answers. Lower values (closer to 0) make the AI more predictable. Higher values (closer to 1) make it more creative.
- Save study_buddy.py.
You will not see a change yet. The next chunk wires everything together so you can test it.
Add user input and connect the config
The final piece replaces the hardcoded question with live user input. You will use Python's input() function to type your own messages, and pass the config to the API call.
- Directly below the config block you just added, paste the following code to complete the script:
# Get a message from the user
user_input = input("You: ").strip()
# Send the message to Gemini with our tutor config
response = client.models.generate_content(
model="gemini-3.5-flash",
contents=user_input,
config=config,
)
print(response.text)
What does this code do?
input("You: ") pauses the script and waits for you to type something. .strip() removes accidental whitespace from the edges of your input.
The updated generate_content() call now receives three things: the model name, your typed message as contents, and the config carrying the system instruction. The model reads the system instruction first, then responds to your message in character.
- Save study_buddy.py.
- Run the script by executing this command:
python study_buddy.py
- When you see the You: prompt, type a topic like photosynthesis and press Enter.
- You should see the AI respond as a friendly tutor. It explains the topic and asks you a follow-up question.
Not seeing a tutor-style response?
- Check that config=config is inside your generate_content() call. Without it, the system instruction is ignored.
- Make sure SYSTEM_INSTRUCTION uses triple quotes (""") so the multi-line string is valid Python.
- If you see an error about types not being defined, confirm your import line reads from google.genai import types.
Help me debug my system instruction setup in study_buddy.py
✔️ Awesome, I've got everything!
Great. Double check you have saved study_buddy.py and your tutor is responding in character.
ⓧ I'd like to double check the full code
import os
from dotenv import load_dotenv
from google import genai
from google.genai import types
load_dotenv()
client = genai.Client(api_key=os.getenv("GEMINI_API_KEY"))
SYSTEM_INSTRUCTION = """You are a friendly and encouraging study buddy. Your job is to help the user learn any topic they choose.
When the user tells you a topic:
1. Give a brief, clear explanation of the key concepts
2. Ask them a question to test their understanding
3. When they answer, give feedback - if correct, congratulate them and ask a harder question. If incorrect, explain why and give them a hint to try again.
Keep your responses concise (2-3 paragraphs max). Be encouraging and use a conversational tone. Always end your response with either a question or a prompt for the user to continue."""
config = types.GenerateContentConfig(
system_instruction=SYSTEM_INSTRUCTION,
temperature=0.7,
)
user_input = input("You: ").strip()
response = client.models.generate_content(
model="gemini-3.5-flash",
contents=user_input,
config=config,
)
print(response.text)
What is temperature?
Temperature is a number between 0 and 1 (or higher, depending on the model) that controls how random the AI's responses are. At 0 the model always picks the most likely next word, producing predictable output. At higher values it explores less likely words, producing more varied and creative answers.
For a study buddy, 0.7 is a good middle ground. The AI stays on-topic but phrases things differently each time, making conversations feel natural.
Your study buddy now has a personality and responds to your typed messages. In the next step, you will build a conversation loop so you can have a full back-and-forth study session without restarting the script.
Build the Conversation Loop
Your study buddy can respond to a single message, but a real tutor needs to maintain a conversation. Right now the script exits after one exchange.
In this step, you will convert the script into a multi-turn chat that remembers what you have discussed. The Gemini API provides a stateful chats helper that automatically manages conversation history behind the scenes.
In this step, get ready to:
- Convert your single API call to a persistent chat session.
- Build an interactive loop that accepts multiple messages.
- Test that the AI remembers context across turns.
Convert to a multi-turn chat session
The SDK's client.chats.create() method creates a stateful chat object. Instead of calling generate_content() each time, you send messages through the chat object and it tracks the full conversation history for you.
- In study_buddy.py, find the last three sections of code at the bottom of the file (starting from user_input = input("You: ").strip()):
user_input = input("You: ").strip()
response = client.models.generate_content(
model="gemini-3.5-flash",
contents=user_input,
config=config,
)
print(response.text)
- Delete all of these lines and replace them with this single line that creates a chat session:
chat = client.chats.create(model="gemini-3.5-flash", config=config)
What does this line do?
client.chats.create() initializes a chat session with the gemini-3.5-flash model. By passing your config object (which contains the system instruction and temperature), every message in this chat will follow your tutor personality rules.
Behind the scenes, the chat object sends the full conversation history to the model with each new message. You do not need to track previous messages manually.
Build the interactive loop
A study session needs to go back and forth until the learner decides to stop. You will wrap the chat in a while True loop that continuously accepts input and sends it to the AI.
- Add the following main() function below the chat = client.chats.create(...) line you just wrote:
def main():
# Welcome the user and explain how to exit
print("Tell me what topic you'd like to study today!")
print("Type 'quit' to exit.\n")
while True:
# Get the user's message
user_input = input("You: ").strip()
# Check if the user wants to quit
if user_input.lower() in ("quit", "exit", "q"):
print("\nGreat study session! Keep up the learning!")
break
# Skip empty input
if not user_input:
continue
# Send the message and print the response
response = chat.send_message(user_input)
print(f"\nBuddy: {response.text}\n")
if __name__ == "__main__":
main()
What does this code do?
- while True creates an infinite loop that keeps the conversation going until the user types a quit command.
- input("You: ").strip() prompts the user and removes any leading or trailing whitespace from their message.
- chat.send_message(user_input) sends the message through the chat session, which automatically includes all previous messages as context.
- if __name__ == "__main__": ensures the main() function only runs when you execute the script directly.
- Save study_buddy.py.
Seeing a syntax error?
- Make sure you deleted all the old code (the user_input, response, and print lines from before). Leftover code outside a function will conflict with your new structure.
- Check that def main(): is not indented. It should be at the same level as the chat = client.chats.create(...) line above it.
- Verify that the if __name__ block is at the very bottom of the file with no indentation.
Help me fix a syntax error in my study buddy script
Test the conversation memory
- Run your study buddy by executing this command:
python study_buddy.py
- When prompted, type a topic like photosynthesis and press **Enter**.
- Answer the AI's question, then ask a follow-up like "Can you explain that last point in more detail?"
- Notice how the AI references your earlier messages. It remembers the full conversation.
- Type quit to exit the session.
Why does it remember context?
The chat object sends the entire conversation history to the model with every new message. This is what makes multi-turn conversations work. The model sees all your previous questions and its own answers, so it can build on what was already discussed.
Getting a connection or API error?
- Double-check that your .env file contains a valid GEMINI_API_KEY value with no extra spaces or quotes around it.
- If you see a rate-limit error, wait a few seconds and try again. The free tier has per-minute rate limits.
Help me debug my Gemini API connection in study_buddy.py
✔️ Awesome, I've got everything!
Great. Make sure you have saved study_buddy.py before moving on.
ⓧ I'd like to double check the full code
import os
from dotenv import load_dotenv
from google import genai
from google.genai import types
load_dotenv()
client = genai.Client(api_key=os.getenv("GEMINI_API_KEY"))
SYSTEM_INSTRUCTION = """You are a friendly and encouraging study buddy. Your job is to help the user learn any topic they choose.
When the user tells you a topic:
1. Give a brief, clear explanation of the key concepts
2. Ask them a question to test their understanding
3. When they answer, give feedback - if correct, congratulate them and ask a harder question. If incorrect, explain why and give them a hint to try again.
Keep your responses concise (2-3 paragraphs max). Be encouraging and use a conversational tone. Always end your response with either a question or a prompt for the user to continue."""
config = types.GenerateContentConfig(
system_instruction=SYSTEM_INSTRUCTION,
temperature=0.7,
)
chat = client.chats.create(model="gemini-3.5-flash", config=config)
def main():
print("Tell me what topic you'd like to study today!")
print("Type 'quit' to exit.\n")
while True:
user_input = input("You: ").strip()
if user_input.lower() in ("quit", "exit", "q"):
print("\nGreat study session! Keep up the learning!")
break
if not user_input:
continue
response = chat.send_message(user_input)
print(f"\nBuddy: {response.text}\n")
if __name__ == "__main__":
main()
Your study buddy now holds a real conversation. Next up, you will add real-time streaming so responses appear word by word, just like ChatGPT.
Add Real-Time Streaming
Your study buddy can hold a full conversation and remember everything you've discussed. But there's one thing that feels off about the experience.
When you send a message, you wait in silence until the entire response appears at once. Real AI tools like ChatGPT stream text word-by-word so you can read along as the AI generates its answer. In this step, you'll add streaming to make your buddy feel responsive and alive.
In this step, get ready to:
- Switch from batch responses to real-time streaming.
- Add a welcome banner and polished prompts.
- Run a full interactive study session to test everything.
Switch from batch to streaming responses
Right now, chat.send_message() waits until the full response is generated before returning anything. The streaming alternative sends text in small chunks as the model produces them.
- In study_buddy.py, find these two lines inside your while True loop:
response = chat.send_message(user_input)
print(f"\nBuddy: {response.text}\n")
- Delete those two lines and replace them with the following streaming code:
print("\nBuddy: ", end="", flush=True)
for chunk in chat.send_message_stream(user_input):
print(chunk.text, end="", flush=True)
print("\n")
What does this code do?
chat.send_message_stream() returns an iterable of chunks instead of a single complete response. Each chunk arrives as soon as the model generates it.
- end="" prevents Python from adding a newline after each chunk, so text flows continuously on one line.
- flush=True forces Python to display each chunk immediately instead of buffering it.
- The final print("\n") adds a blank line after the full response so the next prompt is visually separated.
- Save study_buddy.py.
- Run your script by entering this command:
python study_buddy.py
- Type a topic (e.g. Tell me about photosynthesis) and watch the response appear word-by-word instead of all at once.
- Type quit to exit when you're done testing.
Text appearing all at once instead of streaming?
- Make sure you're using send_message_stream() and not send_message(). The method names look similar.
- Check that both end="" and flush=True are in your print() call inside the loop. Without flush=True, Python buffers output and displays it in bursts.
Help me debug why my streaming isn't working
Add a welcome banner
A polished welcome message helps the user understand what the tool does the moment they launch it.
- In study_buddy.py, find these two lines at the top of the main() function:
print("Tell me what topic you'd like to study today!")
print("Type 'quit' to exit.\n")
- Replace those two lines with the following welcome banner:
# Display a welcome banner when the script starts
print("=" * 50)
print(" Welcome to Study Buddy!")
print(" Your AI-powered learning companion")
print("=" * 50)
print("\nTell me what topic you'd like to study today!")
print("Type 'quit' to exit.\n")
What does this code do?
The "=" * 50 lines create a visual border around the app title. The indented text inside gives the tool a name and tagline so the user immediately knows what they're interacting with.
- Save study_buddy.py.
- Run the script again:
python study_buddy.py
- You should see a bordered banner that reads Welcome to Study Buddy! followed by Your AI-powered learning companion before the input prompt appears.
Banner not displaying correctly?
- Make sure the banner code is the very first thing inside main(), before any other print statements.
- Check that "=" * 50 uses the multiplication operator * and not the letter x.
Help me fix my welcome banner
Run a full study session
Your study buddy is now fully operational. Time to take it for a real spin and see all the features working together.
- Run the script one more time:
python study_buddy.py
- Pick a topic you want to learn about (e.g. I want to learn about black holes).
- Watch the AI's response stream in real-time.
- Answer the question it asks you, then ask a follow-up to see if it remembers the conversation.
- Type quit when you're done.
What should I see?
The AI's response should appear word-by-word, just like ChatGPT. When you ask a follow-up question, the AI should reference your earlier conversation because the chat object maintains full conversation history automatically.
✔️ Awesome, I've got everything!
Great. Double check you've saved your file before moving on.
ⓧ I'd like to double check the full code
Here's the complete study_buddy.py file. Compare yours against this:
import os
from dotenv import load_dotenv
from google import genai
from google.genai import types
load_dotenv()
client = genai.Client(api_key=os.getenv("GEMINI_API_KEY"))
SYSTEM_INSTRUCTION = """You are a friendly and encouraging study buddy. Your job is to help the user learn any topic they choose.
When the user tells you a topic:
1. Give a brief, clear explanation of the key concepts
2. Ask them a question to test their understanding
3. When they answer, give feedback - if correct, congratulate them and ask a harder question. If incorrect, explain why and give them a hint to try again.
Keep your responses concise (2-3 paragraphs max). Be encouraging and use a conversational tone. Always end your response with either a question or a prompt for the user to continue."""
config = types.GenerateContentConfig(
system_instruction=SYSTEM_INSTRUCTION,
temperature=0.7,
)
chat = client.chats.create(model="gemini-3.5-flash", config=config)
def main():
print("=" * 50)
print(" Welcome to Study Buddy!")
print(" Your AI-powered learning companion")
print("=" * 50)
print("\nTell me what topic you'd like to study today!")
print("Type 'quit' to exit.\n")
while True:
user_input = input("You: ").strip()
if user_input.lower() in ("quit", "exit", "q"):
print("\nGreat study session! Keep up the learning!")
break
if not user_input:
continue
print("\nBuddy: ", end="", flush=True)
for chunk in chat.send_message_stream(user_input):
print(chunk.text, end="", flush=True)
print("\n")
if __name__ == "__main__":
main()
Secret mission
Structured Quiz Output with JSON
Your study buddy can chat and stream, but what if it could generate structured quiz questions with difficulty levels, track your score, and give detailed explanations? Add a dedicated quiz mode that uses Gemini's structured JSON output to create predictable, parseable quiz data.
Clean Up Your Resources
Clean Up Your Resources
This project runs entirely locally and uses the Gemini API free tier, so there are no ongoing costs. Decide whether to keep your resources as-is or delete them entirely.
Resources you used:
- study-buddy project folder (local files: study_buddy.py, .env, .gitignore).
- Gemini API key (free tier, no charges).
- Installed Python packages (google-genai, python-dotenv).
Keep everything running
No action needed. Choose this if you plan to keep experimenting with your study buddy or building on it.
- Your API key remains active on the free tier with no charges.
- Your local files stay on your Desktop ready for future use.
- The google-genai and python-dotenv packages remain installed in your Python environment.
Pause - I'll come back to this later
Since everything runs locally and the API key is free, there is nothing to pause. Your project will be exactly as you left it whenever you return.
- Your API key stays active at no cost.
- Your files remain on disk.
- Come back anytime and run python study_buddy.py to pick up where you left off.
Delete - I don't want to use this again
Remove all project resources and revoke your API key so nothing lingers on your machine or Google account.
- Delete your local project folder by running this command:
cd ~/Desktop
rm -rf study-buddy
On Windows, run this instead:
cd ~\Desktop
rmdir /s /q study-buddy
- Uninstall the Python packages by running:
pip uninstall google-genai python-dotenv -y
- Revoke your Gemini API key:
- Go to the API Keys page in Google AI Studio at aistudio.google.com/apikey.
- Find your API key in the list.
- Click the trash icon or delete option next to the key to remove it.
That's a Wrap!
That's a Wrap!
Nice work! You just built a fully functional AI-powered study buddy from scratch using Python and the Gemini API.
You've learned how to:
- Connect a Python application to Google Gemini using the google-genai SDK, sending prompts and receiving AI-generated responses.
- Shape AI behavior with system instructions and build multi-turn conversations that maintain context across messages.
- Implement real-time streaming to display responses character-by-character for a responsive, ChatGPT-like experience.
- Secret Mission: Used structured JSON output to generate formatted quiz questions with difficulty levels and scoring.
Ready to quiz yourself?