A procurement request management system with AI-powered document extraction and commodity classification.
| Feature | Description |
|---|---|
| PDF/TXT Upload | Drop vendor offers (PDF or plain text) for automatic data extraction |
| AI Classification | Semantic embedding-based commodity group suggestions |
| Auto Submission | Optional: automatically submit extracted requests |
| AI Validation | Optional: AI-powered explanation of extraction discrepancies |
| Status Tracking | Full lifecycle: Open → In Progress → Closed |
| VAT Validation | German, EU, and international VAT ID format validation |
| Layer | Technology |
|---|---|
| Frontend | Next.js 14, shadcn/ui, Tailwind CSS, Zod |
| Backend | FastAPI, LangGraph, SQLModel, Pydantic |
| Database | SQLite |
| AI/ML | OpenAI GPT-4o or Google Gemini (extraction), sentence-transformers (classification) |
| Deployment | Docker, Docker Compose |
Prerequisites: Docker, Docker Compose, OpenAI API key
# Clone and enter directory
git clone <repository-url>
cd lio_usecase1
# Create environment file
cp .env.example .env
# Edit .env and add your OPENAI_API_KEY
# Build and run
docker-compose up --build| Service | URL |
|---|---|
| Frontend | http://localhost:3000 |
| Backend API | http://localhost:8000 |
| API Docs | http://localhost:8000/docs |
cd backend
# Create virtual environment with uv
uv venv
source .venv/bin/activate
# Install dependencies
uv pip install -e ".[dev]"
# Generate embeddings (first time only)
python scripts/generate_embeddings.py
# Start server
uvicorn app.main:app --reloadcd frontend
# Install dependencies
npm install
# Start dev server
npm run devlio_usecase1/
├── backend/
│ ├── app/
│ │ ├── api/routes/ # REST endpoints
│ │ ├── core/ # Config, VAT validation
│ │ ├── db/ # Database, seeding
│ │ ├── models/ # SQLModel & Pydantic schemas
│ │ └── services/
│ │ ├── classification/ # Embedding-based classification
│ │ └── extraction/ # LangGraph pipeline, LLM providers
│ ├── data/ # Embeddings, SQLite DB
│ ├── scripts/ # generate_embeddings.py
│ └── tests/
├── frontend/
│ ├── src/
│ │ ├── app/ # Next.js pages
│ │ ├── components/ # React components
│ │ └── lib/ # API client
│ └── Dockerfile
├── docker-compose.yml
└── .env.example
graph LR
A[Upload PDF/TXT] --> B[LLM Extraction]
B --> C[Commodity Classification]
C --> D[Merge Results]
D --> E{AI Validation?}
E -->|enabled| F[Validate & Explain]
E -->|disabled| G[Return Response]
F --> G
The extraction pipeline uses LangGraph to orchestrate:
- LLM Extraction — GPT-4o Vision (PDF) or Gemini (native PDF) extracts vendor info and order lines
- Classification — sentence-transformers embeddings match to 50 predefined commodity groups
- AI Validation — optional: explains discrepancies when totals don't match
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/extract |
Upload document, extract data |
| GET | /api/requests |
List all requests |
| POST | /api/requests |
Create request |
| GET | /api/requests/{id} |
Get request details |
| PATCH | /api/requests/{id} |
Update request |
| DELETE | /api/requests/{id} |
Delete request |
| GET | /api/commodity-groups |
List commodity groups |
| POST | /api/commodity-groups/classify |
Classify text |
cd backend
pytestFrontend build fails with npm error
cd frontend && npm install && cd ..Frontend shows "Failed to fetch"
Ensure backend is running at http://localhost:8000.