Skills › Scientific Agent Skills › scientific-schematics › example_usage.sh
example_usage.sh
92 lines · skills/scientific-schematics/scripts/example_usage.sh at 5f2bc03
1#!/bin/bash
2# Example usage of AI-powered scientific schematic generation
3#
4# Prerequisites:
5# 1. Set OPENROUTER_API_KEY environment variable
6# 2. Ensure Python 3.10+ is installed
7# 3. Install requests: uv pip install requests
9set -e
11echo "=========================================="
12echo "Scientific Schematics - AI Generation"
13echo "Example Usage Demonstrations"
14echo "=========================================="
15echo ""
16echo "This runs three real generations against OpenRouter and will be billed"
17echo "to your account: 2 API calls per iteration, up to 4 per example."
18echo ""
20# Check for API key
21if [ -z "$OPENROUTER_API_KEY" ]; then
22 echo "[FAIL] Error: OPENROUTER_API_KEY environment variable not set"
23 echo ""
24 echo "Get an API key at: https://openrouter.ai/keys"
25 echo "Then set it with: export OPENROUTER_API_KEY='your_key'"
26 exit 1
27fi
29echo "[OK] OPENROUTER_API_KEY is set"
30echo ""
32# Create output directory
33mkdir -p figures
34echo "[OK] Created figures/ directory"
35echo ""
37# Example 1: Simple flowchart
38echo "Example 1: CONSORT Flowchart"
39echo "----------------------------"
40python scripts/generate_schematic.py \
41 "CONSORT participant flow diagram. Assessed for eligibility (n=500). Excluded (n=150) with reasons: age<18 (n=80), declined (n=50), other (n=20). Randomized (n=350) into Treatment (n=175) and Control (n=175). Received allocated intervention: 175 and 175; did not receive: 0 and 0. Discontinued intervention: 0 and 0. Lost to follow-up for primary outcome: 15 and 10 (outcome visit not attended). Analyzed for primary outcome: 160 and 165; excluded due to missing primary outcome: 15 and 10. This is an illustrative complete-case analysis, not an intention-to-treat analysis." \
42 -o figures/consort_example.png \
43 --iterations 2
45echo ""
46echo "[OK] Generated: figures/consort_example.png"
47echo " - Also created: consort_example_v1.png (and v2.png if it needed a second pass)"
48echo " - Review log: consort_example_review_log.json"
49echo ""
51# Example 2: Neural network (shorter for demo)
52echo "Example 2: Simple Neural Network"
53echo "--------------------------------"
54python scripts/generate_schematic.py \
55 "Simple feedforward neural network diagram. Input layer with 4 nodes, hidden layer with 6 nodes, output layer with 2 nodes. Show all connections. Label layers clearly." \
56 -o figures/neural_net_example.png \
57 --iterations 2
59echo ""
60echo "[OK] Generated: figures/neural_net_example.png"
61echo ""
63# Example 3: Biological pathway (minimal)
64echo "Example 3: Signaling Pathway"
65echo "---------------------------"
66python scripts/generate_schematic.py \
67 "Simple signaling pathway: Receptor -> Kinase A -> Kinase B -> Transcription Factor -> Gene. Show arrows with 'activation' labels. Use different colors for each component." \
68 -o figures/pathway_example.png \
69 --iterations 2
71echo ""
72echo "[OK] Generated: figures/pathway_example.png"
73echo ""
75echo "=========================================="
76echo "All examples completed successfully!"
77echo "=========================================="
78echo ""
79echo "Generated files in figures/:"
80ls -lh figures/*example*.png 2>/dev/null || echo " (Files will appear after running with valid API key)"
81echo ""
82echo "Review the review_log.json files to see:"
83echo " - Quality scores for each iteration"
84echo " - Detailed critiques and suggestions"
85echo " - Improvement progression"
86echo ""
87echo "Next steps:"
88echo " 1. View the generated images"
89echo " 2. Review the quality scores in *_review_log.json"
90echo " 3. Try your own prompts!"
91echo ""