Upgrade to Nano Banan 2

This commit is contained in:
Timothy Kassis
2026-03-05 10:08:17 -08:00
parent 1299970688
commit d965eb83bc
5 changed files with 49 additions and 49 deletions

View File

@@ -1,6 +1,6 @@
---
name: scientific-schematics
description: Create publication-quality scientific diagrams using Nano Banana Pro AI with smart iterative refinement. Uses Gemini 3 Pro for quality review. Only regenerates if quality is below threshold for your document type. Specialized in neural network architectures, system diagrams, flowcharts, biological pathways, and complex scientific visualizations.
description: Create publication-quality scientific diagrams using Nano Banana 2 AI with smart iterative refinement. Uses Gemini 3.1 Pro Preview for quality review. Only regenerates if quality is below threshold for your document type. Specialized in neural network architectures, system diagrams, flowcharts, biological pathways, and complex scientific visualizations.
allowed-tools: Read Write Edit Bash
license: MIT license
metadata:
@@ -11,12 +11,12 @@ metadata:
## Overview
Scientific schematics and diagrams transform complex concepts into clear visual representations for publication. **This skill uses Nano Banana Pro AI for diagram generation with Gemini 3 Pro quality review.**
Scientific schematics and diagrams transform complex concepts into clear visual representations for publication. **This skill uses Nano Banana 2 AI for diagram generation with Gemini 3.1 Pro Preview quality review.**
**How it works:**
- Describe your diagram in natural language
- Nano Banana Pro generates publication-quality images automatically
- **Gemini 3 Pro reviews quality** against document-type thresholds
- Nano Banana 2 generates publication-quality images automatically
- **Gemini 3.1 Pro Preview reviews quality** against document-type thresholds
- **Smart iteration**: Only regenerates if quality is below threshold
- Publication-ready output in minutes
- No coding, templates, or manual drawing required
@@ -34,11 +34,11 @@ Scientific schematics and diagrams transform complex concepts into clear visual
| presentation | 6.5/10 | Slides, talks |
| default | 7.5/10 | General purpose |
**Simply describe what you want, and Nano Banana Pro creates it.** All diagrams are stored in the figures/ subfolder and referenced in papers/posters.
**Simply describe what you want, and Nano Banana 2 creates it.** All diagrams are stored in the figures/ subfolder and referenced in papers/posters.
## Quick Start: Generate Any Diagram
Create any scientific diagram by simply describing it. Nano Banana Pro handles everything automatically with **smart iteration**:
Create any scientific diagram by simply describing it. Nano Banana 2 handles everything automatically with **smart iteration**:
```bash
# Generate for journal paper (highest quality threshold: 8.5/10)
@@ -55,8 +55,8 @@ python scripts/generate_schematic.py "Complex circuit diagram with op-amp, resis
```
**What happens behind the scenes:**
1. **Generation 1**: Nano Banana Pro creates initial image following scientific diagram best practices
2. **Review 1**: **Gemini 3 Pro** evaluates quality against document-type threshold
1. **Generation 1**: Nano Banana 2 creates initial image following scientific diagram best practices
2. **Review 1**: **Gemini 3.1 Pro Preview** evaluates quality against document-type threshold
3. **Decision**: If quality >= threshold → **DONE** (no more iterations needed!)
4. **If below threshold**: Improved prompt based on critique, regenerate
5. **Repeat**: Until quality meets threshold OR max iterations reached
@@ -124,7 +124,7 @@ This skill should be used when:
## How to Use This Skill
**Simply describe your diagram in natural language.** Nano Banana Pro generates it automatically:
**Simply describe your diagram in natural language.** Nano Banana 2 generates it automatically:
```bash
python scripts/generate_schematic.py "your diagram description" -o output.png
@@ -150,7 +150,7 @@ python scripts/generate_schematic.py "your diagram description" -o output.png
---
# AI Generation Mode (Nano Banana Pro + Gemini 3 Pro Review)
# AI Generation Mode (Nano Banana 2 + Gemini 3.1 Pro Preview Review)
## Smart Iterative Refinement Workflow
@@ -160,9 +160,9 @@ The AI generation system uses **smart iteration** - it only regenerates if quali
```
┌─────────────────────────────────────────────────────┐
│ 1. Generate image with Nano Banana Pro
│ 1. Generate image with Nano Banana 2
│ ↓ │
│ 2. Review quality with Gemini 3 Pro │
│ 2. Review quality with Gemini 3.1 Pro Preview
│ ↓ │
│ 3. Score >= threshold? │
│ YES → DONE! (early stop) │
@@ -180,9 +180,9 @@ Scientific diagram guidelines + User request
**Output:** `diagram_v1.png`
### Quality Review by Gemini 3 Pro
### Quality Review by Gemini 3.1 Pro Preview
Gemini 3 Pro evaluates the diagram on:
Gemini 3.1 Pro Preview evaluates the diagram on:
1. **Scientific Accuracy** (0-2 points) - Correct concepts, notation, relationships
2. **Clarity and Readability** (0-2 points) - Easy to understand, clear hierarchy
3. **Label Quality** (0-2 points) - Complete, readable, consistent labels
@@ -219,10 +219,10 @@ VERDICT: ACCEPTABLE (for poster, threshold 7.0)
### Subsequent Iterations (Only If Needed)
If quality is below threshold, the system:
1. Extracts specific issues from Gemini 3 Pro's review
1. Extracts specific issues from Gemini 3.1 Pro Preview's review
2. Enhances the prompt with improvement instructions
3. Regenerates with Nano Banana Pro
4. Reviews again with Gemini 3 Pro
3. Regenerates with Nano Banana 2
4. Reviews again with Gemini 3.1 Pro Preview
5. Repeats until threshold met or max iterations reached
### Review Log
@@ -418,7 +418,7 @@ python scripts/generate_schematic.py "complex diagram" -o diagram.png --iteratio
python scripts/generate_schematic.py "diagram" -o out.png -v
```
**Note:** The Nano Banana Pro AI generation system includes automatic quality review in its iterative refinement process. Each iteration is evaluated for scientific accuracy, clarity, and accessibility.
**Note:** The Nano Banana 2 AI generation system includes automatic quality review in its iterative refinement process. Each iteration is evaluated for scientific accuracy, clarity, and accessibility.
## Best Practices Summary

View File

@@ -1,6 +1,6 @@
# Scientific Schematics - Quick Reference
**How it works:** Describe your diagram → Nano Banana Pro generates it automatically
**How it works:** Describe your diagram → Nano Banana 2 generates it automatically
## Setup (One-Time)
@@ -15,7 +15,7 @@ echo 'export OPENROUTER_API_KEY="sk-or-v1-your_key"' >> ~/.bashrc # or ~/.zshrc
## Basic Usage
```bash
# Describe your diagram, Nano Banana Pro creates it
# Describe your diagram, Nano Banana 2 creates it
python scripts/generate_schematic.py "your diagram description" -o output.png
# That's it! Automatic:
@@ -166,7 +166,7 @@ Typical cost per diagram (max 2 iterations):
- Simple (1 iteration): $0.05-0.15
- Complex (2 iterations): $0.10-0.30
## How Nano Banana Pro Works
## How Nano Banana 2 Works
**Simply describe your diagram in natural language:**
- ✓ No coding required

