Donsir Arcilla.
  • TypeScript
  • CSS
  • JavaScript

Overview

A stateless AI reasoning engine that processes questions against PDF documents using Google Gemini 1.5 Flash. Leverages the massive 1-million-token context window for the “Combined Mind” approach, enforcing a strict retrieval-only policy with zero external knowledge.

Features

  • Strict Mode: Zero-knowledge policy - answers ONLY from provided PDF context
  • Multimodal Input: Supports both text questions and image-based questions
  • Source Citations: Every answer includes file name and page number
  • Question Type Detection: Specialized reasoning for Multiple Choice, True/False, Identification, and Long Answer
  • Structured Responses: Clean JSON output with reasoning steps and confidence scores
  • High Performance: Optimized for low latency with transient logging

Key Components

FilePurpose
app/api/brain/route.tsMain API endpoint handler
lib/brain-types.tsTypeScript type definitions
lib/brain-prompts.tsSystem prompts & context formatting
lib/brain-client.tsFrontend client utilities