A local-first personal knowledge base application that integrates document management, vector embedding, and AI-powered Q&A capabilities.
- Document Management: Upload, categorize, and organize documents in a multi-level folder structure
- Google Drive Sync: Automatically sync documents with Google Drive for backup and accessibility
- Vector Search: Convert documents into semantic vectors for efficient retrieval
- AI Question Answering: Ask questions about your documents in natural language
- Privacy-First: Run locally with your own models, keeping your data private
- Python 3.10+
- Docker (optional, for running Ollama)
- Google account (for Drive integration)
- Clone this repository
git clone https://github.com/yourusername/personal-knowledge-base.git
cd personal-knowledge-base- Create a virtual environment
python -m venv venv_kbs
source venv_kbs/bin/activate # On Windows: venv_kbs\Scripts\activate- Install dependencies
pip install -r requirements.txt-
Set up Google Drive API
- Create a project in Google Cloud Console
- Enable Google Drive API
- Create OAuth 2.0 credentials
- Download the credentials as
client_secret.jsonand place in the project root
-
Configure environment variables by copying the example
cp .env.example .env- Set up Ollama (for local LLM)
- Install Ollama or use the Docker configuration
- Pull required models:
ollama pull mistral:7b-instruct
ollama pull bge-m3:latestOption 1: Local Development
streamlit run main.pyOption 2: Using Docker
docker-compose up -dEdit the .env file to customize your setup:
OLLAMA_URL: URL for your Ollama instance (default: http://localhost:11434)DRIVE_FOLDER_ID: Google Drive folder ID for document storageVECTOR_DRIVE_FOLDER_ID: Google Drive folder ID for vector database backupUSE_WEB_SEARCH: Enable/disable web search for question answering
- Frontend: Streamlit-based UI for interaction
- Document Processing: Converts documents to vectors using embedding models
- Vector Database: ChromaDB for efficient semantic search
- LLM Integration: Local Ollama models (default: Mistral 7B)
- Storage: Local files with Google Drive synchronization
- Push your code to GitHub
- Connect your repository in Streamlit Cloud
- Configure the following secrets in Streamlit Cloud:
google_creds: Content of your Google credentials JSON file- Add any additional environment variables from your
.envfile
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
knowledge-base-assistant/
├── components/ # UI components
├── core/ # Core business logic
├── services/ # External services integration
├── utils/ # Utility functions
└── data_base/ # Knowledge base storage
- Python 3.10+
- Streamlit
- LangChain
- (Optional) Ollama for local AI models
- Files are stored in categorized folders
- Supports multiple document formats
- Web search is optional and can be enabled/disabled
- All chat history is session-based and not persisted