A semantic search system for personal notes using FAISS and sentence transformers.
After refactoring, the project has been organized into a cleaner structure:
notes_core/__init__.py
- Contains all core functionality:NotesCore
class - Main class for notes management, indexing, and queryingNote
model - Database model for notes
- Simple command-line interface that directly initializes and uses
NotesCore
- Handles argument parsing and high-level script entry
- No core logic - just CLI orchestration
config.py
- Configuration settingsapi.py
- FastAPI web interface (unchanged)notes.json
- Sample notes datarequirements.txt
- Python dependencies
# Load notes from JSON to database
python notes_manager.py --load
# Build semantic search index
python notes_manager.py --build-index
# Query notes (interactive mode)
python notes_manager.py
# Query notes with specific query
python notes_manager.py --query "when is my flight"
# Query with custom number of results
python notes_manager.py --query "meeting" --k 3
from notes_core import NotesCore
# Initialize core functionality
core = NotesCore()
# Load notes
core.load_notes_to_db()
# Build index
core.build_index()
# Search notes
results = core.search_notes("your query", k=5)
# Format results
formatted = core.format_results("your query", results)
- Single Source of Truth: All core logic is now in
notes_core/__init__.py
- No Duplication: Logic is not duplicated between CLI and individual scripts
- Clean Separation: CLI wrapper only handles argument parsing and orchestration
- Direct Usage: CLI directly uses the NotesCore object without wrapper functions
- Programmatic Access: Easy to use the core functionality in other Python code
- Maintainability: Changes only need to be made in one place
Install required packages:
pip install -r requirements.txt