All projects

162026AI / Backend

Document Classifier and Extractor

A FastAPI service that takes a PDF or text upload and returns validated JSON: document type, sentiment, named entities with confidence, and a summary.

Period
2026
Context
Personal Project

The problem

The useful decision here is the fallback. When no API key is present the service degrades to a deterministic local analyser rather than failing, so the endpoint contract holds either way.

What I built

  1. Extracted text from PDFs with pdfminer.six.
  2. Produced structured output through OpenRouter, validated against a fixed schema.
  3. Implemented a deterministic local analyser as a fallback when no LLM key is configured.

Stack

PythonFastAPIpdfminer.sixOpenRouterPydantic

Skills applied

  • Structured LLM output
  • Document parsing
  • Graceful degradation
  • API design