View File

@@ -1,8 +1,8 @@
# Scientific Schematics - Nano Banana Pro
# Scientific Schematics - Nano Banana 2
**Generate any scientific diagram by describing it in natural language.**
Nano Banana Pro creates publication-quality diagrams automatically - no coding, no templates, no manual drawing required.
Nano Banana 2 creates publication-quality diagrams automatically - no coding, no templates, no manual drawing required.
## Quick Start
@@ -223,9 +223,9 @@ Each generation produces a JSON review log:
}
```
## Why Use Nano Banana Pro
## Why Use Nano Banana 2
**Simply describe what you want - Nano Banana Pro creates it:**
**Simply describe what you want - Nano Banana 2 creates it:**
-**Fast**: Results in minutes
-**Easy**: Natural language descriptions (no coding)
@@ -297,7 +297,7 @@ This tests:
## Cost Considerations
OpenRouter pricing for models used:
- **Nano Banana Pro**: ~$2/M input tokens, ~$12/M output tokens
- **Nano Banana 2**: ~$2/M input tokens, ~$12/M output tokens
Typical costs per diagram:
- Simple diagram (1 iteration): ~$0.05-0.15

View File

@@ -1,12 +1,12 @@
#!/usr/bin/env python3
"""
Scientific schematic generation using Nano Banana Pro.
Scientific schematic generation using Nano Banana 2.
Generate any scientific diagram by describing it in natural language.
Nano Banana Pro handles everything automatically with smart iterative refinement.
Nano Banana 2 handles everything automatically with smart iterative refinement.
Smart iteration: Only regenerates if quality is below threshold for your document type.
Quality review: Uses Gemini 3 Pro for professional scientific evaluation.
Quality review: Uses Gemini 3.1 Pro Preview for professional scientific evaluation.
Usage:
# Generate for journal paper (highest quality threshold)
@@ -34,9 +34,9 @@ def main():
epilog="""
How it works:
Simply describe your diagram in natural language
Nano Banana Pro generates it automatically with:
Nano Banana 2 generates it automatically with:
- Smart iteration (only regenerates if quality is below threshold)
- Quality review by Gemini 3 Pro
- Quality review by Gemini 3.1 Pro Preview
- Document-type aware quality thresholds
- Publication-ready output

View File

@@ -1,10 +1,10 @@
#!/usr/bin/env python3
"""
AI-powered scientific schematic generation using Nano Banana Pro.
AI-powered scientific schematic generation using Nano Banana 2.
This script uses a smart iterative refinement approach:
1. Generate initial image with Nano Banana Pro
2. AI quality review using Gemini 3 Pro for scientific critique
1. Generate initial image with Nano Banana 2
2. AI quality review using Gemini 3.1 Pro Preview for scientific critique
3. Only regenerate if quality is below threshold for document type
4. Repeat until quality meets standards (max iterations)
@@ -79,7 +79,7 @@ def _load_env_file():
class ScientificSchematicGenerator:
"""Generate scientific schematics using AI with smart iterative refinement.
Uses Gemini 3 Pro for quality review to determine if regeneration is needed.
Uses Gemini 3.1 Pro Preview for quality review to determine if regeneration is needed.
Multiple passes only occur if the generated schematic doesn't meet the
quality threshold for the target document type.
"""
@@ -171,11 +171,11 @@ IMPORTANT - NO FIGURE NUMBERS:
self.verbose = verbose
self._last_error = None # Track last error for better reporting
self.base_url = "https://openrouter.ai/api/v1"
# Nano Banana Pro - Google's advanced image generation model
# Nano Banana 2 - Google's advanced image generation model
# https://openrouter.ai/google/gemini-3-pro-image-preview
self.image_model = "google/gemini-3-pro-image-preview"
# Gemini 3 Pro for quality review - excellent vision and reasoning
self.review_model = "google/gemini-3-pro"
self.image_model = "google/gemini-3.1-flash-image-preview"
# Gemini 3.1 Pro Preview for quality review - excellent vision and reasoning
self.review_model = "google/gemini-3.1-pro-preview"
def _log(self, message: str):
"""Log message if verbose mode is enabled."""
@@ -242,7 +242,7 @@ IMPORTANT - NO FIGURE NUMBERS:
"""
Extract base64-encoded image from API response.
For Nano Banana Pro, images are returned in the 'images' field of the message,
For Nano Banana 2, images are returned in the 'images' field of the message,
not in the 'content' field.
Args:
@@ -259,7 +259,7 @@ IMPORTANT - NO FIGURE NUMBERS:
message = choices[0].get("message", {})
# IMPORTANT: Nano Banana Pro returns images in the 'images' field
# IMPORTANT: Nano Banana 2 returns images in the 'images' field
images = message.get("images", [])
if images and len(images) > 0:
self._log(f"Found {len(images)} image(s) in 'images' field")
@@ -347,7 +347,7 @@ IMPORTANT - NO FIGURE NUMBERS:
def generate_image(self, prompt: str) -> Optional[bytes]:
"""
Generate an image using Nano Banana Pro.
Generate an image using Nano Banana 2.
Args:
prompt: Description of the diagram to generate
@@ -427,9 +427,9 @@ IMPORTANT - NO FIGURE NUMBERS:
iteration: int, doc_type: str = "default",
max_iterations: int = 2) -> Tuple[str, float, bool]:
"""
Review generated image using Gemini 3 Pro for quality analysis.
Review generated image using Gemini 3.1 Pro Preview for quality analysis.
Uses Gemini 3 Pro's superior vision and reasoning capabilities to
Uses Gemini 3.1 Pro Preview's superior vision and reasoning capabilities to
evaluate the schematic quality and determine if regeneration is needed.
Args:
@@ -442,7 +442,7 @@ IMPORTANT - NO FIGURE NUMBERS:
Returns:
Tuple of (critique text, quality score 0-10, needs_improvement bool)
"""
# Use Gemini 3 Pro for review - excellent vision and analysis
# Use Gemini 3.1 Pro Preview for review - excellent vision and analysis
image_data_url = self._image_to_base64(image_path)
# Get quality threshold for this document type
@@ -518,7 +518,7 @@ If score < {threshold}, mark as NEEDS_IMPROVEMENT with specific suggestions."""
]
try:
# Use Gemini 3 Pro for high-quality review
# Use Gemini 3.1 Pro Preview for high-quality review
response = self._make_request(
model=self.review_model,
messages=messages
@@ -532,7 +532,7 @@ If score < {threshold}, mark as NEEDS_IMPROVEMENT with specific suggestions."""
message = choices[0].get("message", {})
content = message.get("content", "")
# Check reasoning field (Nano Banana Pro puts analysis here)
# Check reasoning field (Nano Banana 2 puts analysis here)
reasoning = message.get("reasoning", "")
if reasoning and not content:
content = reasoning
@@ -683,8 +683,8 @@ Generate a publication-quality scientific diagram that meets all the guidelines
f.write(image_data)
print(f"✓ Saved: {iter_path}")
# Review image using Gemini 3 Pro
print(f"Reviewing image with Gemini 3 Pro...")
# Review image using Gemini 3.1 Pro Preview
print(f"Reviewing image with Gemini 3.1 Pro Preview...")
critique, score, needs_improvement = self.review_image(
str(iter_path), user_prompt, i, doc_type, iterations
)