GitHub to OpenWebUI Knowledge Pipeline
March 21, 2025 ยท View on GitHub
This repository models a functional and validated data pipeline pushing data from a Github repository into a vector database (Qdrant) via Open Web UI which serves as the AI chat frontend and directly manages the collections.
The hardest part of setting this pipeline up, as usual, was handling the Cloudflare authentication. For those not running their instances in the cloud (and specifically behind Access policies) this is one headache that you won't have to worry about.
The data pipeline scripts can be modified, although of course the API key and JWT tokens will still be required for authentication against Open Web UI API.
Prerequisites
- An OpenWebUI instance
- Cloudflare for security (if applicable)
- Qdrant for vector database storage
- OpenAI for embeddings
Quick Start
- Add your content: Place your files in subdirectories under the
context-data/directory - Commit and push: The GitHub workflow template will automatically sync your changes to OpenWebUI when implemented in your repository
- Done! Your content is now available in your OpenWebUI knowledge collections
How It Works
- Each subdirectory in
context-data/becomes a knowledge collection in OpenWebUI - The name of the subdirectory is converted to a collection name (e.g.,
company-policiesbecomes "Company Policies") - Files in each subdirectory are uploaded and added to the corresponding collection
- When files are removed from a subdirectory, they are also removed from the collection
Authentication Requirements
The pipeline requires the following authentication credentials:
- Cloudflare Service Token - For accessing your Cloudflare-secured instance
- OpenWebUI API Key - For authenticating with the OpenWebUI API
- JWT Key - For OpenWebUI authentication
The workflow template uses the following secrets that need to be configured in your GitHub repository:
OWUI_BASE_URL: URL of your OpenWebUI instanceOWUI_API_KEY: API key for authenticationOWUI_JWT_TOKEN: JWT token for authenticationCF_ACCESS_CLIENT_ID: Cloudflare Access Client ID (if using Cloudflare Access)CF_ACCESS_CLIENT_SECRET: Cloudflare Access Client Secret (if using Cloudflare Access)
Setup Instructions
-
Enable Developer Mode in OpenWebUI
- It's recommended to start the OpenWebUI instance in dev mode to expose the Swagger documentation
- The Swagger docs provide detailed information about the API endpoints for managing knowledge collections
- Configure the ENV environment variable:
ENV=dev # Enables the FastAPI API docs on /docs # Alternative: ENV=prod - Automatically configures several environment variables
-
Configure Cloudflare Access Policies
- In your Cloudflare Access Policies area, create a service token policy with the appropriate type
- Create a service token for the script to use
- Ensure the token is allowed in the policy (or allow all service tokens)
-
Configure Authentication Credentials
- Set up the required Cloudflare service token
- Configure the OpenWebUI API and JWT keys
Authentication Flow

Data Flow

- Data is managed in your GitHub repository
- The pipeline authenticates through the Cloudflare tunnel
- The pipeline then authenticates with OpenWebUI
- OpenWebUI handles collection creation and file uploading
- Data is embedded into Qdrant for vector search capabilities
Repository Structure
.
โโโ context-data/ # ๐ ADD YOUR CONTENT HERE
โ โโโ collection-1/ # Each subdirectory becomes a knowledge collection
โ โ โโโ document1.pdf
โ โ โโโ document2.md
โ โโโ collection-2/
โ โโโ document3.txt
โโโ .github/workflows/ # GitHub workflow configuration
โโโ code/ # Source code for the sync script
โโโ tests/ # Test scripts and files
โโโ config.template.json # Template for configuration
Local Development
To run the sync script locally:
-
Create a
config.jsonfile based on the template:cp config.template.json config.json # Edit config.json with your credentials -
Install dependencies:
pip install requests requests-toolbelt -
Run the sync script:
python code/src/sync_knowledge.py --base-dir context-data --config config.json --verbose
Testing
To test the file upload functionality:
python tests/test_upload.py --file tests/test_file.txt --config config.json --verbose
Supported File Types
- Text files (.txt), Markdown files (.md), PDF files (.pdf)
- Word documents (.docx), Excel spreadsheets (.xlsx), PowerPoint presentations (.pptx)
- CSV files (.csv), JSON files (.json), HTML files (.html)
Notes
- Cloudflare authentication is the most challenging part of the setup
- Once authentication is properly configured, the pipeline operates seamlessly
- The system has been verified to work with Qdrant as the vector database and OpenAI for embeddings
Acknowledgments
- Special thanks to TheophileH for pointing out the dev mode configuration fix that enables access to the Swagger documentation