GSP1335

Overview
Google AI Studio is a powerful tool that allows you to interact with various AI models and experiment with different prompts. Google AI Studio serves as a platform for developers to experiment with and integrate Gemini's multimodal generative AI capabilities into their applications. It provides an environment for prompt engineering, allowing users to test and refine their prompts to achieve desired outputs from Gemini models.
This lab explores prompt engineering and best practices for designing effective prompts to improve the quality of your LLM-generated responses. You'll learn how to craft prompts that are concise, specific, and well-defined, focusing on one task at a time. Throughout this lab, you'll take on the persona of a creative writer using Google AI Studio to brainstorm ideas for a new science fiction story.
What you'll learn
In this lab, you will learn how to:
- Create basic prompts in Google AI Studio.
- Add system instructions to prompts.
- Explore Gemini models and adjust temperature settings.
- Experiment with prompt tools to adjust the model’s output.
Setup and requirements
Before you click the Start Lab button
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources are made available to you.
This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
- Access to a standard internet browser (Chrome browser recommended).
Note: Use an Incognito (recommended) or private browser window to run this lab. This prevents conflicts between your personal account and the student account, which may cause extra charges incurred to your personal account.
- Time to complete the lab—remember, once you start, you cannot pause a lab.
Note: Use only the student account for this lab. If you use a different Google Cloud account, you may incur charges to that account.
Open Google AI Studio
-
Click Start Lab. The lab panel will display the temporary credentials for this lab.
-
Note: If this is a paid lab, you will be prompted to select a payment method.
-
Open Google AI Studio in an Incognito window. The Google sign-in page will appear.
-
Tip: For easier access, arrange the lab and AI Studio tabs in separate, side-by-side windows.
-
Copy the Username below and paste it into the Email field, then click Next.
{{{user_0.username | "Username"}}}
-
Copy the Password below and paste it into the Enter your password field, then click Next.
{{{user_0.password | "Password"}}}
-
Accept any on-screen terms and conditions to proceed.
You are now logged into Google AI Studio using your temporary student account.
Task 1. Create a basic prompt
In this task, you'll start by sending a simple, "zero-shot" prompt to the model. This is the most fundamental interaction, where you ask the model to perform a task without giving it any prior examples.
-
In the left navigation menu, click Chat to open a new, empty chat session.
-
In the prompt entry field, type the following request:
Suggest 5 names for a rugged space freighter.
-
Click the Run button (the arrow icon to the right of the prompt field).
-
Review the list of names generated by the model. In the right-hand panel, notice the Token count, which shows the size of your prompt and the model's response.
-
Save your prompts and responses by clicking the save prompt icon
to edit the title and description of the prompt.
-
If a pop-up window prompts for permissions, choose your student account (e.g., student-XX-YYYY@qwiklabs.net
) and grant any necessary permissions to continue.
-
In the Save prompt dialog, for Prompt name, type Rugged Space Freighter Names.
-
Click Save.
Click Check my progress to verify the objective.
Create a basic prompt
Task 2. Add context and structure to prompts
In this task, you'll guide the model to produce a more specific and higher-quality response. First, you'll use the System instructions feature to give the model a persona. Then, you'll provide a "one-shot" example within your prompt to show the model the exact format you want.
Use system instructions to set a persona
-
To start a new, empty chat session, click the Clear Chat icon on the toolbar at the top of the chat window.
-
At the top of the chat window, click the System instructions icon (the leftmost icon, showing a clipboard) to reveal the system instructions field.
-
In this field, define the model's persona by entering the following:
You are a science fiction author known for hard sci-fi and gritty, realistic world-building.
- In the main prompt field below, enter your request:
Write a one-paragraph ship description for a long-haul mining vessel named 'The Odyssey'.
- Click Run and observe the result. Notice how the model adopts the "hard sci-fi" persona, producing a more detailed and stylistically focused description.
Use a one-shot example to define structure
- Now, you'll refine the prompt to request a specific output structure. Edit your main prompt to include an example for the model to follow:
You are a science fiction author. Create a ship description.
**Example:**
Name: The Serenity
Class: Firefly
Description: A small, versatile transport ship, old but reliable, with many hidden compartments.
**My Request:**
Name: The Odyssey
Class: Long-Haul Miner
Description:
- Click Run. The model will now "fill in the blank" and follow your requested
Name
, Class
, and Description
format because you provided a clear example.
Click Check my progress to verify the objective.
Add context and structure to prompts
Task 3. Explore Gemini models and adjust temperature
In this task, you'll learn how to modify two key parameters that control the model's behavior: the model itself and the temperature, which governs creativity.
Switch between Gemini models
-
Use the same prompt from the previous task. In the right-hand panel, choose a model from the model dropdown menu.
-
From the dropdown menu, select .
-
Click Run and note the model's response speed. is optimized for speed and efficiency.
-
Click the model selector again and switch back to for the next step.
Adjust the temperature to influence the output
In this task, you'll adjust the temperature setting to see how it influences the model's responses. A lower temperature makes the output more predictable and focused, while a higher temperature is often used to elicit a more creative response.
- In a new chat, enter the following prompt:
Suggest an exciting event that could happen aboard a spaceship.
-
In the right-hand panel, locate the Temperature slider and set it to a low value, such as 0.1.
-
Click Run and review the response. A low temperature setting encourages the model to choose the most probable and common words.
-
Now, drag the Temperature slider to a high value, such as 1.8.
-
Click Run again. Compare this new response to the previous one and observe the differences. The higher temperature allows the model to use a wider range of words, which can lead to more varied or unexpected suggestions.
Click Check my progress to verify the objective.
Explore Gemini models and adjust temperature
Task 4. Experiment with tools to adjust the model’s output
In this task, you'll explore the Tools available in Google AI Studio. These allow the model to interact with external systems or provide its output in a specific format.
Use Structured Output to get JSON
- You want a list of planets for your story in a format that a computer could easily read. In a new chat, enter the following prompt:
Generate a list of three planets in the Tau Ceti system, including their name, type, and a fictional key resource. Provide the output in JSON format.
-
In the Tools section on the right, click the Structured output toggle. This tells the model to strictly follow your formatting request.
-
Click Run. Observe the output, which should be a perfectly formatted JSON array, ready to be used in an application.
Use Google Search for factual grounding
Sometimes you need the model to access up-to-date, real-world information.
-
To start a new, empty chat session, click the Clear Chat icon on the toolbar at the top of the chat window.
-
In the Tools section, click the toggle to enable Grounding with Google Search.
-
Enter a prompt that requires both factual retrieval and creative writing:
Using Google Search, what is the latest news about the James Webb Space Telescope? Then, write a short, inspirational journal entry from an astronomer working on the project.
- Click Run. Notice how the model first provides current, factual information sourced from Google Search before fulfilling the creative part of the prompt.
Click Check my progress to verify the objective.
Experiment with tools to adjust the model’s output
Task 5. View the saved prompt in History
In this task, you'll navigate to the History page to find and review the prompt you just saved. All saved prompts are stored here, connected to your Google Drive.
-
In the navigation menu on the left side of the page, click History.
-
You will now see a list of your saved prompts.
-
This loads the prompt and its previously generated response back into the chat window, allowing you to review your work or continue the conversation.
Congratulations!
Congratulations! You've successfully used Google AI Studio to move from a simple idea to a well-structured and powerful prompt. You learned to guide the model with context, control its creativity, and connect it to external tools. You now have a strong foundation for crafting effective prompts for your own projects.
Google Cloud training and certification
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated June 27, 2025
Lab Last Tested June 27, 2025
Copyright 2025 Google LLC. All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.