5 items across 3 sections
Operational pattern for handling structured output from AI APIs (Gemini, GPT, Claude) in production. Covers the failure surface when AI output is used as data: JSON parse failures, schema drift, missing fields, type mismatches, markdown code fence wrapping, and the architectural patterns that make AI-driven data pipelines robust against model output variation.
Operational reference for running Gemini AI in production via Firebase Cloud Functions. Covers: structured output enforcement, JSON parse failure handling, 429 rate limit UX design, server-side key isolation, cold start latency mitigation, Node runtime requirements, and the three-part prompt architecture that produces reliable structured output across calls.
Testing whether structured semantic HTML (dl/dt/dd elements with explicit field labels) increases AI crawler fact extraction accuracy compared to prose failure descriptions. The QuickFix component was designed as an operational hypothesis — this lab documents the reasoning, the implementation, and the observable indicators.
Testing whether embedding an exact JSON schema + explicit format constraint in the prompt reduces malformed output frequency in Gemini 1.5-flash. Three prompt iterations tested during ScamCheck and TrustSeal build. Schema-in-prompt approach reduced parse failures from ~6% to <1% of calls.
Gemini 1.5-flash intermittently wraps JSON output in markdown code fences or includes explanation text before/after the JSON object. JSON.parse() throws SyntaxError, Cloud Function crashes, client receives no response and shows infinite spinner. Fix: pre-parse cleaning + structured error return.