arrow_back

Google AI Studio: Prompt Design

Acesse mais de 700 laboratórios e cursos

Google AI Studio: Prompt Design

Laboratório 30 minutos universal_currency_alt Sem custo financeiro show_chart Introdutório
info Este laboratório pode incorporar ferramentas de IA para ajudar no seu aprendizado.
Acesse mais de 700 laboratórios e cursos

GSP1335

Google Cloud self-paced labs logo

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

  1. 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.
  2. 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.
  3. Copy the Username below and paste it into the Email field, then click Next.

    {{{user_0.username | "Username"}}}
  4. Copy the Password below and paste it into the Enter your password field, then click Next.

    {{{user_0.password | "Password"}}}
  5. 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.

  1. In the left navigation menu, click Chat to open a new, empty chat session.

  2. In the prompt entry field, type the following request:

Suggest 5 names for a rugged space freighter.
  1. Click the Run button (the arrow icon to the right of the prompt field).

  2. 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.

  3. Save your prompts and responses by clicking the save prompt icon save to edit the title and description of the prompt.

  4. 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.

  5. In the Save prompt dialog, for Prompt name, type Rugged Space Freighter Names.

  6. 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

  1. To start a new, empty chat session, click the Clear Chat icon on the toolbar at the top of the chat window.

  2. At the top of the chat window, click the System instructions icon (the leftmost icon, showing a clipboard) to reveal the system instructions field.

  3. 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.
  1. In the main prompt field below, enter your request:
Write a one-paragraph ship description for a long-haul mining vessel named 'The Odyssey'.
  1. 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

  1. 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:
  1. 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

  1. Use the same prompt from the previous task. In the right-hand panel, choose a model from the model dropdown menu.

  2. From the dropdown menu, select .

  3. Click Run and note the model's response speed. is optimized for speed and efficiency.

  4. 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.

  1. In a new chat, enter the following prompt:
Suggest an exciting event that could happen aboard a spaceship.
  1. In the right-hand panel, locate the Temperature slider and set it to a low value, such as 0.1.

  2. Click Run and review the response. A low temperature setting encourages the model to choose the most probable and common words.

  3. Now, drag the Temperature slider to a high value, such as 1.8.

  4. 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

  1. 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.
  1. In the Tools section on the right, click the Structured output toggle. This tells the model to strictly follow your formatting request.

  2. 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.

  1. To start a new, empty chat session, click the Clear Chat icon on the toolbar at the top of the chat window.

  2. In the Tools section, click the toggle to enable Grounding with Google Search.

  3. 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.
  1. 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.

  1. In the navigation menu on the left side of the page, click History.

  2. You will now see a list of your saved prompts.

  3. 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.

Antes de começar

  1. Os laboratórios criam um projeto e recursos do Google Cloud por um período fixo
  2. Os laboratórios têm um limite de tempo e não têm o recurso de pausa. Se você encerrar o laboratório, vai precisar recomeçar do início.
  3. No canto superior esquerdo da tela, clique em Começar o laboratório

Usar a navegação anônima

  1. Copie o nome de usuário e a senha fornecidos para o laboratório
  2. Clique em Abrir console no modo anônimo

Fazer login no console

  1. Faça login usando suas credenciais do laboratório. Usar outras credenciais pode causar erros ou gerar cobranças.
  2. Aceite os termos e pule a página de recursos de recuperação
  3. Não clique em Terminar o laboratório a menos que você tenha concluído ou queira recomeçar, porque isso vai apagar seu trabalho e remover o projeto

Este conteúdo não está disponível no momento

Você vai receber uma notificação por e-mail quando ele estiver disponível

Ótimo!

Vamos entrar em contato por e-mail se ele ficar disponível

Um laboratório por vez

Confirme para encerrar todos os laboratórios atuais e iniciar este

Use a navegação anônima para executar o laboratório

Para executar este laboratório, use o modo de navegação anônima ou uma janela anônima do navegador. Isso evita conflitos entre sua conta pessoal e a conta de estudante, o que poderia causar cobranças extras na sua conta pessoal.