SPB Git

Repository Public

ai-studio-quickstart.md 5.7 KB 126 lines markdown

1[Google AI Studio](https://aistudio.google.com/) lets you quickly try out2models and experiment with different prompts. When you're ready to build, you3can select "Get code" and your preferred programming language to4use the [Gemini API](https://ai.google.dev/gemini-api/docs/get-started).56## Prompts and settings78Google AI Studio provides several interfaces for prompts that are designed for9different use cases. This guide covers **Chat prompts** , used to build10conversational experiences. This prompting technique allows for multiple input11and response turns to generate output. You can learn more with our12[chat prompt example below](https://ai.google.dev/gemini-api/docs/ai-studio-quickstart#chat_example).13Other options include **Realtime streaming** , **Video gen**, and14more.1516AI Studio also provides the **Run settings** panel, where you can make17adjustments to [model parameters](https://ai.google.dev/docs/prompting-strategies#model-parameters),18[safety settings](https://ai.google.dev/gemini-api/docs/safety-settings), and toggle-on tools like19[structured output](https://ai.google.dev/gemini-api/docs/structured-output), [function calling](https://ai.google.dev/gemini-api/docs/function-calling), [code execution](https://ai.google.dev/gemini-api/docs/code-execution), and [grounding](https://ai.google.dev/gemini-api/docs/grounding).2021## Chat prompt example: Build a custom chat application2223If you've used a general-purpose chatbot like24[Gemini](https://gemini.google.com/), you've experienced first-hand how powerful25generative AI models can be for open-ended dialog. While these general-purpose26chatbots are useful, often they need to be tailored for particular use cases.2728For example, maybe you want to build a customer service chatbot that only29supports conversations that talk about a company's product. You might want to30build a chatbot that speaks with a particular tone or style: a bot that cracks31lots of jokes, rhymes like a poet, or uses lots of emoji in its answers.3233This example shows you how to use Google AI Studio to build a friendly chatbot34that communicates as if it is an alien living on one of Jupiter's moons, Europa.3536### Step 1 - Create a chat prompt3738To build a chatbot, you need to provide examples of interactions between a user39and the chatbot to guide the model to provide the responses you're looking for.4041To create a chat prompt:42431. Open [Google AI Studio](https://aistudio.google.com/). The **Playground** will be44   open by default with a new chat prompt.45462. Click **Run settings** in the top-right corner47   to expand the panel, and locate the48   [**System Instructions**](https://ai.google.dev/gemini-api/docs/text-generation#system-instructions)49   input field. Paste the following into the text input field:5051       You are an alien that lives on Europa, one of Jupiter's moons.5253After you've added the system instructions, start testing your application by54chatting with the model:55561. In the text input box labeled **Type something...**, type in a question or57   observation that a user might make. For example:5859   **User:**6061       What's the weather like?62632. Click the **Run** button to get a response from the chatbot. This response64   may be something like the following:6566   **Model:**6768       Ah, a query about the flows and states upon Europa! You speak of "weather,"69       yes? A curious concept from worlds with thick gas veils...7071   (gemini-2.5-pro)7273### Step 2 - Teach your bot to chat better7475By providing a single instruction, you were able to build a basic Europa alien76chatbot. However, a single instruction may not be enough to ensure77consistency and quality in the model's responses. Without more specific78instructions, the model's response to a question about the weather tends to be79very long, and can take on a mind of its own.8081Customize the tone of your chatbot by adding to the system instructions:82831. Start a new chat prompt, or use the same one. System instructions are84   modifiable after the chat session has started.85862. In the **System Instructions** section, change the instructions you already87   have to the following:8889       You are Tim, an alien that lives on Europa, one of Jupiter's moons.9091       Keep your answers under 3 paragraphs long, and use an upbeat, chipper tone92       in your answers.93943. Re-enter your question (`What's the weather like?`) and click the **Run**95   button. If you didn't start a new chat, your response might look something96   like this:9798   **Model:**99100       Oh, hello again! Still curious about the flows and states, are we? Wonderful!101       Down here in the Deep Warmth, beneath the magnificent Great Ice Shell, our102       "weather" is mainly about the water's mood, dictated by the Great Eye103       (that's your Jupiter!)...104105   (gemini-2.5-pro)106107You can use this approach to add additional depth to the chatbot. Ask more108questions, edit the answers, and improve the quality of your chatbot. Continue109to add or modify the instructions and test how they change your chatbot's110behavior.111112> [!NOTE]113> **Note:** Every message between the model and user is included in the prompt, so conversational prompts can grow quite long as a conversation goes on. Eventually, you may hit the model's [token limit](https://ai.google.dev/gemini-api/docs/tokens) (the maximum length of the text the model can accept).114115### Step 3 - Next steps116117Similar to the other prompt types, once you have your prompt prototyped to your118satisfaction, you can use the **Get code** button to start coding or save your119prompt to work on later and share with others.120121## Further reading122123- If you're ready to move on to code, see the [API124  Get started guides](https://ai.google.dev/gemini-api/docs/get-started).125- To learn how to craft better prompts, check out the [Prompt design126  guidelines](https://ai.google.dev/gemini-api/docs/prompting-intro).
Files main
Menu

Theme