PromptLab MCP Server

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クエリ拡張エンジン

PromptLabは、基本的なユーザークエリをAIシステム向けに最適化されたプロンプトに変換します。コンテンツの種類(エッセイ、メール、技術説明、クリエイティブライティング)を自動的に検出し、カスタマイズされたテンプレートを適用し、強化されたプロンプトが元の意図を維持しているかどうかを検証します。

🔍 概要

PromptLabは、YAMLベースのテンプレートシステムを備えたモジュール式アーキテクチャ上に構築されており、コーディングの知識がなくても誰でもプロンプトテンプレートを作成・管理できます。このシステムは、より構造化された入力を通じて、より高品質なAI応答を生成します。

🏗️ 建築

PromptLab は 3 つの主要コンポーネントで構成されています。

  1. テンプレート システム( prompt_templates.yaml ) - さまざまなコンテンツ タイプ用の構造化テンプレート
  2. MCP サーバー( promptlab_server.py ) - LangGraph ワークフローを使用して標準化されたプロトコルを通じてテンプレートを提供します。
  3. 処理クライアント( promptlab_client.py ) - ユーザークエリを処理するシンクライアント

ワークフロープロセス

  1. クエリ入力: ユーザーが自然言語クエリを送信する
  2. 分類: システムがコンテンツの種類 (エッセイ、電子メールなど) を決定します。
  3. パラメータ抽出: 主要なパラメータが識別されます (トピック、対象者など)
  4. テンプレートアプリケーション: 適切なテンプレートが取得され、入力されます
  5. 検証: 強化されたプロンプトは元の意図と照合されます
  6. 調整: 必要な調整は自動的に行われます
  7. 応答生成:最適化されたプロンプトは高品質の応答を生成します

📋 機能

  • コンテンツタイプの検出- ユーザークエリをエッセイ、メール、技術、またはクリエイティブライティングのリクエストに自動的に分類します
  • パラメータ抽出- トピック、受信者、オーディエンスレベルなどの主要なパラメータをインテリジェントに抽出します
  • テンプレートライブラリ- 構造化されたガイダンスを備えた一般的なコンテンツタイプ用の事前構成されたテンプレート
  • 検証システム- 強化されたプロンプトが元のユーザーの意図を維持することを保証します
  • フィードバックループ- 検証で不整合が特定されたときにプロンプトを調整します
  • モジュラー設計- MCPサーバーはあらゆるLLMシステムに接続可能
  • 非技術的な管理- コーディングの知識がなくてもテンプレートを更新できます

🚀 はじめに

前提条件

  • Python 3.8以上
  • 依存関係:
    • mcp[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

使用法

  1. まずサーバーを実行します。
# The server loads templates from prompt_templates.yaml python promptlab_server.py
  1. クエリを使用してクライアントを実行します。
python promptlab_client.py "Write an essay about climate change"
  1. システムは以下を出力します:
    • 元のクエリ
    • 分類されたコンテンツの種類
    • 強化されたプロンプト
    • 検証結果
    • 最終回答

📝 テンプレートシステム

テンプレートは、 prompt_templates.yamlで構造化された形式を使用して定義されます。

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

新しいテンプレートの追加

  1. prompt_templates.yamlを開く
  2. 既存の形式に従って新しいテンプレートを追加する
  3. パラメータと変換を定義する
  4. サーバー側でツールを定義し、テンプレートをロードする
  5. サーバーは再起動時に新しいテンプレートを自動的に読み込みます

🛠️ 高度な設定

環境変数

  • TEMPLATES_FILE - テンプレート YAML ファイルへのパス (デフォルト: prompt_templates.yaml )
  • OPENAI_API_KEY - LLM アクセス用の OpenAI API キー
  • MODEL_NAME - 使用するOpenAIモデル(デフォルト: gpt-3.5-turbo
  • PERSONA_SERVER_SCRIPT - サーバー スクリプトへのパス (デフォルト: promptlab_server.py )

カスタム変換

テンプレートには、パラメータを動的に調整する変換を含めることができます。

transformations: - name: formality value: "formal if recipient_type.lower() in ['boss', 'client'] else 'semi-formal'"

📊 出力例

入力クエリ

「教授のために再生可能エネルギーについて何か書いてください」

強化されたプロンプト

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ファイルを参照

🤝 貢献する

貢献を歓迎します!お気軽にプルリクエストを送信してください。

  1. リポジトリをフォークする
  2. 機能ブランチを作成します( git checkout -b feature/amazing-feature
  3. 変更をコミットします ( git commit -m 'Add some amazing feature' )
  4. ブランチにプッシュする ( git push origin feature/amazing-feature )
  5. プルリクエストを開く
-
security - not tested
A
license - permissive license
-
quality - not tested

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.

基本的なユーザークエリを AI システム向けに最適化されたプロンプトに変換するための標準化されたプロトコルを通じてプロンプト テンプレートを提供します。

  1. 🔍 Overview
    1. 🏗️ Architecture
      1. Workflow Process
    2. 📋 Features
      1. 🚀 Getting Started
        1. Prerequisites
        2. Installation
        3. Usage
      2. 📝 Template System
        1. Adding New Templates
      3. 🛠️ Advanced Configuration
        1. Environment Variables
        2. Custom Transformations
      4. 📊 Example Outputs
        1. Input Query
        2. Enhanced Prompt
      5. 📄 License
        1. 🤝 Contributing
          ID: i3tad94sjm