An AI-powered microservice designed to transform unstructured text (emails, invoices, chat logs) into strictly validated, structured data schemas.
- Schema Enforcement: Uses Pydantic V2 to ensure parsed data matches your business rules.
- Smart Parsing: Powered by GPT-4o-mini and
instructorfor high-accuracy extraction. - Input Validation: Custom Pydantic validators to catch logical errors (e.g., negative quantities).
- Production Infrastructure: Built-in Docker, Makefile, and CI/CD support.
- Python: 3.10+
- UV: Fast Python package manager
- OpenAI API Key: Required for the parsing engine
Create a .env file:
OPENAI_API_KEY=sk-...
make devAccess the interactive documentation at http://localhost:8000/docs.
Request: POST /parse-order
{
"text": "Hi, I'm John. I want to buy 3 mechanical keyboards and I need express shipping. Please leave it at the front door."
}Output:
{
"customer_name": "John",
"items": [
{
"product_name": "mechanical keyboards",
"quantity": 3
}
],
"shipping": "express",
"notes": "Please leave it at the front door."
}- Order extraction logic with Pydantic validation.
- FastAPI modularization.
- Multi-document support (Batch parsing).
- Table extraction from raw text/markdown.
- Linting:
make lint - Testing:
make test - Docker:
make up