LLM-Powered Document Editor: DSPy & LangChain Integration for Intelligent Writing (OpenRouter/OpenAI/Deepseek/Gemini/Github/Ollama)
An intelligent writing assistant with multi-LLM integration for enhanced content creation and editing.
screen_recording.mov
Leverage DSPy's LLM orchestration and LangChain's document processing to create, refine, and manage content with unprecedented efficiency. Ideal for technical writers, content creators, and knowledge workers seeking intelligent document editing.
Try the live demo immediately:
- Clone repository:
git clone https://github.com/clchinkc/streamlit-editor.git
python -m venv venv
source venv/bin/activate # Unix/MacOS
# .\venv\Scripts\activate # Windows
- Install dependencies:
pip install -r requirements.txt
- Configure Streamlit secrets:
mkdir -p .streamlit
touch .streamlit/secrets.toml
Add the following to .streamlit/secrets.toml
:
# API Keys (at least one required)
[openrouter]
OPENROUTER_API_KEY = "your_openrouter_api_key"
OPENROUTER_MODEL = "your_openrouter_model"
[openai]
OPENAI_API_KEY = "your_openai_api_key"
[deepseek]
DEEPSEEK_API_KEY = "your_deepseek_api_key"
[gemini]
GEMINI_API_KEY = "your_gemini_api_key"
[github]
GITHUB_TOKEN = "your_github_token"
[ollama]
OLLAMA_MODEL = "your_ollama_model"
- (If you want to use Ollama) Setup Ollama:
First, install Ollama.
Then start Ollama server with the specified model:
ollama run your_ollama_model
- Launch application:
streamlit run streamlit_editor.py
And the app will be running on http://localhost:8501.
Combined Features & User Processes
-
Multi-format Editing Suite
- ✍️ Dual-mode editor (Editor + Markdown Preview)
- 📥 File ingestion: Drag-and-drop
.md
/.txt
support - 📤 Export flexibility: Download markdown or clipboard copy
-
Structural Tools
- 🗂️ LangChain-powered document chunking
- 📚 Section-level editing
-
Context-Aware Assistance
- 🤖 DSPy-powered feedback suggestions (general or specific to reference text)
- 📑 Automated section summarization
- 🧩 LLM-driven content regeneration
- 📝 Review and compare AI-generated changes
-
Quality Control
- 🔍 Semantic feedback tracking with source references
- 📊 Real-time feedback dashboard
- ✅ Accept/reject AI suggestions with diff view
-
Output Optimization
- 🧮 Batch operation processing for bulk edits
-
Advanced Orchestration
- 🚦 DSPy-managed suggestion pipeline
- 📜 Version history tracking
- 🌐 Multi-modal previews (raw + rendered views)
- 📄 Pagination for summaries
Component | Technology | Purpose |
---|---|---|
AI Framework | DSPy | LLM operations management |
Text Processing | LangChain | Document chunking |
UI Framework | Streamlit | Web interface |
Visualization | Streamlit Mermaid | Document flow diagrams |
MIT Licensed - See LICENSE for details.