PromptLab

by irahulpandey

6 stars
Not rated
GitHub

About

Transforms basic user queries into optimized prompts for AI systems by automatically detecting content type and applying tailored templates from a YAML-based system.

Details

Author
irahulpandey
Repository
iRahulPandey/PromptLab
GitHub stars
6
License
Apache License 2.0
Categories
Design, AI, Infrastructure, Developer Tools

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name PromptLab
    Command (node, npx, python, etc.) npx
    Arguments
    • Argument 1 -y
    • Argument 2 @highlight/mcp-server

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository


pip install -r requirements.txt

export OPENAI_API_KEY="your-openai-api-key"

```bash

register_prompt

Register a new prompt or version in MLflow.

update_prompt

Update an existing prompt, archiving the previous production version.

list_prompts

List all registered prompts in MLflow.

register_from_file

Register multiple prompts from a JSON file.

register_sample_prompts

Initialize the system with standard sample prompts.

load_all_prompts

Load all available prompts from MLflow at server startup.

match_prompt

Match user queries to appropriate prompt templates.

enhance_query

Apply the selected prompt template to the user's query.

validate_query

Validate the enhanced queries to ensure quality.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "promptlab": {
            "env": {},
            "args": [
                "-y",
                "@highlight/mcp-server"
            ],
            "command": "npx"
        }
    }
}

Linux

{
    "env": [],
    "args": [
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "npx"
}

Macos

{
    "env": [],
    "args": [
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "npx"
}

Windows

{
    "env": [],
    "args": [
        "/c",
        "npx",
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "cmd"
}

PromptLab: AI Query Enhancement with MLflow Integration

PromptLab is an intelligent system that transforms basic user queries into optimized prompts for AI systems using MLflow Prompt Registry. It dynamically matches user requests to the most appropriate prompt template and applies it with extracted parameters.

🔍 Overview

PromptLab combines MLflow Prompt Registry with dynamic prompt matching to create a powerful, flexible system for prompt engineering:

- Centralized Prompt Management: Store, version, and manage prompts in MLflow
- Dynamic Matching: Intelligently match user queries to the best prompt template
- Version Control: Track prompt history with production and archive aliases
- Extensible: Easily add new prompt types without code changes

🏗️ Architecture

The system consists of three main components:

1. Prompt Registry (register_prompts.py) - Tool for registering and managing prompts in MLflow
2. Server (promptlab_server.py) - Server with dynamic prompt matching and LangGraph workflow
3. Client (promptlab_client.py) - Lightweight client for processing user queries

Workflow Process

PromptLab Workflow

1. Prompt Registration: Register prompt templates in MLflow with versioning and aliasing
2. Prompt Loading: Server loads all available prompts from MLflow at startup
3. Query Submission: User submits a natural language query via the client
4. Intelligent Matching: LLM analyzes the query and selects the most appropriate prompt template
5. Parameter Extraction: System extracts required parameters from the query
6. Template Application: Selected template is applied with extracted parameters
7. Validation & Adjustment: Enhanced prompt is validated and adjusted if needed
8. Response Generation: Optimized prompt produces a high-quality response

📂 Code Structure

promptlab/
├── promptlab_server.py            # Main server with LangGraph workflow
├── promptlab_client.py            # Client for processing queries
├── register_prompts.py            # MLflow prompt management tool
├── requirements.txt               # Project dependencies
├── advanced_prompts.json          # Additional prompt templates
└── README.md                      # Project documentation

Core Components:

register_prompts.py

- Purpose: Manages prompts in MLflow Registry - Key Functions: - register_prompt(): Register a new prompt or version - update_prompt(): Update an existing prompt (archives previous production) - list_prompts(): List all registered prompts - register_from_file(): Register multiple prompts from JSON - register_sample_prompts(): Initialize with standard prompts

promptlab_server.py

- Purpose: Processes queries using LangGraph workflow - Key Components: - load_all_prompts(): Loads prompts from MLflow - match_prompt(): Matches queries to appropriate templates - enhance_query(): Applies selected template - validate_query(): Validates enhanced queries - LangGraph workflow: Orchestrates the query enhancement process

promptlab_client.py

- Purpose: Provides user interface to the service - Key Features: - Process queries with enhanced prompts - List available prompts - Display detailed prompt matching information

🚀 Getting Started

Prerequisites

- Python 3.12
- Dependencies in requirements.txt
- OpenAI API key for LLM capabilities

Installation

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.