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
- Extracted text from PDFs with pdfminer.six.
- Produced structured output through OpenRouter, validated against a fixed schema.
- 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