rst2kb
____ ____ _____ ____ _ ____
| _ \/ ___|_ _|___ \| |/ / __ )
| |_) \___ \ | | __) | ' /| _ \
| _ < ___) || | / __/| . \| |_) |
|_| \_\____/ |_| |_____|_|\_\____/
Python utility to prepare .rst documentation for RAG in Open WebUI.
It exports docs to .txt files with a manifest, and can optionally upload files to an existing Open WebUI Knowledge Base.
Documentation
docs/README.md: documentation indexdocs/architecture.md: system architecture and data flow diagramsdocs/operations.md: runbook for export/upload and validationdocs/troubleshooting.md: common failures and fixes
Requirements
- Python 3.12+
uv- Open WebUI URL, API key, and Knowledge Base ID (only for upload mode)
Install
uv syncUsage
Dry-run discovery:
uv run python rst2kb.py export --dry-run --source source --output /tmp/owui-ragExport all RST files:
uv run python rst2kb.py export --source source --output /tmp/owui-ragExport and keep raw RST copies:
uv run python rst2kb.py export --source source --output /tmp/owui-rag --copy-rawUpload exported files to Open WebUI:
export OPENWEBUI_API_KEY="YOUR_API_KEY"
uv run python rst2kb.py upload \
--output /tmp/owui-rag \
--openwebui-url http://localhost:3000 \
--knowledge-id YOUR_KNOWLEDGE_IDUpload behavior notes
- Empty
.txtfiles are skipped (reported withstatus: "skipped"anderror: "empty text content"). - Duplicate content in the same upload batch is skipped to avoid duplicate-content API errors.
- Skipped files do not count as failed uploads.
Test
uv run python -m unittest -v rst2kb_testOutput
OUT/txt/**/*.txt: exported text filesOUT/raw/**/*.rst: optional raw copies when--copy-rawis usedOUT/manifest.json: export summary and per-file detailsOUT/upload_report.json: upload results per file
Environment variables
OPENWEBUI_API_KEY: bearer token used by upload mode
Known limits
- Upload mode does not create a Knowledge Base; it requires an existing
--knowledge-id. - Upload mode requires files to be processed by Open WebUI before attach and can take time for large datasets.
Disclaimer
This project was built using AI-assisted development ("vibe coding") with human oversight and review at each step. While the code has been tested and verified, you should review it before using in production environments.