Integrations
Used for environment variable management to configure the PromptLab server with API keys and other settings
Enables version control and contribution workflows for the PromptLab project
Hosts the repository and provides collaboration features for contributing to PromptLab
PromptLab: AI Query Enhancement Engine
PromptLab transforms basic user queries into optimized prompts for AI systems. It automatically detects content type (essays, emails, technical explanations, creative writing), applies tailored templates, and validates that enhanced prompts maintain the original intent.
🔍 Overview
PromptLab is built on a modular architecture with a YAML-based template system that enables anyone to create and manage prompt templates without coding knowledge. The system ultimately produces higher-quality AI responses through better-structured inputs.
🏗️ Architecture
PromptLab consists of three primary components:
- Template System (
prompt_templates.yaml
) - Structured templates for different content types - MCP Server (
promptlab_server.py
) - Serves templates through a standardized protocol with LangGraph Workflow - Processing Client (
promptlab_client.py
) - Thin client that processes user query
Workflow Process
- Query Input: User submits a natural language query
- Classification: System determines the content type (essay, email, etc.)
- Parameter Extraction: Key parameters are identified (topic, audience, etc.)
- Template Application: The appropriate template is retrieved and filled
- Validation: The enhanced prompt is checked against the original intent
- Adjustment: Any needed refinements are made automatically
- Response Generation: The optimized prompt produces a high-quality response
📋 Features
- Content Type Detection - Automatically classifies user queries into essay, email, technical, or creative writing requests
- Parameter Extraction - Intelligently extracts key parameters like topics, recipients, and audience levels
- Template Library - Pre-configured templates for common content types with structured guidance
- Validation System - Ensures enhanced prompts maintain the original user intent
- Feedback Loop - Adjusts prompts when validation identifies misalignments
- Modular Design - MCP server can be plugged into any LLM system
- Non-Technical Management - Templates can be updated without coding knowledge
🚀 Getting Started
Prerequisites
- Python 3.8+
- Dependencies:
mcp[cli]
langchain-openai
langgraph>=0.0.20
python-dotenv
pyyaml
Installation
Usage
- Start by running the server:
- Run the client with your query:
- The system will output:
- Original query
- Classified content type
- Enhanced prompt
- Validation result
- Final response
📝 Template System
Templates are defined in prompt_templates.yaml
using a structured format:
Adding New Templates
- Open
prompt_templates.yaml
- Add a new template following the existing format
- Define parameters and transformations
- Define a tool on server side and load the template
- The server will automatically load the new template on restart
🛠️ Advanced Configuration
Environment Variables
TEMPLATES_FILE
- Path to the templates YAML file (default:prompt_templates.yaml
)OPENAI_API_KEY
- Your OpenAI API key for LLM accessMODEL_NAME
- The OpenAI model to use (default:gpt-3.5-turbo
)PERSONA_SERVER_SCRIPT
- Path to the server script (default:promptlab_server.py
)
Custom Transformations
Templates can include transformations that dynamically adjust parameters:
📊 Example Outputs
Input Query
"Write something about renewable energy for my professor"
Enhanced Prompt
📄 License
MIT License - See LICENSE file for details
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Serves prompt templates through a standardized protocol for transforming basic user queries into optimized prompts for AI systems.