A cost-effective AI-powered inventory assistant that uses Azure OpenAI (GPT-4o mini) to provide natural language interaction with Excel inventory files. Upload your spreadsheet and ask questions in plain English.
Managing inventory data trapped in Excel files is painful. Teams spend hours manually searching, filtering, and generating reports. This tool brings AI-powered natural language queries to your existing Excel inventory — no database migration required.
Cost: Less than $1/month for 1,000 daily queries using GPT-4o mini.
- Natural Language Search — Ask questions like "Show all laptops with stock below 5" instead of writing VLOOKUP formulas
- Multi-Sheet Support — Automatically reads ALL worksheet tabs and searches across them
- Inventory Analytics — Summaries, statistics, low stock detection, and duplicate identification
- Read & Write — Update existing records and add new entries through conversation
- Session Memory — Maintains conversation context within a session for follow-up questions
- Minimal Setup — Upload any
.xlsxfile and start querying immediately - Cost-Effective — Built on GPT-4o mini (~$0.001 per query)
┌──────────────┐ ┌────────────────────┐ ┌──────────────────┐
│ Browser UI │────▶│ FastAPI Backend │────▶│ Azure OpenAI │
│ (Chat) │◀────│ (Python) │◀────│ (GPT-4o mini) │
└──────────────┘ └────────┬───────────┘ └──────────────────┘
│
┌────────▼───────────┐
│ Excel Files │
│ (.xlsx via │
│ openpyxl) │
└────────────────────┘
How it works:
- User uploads an Excel file through the web UI
- The backend reads all sheets using
openpyxland caches the data - User asks a question in natural language
- Azure OpenAI determines which tool(s) to call (search, summary, update, etc.)
- The backend executes the tool against the Excel data and returns results
- Azure OpenAI formats the response in a human-readable way
- Python 3.9 or later
- An Azure OpenAI resource with GPT-4o mini deployed (Setup Guide)
# Clone the repository
git clone https://github.com/unifyservices/ai-inventory-assistant.git
cd ai-inventory-assistant
# Create virtual environment
python -m venv venv
source venv/bin/activate # macOS/Linux
# venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env with your Azure OpenAI credentials (see setup guide below)python main.pyOpen http://localhost:8000 in your browser.
Upload an Excel inventory file and try these queries:
| Query | What It Does |
|---|---|
"Show all items in category Laptop" |
Filters by category across all sheets |
"Find items with stock below 5" |
Low stock detection with threshold |
"Summarize the inventory" |
Statistics: counts, ranges, top values per column |
"Find duplicate entries by item name" |
Identifies duplicate records |
"Update row 5 status to Retired" |
Updates a specific cell (with confirmation) |
"Add a new item: Keyboard, Peripherals, qty 50" |
Appends a new row to the spreadsheet |
"Search for SHDPC0165 across all sheets" |
Cross-sheet search by any value |
"What columns are available?" |
Lists all column headers across sheets |
- Go to Azure Portal
- Search for "Azure OpenAI" → Click Create
- Configure:
- Resource group: Create new or select existing
- Region: East US (or nearest region with GPT-4o mini availability)
- Name: Choose a unique name (e.g.,
my-inventory-openai) - Pricing tier: Standard S0
- Click Review + Create → Create
- Go to your Azure OpenAI resource
- Click Go to Azure OpenAI Studio (or visit oai.azure.com)
- Navigate to Deployments → Create new deployment
- Select:
- Model:
gpt-4o-mini - Deployment name:
gpt-4o-mini - Tokens per Minute: Start with 10K TPM
- Model:
- Click Create
- In Azure Portal → Your Azure OpenAI resource → Keys and Endpoint
- Copy Endpoint and Key 1
- Update your
.envfile:
AZURE_OPENAI_ENDPOINT=https://your-resource-name.openai.azure.com/
AZURE_OPENAI_API_KEY=your-api-key-here
AZURE_OPENAI_DEPLOYMENT=gpt-4o-mini
AZURE_OPENAI_API_VERSION=2024-10-21ai-inventory-assistant/
├── main.py # FastAPI server — API endpoints for chat, upload, file listing
├── config.py # Environment variable loading
├── requirements.txt # Python dependencies
├── .env.example # Configuration template (safe to commit)
├── .gitignore # Excludes .env, data files, virtual environment
├── LICENSE # Apache 2.0
├── inventory/
│ ├── __init__.py
│ ├── ai_agent.py # Azure OpenAI agent with function calling (tools)
│ └── excel_handler.py # Excel read/write operations via openpyxl
├── static/
│ └── index.html # Chat UI (vanilla HTML/CSS/JS — no framework)
├── data/ # Excel files uploaded by users (gitignored)
└── docs/
└── images/ # Screenshots and diagrams
Built on GPT-4o mini for minimal cost:
| Usage Level | Input Tokens | Output Tokens | Monthly Cost |
|---|---|---|---|
| Light (100 queries/day) | ~$0.015/day | ~$0.06/day | ~$2.25 |
| Medium (500 queries/day) | ~$0.075/day | ~$0.30/day | ~$11.25 |
| Heavy (1000 queries/day) | ~$0.15/day | ~$0.60/day | ~$22.50 |
A single inventory query typically costs less than $0.001.
| Method | Endpoint | Description |
|---|---|---|
POST |
/chat |
Send a message to the AI assistant |
POST |
/upload |
Upload an Excel file (.xlsx/.xls) |
GET |
/files |
List available Excel files |
GET |
/ |
Serve the web UI |
{
"message": "Show all items with quantity below 10",
"session_id": "optional-session-id",
"filename": "optional-specific-file.xlsx"
}{
"reply": "I found 5 items with quantity below 10...",
"session_id": "generated-session-id"
}| Variable | Required | Default | Description |
|---|---|---|---|
AZURE_OPENAI_ENDPOINT |
Yes | — | Azure OpenAI endpoint URL |
AZURE_OPENAI_API_KEY |
Yes | — | Azure OpenAI API key |
AZURE_OPENAI_DEPLOYMENT |
No | gpt-4o-mini |
Deployment name |
AZURE_OPENAI_API_VERSION |
No | 2024-10-21 |
API version |
- Never commit
.envfiles — The.gitignoreexcludes them by default - API keys — Store in Azure Key Vault for production deployments
- Data files — Uploaded Excel files are stored locally in
/data/(also gitignored) - No authentication — This is a local development tool. Add authentication before exposing to a network.
Contributions are welcome! Please read our CONTRIBUTING.md before submitting a pull request.
- Fork the repository
- Create a feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -m 'Add: your feature description') - Push to the branch (
git push origin feature/your-feature) - Open a Pull Request
This project is licensed under the Apache 2.0 License — see the LICENSE file for details.
Built by the Cloud Consulting team at Unify Services — specializing in Azure architecture, Microsoft 365, cloud security, and FinOps.
Need help with Azure AI integration or cloud automation? Connect on LinkedIn | Visit our website
