Modern AI Prompt Management System with FastAPI Web UI, Dynamic Multi-Language Support, and AI-Powered Optimization
Project description
๐ Instruere - AI Prompt Manager
The intelligent way to manage, optimize, and scale your AI prompts
A comprehensive AI prompt management system featuring a modern web interface (FastAPI + HTMX + Tailwind CSS) with unified architecture supporting both single-user and multi-tenant deployments. Features advanced authentication, real-time cost estimation, AI-powered optimization, and secure API access.
graph LR
A[๐ค AI Prompts] --> B[๐ Management] --> C[๐ Optimization] --> D[๐ฐ Cost Control]
style A fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000
style B fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#000
style C fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
style D fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#000
๐ฏ What is AI Prompt Management?
Prompts are instructions you give to AI systems like ChatGPT or Claude - the quality of your prompts directly impacts the quality of AI responses and your costs.
๐ Rules Management: The Foundation of Autonomous AI Agents
In today's rapidly evolving AI landscape, Rules Management has become the cornerstone of successful autonomous agent systems. As AI agents increasingly handle complex, multi-step tasks independently, having structured guidelines becomes critical for consistent, reliable outcomes.
Rules are structured Markdown documents that define guidelines, constraints, and behavioral expectations for AI agents. Unlike prompts that request specific outputs, rules establish the framework within which agents operate - ensuring they work together harmoniously while maintaining quality standards.
๐ค Why Rules Matter in the Age of AI Agents
graph TB
subgraph "AI Agent Ecosystem"
A[Agent 1: Code Review] --> C[Shared Rules Engine]
B[Agent 2: Documentation] --> C
D[Agent 3: Testing] --> C
E[Agent 4: Deployment] --> C
end
C --> F[Consistent Quality]
C --> G[Reliable Outcomes]
C --> H[Predictable Behavior]
style C fill:#e3f2fd,stroke:#1976d2,stroke-width:3px,color:#000
style F fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
style G fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
style H fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
๐ฏ The Power of Combined Prompts + Rules
Modern AI workflows require both prompts (what to do) and rules (how to do it):
- Prompts: Define specific tasks and desired outputs
- Rules: Establish quality standards, constraints, and behavioral guidelines
- Together: Create autonomous agents that deliver consistent, high-quality results
๐ Real-World Applications
Agentic Coding Systems like Claude Projects, Amazon Q, and VS Code Copilot rely on rules for:
- Code Quality: Enforcing style guides, security practices, and architecture patterns
- Documentation Standards: Ensuring consistent, comprehensive documentation
- Testing Requirements: Maintaining coverage and quality thresholds
- Collaboration Guidelines: Defining how multiple agents coordinate work
The combination of intelligent prompts and structured rules enables teams to scale AI assistance while maintaining the quality and consistency that enterprise environments demand.
The Challenge vs Solution
graph LR
subgraph P ["โ Problems"]
P1[Scattered prompts]
P2[No cost visibility]
P3[Manual optimization]
end
subgraph S ["โ
Solutions"]
S1[Centralized library]
S2[Real-time costs]
S3[AI optimization]
end
P --> S
style P fill:#ffebee,stroke:#d32f2f,stroke-width:2px,color:#000
style S fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
style P1 fill:#fff,stroke:#d32f2f,color:#000
style P2 fill:#fff,stroke:#d32f2f,color:#000
style P3 fill:#fff,stroke:#d32f2f,color:#000
style S1 fill:#fff,stroke:#388e3c,color:#000
style S2 fill:#fff,stroke:#388e3c,color:#000
style S3 fill:#fff,stroke:#388e3c,color:#000
Why Instruere?
- ๐ Rules Management: Structured AI agent guidance with visual combination builder
- ๐ Project Management: Organize workflows, collaborate with teams, and track costs
- ๐ฐ Cost Control: Real-time token estimation prevents expensive mistakes
- ๐ Optimization: AI-powered improvements using LangWatch, PromptPerfect, and more
- ๐งฉ Builder Interface: Drag-and-drop prompt and rule combination
- ๐ค Speech Dictation: Voice-to-text with AI enhancement and multi-language support
- ๐ Multi-Language: 10 languages with automatic translation
- ๐ข Enterprise Ready: Multi-tenant with SSO, RBAC, and audit trails
- ๐ Developer Friendly: Complete REST API with comprehensive documentation
๐ Table of Contents
๐ Getting Started
- โก Quick Start - Get up and running in 5 minutes
- ๐๏ธ System Architecture - Understanding the design
- โ๏ธ Configuration - Setup and customization
๐ฏ Core Features
- ๐ค Enhanced AI Services Configuration - Multi-model AI setup
- ๐ Prompt Management - Create, organize, and manage prompts
- ๐ค Speech Dictation - Voice-to-text with AI enhancement
- ๐ Rules Management - AI agent guidance and behavioral rules
- ๐ Project Management - Organize workflows and collaborate on AI projects
- ๐ท๏ธ Advanced Tagging System - Intelligent organization and discovery
- ๐งฎ Token Calculator - Real-time cost estimation
- ๐ AI-Powered Optimization - Improve prompt quality
- ๐งฉ Prompt Builder - Drag-and-drop prompt combination
๐ Advanced Features
- ๐ Multi-Language Support - 10 languages with translation
- ๐ API Access - REST API for developers
- ๐ต Azure AI Integration - Enterprise AI services
๐ข Enterprise & Deployment
- ๐ข Multi-Tenant Features - Organization management
- ๐ Production Deployment - Scale and security
- ๐ ๏ธ Development - Contributing and extending
๐ Documentation & Resources
- ๐ Documentation - Comprehensive guides and references
- ๐ Quick Reference - Commands and shortcuts
- ๐ง Troubleshooting - Common issues and solutions
- ๐ License - Usage terms
๐ Modern Web Interface
Instruere features a completely redesigned modern web interface - a responsive, enterprise-ready web application built from the ground up:
โจ What's New
| Feature | Modern Web UI | Previous Version |
|---|---|---|
| ๐จ Design | Responsive Tailwind CSS, mobile-optimized | Fixed desktop layout |
| โก Performance | FastAPI + HTMX real-time updates | Page refreshes required |
| ๐ Security | Session-based auth, CSRF protection | Basic authentication |
| ๐ I18n | 10 languages, dynamic switching | English only |
| ๐ฑ Mobile | Full mobile support | Desktop only |
| ๐ง API | Integrated REST API | External API server |
| ๐ฏ UX | Modern components, drag-drop | Basic forms |
| ๐ Navigation | Clickable app title, improved UX | Static title |
| ๐จ Buttons | Modern styled buttons with zoom support | Basic unstyled buttons |
๐ Recent Improvements
Translation System Enhancements:
- Fixed critical translation function availability in single-user mode
- Unified all translation calls to use consistent
t()function - Enhanced navigation translation compatibility across all modes
User Interface Improvements:
- Made app title clickable for quick dashboard navigation
- Comprehensive button styling overhaul with modern CSS framework
- Added zoom scaling support for accessibility compliance
- Enhanced keyboard navigation and screen reader support
Code Quality & Testing:
- Executed comprehensive test validation (96 unit tests + integration tests)
- Applied code formatting and security validation
- Fixed template syntax errors and improved HTML quality
๐ Key Advantages
- โก Real-time Updates: HTMX-powered dynamic interactions without page reloads
- ๐ฑ Mobile-First: Responsive design that works on all devices
- ๐จ Modern UI: Clean, intuitive interface with consistent styling
- ๐ Enterprise Security: Session management, CSRF protection, secure authentication
- ๐ Internationalization: Full 10-language support with instant switching
- ๐ API Integration: Built-in REST API for developer access
- โฟ Accessibility: Screen reader support, keyboard navigation, ARIA labels
The modern web UI is now the default and only interface! Experience a complete enterprise-ready web application with all the benefits listed above.
๐๏ธ System Architecture
Instruere is built on a unified, modular architecture that scales from single-user development to enterprise multi-tenant deployments.
graph TB
Client[๐ Client Layer<br/>Modern Web UI โข API โข Mobile] --> App[๐ Application Layer<br/>FastAPI + HTMX โข Auth โข Real-time]
App --> Logic[๐ง Business Logic<br/>Prompts โข Calculator โข Optimizer โข AI Services]
Logic --> Data[๐พ Data Layer<br/>SQLite โข PostgreSQL โข Multi-tenant]
style Client fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000
style App fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#000
style Logic fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
style Data fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#000
๐ Modern Modular Architecture
Instruere features a hybrid architecture that combines proven legacy components with a new modular architecture designed for maintainability, scalability, and enterprise deployment:
- ๐ฆ Modular Design: Clean separation between authentication, prompts, API, and UI layers
- ๐๏ธ Base Classes: Shared functionality through inheritance and composition patterns
- ๐ง Dependency Injection: Testable, loosely-coupled components with full dependency injection
- ๐ก๏ธ Type Safety: Comprehensive type hints throughout the codebase for reliability
- ๐ Structured Logging: Centralized logging with audit trails and performance metrics
- โก Modern Security: Argon2/bcrypt password hashing, JWT management, and RBAC
- ๐ณ Container Ready: Full Docker support with Redis caching and health monitoring
๐ Architecture Documentation:
- Development Guide - Complete system architecture with diagrams and implementation details
๐ Key Architectural Principles
- ๐๏ธ Unified Codebase: Single application, multiple deployment modes
- ๐ Tenant Isolation: Complete data separation between organizations
- ๐ฆ Modular Design: Loosely coupled, independently testable components
- ๐ API-First: RESTful API with comprehensive OpenAPI documentation
- โก Performance: Efficient database queries and caching strategies
๐ Documentation
๐ Comprehensive Guides
- ๐ Quick Start - Get up and running in 5 minutes
- ๐ค User Guide - Complete user documentation for all features
- โ๏ธ Configuration - AI services, deployment, and system setup
- ๐ ๏ธ Development - Architecture, testing, and development workflows
- ๐ API Reference - Complete REST API documentation with examples
- โจ Features Guide - Speech dictation, rules management, and advanced features
- ๐ Release Management - Versioning, releases, and deployment automation
- ๐ค Deployment Automation - CI/CD pipelines and automation setup
โก Quick Start
Get Instruere running in under 5 minutes with these simple steps:
โ
Python 3.12+
โ
Poetry (recommended) or pip
โ
Optional: PostgreSQL for production
๐ณ Option 1: Docker (Recommended)
# ๐ Quick Start - Single Container
docker run -p 7860:7860 ghcr.io/makercorn/ai-prompt-manager:latest
# ๐๏ธ Development - Full Stack with PostgreSQL & Redis
docker-compose up -d
# ๐ญ Production - Optimized with Health Checks
docker-compose -f docker-compose.prod.yml up -d
# ๐งช Test Docker Setup
./scripts/docker-test.sh
# Open browser to http://localhost:7860
# Login: admin@localhost / admin123
๐ Option 2: Python Installation
๐ฆ From PyPI (Recommended)
# 1๏ธโฃ Install from PyPI
pip install promptman
# 2๏ธโฃ Run the application
python -m promptman
# 3๏ธโฃ Open browser to http://localhost:7860
๐ข From GitHub Packages (Enterprise)
# 1๏ธโฃ Install from GitHub Packages
pip install --index-url https://pypi.pkg.github.com/makercorn/simple/ promptman
# 2๏ธโฃ Run the application
python -m promptman
# 3๏ธโฃ Open browser to http://localhost:7860
๐ง From Source (Development)
# 1๏ธโฃ Clone and install
git clone <repository-url>
cd ai-prompt-manager
poetry install
# 2๏ธโฃ Configure (optional)
cp .env.example .env
# Edit .env for custom settings
# 3๏ธโฃ Launch application (IMPORTANT: Use Poetry environment)
poetry run python run.py
# 4๏ธโฃ Open browser to http://localhost:7860
# โ ๏ธ CRITICAL: Always use 'poetry run' to ensure dependencies are available
# Running python run.py directly may result in "Create New Prompt" errors
๐ Deployment Options
| Environment | Command | Interface | Features | Use Case |
|---|---|---|---|---|
| ๐งช Development | poetry run python run.py --single-user |
Modern Web UI | SQLite, Single User | Personal use, testing |
| ๐ข Multi-Tenant | poetry run python run.py |
Modern Web UI | SQLite, Multi-tenant, Auth | Teams, organizations |
| ๐ With API | poetry run python run.py --with-api |
Web UI + API | API + UI, Multi-tenant | Developer integration |
| ๐ณ Docker Dev | docker-compose up -d |
Modern Web UI | PostgreSQL + Redis + Full Stack | Development with persistence |
| ๐ญ Production | docker-compose -f docker-compose.prod.yml up -d |
Modern Web UI | Optimized + Health Checks + Redis | Scalable deployment |
โ Testing Status: 21 test files (11 unit + 10 integration) with comprehensive coverage across all deployment modes and architecture components. All critical translation system fixes and button styling improvements validated through comprehensive test execution.
โ Verify Installation
# Check system health (if API enabled)
curl http://localhost:7860/api/health
# Expected response: {"status": "healthy"}
# Test prompt creation (main functionality)
# 1. Open http://localhost:7860 in browser
# 2. Click "Create New Prompt"
# 3. Fill form and save - should work without errors
# Test comprehensive functionality (development)
poetry run python tests/integration/test_mt_install.py # Multi-tenant setup
poetry run python tests/integration/test_new_architecture_integration.py # New architecture
poetry run python tests/integration/test_langwatch_integration.py # AI optimization
# Run validation steps for code quality
poetry run black . # Format Python code
poetry run isort . # Organize imports
poetry run flake8 . --max-line-length=88 --extend-ignore=E203,W503 # Linting
poetry run bandit -r . --skip B101,B602,B603 # Security scanning
โ๏ธ Configuration
Configure Instruere for your specific needs - from development to enterprise deployment.
๐ Quick Configuration
# 1๏ธโฃ Copy template
cp .env.example .env
# 2๏ธโฃ Edit for your environment
nano .env # or your preferred editor
# 3๏ธโฃ Restart application
poetry run python run.py
๐ Essential Settings
The most important configuration options organized by priority:
๐๏ธ Application Mode (Choose One)
# ๐ค Single-User (Personal Use)
MULTITENANT_MODE=false
ENABLE_API=false
# ๐ข Multi-Tenant (Teams/Organizations)
MULTITENANT_MODE=true
ENABLE_API=false
# ๐ Full Enterprise (Multi-tenant + API)
MULTITENANT_MODE=true
ENABLE_API=true
๐ Server Settings
SERVER_HOST=0.0.0.0 # Bind address (0.0.0.0 for external access)
SERVER_PORT=7860 # Port number
DEBUG=false # Debug mode (true for development)
๐พ Database Configuration
# ๐งช Development (Default)
DB_TYPE=sqlite
DB_PATH=prompts.db
# ๐ข Production (Recommended)
DB_TYPE=postgres
POSTGRES_DSN=postgresql://user:pass@host:port/dbname
โก Command Line Overrides
Override configuration without editing files:
# Mode selection
python run.py --single-user # Force single-user mode
python run.py --with-api # Enable API
python run.py --single-user --with-api # Single-user + API
# Server configuration
python run.py --port 8080 --host 127.0.0.1
python run.py --debug --share # Debug + public access
# Get help
python run.py --help
๐ง Advanced Configuration
๐ Authentication & Security
# JWT Security
SECRET_KEY=your-secure-secret-key # Auto-generated if not set
LOCAL_DEV_MODE=true # Development features
# SSO Integration
SSO_ENABLED=false
SSO_CLIENT_ID=your-application-id
SSO_CLIENT_SECRET=your-client-secret
SSO_AUTHORITY=https://login.microsoftonline.com/tenant-id
# Azure Entra ID
ENTRA_ID_ENABLED=false
ENTRA_CLIENT_ID=your-entra-client-id
ENTRA_TENANT_ID=your-azure-tenant-id
๐ค AI Services
# Prompt Optimization
PROMPT_OPTIMIZER=langwatch # langwatch, promptperfect, builtin
LANGWATCH_API_KEY=your-api-key
PROMPTPERFECT_API_KEY=your-api-key
# Azure AI Services
AZURE_AI_ENABLED=false
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com
AZURE_OPENAI_KEY=your-azure-key
# Translation Services
TRANSLATION_SERVICE=openai # openai, google, libre, mock
OPENAI_API_KEY=your-openai-key
๐ Configuration Validation
Check your configuration:
# Test configuration
python -c "
from auth_manager import AuthManager
auth = AuthManager()
print('โ
Configuration valid')
print(f'Mode: {'Multi-tenant' if auth.is_multitenant_mode() else 'Single-user'}')
print(f'API: {'Enabled' if auth.is_api_enabled() else 'Disabled'}')
"
๐ Multi-Language Support
AI Prompt Manager supports 10 languages with real-time interface switching, making it accessible to users worldwide. The internationalization system provides comprehensive translations for all UI elements.
๐ Supported Languages
| Language | Code | Native Name | Status |
|---|---|---|---|
| English | en |
English | โ Complete |
| Spanish | es |
Espaรฑol | โ Complete |
| French | fr |
Franรงais | โ Complete |
| German | de |
Deutsch | โ Complete |
| Chinese | zh |
ไธญๆ | โ Complete |
| Japanese | ja |
ๆฅๆฌ่ช | โ Complete |
| Portuguese | pt |
Portuguรชs | โ Complete |
| Russian | ru |
ะ ัััะบะธะน | โ Complete |
| Arabic | ar |
ุงูุนุฑุจูุฉ | โ Complete |
| Hindi | hi |
เคนเคฟเคจเฅเคฆเฅ | โ Complete |
๐ How to Change Language
Method 1: Using the Interface (Recommended)
- Locate the Language Selector: Look for the ๐ Language dropdown in the top-right corner
- Select Your Language: Click the dropdown and choose your preferred language
- Instant Update: The interface will immediately switch to the selected language
Method 2: Environment Configuration
Set the default language for new sessions:
# Set default language (optional)
DEFAULT_LANGUAGE=es python run.py # Spanish
DEFAULT_LANGUAGE=fr python run.py # French
DEFAULT_LANGUAGE=zh python run.py # Chinese
Method 3: URL Parameter
Access the interface with a specific language:
# Examples
http://localhost:7860/?lang=es # Spanish
http://localhost:7860/?lang=fr # French
http://localhost:7860/?lang=zh # Chinese
๐ฏ What Gets Translated
The multi-language system covers all user-facing elements:
Interface Elements
- โ Navigation menus and tabs
- โ Button labels and actions
- โ Form fields and placeholders
- โ Status messages and notifications
- โ Help text and tooltips
Application Sections
- โ Authentication: Login forms, SSO options
- โ Prompt Management: Add, edit, delete prompts
- โ Library: Search, categories, filters
- โ Token Calculator: Model selection, cost estimation
- โ API Management: Token creation, documentation
- โ Settings: Configuration options
- โ Admin Panel: User and tenant management
AI Features
- โ LangWatch Integration: Optimization interface
- โ Enhancement Engine: Prompt improvement tools
- โ Error Messages: Validation and system feedback
๐ Translation Feature
When using the interface in a non-English language, AI Prompt Manager provides an automatic translation feature to help you work with AI enhancement tools that work best with English prompts.
How Translation Works
- Automatic Detection: Translation button appears automatically when UI language is not English
- One-Click Translation: Click "Translate to English" button in prompt editor
- Smart Replacement: Translated text replaces original content in the editor
- Validation: Translated text undergoes validation before saving
- Status Feedback: Clear success/error messages guide the process
Supported Translation Services
| Service | Quality | Setup | Cost |
|---|---|---|---|
| OpenAI | โญโญโญโญโญ | API Key | Paid |
| Google Translate | โญโญโญโญ | API Key | Paid |
| LibreTranslate | โญโญโญ | Optional Key | Free/Paid |
| Mock | โญ | None | Free |
Configuration
Set up translation services via environment variables:
# Use OpenAI for highest quality
TRANSLATION_SERVICE=openai
OPENAI_API_KEY=your_openai_api_key
# Use Google Translate
TRANSLATION_SERVICE=google
GOOGLE_TRANSLATE_API_KEY=your_google_key
# Use LibreTranslate (open source)
TRANSLATION_SERVICE=libre
LIBRETRANSLATE_URL=https://libretranslate.de/translate
LIBRETRANSLATE_API_KEY=optional_key
# Use mock for testing (default)
TRANSLATION_SERVICE=mock
Usage Workflow
- Switch Language: Change UI to your preferred language (Spanish, French, etc.)
- Write Prompt: Enter your prompt in your native language
- Translate: Click the "๐ Translate to English" button that appears
- Enhance: Use the translated English text with AI enhancement tools
- Save: Save the improved prompt after validation
Example
Original (Spanish): "Escribe un poema sobre la naturaleza"
Translated (English): "Write a poem about nature"
Enhanced (English): "Create a beautiful, evocative poem about the wonders
of nature, focusing on vivid imagery and emotional depth"
๐ง Advanced Configuration
Programmatic Language Control
Access the internationalization system programmatically:
from i18n import i18n, t
# Get available languages
languages = i18n.get_available_languages()
print(languages) # {'en': 'English', 'es': 'Espaรฑol', ...}
# Change language
i18n.set_language('es')
# Translate text
title = t('app.title') # Returns translated app title
welcome = t('auth.welcome', name='John') # With parameters
Custom Translations
Extend translations for custom deployments:
# Add custom translations
from i18n import i18n
# Add new language or extend existing
custom_translations = {
'custom.message': 'My custom message',
'custom.button': 'Custom Button'
}
# Extend existing language
i18n.translations['en'].update(custom_translations)
๐ Language Features
Smart Fallbacks
- Automatic Fallback: Missing translations default to English
- Graceful Degradation: Untranslated keys display as readable text
- Context Preservation: Formatting and parameters work across all languages
Cultural Considerations
- Text Direction: Right-to-left support for Arabic
- Number Formatting: Locale-appropriate number display
- Date Formats: Regional date and time formatting
- Currency: Localized cost estimates in token calculator
Accessibility
- Screen Readers: Proper language attributes for assistive technology
- Keyboard Navigation: Language switching via keyboard shortcuts
- High Contrast: Language selector works with accessibility themes
๐จ UI Adaptations
The interface automatically adapts to different languages:
Layout Flexibility
- Dynamic Text Sizing: Accommodates longer/shorter translations
- Responsive Labels: Forms adjust to text length variations
- Icon Consistency: Universal icons complement text labels
Typography
- Font Support: Web fonts that support all character sets
- Readability: Optimized contrast and spacing for each language
- Consistency: Unified styling across all language versions
๐ Technical Details
Translation Architecture
- Embedded Translations: No external files required for reliability
- Key-Based System: Hierarchical translation keys (e.g.,
auth.login) - Parameter Support: Dynamic content with variable substitution
- Caching: Efficient translation loading and memory usage
File Structure
ai-prompt-manager/
โโโ i18n.py # Internationalization system
โโโ ui_components.py # Language-aware UI components
โโโ run.py # Main launcher with i18n integration
โโโ web_app.py # Web interface with i18n integration
Browser Support
- Modern Browsers: Full support in Chrome, Firefox, Safari, Edge
- Fallback Support: Graceful degradation in older browsers
- Mobile Optimized: Touch-friendly language switching on mobile devices
โ Troubleshooting
Common Issues
Language not switching immediately:
- Refresh the page or restart the interface
- Check browser console for JavaScript errors
Missing translations:
- Some text remains in English - this is expected fallback behavior
- Report missing translations via GitHub issues
Performance with many languages:
- All translations are loaded efficiently in memory
- No performance impact from multiple language support
Getting Help
- ๐ Documentation: Check this guide for configuration details
- ๐ Bug Reports: Report translation issues on GitHub
- ๐ก Feature Requests: Suggest new languages or improvements
- ๐ Community: Join discussions about localization
๐ค Enhanced AI Services Configuration
Instruere features a comprehensive AI services configuration system that allows users to set different models and providers for different functions, providing unprecedented flexibility and control over AI operations.
๐ Multi-Model Architecture Overview
The enhanced AI services system supports 10+ AI providers and 11 operation types, enabling you to optimize each AI function with the best-suited model:
graph TB
A[๐ฏ Operation Types] --> B[๐ Default Operations]
A --> C[๐ Prompt Enhancement]
A --> D[โก Optimization]
A --> E[๐งช Testing]
A --> F[๐ Translation]
B --> G[๐ค AI Models]
C --> G
D --> G
E --> G
F --> G
G --> H[โ๏ธ Cloud Providers<br/>OpenAI โข Azure โข Anthropic]
G --> I[๐ Local Models<br/>Ollama โข LM Studio โข llama.cpp]
style A fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000
style G fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
style H fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#000
style I fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#000
๐ฏ Supported AI Providers
| Provider | Models | Features | Use Case |
|---|---|---|---|
| ๐ค OpenAI | GPT-4, GPT-3.5-turbo, GPT-4-turbo | Streaming, Function Calling, Vision | General purpose, coding, analysis |
| โ๏ธ Azure OpenAI | Enterprise GPT models | Enhanced security, compliance | Enterprise deployments |
| ๐ง Anthropic | Claude-3 (Opus, Sonnet, Haiku) | Large context, safety | Research, writing, reasoning |
| ๐ Google | Gemini Pro, Gemini Ultra | Multimodal, fast inference | Search, analysis, creativity |
| ๐ Ollama | Llama 2/3, Mistral, CodeLlama | Local deployment, privacy | On-premises, data sensitivity |
| ๐ฅ๏ธ LM Studio | Various open models | Local GUI, easy setup | Development, experimentation |
| โก llama.cpp | GGUF models | Optimized inference | Resource-constrained environments |
| ๐ค Hugging Face | Thousands of models | Open source, diverse | Specialized tasks, research |
| ๐ฌ Cohere | Command, Embed models | Enterprise APIs | Business applications |
| ๐ Together AI | Various open models | Hosted inference | Scalable deployments |
๐ฏ Operation Types & Use Cases
Configure different models for each type of AI operation:
| Operation | Purpose | Recommended Models | Configuration |
|---|---|---|---|
| ๐ Default | General prompt processing | GPT-4, Claude-3-Sonnet | High-quality, balanced |
| ๐ Prompt Enhancement | Improving prompt quality | GPT-4, Claude-3-Opus | Advanced reasoning |
| โก Prompt Optimization | Performance optimization | GPT-3.5-turbo, Gemini Pro | Fast, cost-effective |
| ๐งช Prompt Testing | Testing and validation | GPT-3.5-turbo, local models | Cheap, quick feedback |
| ๐ Model Combining | Ensemble operations | Multiple models | Diversity, reliability |
| ๐ Translation | Language translation | GPT-4, specialized models | Accuracy, cultural context |
| ๐ Summarization | Content summarization | Claude-3-Haiku, Gemini Pro | Concise, structured |
| ๐ฌ Conversation | Chat and dialogue | GPT-3.5-turbo, Claude-3 | Natural, engaging |
| ๐ Question Answering | Q&A tasks | GPT-4, knowledge models | Accurate, comprehensive |
| ๐จ Content Generation | Creative writing | Claude-3, creative models | Original, stylistic |
| ๐ง Code Generation | Programming assistance | GPT-4, CodeLlama, StarCoder | Technical, accurate |
๐๏ธ Modern Tabbed Interface
Access the enhanced AI services configuration through the intuitive tabbed interface:
๐ค Models Tab
- Add Models: Configure new AI models with complete settings
- Model Cards: Visual representation of each model with status indicators
- Health Monitoring: Real-time availability and performance metrics
- Quick Actions: Enable/disable, test, and configure models instantly
โ๏ธ Operations Tab
- Operation Configuration: Set primary and fallback models for each operation type
- Drag & Drop: Intuitive model assignment with visual feedback
- Smart Recommendations: AI-powered suggestions for optimal model selection
- Batch Configuration: Configure multiple operations simultaneously
๐ Providers Tab
- Provider Setup: Configure API keys and endpoints for each provider
- Connection Testing: Validate credentials and connectivity
- Provider Cards: Visual status and configuration overview
- Batch Operations: Configure multiple providers efficiently
๐ Health & Usage Tab
- Health Dashboard: Real-time model availability and performance
- Usage Statistics: Token consumption, costs, and request metrics
- Performance Monitoring: Response times and success rates
- Cost Analysis: Detailed breakdown by model and operation
๐ Quick Setup Guide
1. Access AI Services Configuration
# Navigate to AI Services in the web interface
http://localhost:7860/ai-services/enhanced
2. Add Your First Model
- Click "Add Model" in the Models tab
- Fill model details:
Name: my-gpt-4 Provider: OpenAI Model ID: gpt-4 API Key: your-openai-api-key Display Name: My GPT-4 Model - Configure features: Streaming, function calling, vision support
- Set cost limits: Input/output token costs for budget control
- Save and test the model connection
3. Configure Operations
- Switch to Operations tab
- Select operation type (e.g., Prompt Enhancement)
- Set primary model: Choose your preferred model
- Add fallback models: Configure backup options
- Enable the operation and save configuration
4. Verify Configuration
- Check Health tab for model status
- Run test operations to validate setup
- Monitor usage and adjust as needed
๐ง Advanced Configuration
Model Health Checking
The system continuously monitors model availability:
# Health check results example
{
"model_name": "my-gpt-4",
"healthy": True,
"status": "Healthy",
"response_time": 1.2,
"last_check": "2025-01-08T10:30:00Z",
"success_rate": 99.5
}
Intelligent Model Selection
The system automatically selects the best available model:
- Primary Model: First choice for the operation
- Fallback Chain: Automatic failover to backup models
- Health-Based: Skips unhealthy or unavailable models
- Requirement Matching: Filters by capabilities (vision, streaming, etc.)
- Cost Optimization: Considers cost constraints and budgets
Usage Statistics & Analytics
Comprehensive tracking of AI service usage:
{
"total_requests": 1250,
"total_tokens": 450000,
"total_cost": 12.50,
"average_response_time": 1.8,
"models": {
"my-gpt-4": {
"requests": 800,
"tokens": 320000,
"cost": 9.60,
"avg_response_time": 2.1,
"success_rate": 99.2
}
}
}
๐ API Integration
The enhanced AI services provide a comprehensive REST API:
Core Endpoints
# Get all configured models
GET /api/ai-models/
# Add new model
POST /api/ai-models/
{
"name": "claude-3-opus",
"provider": "anthropic",
"model_id": "claude-3-opus-20240229",
"api_key": "your-api-key"
}
# Update model configuration
PUT /api/ai-models/{model_name}
{
"display_name": "Updated Claude Opus",
"is_enabled": true
}
# Test model health
POST /api/ai-models/{model_name}/test
{
"test_prompt": "Hello, test the model connectivity"
}
# Get operation configurations
GET /api/ai-models/operations
# Update operation configuration
PUT /api/ai-models/operations/{operation_type}
{
"primary_model": "claude-3-opus",
"fallback_models": ["gpt-4", "gemini-pro"]
}
Advanced Endpoints
# Get model recommendations for operation
GET /api/ai-models/recommendations/{operation_type}
# Export complete configuration
POST /api/ai-models/export
# Import configuration
POST /api/ai-models/import
# Get usage statistics
GET /api/ai-models/usage-stats
# Run health checks on all models
POST /api/ai-models/health-check
๐ก Best Practices
Model Selection Strategy
- Cost-Conscious: Use cheaper models (GPT-3.5-turbo, Claude-3-Haiku) for testing and iteration
- Quality-First: Deploy premium models (GPT-4, Claude-3-Opus) for production operations
- Local Privacy: Use local models (Ollama, LM Studio) for sensitive data
- Hybrid Approach: Combine cloud and local models for optimal balance
Operation Configuration
- Default Operations: Configure with your most reliable, balanced model
- Enhancement: Use advanced reasoning models for prompt improvements
- Testing: Use fast, cheap models for validation and debugging
- Translation: Use models specifically trained for multilingual tasks
Performance Optimization
- Health Monitoring: Enable automatic health checks for proactive issue detection
- Fallback Chains: Configure multiple fallback models for high availability
- Cost Budgets: Set spending limits and alerts for budget control
- Usage Analytics: Monitor patterns to optimize model selection
Security & Compliance
- API Key Management: Rotate keys regularly and use environment variables
- Data Privacy: Use local models for sensitive information processing
- Audit Trails: Monitor usage logs for compliance requirements
- Access Control: Configure user permissions and rate limiting
๐จ Troubleshooting
Common Issues
Model Not Responding:
# Check model health
GET /api/ai-models/{model_name}/test
# Common fixes:
- Verify API key is valid and active
- Check API quota and rate limits
- Ensure model ID matches provider's format
- Test network connectivity to provider
Configuration Not Saving:
# Verify database connectivity
# Check browser console for JavaScript errors
# Ensure all required fields are completed
# Try refreshing the page and reconfiguring
High API Costs:
# Monitor usage statistics
GET /api/ai-models/usage-stats
# Optimization strategies:
- Switch to cheaper models for testing operations
- Implement token limits and cost controls
- Use local models for development
- Configure fallback chains with cost-effective options
Performance Issues
- Slow Response Times: Check model health and provider status
- Failed Requests: Verify API credentials and rate limits
- Missing Features: Ensure selected models support required capabilities
- Database Errors: Check SQLite/PostgreSQL connectivity and permissions
๐ Integration Examples
Python Integration
import requests
# Add model via API
model_config = {
"name": "production-gpt-4",
"provider": "openai",
"model_id": "gpt-4",
"api_key": "your-api-key",
"max_context_length": 8192,
"cost_per_1k_input_tokens": 0.01,
"cost_per_1k_output_tokens": 0.03
}
response = requests.post(
"http://localhost:7860/api/ai-models/",
json=model_config
)
# Configure operation
operation_config = {
"primary_model": "production-gpt-4",
"fallback_models": ["gpt-3.5-turbo"],
"is_enabled": True
}
requests.put(
"http://localhost:7860/api/ai-models/operations/default",
json=operation_config
)
Configuration Backup
# Export configuration for backup
curl -X POST http://localhost:7860/api/ai-models/export > ai_config_backup.json
# Import configuration from backup
curl -X POST http://localhost:7860/api/ai-models/import \
-H "Content-Type: application/json" \
-d @ai_config_backup.json
๐ Prompt Management
Create, organize, and manage your AI prompts with powerful tools for optimization and collaboration.
๐ Recent Enhancements
- ๐ Visibility Control: Public/private prompt sharing with granular access control
- ๐จ Enhanced Dashboard: Redesigned dashboard with clean actions and better organization
- ๐ท๏ธ Advanced Tagging: Smart tag management with auto-complete and analytics
- ๐ Real-time Updates: HTMX-powered interface for seamless user experience
- ๐ Multi-language UI: Full internationalization with 10 language support
๐ Quick Start Workflow
graph LR
A[๐ Create] --> B[๐งฎ Calculate] --> C[๐ Optimize] --> D[๐พ Save] --> E[๐ Reuse]
style A fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000
style B fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#000
style C fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
style D fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#000
style E fill:#e1f5fe,stroke:#0277bd,stroke-width:2px,color:#000
โ๏ธ Creating Prompts
Step-by-step process:
- ๐ Navigate to the Prompt Management tab
- ๐ Fill in details:
Name: unique-prompt-name (required) Title: Descriptive title for humans Category: Writing, Analysis, Code, etc. Content: Your actual AI prompt text Tags: comma, separated, keywords - ๐งฎ Check costs with the built-in Token Calculator
- ๐ Optimize using AI-powered suggestions (optional)
- ๐พ Save your prompt to the library
๐ท๏ธ Advanced Tagging System
Intelligent organization and discovery for prompts and templates
The comprehensive tagging system provides powerful categorization and search capabilities across all content types:
๐ฏ Multi-Entity Tag Support
- Unified Tagging: Single tag vocabulary across prompts, templates, and rules
- Cross-Entity Search: Find content by tags regardless of type
- Consistent Display: Visual tag badges with unified styling
- Data Integrity: Tag normalization and validation ensures consistency
๐ Advanced Search Capabilities
graph LR
A["๐ท๏ธ Tag Input"] --> B{"Search Logic"}
B --> C["AND Logic: tag1 + tag2"]
B --> D["OR Logic: tag1 | tag2"]
B --> E["Entity Filter: prompts only"]
C --> F["Precise Results"]
D --> G["Broad Results"]
E --> H["Filtered Results"]
style A fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000
style B fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#000
style F fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
style G fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
style H fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
๐ง Intelligent Auto-Complete
- Real-Time Suggestions: Dynamic tag suggestions as you type
- Existing Tag Detection: Suggest from your existing tag vocabulary
- Fuzzy Matching: Find tags with partial or approximate input
- Smart Limits: Configurable suggestion count for optimal UX
๐ Comprehensive Analytics
Track tag usage and discover insights:
# Popular Tags
python, api, automation, testing, documentation
# Usage Statistics
- Total Tags: 156
- Most Used: "python" (23 items)
- Versatile Tags: "documentation" (prompts + templates)
- Recent: "ai-agents", "rules", "automation"
๐จ Modern UI Components
- Tag Input Component: Modern interface with auto-complete and validation
- Visual Tag Display: Clean, accessible badges with proper spacing
- Interactive Elements: Click-to-remove tags and keyboard navigation
- Mobile Responsive: Touch-friendly interface for all devices
๐ REST API Integration
Complete programmatic access with 6 dedicated endpoints:
GET /api/tags/ # List all tags with usage statistics
GET /api/tags/suggestions # Get tag suggestions for auto-complete
GET /api/tags/analytics # Comprehensive tag analytics and insights
POST /api/tags/search # Advanced tag-based search with filters
GET /api/tags/popular # Most frequently used tags
GET /api/tags/versatile # Tags used across multiple content types
๐งฎ Token Calculator
Understanding AI Costs in Real-Time
graph LR
A[๐ Input: 245 tokens] --> C[๐ Cost: $0.0615]
B[๐ฌ Output: 1,000 tokens] --> C
C --> D[โ ๏ธ Large prompt - Split recommended]
style A fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000
style B fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#000
style C fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#000
style D fill:#ffebee,stroke:#d32f2f,stroke-width:2px,color:#000
Key Features:
- โก Real-time estimation as you type
- ๐ฏ Multi-model support (GPT-4, Claude, Gemini, etc.)
- ๐ Cost breakdown (input vs output costs)
- ๐ก Optimization suggestions for cost reduction
- โ ๏ธ Alert system for expensive prompts
Model Comparison Quick Reference:
| Model | ๐ฐ Cost | โก Speed | ๐ฏ Quality | ๐ Best For |
|---|---|---|---|---|
| GPT-4 | $$$ | Slow | Highest | Complex reasoning, code |
| GPT-3.5 | $ | Fast | Good | General tasks, chat |
| Claude Opus | $$$ | Medium | Excellent | Analysis, writing |
| Gemini Pro | $$ | Medium | Very Good | Research, multimodal |
๐ Prompt Library & Organization
Smart Organization System:
graph LR
A[๐ Library] --> B[๐ Writing<br/>35 prompts]
A --> C[๐ป Code<br/>41 prompts]
A --> D[๐ Analysis<br/>29 prompts]
style A fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000
style B fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#000
style C fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
style D fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#000
Features:
- ๐ Smart search - Find prompts by name, content, or tags
- ๐ท๏ธ Category filtering - Organize by type and purpose
- โญ Favorites system - Quick access to your most-used prompts
- ๐ Usage analytics - See which prompts perform best
- ๐ Version history - Track prompt evolution over time
๐จ Custom Prompt Templates
Standardize and Optimize Your Prompt Creation
AI Prompt Manager supports custom templates that help you create consistent, high-quality prompts across different domains and use cases.
graph LR
A[๐ Template] --> B[๐ง Variables] --> C[๐ฏ Applied] --> D[โจ Generated]
style A fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000
style B fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#000
style C fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
style D fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#000
๐ Available Templates
| Template | Purpose | Variables | Use Case |
|---|---|---|---|
| ๐ง Default | General prompt creation | {content}, {category}, {tags}, {user_context} |
Standard prompts |
| ๐ Enhancement | Prompt optimization | {original_prompt}, {enhancement_instructions}, {target_model} |
Improving existing prompts |
| ๐ผ Business | Commercial use cases | Business metrics, ROI focus, stakeholder alignment | Marketing, sales, strategy |
| โ๏ธ Technical | Development & engineering | Code quality, best practices, security | Software development |
| ๐จ Creative | Content generation | Style, tone, audience considerations | Writing, marketing copy |
| ๐ Analytical | Data & research | Methodology, evidence-based reasoning | Analysis, research |
๐ง Template Configuration
Set template preferences via environment variables:
# Use custom prompt template
export PROMPT_TEMPLATE="/path/to/templates/my_template.txt"
# Use custom enhancement template
export ENHANCEMENT_TEMPLATE="/path/to/templates/my_enhancement.txt"
# Templates directory is automatically scanned for .txt files
# Default location: templates/
โ๏ธ Creating Custom Templates
Templates support variable substitution using {variable_name} syntax:
# Example business template
"""
Create a business-focused prompt for {category} use case:
Business Context: {user_context}
Key Areas: {tags}
Prompt Content: {content}
Business Guidelines:
- Focus on measurable outcomes and ROI
- Consider target audience and market impact
- Include implementation timeline
- Address stakeholder requirements
"""
๐ฏ Using Templates in Prompts
- ๐ Create or edit a prompt in the main interface
- ๐จ Select template from the available options
- ๐ Fill variables - Content, category, tags, context
- ๐๏ธ Preview the templated result
- ๐พ Save your structured prompt
โก Template Features
- ๐ Variable Validation - Ensures all required variables are provided
- ๐ Template Library - Pre-built templates for common use cases
- ๐จ Custom Templates - Create organization-specific templates
- ๐ Multi-Language - Templates work with translation features
- ๐ Version Control - Track template evolution over time
๐ก Best Practices
- Be Specific: Include domain-specific terminology and concepts
- Provide Context: Explain the intended use case for the prompts
- Test Templates: Experiment with different templates for your use cases
- Use Variables: Leverage template variables for flexible content insertion
- Organize Templates: Group templates by domain or use case
๐ Integration
Templates integrate seamlessly with other features:
- ๐งฎ Token Calculator - Estimate costs for templated prompts
- ๐ AI Optimization - Optimize templated prompts with LangWatch
- ๐งฉ Prompt Builder - Combine templated prompts for complex workflows
- ๐ API Access - Access templates programmatically via REST API
๐ค Speech Dictation
Revolutionize prompt creation with advanced speech-to-text functionality featuring AI-powered enhancement, multi-language support, and seamless integration with the prompt editor.
โก Quick Start with Speech Dictation
graph LR
A[๐ค Speak] --> B[๐ Recognize] --> C[โจ Enhance] --> D[๐ Translate] --> E[๐พ Save]
style A fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000
style B fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#000
style C fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
style D fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#000
style E fill:#e1f5fe,stroke:#0277bd,stroke-width:2px,color:#000
๐ฏ Key Features
๐ค Advanced Speech Recognition
- Web Speech API Integration: Browser-based speech recognition with no external dependencies
- 12 Language Support: English, Spanish, French, German, Italian, Portuguese, Dutch, Russian, Chinese, Japanese, Korean, Arabic
- Pause/Resume Control: Full control over dictation sessions with real-time status indicators
- High Accuracy: Optimized for technical content and AI prompt terminology
โจ AI-Powered Text Enhancement
- Intelligent Filler Removal: Automatically removes "um", "uh", "you know", "basically", etc.
- Grammar Correction: Fixes punctuation, capitalization, and sentence structure
- AI Optimization: Uses configured AI services for advanced text enhancement
- Fallback Processing: Robust regex-based enhancement when AI services are unavailable
๐ Multi-Language Translation
- Instant Translation: Dictate in any supported language and translate to English
- Context Awareness: Maintains meaning and technical terminology during translation
- Batch Processing: Translate multiple prompts simultaneously
๐ง Seamless Integration
- Form Integration: Works directly in prompt creation and editing forms
- Real-time Updates: Live character count and preview as you dictate
- Mobile Optimized: Touch-friendly controls for mobile devices
- Accessibility: Full keyboard navigation and screen reader support
๐ How to Use Speech Dictation
1. ๐ Start Dictating
1. Navigate to Prompt Creation/Editing
2. Click the ๐ค Dictate button
3. Allow microphone permissions when prompted
4. Begin speaking your prompt content
2. ๐๏ธ Control Your Session
โข ๐ด Click to start/stop recording
โข โธ๏ธ Pause/Resume as needed
โข ๐ Select your dictation language
โข ๐๏ธ Monitor real-time status updates
3. โจ Enhance Your Text
โข Click โจ Enhance to clean up dictated text
โข Remove filler words automatically
โข Improve grammar and punctuation
โข Apply AI-powered optimizations
4. ๐ Translate if Needed
โข Dictate in your native language
โข Click ๐ Translate to convert to English
โข Maintain technical terminology
โข Preserve original meaning
๐ฏ Best Practices for Speech Dictation
๐ข Speaking Techniques:
- Clear Articulation: Speak clearly and at moderate pace
- Technical Terms: Spell out complex technical terms if needed
- Punctuation: Say "period", "comma", "question mark" for punctuation
- Pause Management: Use natural pauses between sentences
๐๏ธ Session Management:
- Short Segments: Dictate in 1-2 minute segments for best accuracy
- Review Before Enhancement: Check raw transcription before AI processing
- Language Consistency: Stick to one language per dictation session
- Environment: Use in quiet environments for optimal recognition
โจ Enhancement Tips:
- AI Enhancement: Use for complex technical content
- Basic Enhancement: Use for simple filler word removal
- Review Results: Always review enhanced text before saving
- Iterative Process: Enhance multiple times if needed
๐ง Technical Implementation
Browser Compatibility:
- โ Chrome/Chromium (Recommended)
- โ Edge (Windows)
- โ Safari (macOS/iOS)
- โ ๏ธ Firefox (Limited support)
API Endpoints:
# Text Enhancement
POST /enhance-text
Content-Type: application/x-www-form-urlencoded
text=dictated_content&type=dictation
# Translation
POST /translate
Content-Type: application/x-www-form-urlencoded
text=content&target_lang=en
Security & Privacy:
- ๐ No Data Storage: Speech processing happens in browser
- ๐ก๏ธ Secure Transmission: All API calls use HTTPS
- ๐ Authentication: Requires valid user session
- ๐ฑ Local Processing: Web Speech API processes audio locally
๐งช Testing Coverage
The speech dictation system includes comprehensive testing:
- ๐ Unit Tests: 19 tests covering text enhancement logic
- ๐ Integration Tests: 10 tests for API endpoints and workflows
- ๐ญ E2E Tests: 20 browser automation tests with Playwright
- ๐ Security Tests: Bandit security scanning passed
- โ Code Quality: Full flake8, black, isort compliance
๐จ UI Components
๐ค Dictation Controls:
<!-- Modern speech controls integrated into forms -->
<button id="speech-btn" class="speech-dictation-btn">
๐ค Dictate
</button>
<select id="speech-language">
<option value="en-US">English (US)</option>
<option value="es-ES">Espaรฑol</option>
<!-- 10 more languages -->
</select>
โจ Enhancement Interface:
- Clean, intuitive buttons for enhancement and translation
- Real-time status indicators and progress feedback
- Mobile-responsive design with touch-friendly controls
- Accessibility features for keyboard navigation
๐ Multi-Language Support
Supported Dictation Languages:
๐บ๐ธ English (US/UK) ๐ช๐ธ Spanish (ES/MX)
๐ซ๐ท French (FR/CA) ๐ฉ๐ช German (DE)
๐ฎ๐น Italian (IT) ๐ต๐น Portuguese (PT/BR)
๐ณ๐ฑ Dutch (NL) ๐ท๐บ Russian (RU)
๐จ๐ณ Chinese (ZH) ๐ฏ๐ต Japanese (JA)
๐ฐ๐ท Korean (KO) ๐ธ๐ฆ Arabic (AR)
Translation Features:
- Automatic language detection
- Context-aware translation for AI prompts
- Technical terminology preservation
- Bulk translation capabilities
๐ AI-Powered Optimization
Transform good prompts into great prompts with AI-powered analysis and improvement suggestions from multiple optimization services.
โก The Optimization Process
graph LR
A[๐ Original] --> B[๐ Analysis] --> C[๐ก Improvements] --> D[โจ Optimized]
style A fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000
style B fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#000
style C fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
style D fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#000
What gets optimized:
- ๐ฏ Clarity - Remove ambiguity, add specific instructions
- ๐ Structure - Logical flow and organization
- ๐จ Effectiveness - Better response quality and accuracy
- ๐ Context - Appropriate background information
- ๐ง Specificity - Replace vague terms with concrete directions
๐ ๏ธ Optimization Services
Choose from multiple AI optimization providers:
graph LR
A[๐ LangWatch<br/>โญโญโญโญโญ] --> B[๐ PromptPerfect<br/>โญโญโญโญ] --> C[๐งช Built-in<br/>โญโญโญ]
style A fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
style B fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000
style C fill:#f1f8e9,stroke:#689f38,stroke-width:2px,color:#000
๐ Optimization Dashboard
Real-time optimization results:
graph LR
A[๐ Score: 78.5/100<br/>+23.5 improvement] --> B[โ
Accept]
A --> C[๐ Retry]
A --> D[โ Reject]
style A fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
style B fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
style C fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#000
style D fill:#ffebee,stroke:#d32f2f,stroke-width:2px,color:#000
๐ฏ Optimization Workflow
- ๐ Create or edit a prompt in the editor
- โ๏ธ Configure settings:
- Optimization context (purpose description)
- Target AI model (GPT-4, Claude, etc.)
- Goals (clarity, effectiveness, structure)
- ๐ Click "Optimize" - Analysis takes 5-15 seconds
- ๐ Review results with score and detailed improvements
- โ Accept, retry, or manual edit based on suggestions
๐ง Service Configuration
Quick setup for optimization services:
# LangWatch (Recommended for enterprise)
PROMPT_OPTIMIZER=langwatch
LANGWATCH_API_KEY=your_api_key
LANGWATCH_PROJECT_ID=your_project
# PromptPerfect (Great for creative prompts)
PROMPT_OPTIMIZER=promptperfect
PROMPTPERFECT_API_KEY=your_api_key
# Built-in (No setup required)
PROMPT_OPTIMIZER=builtin
๐ ๏ธ Optimization Services
AI Prompt Manager supports multiple optimization backends for flexibility and reliability:
๐ LangWatch (Recommended)
- Quality: โญโญโญโญโญ Enterprise-grade optimization
- Features: Advanced analytics, A/B testing, real-time monitoring
- Best For: Production applications, complex prompts
- Setup: Requires API key and project ID
๐ PromptPerfect
- Quality: โญโญโญโญ Specialized prompt refinement
- Features: Multi-model optimization, instant feedback
- Best For: Creative prompts, image generation
- Setup: API key required
๐ง LangSmith
- Quality: โญโญโญโญ LangChain ecosystem integration
- Features: Version control, collaborative editing, testing
- Best For: LangChain applications, team workflows
- Setup: LangSmith account and API key
โก Helicone
- Quality: โญโญโญ Observability-focused optimization
- Features: Performance monitoring, cost tracking
- Best For: Production monitoring, debugging
- Setup: Helicone account and API key
๐งช Built-in Optimizer (Default)
- Quality: โญโญโญ Rule-based improvements
- Features: No external dependencies, instant results
- Best For: Development, testing, offline use
- Setup: No configuration required
๐ง Configuration
Configure your preferred optimization service via environment variables:
LangWatch Configuration
# LangWatch (Recommended for production)
PROMPT_OPTIMIZER=langwatch
LANGWATCH_API_KEY=your_langwatch_api_key
LANGWATCH_PROJECT_ID=your_project_id
LANGWATCH_ENDPOINT=https://api.langwatch.ai # Optional
PromptPerfect Configuration
# PromptPerfect
PROMPT_OPTIMIZER=promptperfect
PROMPTPERFECT_API_KEY=your_promptperfect_api_key
LangSmith Configuration
# LangSmith (LangChain)
PROMPT_OPTIMIZER=langsmith
LANGSMITH_API_KEY=your_langsmith_api_key
LANGSMITH_PROJECT=your_project_name
Helicone Configuration
# Helicone
PROMPT_OPTIMIZER=helicone
HELICONE_API_KEY=your_helicone_api_key
HELICONE_APP_NAME=ai-prompt-manager
Built-in Optimizer (Default)
# Built-in optimizer (no external service required)
PROMPT_OPTIMIZER=builtin
# No additional configuration needed
๐ Optimization Features
Smart Analysis
- Prompt Length Analysis: Identifies overly long or short prompts
- Complexity Detection: Recognizes overly complex or repetitive content
- Structure Assessment: Evaluates logical flow and organization
- Clarity Metrics: Measures instruction specificity and precision
Multi-Model Support
The optimizer adapts suggestions based on your target AI model:
- GPT-4: Focus on complex reasoning and detailed instructions
- GPT-3.5-turbo: Emphasize clarity and conciseness
- Claude: Optimize for conversational flow and context
- Gemini: Balance creativity with structure
Optimization Goals
Customize optimization focus:
- Clarity: Remove ambiguity, add specific instructions
- Effectiveness: Improve response quality and accuracy
- Conciseness: Remove redundancy while maintaining completeness
- Structure: Add organization and logical flow
- Creativity: Enhance creative and open-ended prompts
๐ฏ Best Practices
Writing Prompts for Optimization
- Provide Context: Add background information about your use case
- Be Specific: Include details about desired output format
- Set Clear Goals: Define what you want the AI to accomplish
- Use Examples: Include sample inputs/outputs when relevant
Optimization Workflow
Original Prompt โ Configure Settings โ Run Optimizer โ Review Results โ Test โ Deploy
Iterative Improvement
- Start with basic prompts and optimize iteratively
- Test optimized prompts with real use cases
- Use A/B testing to compare versions
- Track performance metrics over time
๐ Advanced Features
Batch Optimization
Optimize multiple prompts simultaneously:
# Coming soon: Batch optimization API
POST /api/optimize/batch
{
"prompts": ["prompt1", "prompt2", "prompt3"],
"settings": { "target_model": "gpt-4", "goals": ["clarity", "effectiveness"] }
}
Custom Optimization Rules
Define organization-specific optimization patterns:
# Custom optimization rules (advanced)
custom_rules = {
"add_role_definition": True,
"require_output_format": True,
"max_length": 2000,
"industry_context": "healthcare"
}
Optimization History
Track improvement over time:
- View optimization history for each prompt
- Compare versions and see improvement metrics
- Export optimization reports for analysis
๐ Performance Metrics
Optimization Score Breakdown
- 0-30: Poor - Requires significant improvement
- 30-60: Fair - Some optimization needed
- 60-80: Good - Well-structured prompt
- 80-95: Excellent - Highly optimized prompt
- 95-100: Perfect - No improvements needed
Improvement Categories
- +5-10 points: Minor improvements (formatting, clarity)
- +10-20 points: Moderate improvements (structure, specificity)
- +20-30 points: Major improvements (complete restructuring)
- +30+ points: Significant transformation (role definition, context)
๐ Multi-Language Support
The prompt optimizer works seamlessly with the translation system:
- Translate First: Use "๐ Translate to English" for non-English prompts
- Optimize: Run optimization on English text for best results
- Translate Back: Optionally translate optimized prompt back to original language
๐งช Testing the Optimizer
You can test the prompt optimization system using the included test script:
# Test with built-in optimizer (no API keys required)
python tests/integration/test_langwatch_integration.py
# Test with specific service (set environment variables first)
PROMPT_OPTIMIZER=langwatch LANGWATCH_API_KEY=your_key python tests/integration/test_langwatch_integration.py
# Test service switching
PROMPT_OPTIMIZER=promptperfect PROMPTPERFECT_API_KEY=your_key python tests/integration/test_langwatch_integration.py
The test script will:
- โ Check service availability and configuration
- โ Test simple and complex prompt optimization
- โ Verify error handling for edge cases
- โ Test different optimization goals
- โ Show before/after comparisons and scoring
๐จ Troubleshooting
Common Issues
Optimization Not Working:
- Check API key configuration in environment variables
- Verify internet connectivity for external services
- Try built-in optimizer as fallback
Poor Optimization Results:
- Provide more context about prompt purpose
- Try different optimization goals
- Use multiple optimization services for comparison
Service Unavailable:
- Built-in optimizer always available as backup
- Check service status pages for external providers
- Configure multiple services for redundancy
Error Messages
API_KEY_MISSING: Set required environment variablesSERVICE_UNAVAILABLE: External service is down, use alternativePROMPT_TOO_LONG: Shorten prompt or split into multiple partsRATE_LIMIT_EXCEEDED: Wait and retry, or upgrade service plan
๐ Examples
Example 1: Basic Prompt Optimization
Original: "Write about dogs"
Optimized: "You are a knowledgeable pet expert. Write a comprehensive
guide about dogs that covers the following topics:
1. Popular dog breeds and their characteristics
2. Basic care requirements (feeding, exercise, grooming)
3. Training tips for new dog owners
4. Health considerations and veterinary care
Please structure your response with clear headings and provide
practical, actionable advice for both new and experienced dog owners."
Improvement: +45 points (clarity, structure, specificity)
Example 2: Technical Prompt Optimization
Original: "Explain API design"
Optimized: "You are a senior software architect with expertise in
API design. Explain REST API design best practices for a junior
developer, covering:
Step 1: Core principles (statelessness, resource-based URLs)
Step 2: HTTP methods and status codes usage
Step 3: Authentication and security considerations
Step 4: Documentation and versioning strategies
Provide concrete examples for each concept and explain common
pitfalls to avoid. Format your response as a structured tutorial
with code examples where appropriate."
Improvement: +38 points (role definition, structure, examples)
๐ Integration with Other Features
Token Calculator Integration
- Optimization results show token impact
- Compare costs before/after optimization
- Optimize for specific token budgets
Prompt Builder Integration
- Optimize combined prompts after building
- Apply optimization to individual components
- Create optimized prompt templates
API Integration
# Optimize via API
POST /api/prompts/optimize
{
"content": "your prompt here",
"context": "analysis task",
"target_model": "gpt-4",
"goals": ["clarity", "effectiveness"]
}
๐งฉ Prompt Builder
Create sophisticated, multi-layered prompts by combining existing ones with an intuitive drag-and-drop interface.
๐ฏ What is Prompt Building?
The power of combination:
graph LR
A[๐ Prompt A] --> B[๐ Prompt B] --> C[๐ Prompt C] --> D[๐ Super Prompt]
style A fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000
style B fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#000
style C fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#000
style D fill:#e8f5e8,stroke:#388e3c,stroke-width:3px,color:#000
Transform individual prompts into comprehensive workflows:
- ๐ Combine multiple prompts into sophisticated sequences
- ๐จ Choose from 4 templates for different combination styles
- ๐๏ธ Live preview - See results before saving
- ๐ฑ๏ธ Drag-and-drop interface - Visual, intuitive building
- ๐ Seamless integration - Edit combined prompts in main editor
๐๏ธ Builder Interface
graph LR
A[๐ Available<br/>Prompts] --> B[๐ฏ Selected<br/>Prompts] --> C[๐๏ธ Preview] --> D[๐ Combine]
style A fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000
style B fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
style C fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#000
style D fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#000
๐จ Template Gallery
Choose the right combination style for your needs:
| Template | Icon | Description | Best For |
|---|---|---|---|
| ๐ Sequential | 1โ2โ3 |
Step-by-step flow | Tutorials, processes |
| ๐ Sections | [A][B][C] |
Organized sections | Reports, documentation |
| ๐๏ธ Layered | Base+Layer1+Layer2 |
Context building | Complex reasoning |
| ๐จ Custom | {template} |
Your own format | Specialized needs |
โก Quick Building Workflow
- ๐ Access the Prompt Builder tab
- ๐ฑ๏ธ Drag prompts from Available to Selected area
- ๐ Arrange order by dragging within Selected area
- ๐จ Choose template - Sequential, Sections, Layered, or Custom
- ๐๏ธ Preview your combined prompt in real-time
- ๐ Combine to generate the final prompt
- ๐ Edit in main editor for final tweaks
๐ Step-by-Step Guide
Step 1: Browse Available Prompts
- The Available Prompts panel shows all your existing prompts as cards
- Each card displays:
- Prompt name and category
- Preview of the content
- Character count and type (regular or enhancement)
- Visual indicators for prompt types
Step 2: Select Prompts to Combine
- Drag prompts from the Available section to the Selected area
- Alternative: Click prompts to add them to your selection
- Reorder: Drag selected prompts to change their order
- Remove: Drag prompts out of the selected area to remove them
Step 3: Choose a Combination Template
| Template | Icon | Description | Best For |
|---|---|---|---|
| Sequential | ๐ | Combines prompts one after another with clear separation | Simple prompt chaining |
| Sections | ๐ | Creates distinct sections with headers for each prompt | Structured, multi-part prompts |
| Layered | ๐๏ธ | Builds context in layers with base + additional layers | Complex context building |
| Custom | ๐จ | Uses your own formatting template with placeholders | Advanced customization |
Step 4: Customize Options
- Custom Separator: Choose how prompts are separated (default:
\n\n) - Add Numbers: Automatically number each prompt section
- Template-Specific Options: Additional settings based on selected template
Step 5: Preview Your Creation
- The Preview panel shows exactly how your combined prompt will look
- Real-time updates as you change templates or options
- Character count and source prompt tracking
Step 6: Finalize and Edit
- Click ๐ Combine Prompts to generate the final result
- Click ๐ Open in Editor to transfer the combined prompt to the main editor
- Continue editing in the main interface with full editing capabilities
๐จ Template Details
๐ Sequential Template
Combines prompts in order with simple separation:
1. First prompt content here
2. Second prompt content here
3. Third prompt content here
Options:
- โ Add sequence numbers
- โ Custom separator between prompts
๐ Sections Template
Creates clearly defined sections with headers:
## First Prompt Title
First prompt content here
---
## Second Prompt Title
Second prompt content here
---
## Third Prompt Title
Third prompt content here
Best for:
- Multi-part instructions
- Structured analysis prompts
- Documentation generation
๐๏ธ Layered Template
Builds context progressively:
Base Context:
Your foundational prompt here
Layer 1:
Additional context or instructions
Layer 2:
Further refinements or specifications
Instructions: Integrate all layers above into a cohesive response.
Best for:
- Complex reasoning tasks
- Context-heavy prompts
- Graduated instruction sets
๐จ Custom Template
Use your own formatting with placeholders:
Template: "Context: {content}\nSource: {name}\nCategory: {category}"
Available Placeholders:
{content}- The prompt content{name}- Prompt name{title}- Prompt title{category}- Prompt category{tags}- Prompt tags
โก Advanced Features
Smart Metadata Generation
When you combine prompts, the system automatically generates:
- Suggested Name:
Combined_PromptA+PromptBorCombined_3_Prompts_20250108 - Suggested Title: Based on prompt categories and content
- Combined Category:
Combinedor inherited from source prompts - Merged Tags: All unique tags from source prompts plus
combinedandX-parttags
Validation and Error Prevention
- Minimum Requirements: Must select at least 2 prompts
- Duplicate Detection: Prevents selecting the same prompt twice
- Length Limits: Warns if combined prompt exceeds 50,000 characters
- Template Validation: Ensures template compatibility with selected prompts
Search and Filter
- Search Bar: Find prompts by name, title, or content
- Category Filter: Show only prompts from specific categories
- Refresh: Update available prompts after creating new ones
๐ Multi-Language Support
The Prompt Builder is fully localized in all 10 supported languages:
| Language | Prompt Builder | Available Prompts | Template Options |
|---|---|---|---|
| ๐บ๐ธ English | Prompt Builder | Available Prompts | Sequential, Sections, Layered, Custom |
| ๐ช๐ธ Spanish | Constructor de Prompts | Prompts Disponibles | Secuencial, Secciones, Por Capas, Personalizado |
| ๐ซ๐ท French | Constructeur de Prompts | Prompts Disponibles | Sรฉquentiel, Sections, En Couches, Personnalisรฉ |
| ๐ฉ๐ช German | Prompt-Builder | Verfรผgbare Prompts | Sequenziell, Abschnitte, Geschichtet, Benutzerdefiniert |
| ๐จ๐ณ Chinese | ๆ็คบๆๅปบๅจ | ๅฏ็จๆ็คบ | ้กบๅบ, ๅๆฎต, ๅๅฑ, ่ชๅฎไน |
| ๐ฏ๐ต Japanese | ใใญใณใใใใซใใผ | ๅฉ็จๅฏ่ฝใชใใญใณใใ | ้ ๆฌก, ใปใฏใทใงใณ, ้ๅฑค, ใซในใฟใ |
| ๐ต๐น Portuguese | Construtor de Prompts | Prompts Disponรญveis | Sequencial, Seรงรตes, Em Camadas, Personalizado |
| ๐ท๐บ Russian | ะะพะฝััััะบัะพั ะัะพะผะฟัะพะฒ | ะะพัััะฟะฝัะต ะัะพะผะฟัั | ะะพัะปะตะดะพะฒะฐัะตะปัะฝัะน, ะกะตะบัะธะธ, ะกะปะพะธัััะน, ะะพะปัะทะพะฒะฐัะตะปััะบะธะน |
| ๐ธ๐ฆ Arabic | ู ูุดุฆ ุงูู ุทุงูุจุงุช | ุงูู ุทุงูุจุงุช ุงูู ุชุงุญุฉ | ุชุณูุณูู, ุฃูุณุงู , ุทุจูุงุช, ู ุฎุตุต |
| ๐ฎ๐ณ Hindi | เคชเฅเคฐเฅเคฎเฅเคชเฅเค เคฌเคฟเคฒเฅเคกเคฐ | เคเคชเคฒเคฌเฅเคง เคชเฅเคฐเฅเคฎเฅเคชเฅเคเฅเคธ | เคเฅเคฐเคฎเคฟเค, เคเคเคก, เคชเคฐเคคเคฆเคพเคฐ, เคเคธเฅเคเคฎ |
๐ก Use Cases and Examples
Example 1: Content Creation Workflow
- Select prompts: "Blog Introduction", "SEO Keywords", "Call to Action"
- Template: Sections
- Result: Complete blog post structure with intro, SEO-optimized content, and CTA
Example 2: Analysis Framework
- Select prompts: "Context Analysis", "SWOT Framework", "Recommendations"
- Template: Layered
- Result: Comprehensive analysis prompt with progressive depth
Example 3: Creative Writing
- Select prompts: "Character Development", "Setting Description", "Plot Points"
- Template: Sequential
- Result: Complete creative writing framework
Example 4: Technical Documentation
- Select prompts: "Requirements Gathering", "Technical Specs", "User Stories"
- Template: Sections with custom separator
- Result: Structured technical documentation prompt
๐ง Tips and Best Practices
Prompt Selection Tips
- โ Start with complementary prompts that work well together
- โ Consider prompt length - very long prompts may overwhelm the combination
- โ Mix prompt types - combine different categories for richer results
- โ Use enhancement prompts strategically to improve overall quality
Template Selection Guide
- Sequential: Simple combinations, tutorials, step-by-step processes
- Sections: Reports, analyses, structured content
- Layered: Complex reasoning, context-heavy tasks
- Custom: Specialized formatting, integration with external systems
Optimization Strategies
- ๐ฏ Preview frequently to catch issues early
- ๐ฏ Test with smaller combinations first
- ๐ฏ Use meaningful names for easy identification later
- ๐ฏ Leverage tags to organize and find combined prompts
๐จ Troubleshooting
Common Issues
"No prompts selected" Error:
- Make sure you've dragged at least 2 prompts to the Selected area
- Check that prompts are actually visible in the Selected section
"Combined prompt too long" Warning:
- Remove some prompts or choose shorter ones
- Use more concise source prompts
- Consider splitting into multiple smaller combinations
Preview not updating:
- Click the "๐๏ธ Refresh Preview" button
- Check that you've selected a valid template
- Ensure selected prompts are properly loaded
Drag-and-drop not working:
- Refresh the page and try again
- Use click-to-select as an alternative
- Check browser compatibility (modern browsers recommended)
Performance Tips
- Limit simultaneous combinations to avoid browser slowdown
- Clear old selections before starting new combinations
- Use shorter prompts for faster preview updates
- Save frequently to avoid losing work
๐ Integration with Other Features
Token Calculator Integration
- Combined prompts automatically work with the Token Calculator
- Estimate costs for your combined prompts before using them
- Compare token usage across different combination templates
LangWatch Optimization
- Use combined prompts with LangWatch optimization
- Improve combined prompts with AI-powered suggestions
- Optimize the final result after combination
Translation Feature
- Combined prompts work with the translation feature
- Translate combined prompts to English for better AI processing
- Maintain formatting across translations
API Access
- Combined prompts are saved like regular prompts
- Access via API endpoints once saved
- Include in automated workflows and integrations
๐ Project Management
Organize and orchestrate your AI workflows with the comprehensive Project Management system. Projects allow you to group related prompts, rules, and resources together while providing advanced features for collaboration, cost tracking, and execution management.
๐ฏ What are Projects?
Projects are containers for organizing AI workflows that bring together:
- ๐ Prompts: Instructions and templates for AI interactions
- ๐ Rules: Guidelines and constraints for AI behavior
- ๐ฅ Team Members: Collaborative access and permissions
- ๐ Analytics: Token usage, cost tracking, and performance metrics
- ๐ Workflows: Sequenced execution and automation
graph TB
A[๐ Project Container] --> B[๐ Prompts Collection]
A --> C[๐ Rules Library]
A --> D[๐ฅ Team Access]
A --> E[๐ Cost Analytics]
A --> F[๐ Execution Engine]
B --> G[๐ Unified Workflow]
C --> G
D --> G
E --> G
F --> G
style A fill:#e3f2fd,stroke:#1976d2,stroke-width:3px,color:#000
style G fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
๐๏ธ Project Types
Choose the project type that matches your workflow:
๐ฏ General Projects
- Best for: Mixed workflows, research, general AI tasks
- Structure: Flexible organization with custom prompt/rule combinations
- Use cases: Content creation, analysis, brainstorming
๐ Sequenced Projects
- Best for: Multi-step processes, complex workflows
- Structure: Ordered execution with dependencies
- Use cases: Document generation, data processing pipelines
๐ LLM Comparison Projects
- Best for: Testing different AI models, A/B testing
- Structure: Parallel execution across multiple models
- Use cases: Quality assessment, model evaluation
๐ป Developer Projects
- Best for: Code generation, technical documentation
- Structure: Developer-focused templates and rules
- Use cases: API documentation, code review, testing
๐ Core Features
๐ Project Creation
# Access project creation through the web interface
http://localhost:7860/projects/new
Required Information:
- Name: Unique identifier for the project
- Title: Human-readable display name
- Description: Project purpose and scope
- Type: Project structure and behavior
- Visibility: Private or shared access
๐ฅ Team Collaboration
- ๐ Ownership Transfer: Change project ownership seamlessly
- ๐ค Member Management: Add/remove team members with role-based access
- ๐ Permission Control: Fine-grained access control (owner, editor, viewer)
- ๐ Activity Tracking: Monitor member contributions and changes
๐ท๏ธ Advanced Tagging
- ๐ท๏ธ Project Tags: Organize projects by category, client, or purpose
- ๐ Aggregate Tags: Automatically collect tags from all project content
- ๐ Smart Search: Find projects by tags, content, or metadata
- ๐ Tag Analytics: Discover popular tags and usage patterns
๐ฐ Cost Management
- ๐งฎ Token Calculation: Real-time cost estimation for project content
- ๐ Usage Analytics: Track token consumption over time
- ๐ต Budget Tracking: Monitor costs per project and team member
- ๐ Cost Optimization: Identify expensive prompts and optimize
๐ง Project Operations
Creating a Project
- Navigate to Projects: Click "Projects" in the main navigation
- Create New: Click "New Project" or "Create Project"
- Fill Details: Enter name, title, description, and select type
- Set Permissions: Choose visibility and initial team members
- Save: Create the project and start adding content
Managing Content
graph LR
A[๐ Project] --> B[โ Add Prompts]
A --> C[โ Add Rules]
A --> D[๐ท๏ธ Update Tags]
A --> E[โ๏ธ Project Settings]
B --> F[โ
Content Library]
C --> F
D --> F
E --> F
style A fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000
style F fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
Project Execution
- ๐ Sequential Workflow: Execute prompts in defined order
- โก Parallel Processing: Run multiple prompts simultaneously
- ๐ง Variable Substitution: Dynamic content with project-specific variables
- ๐ Result Aggregation: Combine outputs from multiple prompts
๐ ๏ธ Advanced Features
๐ Ownership Transfer
Transfer project ownership while maintaining data integrity:
# Via web interface at project settings
# Or through API endpoint
POST /api/projects/{id}/transfer-ownership
{
"new_owner_user_id": "target-user-id"
}
Features:
- โ Seamless Transfer: No data loss or permission disruption
- ๐ Security Validation: Only owners can transfer ownership
- ๐ Audit Trail: Track ownership changes with timestamps
- ๐ฅ Member Updates: Automatic role adjustments for all members
๐ Analytics Dashboard
- ๐ Token Usage: Track consumption patterns and trends
- ๐ฐ Cost Analysis: Detailed breakdowns by prompt, rule, and time period
- ๐ฅ Team Performance: Member contribution statistics
- ๐ท๏ธ Tag Distribution: Popular tags and categorization insights
๐ API Integration
Full REST API support for project management:
# Get project details
GET /api/projects/{id}
# Update project tags
PUT /api/projects/{id}/tags
{"tags": "production,ai-agent,optimization"}
# Calculate project costs
GET /api/projects/{id}/token-cost
# Get project permissions
GET /api/projects/{id}/permissions
๐ก Best Practices
๐ฏ Project Organization
- ๐ Logical Grouping: Group related prompts and rules together
- ๐ท๏ธ Consistent Tagging: Use standardized tags across projects
- ๐ Clear Naming: Use descriptive names and titles
- ๐ฅ Appropriate Access: Set correct permissions from the start
๐ฐ Cost Optimization
- ๐ Regular Monitoring: Check token usage and costs frequently
- ๐ฏ Targeted Prompts: Keep prompts focused and specific
- ๐ Template Reuse: Share common patterns across projects
- ๐ Performance Tracking: Monitor and improve prompt efficiency
๐ฅ Team Collaboration
- ๐ Role Clarity: Assign appropriate roles (owner, editor, viewer)
- ๐ Documentation: Keep project descriptions up-to-date
- ๐ Regular Reviews: Periodically review project content and permissions
- ๐ Activity Monitoring: Track team contributions and engagement
๐ Getting Started
- Navigate to Projects: Go to
/projectsin the web interface - Create Your First Project: Click "New Project" and fill out the form
- Add Content: Include relevant prompts and rules
- Invite Team Members: Add collaborators with appropriate permissions
- Execute Workflows: Use the project execution interface to run your workflows
- Monitor Performance: Check analytics and optimize based on usage patterns
The Project Management system transforms individual prompts and rules into powerful, collaborative AI workflows that scale with your organization's needs.
๐ API Access
Dual-Server Architecture: The API system uses a dedicated FastAPI server running alongside the main web interface for optimal performance and separation of concerns.
๐๏ธ Architecture Overview
graph LR
A[๐ Client Request] --> B{Port Router}
B -->|:7860| C[๐ฑ Web UI Server]
B -->|:7861| D[๐ FastAPI API Server]
C --> E[Web Interface]
D --> F[REST API Endpoints]
D --> G[๐ Swagger Docs]
style A fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000
style C fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#000
style D fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
style E fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#000
style F fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#000
style G fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#000
๐ Enabling API Access
Start with API enabled:
python run.py --with-api --port 7860
This starts two servers:
- ๐ฅ๏ธ Web UI Server:
http://localhost:7860(Modern web interface) - ๐ API Server:
http://localhost:7861(FastAPI endpoints)
๐ API Endpoints
Base URL: http://localhost:7861 (main port + 1)
Core Endpoints:
# Health check
GET /health
# Returns: {"status": "healthy", "timestamp": "2025-01-01T12:00:00"}
# Service information
GET /info
# Returns: {"service": "ai-prompt-manager", "version": "1.0.0"}
# API root with endpoint listing
GET /
# Returns: {"message": "AI Prompt Manager API", "endpoints": {...}}
Documentation Endpoints:
# Interactive Swagger UI
GET /docs
# ReDoc documentation
GET /redoc
# OpenAPI schema
GET /openapi.json
๐ง Development Workflow
1. Start the application:
python run.py --with-api --debug --port 7860
2. Access services:
- UI: http://localhost:7860
- API: http://localhost:7861
- API Docs: http://localhost:7861/docs
3. Test endpoints:
# Test health endpoint
curl http://localhost:7861/health
# Test with pretty JSON
curl -s http://localhost:7861/info | python -m json.tool
๐ Authentication (Future Enhancement)
Current API endpoints are public for development. Production authentication will be added via:
- Navigate to Account Settings โ API Tokens (UI feature)
- Create token with expiration
- Use Bearer token authentication:
curl -H "Authorization: Bearer apm_your_token_here" \ http://localhost:7861/health
๐ Port Configuration
Default Ports:
- Main port: 7860 (UI)
- API port: 7861 (Main + 1)
Custom Ports:
# Custom port configuration
python run.py --with-api --port 8080
# UI: http://localhost:8080
# API: http://localhost:8081
Docker Deployment:
# Expose both ports
docker run -p 7860:7860 -p 7861:7861 \
-e ENABLE_API=true \
ghcr.io/makercorn/ai-prompt-manager:latest
โ๏ธ Configuration
Environment Setup
Create a .env file with your settings:
# Application Mode
MULTITENANT_MODE=true # Enable multi-tenant mode (default: true)
ENABLE_API=false # Enable dual-server API architecture (default: false)
# Server Configuration
SERVER_HOST=0.0.0.0 # Server host (default: 0.0.0.0)
SERVER_PORT=7860 # Main server port (UI server, API will be PORT+1)
# Database Configuration
DB_TYPE=sqlite # Database type: sqlite or postgres (default: sqlite)
DB_PATH=prompts.db # SQLite database path (default: prompts.db)
POSTGRES_DSN=postgresql://user:pass@localhost:5432/dbname
# Authentication & Security
SECRET_KEY=your-secure-secret-key # JWT signing secret (auto-generated if not set)
LOCAL_DEV_MODE=true # Enable local development features (default: false)
# SSO/ADFS Integration (optional)
SSO_ENABLED=false
SSO_CLIENT_ID=your-application-id
SSO_CLIENT_SECRET=your-client-secret
SSO_AUTHORITY=https://login.microsoftonline.com/your-tenant-id
SSO_REDIRECT_URI=http://localhost:7860/auth/callback
# Entra ID (Azure AD) Authentication (optional)
ENTRA_ID_ENABLED=false
ENTRA_CLIENT_ID=your-entra-client-id
ENTRA_CLIENT_SECRET=your-entra-client-secret
ENTRA_TENANT_ID=your-azure-tenant-id
ENTRA_REDIRECT_URI=http://localhost:7860/auth/entra-callback
ENTRA_SCOPES=openid email profile User.Read
# Azure AI Services (optional)
AZURE_AI_ENABLED=false
AZURE_AI_ENDPOINT=https://your-azure-ai-endpoint.cognitiveservices.azure.com
AZURE_AI_KEY=your-azure-ai-key
AZURE_OPENAI_ENDPOINT=https://your-openai-resource.openai.azure.com
AZURE_OPENAI_KEY=your-azure-openai-key
AZURE_OPENAI_VERSION=2024-02-15-preview
# Prompt Optimization Services (optional)
PROMPT_OPTIMIZER=langwatch # Service: langwatch, promptperfect, langsmith, helicone, builtin
LANGWATCH_API_KEY=your-langwatch-api-key
LANGWATCH_PROJECT_ID=ai-prompt-manager
PROMPTPERFECT_API_KEY=your-promptperfect-key
LANGSMITH_API_KEY=your-langsmith-key
LANGSMITH_PROJECT=your-project-name
HELICONE_API_KEY=your-helicone-key
# Development & Debugging
DEBUG=false # Enable debug mode (default: false)
Complete Environment Variable Reference
| Variable | Description | Default | Command Line Override |
|---|---|---|---|
MULTITENANT_MODE |
Enable multi-tenant architecture | true |
--single-user / --multi-tenant |
ENABLE_API |
Enable REST API endpoints | false |
--with-api |
SERVER_HOST |
Server bind address | 0.0.0.0 |
--host HOST |
SERVER_PORT |
Server port | 7860 |
--port PORT |
DB_TYPE |
Database type (sqlite/postgres) | sqlite |
- |
DB_PATH |
SQLite database file path | prompts.db |
- |
POSTGRES_DSN |
PostgreSQL connection string | - | - |
SECRET_KEY |
JWT signing secret | auto-generated | - |
LOCAL_DEV_MODE |
Enable development features | true |
- |
SSO_ENABLED |
Enable SSO authentication | false |
- |
SSO_CLIENT_ID |
SSO application ID | - | - |
SSO_CLIENT_SECRET |
SSO client secret | - | - |
SSO_AUTHORITY |
SSO authority URL | - | - |
PROMPT_OPTIMIZER |
Optimization service to use | builtin |
- |
LANGWATCH_API_KEY |
LangWatch API key | - | - |
LANGWATCH_PROJECT_ID |
LangWatch project ID | ai-prompt-manager |
- |
PROMPTPERFECT_API_KEY |
PromptPerfect API key | - | - |
LANGSMITH_API_KEY |
LangSmith API key | - | - |
HELICONE_API_KEY |
Helicone API key | - | - |
ENTRA_ID_ENABLED |
Enable Entra ID authentication | false |
- |
ENTRA_CLIENT_ID |
Entra ID application ID | - | - |
ENTRA_CLIENT_SECRET |
Entra ID client secret | - | - |
ENTRA_TENANT_ID |
Azure tenant ID | - | - |
ENTRA_REDIRECT_URI |
Entra ID callback URL | /auth/entra-callback |
- |
AZURE_AI_ENABLED |
Enable Azure AI services | false |
- |
AZURE_AI_ENDPOINT |
Azure AI Studio endpoint | - | - |
AZURE_AI_KEY |
Azure AI Studio key | - | - |
AZURE_OPENAI_ENDPOINT |
Azure OpenAI endpoint | - | - |
AZURE_OPENAI_KEY |
Azure OpenAI key | - | - |
AZURE_OPENAI_VERSION |
Azure OpenAI API version | 2024-02-15-preview |
- |
DEBUG |
Enable debug logging | false |
--debug |
PUBLIC_SHARE |
Enable public sharing | false |
--share |
Database Options
SQLite (Development):
- Zero setup required
- File-based storage
- Single-user friendly
PostgreSQL (Production):
- Better performance
- Multi-user support
- Enterprise features
AI Service Integration
Supported AI providers:
- OpenAI (GPT-4, GPT-3.5-turbo)
- Azure OpenAI (Enterprise OpenAI models)
- Azure AI Studio (Phi-3, Mistral, and other Azure models)
- LM Studio (Local models)
- Ollama (Self-hosted)
- Llama.cpp (Local inference)
Configure in the application's AI Service Settings.
๐ต Azure AI Integration
Overview
AI Prompt Manager provides comprehensive support for Microsoft Azure services, including:
- Azure OpenAI: Enterprise-grade OpenAI models with enhanced security and compliance
- Azure AI Studio: Access to Phi-3, Mistral, and other Azure-hosted AI models
- Entra ID: Modern Azure Active Directory authentication with Microsoft Graph integration
๐ Entra ID Authentication Setup
Entra ID (formerly Azure Active Directory) provides enterprise-grade authentication with seamless Microsoft Graph API integration.
1. Azure App Registration
-
Navigate to Azure Portal โ Azure Active Directory โ App registrations
-
Create new registration:
- Name:
AI Prompt Manager - Supported account types:
Accounts in this organizational directory only - Redirect URI:
http://localhost:7860/auth/entra-callback(for local dev)
- Name:
-
Configure Authentication:
- Add redirect URIs for production environments
- Enable
ID tokensunder Authentication โ Implicit grant and hybrid flows
-
API Permissions:
- Add
Microsoft Graphpermissions:openid(Sign users in)email(Read user email)profile(Read user profile)User.Read(Read user information)
- Add
-
Certificates & secrets:
- Create new client secret
- Copy the secret value (save immediately - you won't see it again)
2. Environment Configuration
# Enable Entra ID authentication
ENTRA_ID_ENABLED=true
ENTRA_CLIENT_ID=12345678-1234-1234-1234-123456789012
ENTRA_CLIENT_SECRET=your-client-secret-value
ENTRA_TENANT_ID=your-azure-tenant-id
ENTRA_REDIRECT_URI=http://localhost:7860/auth/entra-callback
# Optional: Customize scopes (default shown)
ENTRA_SCOPES=openid email profile User.Read
3. Multi-Tenant Configuration
For organizations with multiple tenants:
# Production example
ENTRA_ID_ENABLED=true
ENTRA_CLIENT_ID=your-production-client-id
ENTRA_TENANT_ID=your-production-tenant-id
ENTRA_REDIRECT_URI=https://prompts.yourcompany.com/auth/entra-callback
# Development
ENTRA_REDIRECT_URI=http://localhost:7860/auth/entra-callback
๐ค Azure AI Services Setup
Azure OpenAI Configuration
- Create Azure OpenAI resource in Azure Portal
- Deploy models (e.g., GPT-4, GPT-3.5-turbo)
- Get endpoint and keys from resource overview
# Azure OpenAI configuration
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com
AZURE_OPENAI_KEY=your-azure-openai-key
AZURE_OPENAI_VERSION=2024-02-15-preview
Azure AI Studio Configuration
- Create Azure AI Studio workspace
- Deploy models (Phi-3, Mistral, etc.)
- Configure endpoints and authentication
# Azure AI Studio configuration
AZURE_AI_ENABLED=true
AZURE_AI_ENDPOINT=https://your-ai-endpoint.cognitiveservices.azure.com
AZURE_AI_KEY=your-azure-ai-key
๐ Supported Azure Models
Azure OpenAI Models
azure-gpt-4- GPT-4 with Azure enterprise featuresazure-gpt-35-turbo- GPT-3.5 Turbo with Azure security
Azure AI Studio Models
azure-ai-phi-3- Microsoft Phi-3 small language modelazure-ai-mistral- Mistral models hosted on Azure
๐ง Testing Configuration
# Test Azure connectivity
python -c "
from auth_manager import AuthManager
auth = AuthManager()
# Test Entra ID configuration
print('Entra ID enabled:', auth.is_entra_id_enabled())
print('Authentication methods:', auth.get_authentication_methods())
# Test Azure AI configuration
print('Azure AI enabled:', auth.is_azure_ai_enabled())
azure_config = auth.get_azure_ai_config()
print('Azure config:', azure_config)
# Validate credentials (requires network access)
valid, message = auth.validate_azure_credentials()
print(f'Azure validation: {valid} - {message}')
"
๐ Production Deployment
Security Considerations
- Use Azure Key Vault for secret management
- Configure proper RBAC permissions
- Enable Azure Monitor for logging
- Use managed identities where possible
Example Production Configuration
# Production environment variables
ENTRA_ID_ENABLED=true
ENTRA_CLIENT_ID=${AZURE_CLIENT_ID}
ENTRA_CLIENT_SECRET=${AZURE_CLIENT_SECRET}
ENTRA_TENANT_ID=${AZURE_TENANT_ID}
ENTRA_REDIRECT_URI=https://prompts.yourcompany.com/auth/entra-callback
AZURE_AI_ENABLED=true
AZURE_OPENAI_ENDPOINT=${AZURE_OPENAI_ENDPOINT}
AZURE_OPENAI_KEY=${AZURE_OPENAI_KEY}
# Use PostgreSQL for production
DB_TYPE=postgres
POSTGRES_DSN=${DATABASE_URL}
๐ Troubleshooting
Common Entra ID Issues
Authentication fails with "invalid_client":
- Verify
ENTRA_CLIENT_IDandENTRA_CLIENT_SECRET - Check redirect URI matches exactly
- Ensure app registration is not expired
No email returned from Entra ID:
- Verify
emailscope is requested - Check API permissions include
User.Read - User might not have email attribute set
Common Azure AI Issues
Azure OpenAI "Invalid API key":
- Check
AZURE_OPENAI_KEYis correct - Verify endpoint URL format
- Ensure API version is supported
Model not found errors:
- Verify model deployment names
- Check Azure AI Studio model availability
- Confirm endpoint supports requested model
Token Calculator Issues
Azure models not showing costs:
- Azure pricing included for common models
- Custom model pricing can be configured
- Check model name matches supported patterns
๐ Migration from Generic SSO
If migrating from generic SSO to Entra ID:
# Disable generic SSO
SSO_ENABLED=false
# Enable Entra ID
ENTRA_ID_ENABLED=true
# ... other Entra ID settings
# Existing users will be matched by email
# SSO ID will be updated to Entra ID object ID
๐ข Multi-Tenant Features
For Organizations
- Complete Data Isolation - Each tenant's data is separate
- User Management - Add users with different roles
- Admin Dashboard - Monitor usage and manage tenants
- SSO Integration - Connect with existing authentication
User Roles
- Admin: Full system access, user management
- User: Create and manage prompts, API access
- Readonly: View prompts only, no modifications
Default Credentials
For local development:
- Tenant:
localhost - Email:
admin@localhost - Password:
admin123
๐ Development
Development Commands
# Install dependencies
poetry install
# Run application in different modes
python run.py # Default: Multi-tenant
python run.py --single-user # Single-user mode
python run.py --with-api # Multi-tenant + API
python run.py --single-user --with-api # Single-user + API
# Development options
python run.py --debug # Enable debug mode
python run.py --share # Enable public sharing
python run.py --port 8080 # Custom port
python run.py --help # Show all options
# Testing
python tests/integration/test_mt_install.py # Multi-tenant setup
python tests/integration/test_langwatch_integration.py # LangWatch features
python tests/integration/test_standalone_api.py # API integration
Docker Development
# Build and run
docker build -t ai-prompt-manager .
docker run -p 7860:7860 ai-prompt-manager
# With environment variables
docker run -p 7860:7860 \
-e MULTITENANT_MODE=false \
-e ENABLE_API=true \
ai-prompt-manager
# With PostgreSQL
docker-compose up -d
Architecture
Core Components:
run.py- Universal launcher (single-user + multi-tenant)web_app.py- Modern FastAPI web interfaceprompt_data_manager.py- Database abstraction with tenant isolationauth_manager.py- Authentication and user managementtoken_calculator.py- Token estimation enginelangwatch_optimizer.py- Prompt optimizationapi_endpoints_enhanced.py- Enhanced REST API implementationapi_token_manager.py- Secure API token management
Database Schema
Multi-Tenant Architecture:
tenants
โโโ id (UUID)
โโโ name
โโโ subdomain
โโโ max_users
โโโ is_active
โโโ created_at
users
โโโ id (UUID)
โโโ tenant_id (FK)
โโโ email (unique per tenant)
โโโ password_hash
โโโ first_name, last_name
โโโ role (admin|user|readonly)
โโโ sso_id (optional)
โโโ is_active
โโโ created_at
โโโ last_login
prompts
โโโ id
โโโ tenant_id (FK) - ensures tenant isolation
โโโ user_id (FK) - tracks ownership
โโโ name (unique per tenant)
โโโ title, content, category, tags
โโโ is_enhancement_prompt
โโโ created_at
โโโ updated_at
config
โโโ id
โโโ tenant_id (FK)
โโโ user_id (FK)
โโโ key, value - stores user/tenant settings
โโโ created_at
api_tokens
โโโ id (UUID)
โโโ user_id (FK)
โโโ tenant_id (FK)
โโโ name
โโโ token_hash
โโโ token_prefix
โโโ expires_at (optional)
โโโ last_used
โโโ created_at
Security Architecture
Multi-Layer Security:
- PBKDF2 Password Hashing: Secure password storage with salt
- JWT Session Tokens: Stateless authentication with expiration
- Tenant Row-Level Security: Complete data isolation between organizations
- Role-Based Access Control: Granular permission system
- API Token Management: Secure programmatic access
- Session Validation: Automatic token validation and renewal
Data Isolation:
- All database queries include tenant_id filtering
- Users cannot access data outside their tenant
- Admin users can manage their tenant only
- Complete separation of configurations and prompts
๐ Production Deployment
Security Checklist
- Change default
SECRET_KEY - Set
LOCAL_DEV_MODE=false - Use PostgreSQL database
- Configure HTTPS/TLS
- Set up proper SSO/ADFS
- Configure firewall rules
- Implement backup procedures
- Monitor application logs
Production Docker
# Set environment variables
export SECRET_KEY="your-production-secret-key"
export SSO_ENABLED="true"
export MULTITENANT_MODE="true"
export ENABLE_API="true"
# Deploy with published images
docker-compose -f docker-compose.prod.yml up -d
# Single command with all options
docker run -p 7860:7860 \
-e MULTITENANT_MODE=true \
-e ENABLE_API=true \
-e SECRET_KEY="your-production-secret" \
-e DB_TYPE=postgres \
-e POSTGRES_DSN="postgresql://user:pass@db:5432/prompts" \
ghcr.io/makercorn/ai-prompt-manager:latest
Available Images:
ghcr.io/makercorn/ai-prompt-manager:latest- Latest development buildghcr.io/makercorn/ai-prompt-manager:stable- Latest stable releaseghcr.io/makercorn/ai-prompt-manager:v1.0.0- Specific tagged releases
Multi-Platform Support: All images support both linux/amd64 and linux/arm64 architectures.
๐ Quick Reference
โก Essential Commands
| Task | Command | Description |
|---|---|---|
| ๐ Start App | python run.py |
Default multi-tenant mode |
| ๐ค Single User | python run.py --single-user |
Personal use mode |
| ๐ With API | python run.py --with-api |
Enable REST endpoints |
| ๐ณ Docker | docker run -p 7860:7860 ghcr.io/makercorn/ai-prompt-manager |
Container deployment |
| ๐ฆ PyPI | pip install promptman && python -m promptman |
Package installation |
| ๐ง Help | python run.py --help |
Show all options |
๐ Multi-Language Quick Access
| Language | Code | Environment Variable | URL Parameter |
|---|---|---|---|
| English | en |
DEFAULT_LANGUAGE=en |
?lang=en |
| Spanish | es |
DEFAULT_LANGUAGE=es |
?lang=es |
| French | fr |
DEFAULT_LANGUAGE=fr |
?lang=fr |
| German | de |
DEFAULT_LANGUAGE=de |
?lang=de |
| Chinese | zh |
DEFAULT_LANGUAGE=zh |
?lang=zh |
| Japanese | ja |
DEFAULT_LANGUAGE=ja |
?lang=ja |
๐งฉ Prompt Builder Shortcuts
| Action | Method | Tip |
|---|---|---|
| Add Prompts | Drag from Available โ Selected | Or click to select |
| Reorder | Drag within Selected area | Order affects output |
| Remove | Drag out or click X | Undo with Ctrl+Z |
| Preview | Auto-updates on changes | ๐๏ธ Refresh if needed |
| Templates | ๐ Sequential, ๐ Sections, ๐๏ธ Layered, ๐จ Custom | Choose based on use case |
๐ง Configuration Quick Setup
# Essential .env settings
MULTITENANT_MODE=true # Teams/organizations
ENABLE_API=true # Developer access
DB_TYPE=postgres # Production database
SECRET_KEY=secure-key # JWT security
# AI Services
PROMPT_OPTIMIZER=langwatch
LANGWATCH_API_KEY=your_key
TRANSLATION_SERVICE=openai
OPENAI_API_KEY=your_key
๐จ Emergency Commands
# Reset admin password
python -c "from auth_manager import AuthManager; auth = AuthManager(); auth.reset_admin_password()"
# Check system health
curl http://localhost:7860/api/health
# Database backup
cp prompts.db prompts.db.backup
# View logs
tail -f application.log
๐ง Troubleshooting
๐จ Common Issues & Quick Fixes
๐ Application Won't Start
# Check port availability
lsof -i :7860
# Try different port
python run.py --port 8080
# Check Python version
python --version # Requires 3.12+
๐๏ธ Database Issues
# SQLite permission errors
chmod 664 prompts.db
chown $USER:$USER prompts.db
# PostgreSQL connection
psql -h localhost -U username -d dbname # Test connection
๐ Authentication Problems
# Reset admin password (emergency)
python -c "
from auth_manager import AuthManager
auth = AuthManager('prompts.db')
auth.create_user('tenant-id', 'admin@localhost', 'newpassword', 'Admin', 'User', 'admin')
"
# Check tenant configuration
python -c "
from auth_manager import AuthManager
auth = AuthManager('prompts.db')
tenants = auth.get_all_tenants()
for t in tenants: print(f'Tenant: {t.name} ({t.subdomain})')
"
๐ Network & Access Issues
# Check if service is running
curl http://localhost:7860/api/health
# Expected: {"status": "healthy"}
# Test with debug mode
python run.py --debug
# Allow external access
python run.py --host 0.0.0.0
๐ณ Docker Issues
# Check container logs
docker logs ai-prompt-manager
# Test database connectivity
docker exec -it ai-prompt-manager python -c "
from prompt_data_manager import PromptDataManager
data = PromptDataManager('prompts.db')
print('Database connection successful')
"
๐ค AI Service Issues
# Test optimization service
python tests/integration/test_langwatch_integration.py
# Verify API keys
python -c "
import os
print('LangWatch:', 'Set' if os.getenv('LANGWATCH_API_KEY') else 'Missing')
print('OpenAI:', 'Set' if os.getenv('OPENAI_API_KEY') else 'Missing')
"
๐ Getting Help
- ๐ Documentation: Check this README for detailed guides
- ๐ Bug Reports: GitHub Issues
- ๐ฌ Community: Join discussions for community support
- ๐ง Self-Service: Use the troubleshooting commands above
๐ Additional Resources
Testing
Comprehensive Test Suite:
# Install test dependencies
poetry install --with dev
# ๐๏ธ New Architecture Tests
python tests/integration/test_new_prompt_architecture.py # New architecture validation
python tests/integration/test_new_architecture_integration.py # Component integration
python -c "
# Test new architecture imports
import sys; sys.path.insert(0, 'src')
from src.core.config.settings import AppConfig
from src.prompts.services.prompt_service import PromptService
from src.auth.models.user import User
print('โ
New architecture components working!')
"
# ๐ง Integration Tests
python tests/integration/test_mt_install.py # Multi-tenant setup and UI creation
python tests/integration/test_standalone_api.py # API integration
python tests/integration/test_langwatch_integration.py # Prompt optimization features
python tests/integration/test_api_integration.py # Full API test suite
# ๐ Component Testing
python -c "
from prompt_data_manager import PromptDataManager
from auth_manager import AuthManager
# Test database initialization
auth = AuthManager('test.db')
data = PromptDataManager('test.db', tenant_id='test', user_id='test')
print('โ
Core components working correctly!')
# Cleanup
import os
os.remove('test.db')
"
# ๐ข Multi-tenant Isolation Testing
python -c "
from auth_manager import AuthManager
auth = AuthManager('test_isolation.db')
# Create two tenants
tenant1_id = auth.create_tenant('Company A', 'company-a', 100)[1]
tenant2_id = auth.create_tenant('Company B', 'company-b', 50)[1]
print('โ
Tenant isolation test passed')
"
# ๐ Test Different Launcher Modes
python run.py --help # Show all options
MULTITENANT_MODE=false python run.py & # Start in single-user mode
sleep 2 && pkill -f "python run.py" # Stop test server
Docker Testing:
# ๐ณ Comprehensive Docker Testing
./scripts/docker-test.sh # Full Docker validation suite
# ๐งช Manual Docker Testing
docker build -t ai-prompt-manager-test . # Test build process
docker run --rm -p 7860:7860 ai-prompt-manager-test # Test single container
# ๐๏ธ Test Development Stack
docker-compose up -d # PostgreSQL + Redis + App
docker-compose logs app # Check application logs
curl http://localhost:7860/api/health # Verify health endpoint
# ๐ญ Test Production Stack
docker-compose -f docker-compose.prod.yml up -d # Production configuration
curl http://localhost:7860/api/health # Verify health endpoint
# ๐ Test Multi-Platform Images
docker pull ghcr.io/makercorn/ai-prompt-manager:latest # Pull latest image
docker run -p 7860:7860 ghcr.io/makercorn/ai-prompt-manager:latest # Test pre-built image
# ๐ Container Validation
docker exec ai-prompt-manager-app-1 python -c "
import sys; sys.path.insert(0, '/app/src')
from src.prompts.services.prompt_service import PromptService
import auth_manager
from run import main
print('โ
All components available in container')
"
CI/CD Pipeline
- Automated Testing - 21 test files with comprehensive unit and integration coverage
- Docker Publishing - GitHub Container Registry with multi-platform support (linux/amd64, linux/arm64)
- Release Management - Automated PyPI publishing and Docker image releases
- Security - Sigstore/Cosign signing for supply chain security and container verification
๐ Setup Guide: See Deployment Automation for complete workflow configuration instructions.
Release Process
The project uses automated releases that create both Python packages and Docker images:
๐ Creating a Release:
# Semantic versioning via GitHub Actions (recommended)
# Go to Actions โ Semantic Version Release โ Run workflow
# Select version type: patch (0.3.2 โ 0.3.3), minor (0.3.2 โ 0.4.0), or major (0.3.2 โ 1.0.0)
# Or using the release script (legacy)
./scripts/create-release.sh
# Manual process (legacy)
git tag v1.0.0
git push origin v1.0.0
๐ฏ Semantic Versioning Workflow Features:
- โ Automatic Version Bumping: Choose patch, minor, or major version increments
- โ Poetry Integration: Automatic pyproject.toml version updates
- โ Changelog Integration: Extracts and formats changelog content for releases
- โ Multi-Platform Docker: Builds and signs images for linux/amd64 and linux/arm64
- โ PyPI Publishing: Automatic package publishing for stable releases
- โ Release Flexibility: Support for pre-releases and draft releases
๐ฆ Release Artifacts:
- Python Packages: Wheel and source distributions
- Docker Images: Multi-platform containers (linux/amd64, linux/arm64)
- Source Archives: Complete source with installation scripts
- Documentation: Release manifests and installation guides
๐ Security Features:
- SHA256 checksums for all packages
- Signed Docker images with Cosign
- Reproducible and auditable builds
๐ณ Docker Images:
# Available tags with multi-platform support (linux/amd64, linux/arm64):
ghcr.io/makercorn/ai-prompt-manager:latest # Latest development build
ghcr.io/makercorn/ai-prompt-manager:stable # Latest stable release
ghcr.io/makercorn/ai-prompt-manager:v1.0.0 # Specific version tags
# All images are signed with Sigstore/Cosign for security verification
# Verify with: cosign verify --certificate-identity-regexp='.*' \
# --certificate-oidc-issuer-regexp='.*' ghcr.io/makercorn/ai-prompt-manager:latest
Note: Docker registry names must be lowercase. The release workflow automatically converts repository names to comply with Docker registry requirements.
Troubleshooting
Common Issues and Solutions:
๐ง Database Connection Issues
# SQLite permission errors
chmod 664 prompts.db
chown user:group prompts.db
# PostgreSQL connection errors
psql -h localhost -U username -d dbname # Test connection
export POSTGRES_DSN="postgresql://user:pass@host:port/db"
๐ Authentication Problems
# Reset admin password (emergency)
python -c "
from auth_manager import AuthManager
auth = AuthManager('prompts.db')
auth.create_user('tenant-id', 'admin@localhost', 'newpassword', 'Admin', 'User', 'admin')
"
# Check tenant configuration
python -c "
from auth_manager import AuthManager
auth = AuthManager('prompts.db')
tenants = auth.get_all_tenants()
for t in tenants: print(f'Tenant: {t.name} ({t.subdomain})')
"
๐ Network and Port Issues
# Check if port is in use
lsof -i :7860
netstat -tulpn | grep 7860
# Test application startup
python run.py --single-user --debug
๐ณ Docker Issues
# Check container logs
docker logs ai-prompt-manager
# Test database connectivity
docker exec -it ai-prompt-manager python -c "
from prompt_data_manager import PromptDataManager
data = PromptDataManager('prompts.db')
print('Database connection successful')
"
๐จ Emergency Recovery
# Backup database
cp prompts.db prompts.db.backup
# Reset to clean state (CAUTION: Loses all data)
rm prompts.db
python -c "from auth_manager import AuthManager; AuthManager('prompts.db')"
Support
- ๐ Documentation: Comprehensive guides and API reference in this README
- ๐ Issues: Report bugs and request features via GitHub Issues
- ๐ฌ Community: Join discussions and share prompts
- ๐ง Troubleshooting: See troubleshooting section above for common solutions
- ๐ Testing: Use provided test scripts to verify functionality
๐ License
Non-Commercial License - This software is licensed for non-commercial use only.
Usage Rights
- โ Personal use - Individual, educational, and research purposes
- โ Non-profit organizations - For non-commercial activities
- โ Academic institutions - Research and educational use
- โ Commercial use - Business operations, revenue generation, or profit
- โ Selling or licensing - Without explicit commercial license agreement
Commercial Licensing
For commercial use, please contact the copyright holder to obtain a separate commercial license agreement.
See the LICENSE file for complete details.
๐ Secure โข ๐งฎ Cost-Aware โข ๐ Optimized โข ๐ค AI-Powered โข ๐งฉ Builder-Enhanced โข ๐ API-Ready
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file promptman-0.6.0.tar.gz.
File metadata
- Download URL: promptman-0.6.0.tar.gz
- Upload date:
- Size: 415.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19dbb0a7ce0a33bb0172c6548b5a9b02aca398d49fa0d7f1c4a74ad443552d7c
|
|
| MD5 |
27e83dd55c50014102089e28b7d9bf15
|
|
| BLAKE2b-256 |
472567e368ad718aba872b42582e127b4cc4b0d9063e0ccb72ceb6eb35989196
|
Provenance
The following attestation bundles were made for promptman-0.6.0.tar.gz:
Publisher:
release.yml on MakerCorn/ai-prompt-manager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
promptman-0.6.0.tar.gz -
Subject digest:
19dbb0a7ce0a33bb0172c6548b5a9b02aca398d49fa0d7f1c4a74ad443552d7c - Sigstore transparency entry: 270568648
- Sigstore integration time:
-
Permalink:
MakerCorn/ai-prompt-manager@54265eaed8faed163857ced46af2111f44eb2c0e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/MakerCorn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@54265eaed8faed163857ced46af2111f44eb2c0e -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file promptman-0.6.0-py3-none-any.whl.
File metadata
- Download URL: promptman-0.6.0-py3-none-any.whl
- Upload date:
- Size: 243.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2e4d4ae0014bc557f331912130aeac578e250b46d5f5d9520b25b62d7b95fde
|
|
| MD5 |
9949f745eb26d131d4f33e827e9989fc
|
|
| BLAKE2b-256 |
bf8412d04a1bd4ee0c686747eee39d4068eec75370961a4bf4e4274dbd328a80
|
Provenance
The following attestation bundles were made for promptman-0.6.0-py3-none-any.whl:
Publisher:
release.yml on MakerCorn/ai-prompt-manager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
promptman-0.6.0-py3-none-any.whl -
Subject digest:
e2e4d4ae0014bc557f331912130aeac578e250b46d5f5d9520b25b62d7b95fde - Sigstore transparency entry: 270568655
- Sigstore integration time:
-
Permalink:
MakerCorn/ai-prompt-manager@54265eaed8faed163857ced46af2111f44eb2c0e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/MakerCorn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@54265eaed8faed163857ced46af2111f44eb2c0e -
Trigger Event:
workflow_dispatch
-
Statement type: