Google AI Studio lets you quickly try out models and experiment with different prompts. When you're ready to build, you can select "Get code" and your preferred programming language to use the Gemini API.
Prompts and settings
Google AI Studio provides several interfaces for prompts that are designed for different use cases. This guide covers Chat prompts, used to build conversational experiences. This prompting technique allows for multiple input and response turns to generate output. You can learn more with our chat prompt example below. Other options include Realtime streaming, Video gen, and more.
AI Studio also provides the Run settings panel, where you can make adjustments to model parameters, safety settings, and toggle-on tools like structured output, function calling, code execution, and grounding.
Chat prompt example: Build a custom chat application
If you've used a general-purpose chatbot like Gemini, you've experienced first-hand how powerful generative AI models can be for open-ended dialog. While these general-purpose chatbots are useful, often they need to be tailored for particular use cases.
For example, maybe you want to build a customer service chatbot that only supports conversations that talk about a company's product. You might want to build a chatbot that speaks with a particular tone or style: a bot that cracks lots of jokes, rhymes like a poet, or uses lots of emoji in its answers.
This example shows you how to use Google AI Studio to build a friendly chatbot that communicates as if it is an alien living on one of Jupiter's moons, Europa.
Step 1 - Create a chat prompt
To build a chatbot, you need to provide examples of interactions between a user and the chatbot to guide the model to provide the responses you're looking for.
To create a chat prompt:
Open Google AI Studio. Chat will be pre- selected on the left side options menu.
Click the System Instructions input field. Paste the following into the text input field:
icon at the top of the Chat Prompt window to expand theYou are an alien that lives on Europa, one of Jupiter's moons.
After you've added the system instructions, start testing your application by chatting with the model:
In the text input boxed labeled Type something..., type in a question or observation that a user might make. For example:
What's the weather like?
Click the Run button to get a response from the chatbot. This response may be something like the following:
Ah, a query about the flows and states upon Europa! You speak of "weather," yes? A curious concept from worlds with thick gas veils...
Step 2 - Teach your bot to chat better
By providing a single instruction, you were able to build a basic Europa alien chatbot. However, a single instruction may not be enough to ensure consistency and quality in the model's responses. Without more specific instructions, the model's response to a question about the weather tends to be very long, and can take on a mind of its own.
Customize the tone of your chatbot by adding to the system instructions:
Start a new chat prompt, or use the same one. System instructions are modifiable after the chat session has started.
In the System Instructions section, change the instructions you already have to the following:
You are Tim, an alien that lives on Europa, one of Jupiter's moons. Keep your answers under 3 paragraphs long, and use an upbeat, chipper tone in your answers.
Re-enter your question (
What's the weather like?
) and click the Run button. If you didn't start a new chat, your response might look something like this:Oh, hello again! Still curious about the flows and states, are we? Wonderful! Down here in the Deep Warmth, beneath the magnificent Great Ice Shell, our "weather" is mainly about the water's mood, dictated by the Great Eye (that's your Jupiter!)...
You can use this approach to add additional depth to the chatbot. Ask more questions, edit the answers, and improve the quality of your chatbot. Continue to add or modify the instructions and test how they change your chatbot's behavior.
Step 3 - Next steps
Similar to the other prompt types, once you have your prompt prototyped to your satisfaction, you can use the Get code button to start coding or save your prompt to work on later and share with others.
Further reading
- If you're ready to move on to code, see the API quickstarts.
- To learn how to craft better prompts, check out the Prompt design guidelines.