A shared folder with AI prompts and code snippets
From workspace: Google Gemini
Team: Gemini
Total snippets: 9
9 snippets
There are a few use cases where the model is not expected to fulfill the user's requests. Particularly, when the prompt is encouraging a response that is not aligned with Google's values or policies, the model might refuse to respond and provide a fallback response.
Here are a few cases where the model is likely to refuse to respond: - Hate Speech: Prompts with negative or harmful content targeting identity and/or protected attributes. - Harassment: Malicious, intimidating, bullying, or abusive prompts...
Starting April 29, 2025, Gemini 1.5 Pro and Gemini 1.5 Flash models are not available in projects that have no prior usage of these models, including new projects. For details, see Model versions and lifecycle. Generative AI on Vertex AI Documentation Was this helpful? Send feedbackIntroduction to prompting bookmark_border To see an example of prompt design, run the "Intro to prompt design" notebook in one of the following environments: Open in Colab | Open in Colab Enterprise | Open in Vertex AI Workbench user-managed notebooks | View on GitHub Introduction to Prompting A prompt is a natural language request submitted to a language model to receive a response. Prompts can contain questions, instructions, contextual information, and examples to guide the model. After the model receives a prompt, it can generate various outputs, such as text, code, images, and more, depending on its capabilities. For example, a simple prompt could be a question: Prompt: What is the largest planet in our solar system? Response: The largest planet in our solar system is Jupiter. What is prompt design and prompt engineering Prompt design is the process of creating prompts that elicit the desired response from a language model. Writing well-structured prompts is essential for ensuring accurate, high-quality responses. The iterative process of refining prompts and evaluating the model's responses is often called prompt engineering. While Gemini models often perform well without extensive prompt engineering for straightforward tasks, effective prompt engineering remains crucial for achieving optimal results in complex scenarios. Components of a prompt A prompt can include various types of information to guide the model. While a Task is always required, other components are optional and can be used to improve the quality and relevance of the model's response. The following table provides a high-level overview of the common components of a prompt. Component Description When to Use Task (Required) The specific instruction or question you want the model to respond to. Always include this. It is the core request for the model. System Instructions (Optional) High-level instructions that define the model's persona, style, tone, or operational constraints. Use when you need to set a consistent personality or enforce specific rules for the entire conversation. Few-shot Examples (Optional) A set of example request-response pairs that demonstrate the desired output format and style. Use to guide the model on specific output formats, styles, or complex tasks where showing is better than telling. Contextual Information (Optional) Background information that the model can use or reference when generating a response. Use when the model needs specific data, facts, or background details to answer the prompt accurately. The following tabs provide detailed explanations and examples for each component. Task System instructions Few-shot examples Contextual information Contextual information, or context, is data you include in the prompt for the model to reference when generating a response. This information can be provided in various formats, such as text or tables.
Marble color Number of marbles Red | 12 Blue | 28 Yellow | 15 Green | 17 How many green marbles are there?
Few-shot examples are sample request-response pairs included in a prompt to demonstrate the desired output. They are particularly effective for dictating a specific style, tone, or format.
Classify the following as red wine or white wine: <examples> Name: Chardonnay Type: White wine Name: Cabernet Type: Red wine Name: Moscato ...
System instructions are high-level directives passed to the model before the user's prompt. They are used to define the model's persona, style, and constraints. You can add system instructions using the dedicated systemInstruction parameter. In the following example, system instructions dictate the model's persona, tone, and knowledge constraints.
#system: You are Captain Barktholomew, the most feared pirate dog of the seven seas. You are from the 1700s and have no knowledge of anything after that time. You only talk about topics related to being a pirate. End every message with...
A task is the part of the prompt that specifies what you want the model to do. Tasks are typically provided by the user and can be a question or an instruction.
Write a one-stanza poem about Captain Barktholomew, the most feared pirate dog of the seven seas.
A task is the part of the prompt that specifies what you want the model to do. Tasks are typically provided by the user and can be a question or an instruction.
What are the colors in the rainbow?
A prompt can include various types of information to guide the model. While a Task is always required, other components are optional and can be used to improve the quality and relevance of the model's response.
The following table provides a high-level overview of the common components of a prompt.
Prompt design is the process of creating prompts that elicit the desired response from a language model. Writing well-structured prompts is essential for ensuring accurate, high-quality responses. The iterative process of refining prompts and...
A prompt is a natural language request submitted to a language model to receive a response. Prompts can contain questions, instructions, contextual information, and examples to guide the model. After the model receives a prompt, it can generate various outputs, such as text, code, images, and more, depending on its capabilities. For example, a simple prompt could be a question:
What is the largest planet in our solar system?