A FastAPI web application that converts free-form notes into structured, trackable action items. Supports both heuristic-based pattern matching and LLM-powered extraction via Ollama.
ActionItemExtractor_LLM/
├── app/
│ ├── main.py # FastAPI app entry point and startup
│ ├── db.py # SQLite database layer
│ ├── schemas.py # Pydantic request/response models
│ ├── routers/
│ │ ├── action_items.py # Action item endpoints
│ │ └── notes.py # Note endpoints
│ └── services/
│ └── extract.py # Extraction logic (heuristic + LLM)
├── frontend/
│ └── index.html # Web frontend
├── tests/
│ └── test_extract.py # Unit tests for extraction
├── requirements.txt # Python dependencies
└── data/
└── app.db # SQLite database (auto-created)
- Python 3.10+
- Ollama (for LLM extraction)
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate -
Install dependencies:
pip install -r requirements.txt -
(Optional) Set up environment variables:
cp .env.example .envEdit
.envto change the Ollama model if desired. The default isllama3.1:8b. -
Install and start Ollama, then pull a model:
ollama pull llama3.1:8bYou can use any Ollama-compatible model by updating
OLLAMA_MODELin your.envfile.
Start the development server:
uvicorn app.main:app --reload
Then open http://127.0.0.1:8000/ in your browser.
| Method | Endpoint | Description |
|---|---|---|
POST |
/notes |
Create a new note |
GET |
/notes |
List all saved notes |
GET |
/notes/{note_id} |
Get a single note by ID |
| Method | Endpoint | Description |
|---|---|---|
POST |
/action-items/extract |
Extract action items using pattern matching |
POST |
/action-items/extract-llm |
Extract action items using Ollama LLM |
GET |
/action-items |
List all action items (optional ?note_id= filter) |
POST |
/action-items/{id}/done |
Mark an action item as done or undone |
Extract action items:
POST /action-items/extract
{"text": "- Buy groceries\n- Walk the dog", "save_note": true}
Response:
{"note_id": 1, "items": [{"id": 1, "text": "Buy groceries"}, {"id": 2, "text": "Walk the dog"}]}Mark item done:
POST /action-items/3/done
{"done": true}
Response:
{"id": 3, "done": true}Run all tests:
pytest tests/test_extract.py -v
Note: The LLM tests (test_llm_*) require Ollama to be running with a model pulled. The heuristic test (test_extract_bullets_and_checkboxes) runs without any external dependencies.