PromptLab
Serves prompt templates through a standardized protocol for transforming basic user queries into optimized prompts for AI systems.
Serves prompt templates through a standardized protocol for transforming basic user queries into optimized prompts for AI systems.
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.
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.
PromptLab consists of three primary components:
prompt_templates.yaml
) - Structured templates for different content typespromptlab_server.py
) - Serves templates through a standardized protocol with LangGraph Workflowpromptlab_client.py
) - Thin client that processes user querymcp[cli]
langchain-openai
langgraph>=0.0.20
python-dotenv
pyyaml
# Clone the repository
git clone https://github.com/iRahulPandey/PromptLab.git
cd PromptLab
# Install dependencies
pip install -r requirements.txt
# Set up environment variables
cp .env
# Edit .env to add your OpenAI API key
# The server loads templates from prompt_templates.yaml
python promptlab_server.py
python promptlab_client.py "Write an essay about climate change"
Templates are defined in prompt_templates.yaml
using a structured format:
templates:
essay_prompt:
description: "Generate an optimized prompt template for writing essays."
template: |
Write a well-structured essay on {topic} that includes:
- A compelling introduction that provides context and states your thesis
...
parameters:
- name: topic
type: string
description: The topic of the essay
required: true
prompt_templates.yaml
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
)Templates can include transformations that dynamically adjust parameters:
transformations:
- name: formality
value: "formal if recipient_type.lower() in ['boss', 'client'] else 'semi-formal'"
"Write something about renewable energy for my professor"
Write a well-structured essay on renewable energy that includes:
- A compelling introduction that provides context and states your thesis
- 2-3 body paragraphs, each with a clear topic sentence and supporting evidence
- Logical transitions between paragraphs that guide the reader
- A conclusion that synthesizes your main points and offers final thoughts
The essay should be informative, well-reasoned, and demonstrate critical thinking.
MIT License - See LICENSE file for details
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)