Gemini Cheat Sheet
title: Gemini date: 2024-12-09 10:00:00 background: bg-[#4285F4] tags: - AI - Google - Prompts - Multimodal categories: - AI intro: Google Gemini AI assistant cheat sheet covering prompts, features, extensions, and best practices for daily productivity plugins: - copyCode
Overview
Model Versions
| Model | Features | Best For |
|---|---|---|
| Gemini 2.0 Flash | Fast, multimodal | Daily tasks, quick queries |
| Gemini 1.5 Pro | Long context (1M tokens) | Document analysis, coding |
| Gemini Ultra | Most capable | Complex reasoning |
Key Capabilities
- Text generation and editing
- Code writing and debugging
- Image understanding and generation
- Document and PDF analysis
- Google Workspace integration
- Real-time web search
- YouTube video summarization
Access Methods
- gemini.google.com - Web interface
- Gemini App - Mobile (iOS/Android)
- Google AI Studio - Developer playground
- Vertex AI - Enterprise API
Prompt Basics {.cols-2}
Prompt Structure
[Context] [Task] [Format] [Constraints]
Example
You are a marketing expert.
Write 5 Instagram caption ideas for a coffee shop.
Use emojis and include hashtags.
Keep each under 150 characters.
Role Assignment
Act as a [role] with expertise in [domain].
Your task is to [specific task].
Output Formatting
Respond in the following format:
- Summary: (2-3 sentences)
- Key Points: (bullet list)
- Recommendation: (1 paragraph)
Google Extensions {.cols-2}
Available Extensions
| Extension | Function |
|---|---|
| Google Flights | Search flights |
| Google Hotels | Find accommodations |
| Google Maps | Location info, directions |
| YouTube | Video summaries |
| Google Workspace | Docs, Gmail, Drive |
Using Extensions
Flights Search
@Google Flights Find flights from Sydney to Tokyo
next month, round trip, economy class
Hotel Search
@Google Hotels Find hotels in Melbourne CBD
for 2 nights, under $200/night, with pool
YouTube Summary
@YouTube Summarize this video:
[paste YouTube URL]
Workspace Integration
Gmail Search
@Gmail Find emails from John about the project
proposal from last week
Docs Summary
@Google Docs Summarize the main points from
my document "Q4 Marketing Plan"
Drive Search
@Google Drive Find spreadsheets related to
budget planning from this year
Prompting Techniques
Zero-Shot
Direct question without examples
What are the main differences between
REST and GraphQL APIs?
Few-Shot
Provide examples for pattern learning
Convert to formal language:
Casual: "Hey, can you help me out?"
Formal: "Would you be able to assist me?"
Casual: "That's awesome!"
Formal: "That is excellent."
Casual: "gonna grab some food"
Formal:
Chain of Thought
Step-by-step reasoning
Solve this problem step by step:
A store has 150 items. They sell 30% on Monday,
then receive 50 new items on Tuesday.
How many items do they have now?
Think through each step before answering.
Self-Consistency
Multiple reasoning paths
Analyze this business decision using three
different frameworks:
1. SWOT Analysis
2. Cost-Benefit Analysis
3. Risk Assessment
Then provide a unified recommendation.
Writing Prompts {.cols-2}
Content Creation
Blog Post
Write a blog post about [topic]:
- Target audience: [audience]
- Tone: [casual/professional/technical]
- Length: approximately [X] words
- Include: introduction, main points, conclusion
- Add a compelling headline
Social Media
Create [number] social media posts about [topic]:
- Platform: [Instagram/Twitter/LinkedIn]
- Include relevant hashtags
- Add call-to-action
- Keep within character limits
Email Writing
Professional Email
Write a professional email:
- Purpose: [meeting request/follow-up/inquiry]
- Recipient: [role/relationship]
- Key points to cover: [list]
- Tone: [formal/friendly professional]
- Include subject line
Editing & Rewriting
Improve this text:
- Fix grammar and spelling
- Improve clarity and flow
- Maintain the original meaning
- Make it more engaging
Original: [paste text]
Code Prompts {.cols-2}
Code Generation
Write a [language] function that:
- Input: [description]
- Output: [description]
- Requirements: [list requirements]
- Include error handling
- Add comments explaining the logic
Code Review
Review this code for:
1. Bugs and errors
2. Security vulnerabilities
3. Performance issues
4. Best practices
5. Readability improvements
```[language]
[paste code]
### Debugging
Debug this code:
[paste code]
Error message: [paste error] Expected behavior: [describe] Actual behavior: [describe]
### Code Explanation
Explain this code in simple terms:
- What does it do?
- How does it work step by step?
- What are the key concepts used?
[paste code]
## Analysis Prompts {.cols-2}
### Data Analysis
Analyze this data: [paste data or describe dataset]
Provide:
- Summary statistics
- Key patterns and trends
- Notable outliers
- Actionable insights
- Visualization suggestions
### Document Analysis
Analyze this document and provide:
- Executive summary (3-5 sentences)
- Key findings
- Important dates/numbers
- Action items
- Questions that need clarification
[paste document or upload]
### Comparative Analysis
Compare [Option A] vs [Option B]:
- Key similarities
- Key differences
- Pros and cons of each
- Recommendation based on [criteria]
## Image Prompts
### Image Understanding
Analyze this image:
- Describe what you see in detail
- Identify any text
- Note colors, composition, style
- Suggest potential uses
### Image Generation (Imagen)
Generate an image of: [detailed description]
Style: [photorealistic/illustration/cartoon] Mood: [bright/dark/professional] Colors: [color palette] Composition: [layout description]
### Visual Content Ideas
Based on this image, suggest:
- 5 social media caption ideas
- Related content themes
- Color palettes to match
- Similar visual styles to explore
## Productivity Prompts {.cols-2}
### Meeting Preparation
Help me prepare for a meeting about [topic]:
- Key talking points
- Potential questions to expect
- Data points to reference
- Agenda suggestion
- Follow-up action items template
### Research Assistant
Research [topic] and provide:
- Overview (2-3 paragraphs)
- Key facts and statistics
- Recent developments
- Different perspectives
- Reliable sources to explore further
### Learning Helper
Teach me about [topic]:
- Explain core concepts simply
- Use real-world analogies
- Provide practical examples
- Common misconceptions
- Practice questions to test understanding
### Project Planning
Create a project plan for [project]:
- Project phases and milestones
- Task breakdown
- Time estimates
- Resource requirements
- Risk factors and mitigation
## API Usage
### Python SDK
```python
import google.generativeai as genai
genai.configure(api_key="YOUR_API_KEY")
model = genai.GenerativeModel('gemini-1.5-pro')
response = model.generate_content("Hello!")
print(response.text)
With System Instruction
model = genai.GenerativeModel(
'gemini-1.5-pro',
system_instruction="You are a helpful coding assistant."
)
response = model.generate_content("Review my code")
Multi-Turn Chat
chat = model.start_chat(history=[])
response = chat.send_message("Hi, I need help with Python")
print(response.text)
response = chat.send_message("How do I read a file?")
print(response.text)
Image Input
import PIL.Image
image = PIL.Image.open('image.jpg')
response = model.generate_content([
"Describe this image in detail",
image
])
print(response.text)
Streaming
response = model.generate_content(
"Write a story",
stream=True
)
for chunk in response:
print(chunk.text, end="")
Gemini Advanced Features
Long Context
Process up to 1 million tokens
Analyze this entire codebase/document:
[paste large content]
Identify:
- Overall structure
- Key components
- Dependencies
- Potential issues
Multimodal Input
Combine text, images, and documents
Look at this [image/document] and:
1. Summarize the content
2. Extract key information
3. Answer specific questions about it
4. Suggest improvements
Code Execution
Run Python code in responses
Calculate and show the result:
- Process this data: [data]
- Create a visualization
- Export the results
Keyboard Shortcuts
Web Interface
| Shortcut | Action |
|---|---|
Enter | Send message |
Shift + Enter | New line |
Ctrl + / | Show shortcuts |
Ctrl + Shift + C | Copy response |
Best Practices
Do's
- Be specific and detailed
- Provide context and examples
- Use structured formatting
- Break complex tasks into steps
- Iterate and refine prompts
- Verify important information
Don'ts
- Share sensitive/personal data
- Rely solely on AI for critical decisions
- Use vague or ambiguous language
- Expect perfect accuracy
- Skip verification of facts
Tips for Better Results
1. Start with clear objectives
2. Provide relevant context
3. Specify desired format
4. Include constraints
5. Ask follow-up questions
6. Request explanations when needed