3.3 KiB
3.3 KiB
Enabling AI Prompt Generation
The Daily Check-in system can use AI to automatically:
- Parse freeform text ("I take vitamin D every morning")
- Create structured entries (medications, vitals, exercise, etc.)
- Generate daily tracking prompts with pre-filled values
- Learn patterns from repeated entries
Current Status
✅ Code is ready and deployed ❌ Gemini API key not configured
Setup Instructions
1. Get a Gemini API Key
- Go to https://aistudio.google.com/app/apikey
- Create a new API key (free tier available)
- Copy the key
2. Configure on Staging
# On staging server (192.168.1.253)
echo "GEMINI_API_KEY=YOUR_KEY_HERE" > /tank/inou/api/anthropic.env
# Restart API service
ssh johan@192.168.1.253 "sudo systemctl restart inou-api"
# Or use the standard restart:
ssh johan@192.168.1.253 "/tank/inou/stop.sh && /tank/inou/start.sh"
3. Configure on Production
# On production server (192.168.100.2)
echo "GEMINI_API_KEY=YOUR_KEY_HERE" > /tank/inou/api/anthropic.env
# Restart API service
ssh johan@192.168.100.2 "sudo systemctl restart inou-api"
4. Verify
Check the API logs to confirm the key loaded:
ssh johan@192.168.1.253 "tail -20 /tank/inou/logs/api.log | grep -i gemini"
You should see: Gemini API key loaded.
Testing
Once configured, test by entering freeform text on the prompts page:
Test inputs:
- "I take vitamin D 5000 IU every morning"
- "Blood pressure 120/80"
- "Walked 30 minutes today"
Expected behavior:
- Entry is created immediately
- System analyzes the pattern
- If it detects a trackable pattern, it creates a new daily prompt
- You see a notification: "✓ Saved! Added new tracking prompt."
- The new prompt appears on the page for tomorrow
How It Works
Architecture
User Input → Triage (category detection) → Extraction (structure) → Create entries + prompts
Prompts
AI prompts are stored in /tank/inou/prompts/:
triage.md- Determines category (medication, vital, exercise, etc.)extract_*.md- Category-specific extraction (one per category)
Code
api/api_llm.go- Main LLM integrationapi/api_prompts.go:192-tryGeneratePromptFromFreeform()entry pointlib/llm.go- Gemini API wrapper
Cost Estimate
Gemini 1.5 Flash (used by default):
- Free tier: 15 requests/minute, 1500 requests/day
- Paid tier: $0.00001875/1K characters input, $0.000075/1K characters output
For typical use (10-20 prompts/day), free tier is sufficient.
Alternative: Claude API
The code can be adapted to use Claude instead of Gemini. Would need:
- Replace
lib.CallGemini()with Claude API calls - Update prompt formatting (Claude uses different message format)
- Set
ANTHROPIC_API_KEYinstead
Fallback Without AI
If no API key is configured:
- Freeform entries still work (saves as plain notes)
- No automatic prompt generation
- Users can manually create prompts via the UI (not yet implemented)
- Or add prompts directly to database
Next Steps
- Get API key - Start with Gemini free tier
- Test on staging - Verify prompt generation works
- Monitor usage - Check if free tier is sufficient
- Consider Claude - If Gemini isn't accurate enough
- Build manual prompt creator - Fallback for users without AI