An intelligent assistant that transforms how you interact with SharePoint content through natural language conversations. Simply ask questions about your documents, and get instant, contextual answers powered by advanced AI.
Transform your SharePoint experience with conversational AI that understands your content:
- Natural Conversations: Ask questions about your SharePoint documents in plain English
- Smart Document Discovery: Find relevant files across your SharePoint sites effortlessly
- Instant Previews: View and analyze PDF, Word, and Excel files without leaving the chat
- Contextual Answers: Get precise responses based on your actual document content
Built for reliability with enterprise-grade security, comprehensive error handling, and production-ready architecture that scales with your organization's needs.
sharepoint-ai-assistant/
βββ src/ # Main application source code
β βββ core/ # Core functionality and configuration
β β βββ __init__.py
β β βββ config.py # Configuration management
β β βββ constants.py # Application constants
β β βββ exceptions.py # Custom exception classes
β β βββ logging_config.py # Logging configuration
β βββ clients/ # External service clients
β β βββ __init__.py
β β βββ sharepoint_client.py # Enhanced SharePoint client
β βββ services/ # Business logic services
β β βββ __init__.py
β β βββ llm_service.py # LLM service with error handling
β βββ utils/ # Utility functions
β β βββ __init__.py
β β βββ validation.py # Input validation and security
β β βββ file_utils.py # File processing utilities
β βββ ui/ # User interface
β βββ __init__.py
β βββ main.py # Enhanced Streamlit UI
βββ tests/ # Test suite
β βββ unit/ # Unit tests
β β βββ test_validation.py # Validation tests
β βββ integration/ # Integration tests
βββ requirements/ # Dependency management
β βββ base.txt # Base requirements
β βββ dev.txt # Development requirements
βββ logs/ # Application logs
βββ data/ # Data directory
βββ main.py # Application entry point
βββ Dockerfile # Enhanced Docker configuration
βββ docker-compose.yml # Docker Compose setup
βββ README.md # This file
- Python 3.11 (required)
- Git
- Ollama (for local LLM support)
- Docker (optional, for containerized deployment)
# 1. Clone and navigate to the project
git clone https://github.com/urdiales/sharepoint-ai-assistant.git
cd sharepoint-ai-assistant
# 2. Create Python 3.11 virtual environment
python3.11 -m venv venv
# 3. Activate environment and install dependencies
# Windows:
venv\Scripts\activate && pip install -r requirements/dev.txt
# macOS/Linux:
source venv/bin/activate && pip install -r requirements/dev.txt
# 4. Set up configuration
cp .env.example .env
# Edit .env with your SharePoint credentials
# 5. Run the application
streamlit run main.pyFor the easiest setup experience, use our interactive setup script:
# Clone the repository
git clone https://github.com/urdiales/sharepoint-ai-assistant.git
cd sharepoint-ai-assistant
# Run the setup script
python setup.pyThe script will:
- β Check your Python version
- π Detect available environment managers (Conda, UV, venv)
- π Guide you through setup options
- βοΈ Create your environment automatically
- π Copy configuration files
Step 1: Install Anaconda/Miniconda
- Download from anaconda.com or miniconda
Step 2: Create and activate environment
# Clone the repository
git clone https://github.com/urdiales/sharepoint-ai-assistant.git
cd sharepoint-ai-assistant
# Create environment with Python 3.11
conda create -n sharepoint-ai python=3.11 -y
conda activate sharepoint-ai
# Install dependencies
pip install -r requirements/dev.txt
# Set up environment variables
cp .env.example .env
# Edit .env with your configuration
# Run the application
streamlit run main.pyStep 1: Install UV
# On Windows (PowerShell)
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# On macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | shStep 2: Set up project
# Clone the repository
git clone https://github.com/urdiales/sharepoint-ai-assistant.git
cd sharepoint-ai-assistant
# Create virtual environment with Python 3.11
uv venv --python 3.11
# Activate environment
# On Windows:
.venv\Scripts\activate
# On macOS/Linux:
source .venv/bin/activate
# Install dependencies (lightning fast!)
uv pip install -r requirements/dev.txt
# Set up environment variables
cp .env.example .env
# Edit .env with your configuration
# Run the application
streamlit run main.pyStep 1: Verify Python 3.11
python3.11 --version # Should show Python 3.11.x
# If not available, install Python 3.11 from python.orgStep 2: Set up project
# Clone the repository
git clone https://github.com/urdiales/sharepoint-ai-assistant.git
cd sharepoint-ai-assistant
# Create virtual environment
python3.11 -m venv venv
# Activate environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
# Upgrade pip and install dependencies
pip install --upgrade pip
pip install -r requirements/dev.txt
# Set up environment variables
cp .env.example .env
# Edit .env with your configuration
# Run the application
streamlit run main.pyAfter setup, verify everything works:
# Check Python version
python --version # Should show Python 3.11.x
# Test import of key dependencies
python -c "import streamlit, pandas, langchain; print('β
All dependencies installed successfully!')"
# Check if Streamlit runs
streamlit hello # Should open Streamlit demo in browserCommon Issues:
-
Python 3.11 not found
- Install from python.org
- On Ubuntu:
sudo apt install python3.11 python3.11-venv - On macOS with Homebrew:
brew install python@3.11
-
Permission errors on Windows
- Run terminal as Administrator
- Or use:
python -m pip install --user -r requirements/dev.txt
-
Conda environment conflicts
- Remove existing environment:
conda env remove -n sharepoint-ai - Create fresh environment
- Remove existing environment:
-
UV installation issues
- Check UV documentation for platform-specific instructions
- Alternative: Use pip in virtual environment
-
Build the Docker image
docker build -t sharepoint-ai-assistant . -
Run with Docker Compose
docker-compose up -d
Create a .env file in the root directory:
# SharePoint Configuration
SHAREPOINT_SITE_URL=https://yourcompany.sharepoint.com/sites/yoursite
SHAREPOINT_CLIENT_ID=your-client-id
SHAREPOINT_CLIENT_SECRET=your-client-secret
# LLM Configuration
LLM_MODEL=llama2
LLM_HOST=http://localhost:11434
LLM_TEMPERATURE=0.7
LLM_MAX_TOKENS=2048
LLM_TIMEOUT=30
# Logging Configuration
LOG_LEVEL=INFO
LOG_FORMAT=json
LOG_FILE=logs/app.log
# Security Configuration
ENABLE_RATE_LIMITING=true
MAX_REQUESTS_PER_MINUTE=60-
Register an app in Azure AD
- Go to Azure Portal > App registrations
- Create a new registration
- Note the Application (client) ID
-
Configure API permissions
- Add SharePoint permissions:
Sites.Read.AllSites.ReadWrite.All(if write access needed)
- Add SharePoint permissions:
-
Create client secret
- Go to Certificates & secrets
- Create a new client secret
- Copy the secret value
pytest tests/unit/ -vpytest tests/ --cov=src --cov-report=htmlpytest tests/unit/test_validation.py -v- DEBUG: Detailed diagnostic information
- INFO: General application flow
- WARNING: Potentially harmful situations
- ERROR: Error events that allow application to continue
- CRITICAL: Serious errors that may abort the program
- Console: Real-time logging output
- File:
logs/app.log(configurable) - Structured: JSON format for log aggregation
The application includes built-in performance monitoring:
- Function execution times
- Memory usage tracking
- API response times
- Error rate monitoring
- XSS protection with HTML sanitization
- SQL injection prevention
- File type validation
- Size limit enforcement
- Secure credential handling
- Environment-based configuration
- No hardcoded secrets
- Configurable request limits
- Protection against abuse
- Graceful degradation
- Environment variables configured
- SharePoint app registered and permissions granted
- Ollama service running (for local LLM)
- Log directory writable
- Health checks configured
- Monitoring set up
# Build production image
docker build -t sharepoint-ai-assistant:latest .
# Run with production settings
docker run -d \
--name sharepoint-ai-assistant \
-p 8501:8501 \
--env-file .env \
-v $(pwd)/logs:/app/logs \
sharepoint-ai-assistant:latestapiVersion: apps/v1
kind: Deployment
metadata:
name: sharepoint-ai-assistant
spec:
replicas: 3
selector:
matchLabels:
app: sharepoint-ai-assistant
template:
metadata:
labels:
app: sharepoint-ai-assistant
spec:
containers:
- name: app
image: sharepoint-ai-assistant:latest
ports:
- containerPort: 8501
env:
- name: SHAREPOINT_SITE_URL
valueFrom:
secretKeyRef:
name: sharepoint-secrets
key: site-url
# Add other environment variables-
SharePoint Connection Failed
- Verify client ID and secret
- Check app permissions in Azure AD
- Ensure site URL is correct
-
LLM Service Unavailable
- Verify Ollama is running
- Check model is downloaded
- Verify host URL and port
-
File Preview Errors
- Check file size limits
- Verify file type is supported
- Ensure sufficient memory
Enable debug logging:
export LOG_LEVEL=DEBUG
streamlit run main.pyThe application provides health check endpoints:
- Streamlit Health:
http://localhost:8501/_stcore/health - Application Status: Check logs for service status
- Fork the repository
- Create a feature branch
- Make changes with tests
- Run the test suite
- Submit a pull request
- Python: Follow PEP 8
- Type Hints: Use type annotations
- Documentation: Docstrings for all functions
- Testing: Unit tests for new features
- Logging: Appropriate log levels
pip install pre-commit
pre-commit installThis project is licensed under the MIT License - see the LICENSE file for details.
Report issues on GitHub Issues
- Multi-tenant support
- Advanced search with filters
- Document summarization
- Workflow automation
- Mobile-responsive UI
- API endpoints
- Advanced analytics
- Integration with Teams
- Enhanced error handling
- Comprehensive logging
- Input validation
- Unit testing framework
- Docker optimization
- Performance improvements
- Additional file formats
- Caching layer
Built with β€οΈ for the SharePoint community