CivicSense is an enterprise-grade, impartial AI assistant built for the Google x hack2skill Prompt Wars Hackathon. It provides verified voting information and civic guidance powered by Google Vertex AI Search Grounding.
- Full Type Safety: TypeScript 5.0+ on the frontend and strict Python 3.11 type hints on the backend.
- Google-Style Documentation: Every service and endpoint is documented with strict docstrings and JSDoc.
- Modular Architecture: Clean separation between AI services, third-party APIs, and core business logic.
- Prompt Injection Protection: Native
system_instructionintegration at the model level to prevent persona overriding. - Hardened Safety Guardrails: Strict
HarmBlockThresholdconfiguration across all Vertex AI safety categories. - Input Validation: Pydantic length constraints to prevent token-exhaustion and DoS attacks.
- Search Grounding: Integrated
GoogleSearchRetrievalto ensure real-time accuracy without redundant LLM retraining. - Intelligent Caching: Asynchronous in-memory response caching to reduce latency and API costs.
- Optimized Compute: Multi-stage Docker builds and lightweight Python base images for fast Cloud Run scaling.
- 100% CI Coverage: Automated GitHub Actions pipeline running Pytest and Jest on every commit.
- Mocked Integration: Robust mocking of Vertex AI services ensures reliable and fast CI runs without network dependencies.
- WCAG 2.1 Compliance: Implemented
aria-liveregions for dynamic content and strict ARIA labeling. - Semantic HTML: Used standard landmarks (
<main>,<section>,<footer>) to ensure compatibility with all assistive technologies.
- Vertex AI Search Grounding: Real-time fact verification for election data.
- Google Civic Information API: Official polling and election metadata source.
- Cloud Run & Firebase: Fully automated deployment configurations for the Google Cloud ecosystem.
- Frontend: Next.js 14, TypeScript, Tailwind CSS, Firebase.
- Backend: FastAPI, Python 3.11, Vertex AI SDK, Google Cloud Run.
- AI: Gemini 2.5 Flash with Native Grounding.