A minimalist command-line knowledge system with semantic memory capabilities using vector embeddings for information retrieval.
- Semantic Memory: Store and retrieve information using vector embeddings
- Fast Similarity Search: Powered by FAISS for efficient vector similarity matching
- Persistent Storage: Knowledge is stored in SQLite for persistence between sessions
- Efficient Caching: Embedding caching to improve performance
- Minimal UI: Simple command-line interface
- This project was developed with the help of AI tools (e.g., GitHub Copilot, Cursor) for code suggestions, debugging, and optimizations.
- Python 3.8 or higher
- Clone the repository:
git clone https://github.com/allemandi/vector-knowledge-base.git
cd vector-knowledge-base- Create and activate a virtual environment:
# Create a virtual environment
python -m venv venv
# Note: On some systems, try python3 instead to explicitly use Python 3.
# Activate on Windows
venv\Scripts\activate
# Activate on macOS/Linux
source venv/bin/activate- Install dependencies:
pip install -r requirements.txtRun the knowledge base:
python main.pyUse Commands.
Remember to run the following to leave the Python virtual environment.
deactivate- Remember [text] - Store information in the knowledge base
- Forget [text] - Remove specific information
- Forget - Remove the previously returned information
- Threshold [0-1] - Set similarity threshold (0.0-1.0) to control recall precision
- Exit - Quit the program
- Any other text - Query the knowledge base (the system will search for relevant information)
- Embeddings: Text is converted to vector embeddings using SentenceTransformers
- Vector Search: When you enter a query, it's converted to an embedding and compared to stored knowledge
- Similarity Matching: The most similar piece of information is returned if it exceeds the similarity threshold
- Knowledge Management: You can add, remove, and manage stored information
main.py- Command-line interfaceknowledge_base.py- Core knowledge base functionalitymemory.py- Vector storage and retrieval with SQLite persistenceembeddings.py- Text to vector embedding conversionmodels.py- Data models for the application
- sentence-transformers - Text embedding generation
- FAISS - Vector similarity search
- orjson - Fast JSON serialization
- SQLite - Persistent storage
MIT