ADR-005: AI Framework & Model Selection
Context
The portfolio showcases a suite of complex generative AI demonstrations. These workloads require a robust foundational model that delivers advanced reasoning, exceptional schema compliance (for JSON diagram graphing), and high-context capabilities under strict enterprise-grade security perimeters and consolidated GCP billing.
Decision
Original decision (the model choice is superseded by the amendment below): standardize entirely on Google Gemini 3.5 Flash as the sole generative engine, integrated via the official `@google/genai` SDK and served from the Google Cloud Vertex AI `eu` multi-region endpoint — the newest Flash generation with EU data residency (single regions lag model releases behind; ADR-013).
Authentication is executed keylessly: the backend container runs under a GCP Service Account inheriting ambient project IAM permissions, completely eliminating static API credentials from the codebase and build assets. The client is created as `new GoogleGenAI({ vertexai: true, project, location })` with an allowlisted location; a GEMINI_API_KEY is used only for local development (or as a fallback if ADC fails). Embeddings use gemini-embedding-001 in europe-southwest1.
Amended 2026-10-06 (ADR-029): the single-model decision is replaced by a curated, allowlisted Gemini lineup — Gemini 3.8 Flash (default) and Gemini 3.5 Flash-Lite. The SDK, keyless authentication and EU endpoint routing decided here are unchanged.
Consequences
Benefits:
* Achieves sub-second inference latency for responsive interactions.
* Replaces key rotation maintenance workloads with secure, ambient IAM policies.
* Offers a massive 1-million token context window to process large document files.
* Exceptional structured JSON schema compliance, critical for generating visual diagrams and the copilot auditor reports (the FinOps cost demo is now off by default).
Alternatives considered
1. Multi-provider hybrid selector (OpenAI/Anthropic/Gemini): Rejected due to excessive secret management overhead, multiple vendor accounts, and increased container cold start libraries footprint.
2. Retaining older Gemini 2.5 Flash: Rejected as Gemini 3.5 Flash provides vastly superior multilingual support and prompt adherence at an equivalent price-performance point.
Amended (ADR-024): the Architecture Copilot later added LangGraph for multi-agent orchestration and checkpointing only — every model invocation still goes through the official @google/genai SDK. The LangChain ChatVertexAI model wrapper was evaluated for those calls and removed after endpoint-routing 404s and production timeouts on the Vertex eu multi-region endpoint.