Skip to main content

Ultimate Prompt Generator - A CLI tool for generating LLM prompts

Project description

Ultimate Prompt Generator (UPG) 🤖

A powerful CLI tool for generating, managing, and reusing prompts for different LLM providers. Currently supports OpenAI and Anthropic models with smart defaults.

Join Russian Speaking Telegram Channel | Watch Russian Video Tutorial

🌟 Features

  • 🔄 Multi-Provider Support:
    • OpenAI (default: gpt-4o)
    • Anthropic (default: claude-3-sonnet-20240229)
  • 📝 Smart Prompt Generation:
    • Generate high-quality prompts for various tasks
    • Create prompts with or without variables
    • Automatic variable detection and validation
  • 💾 Prompt Management:
    • Save and reuse generated prompts
    • Tag and categorize prompts
    • Search through saved prompts
  • 🔑 Secure Configuration: Safe storage of API keys and preferences

🚀 Quick Start

# Install with pip
pip install upg-cli

# Or install with Poetry
poetry add upg-cli

Initial Configuration

# Configure your preferred LLM provider
upg config --provider openai --api-key YOUR_API_KEY

Basic Usage

# Generate a simple prompt without variables
upg generate "Write a story about a space traveler"

# Generate a prompt with variables
upg generate "Create a Python function to calculate fibonacci numbers" \
    -v FUNCTION_NAME \
    -v ARGS \
    --save --name "python-fibonacci" \
    --tag python --tag math

# Use a saved prompt
upg answer python-fibonacci \
    -v FUNCTION_NAME "fibonacci" \
    -v ARGS "n: int"

📋 Detailed Usage Guide

Prompt Generation

You can generate prompts both with and without variables:

# Simple prompt without variables
upg generate "Write a poem about autumn"

# Prompt with variables
upg generate "Write a {GENRE} story about {TOPIC}" \
    -v GENRE \
    -v TOPIC

# Save generated prompt
upg generate "Your task description" [options]

Options:
  --provider TEXT           LLM provider to use (openai/anthropic)
  -v, --variable TEXT      Variable names for the prompt (optional)
  -o, --output FILENAME    Save prompt to file
  -s, --save              Save prompt for later use
  --name TEXT             Name for saved prompt
  -d, --description TEXT  Description for saved prompt
  -t, --tag TEXT         Tags for categorizing the prompt

Using Prompts

For prompts without variables, you can use them directly:

# Using a simple prompt without variables
upg answer simple-story

# Using a prompt with variables
upg answer story-template \
    -v GENRE "mystery" \
    -v TOPIC "lost artifact"

More Examples

Simple Prompts (No Variables)

# Generate a blog post outline
upg generate "Create an outline for a blog post about machine learning basics" \
    --save --name "blog-outline" \
    --tag content --tag blog

# Generate coding guidelines
upg generate "Write Python code style guidelines for a team" \
    --save --name "python-guidelines" \
    --tag python --tag guidelines

# Use saved prompts
upg answer blog-outline
upg answer python-guidelines

Prompts with Variables

# Generate a template for API documentation
upg generate "Write documentation for a REST API endpoint" \
    -v ENDPOINT \
    -v METHOD \
    --save --name "api-docs" \
    --tag api

# Use the template
upg answer api-docs \
    -v ENDPOINT "/users" \
    -v METHOD "POST"

🔧 Configuration

UPG provides flexible configuration options through the config command group:

Provider Configuration

# Configure a provider
upg config provider --provider openai --api-key YOUR_API_KEY --model gpt-4o

# Or configure interactively
upg config provider

Default Provider

# Set default provider
upg config set-default openai

# Switch to using Anthropic by default
upg config set-default anthropic

View Configuration

# Show current configuration
upg config show

Example output:

Current Configuration:
----------------------------------------
Default Provider: openai

Configured Providers:

OPENAI:
  Model: gpt-4o
  Temperature: 1.0
  API Key: sk-abcd...wxyz

ANTHROPIC:
  Model: claude-3-sonnet-20240229
  Temperature: 1.0
  API Key: sk-ant...4321

Configuration Storage

The tool stores configuration in ~/.config/upg/config.json:

  • API keys for LLM providers
  • Default provider settings
  • Provider-specific configurations
  • Saved prompts and their metadata

🗃️ Prompt Storage

Prompts are stored with:

  • Unique name
  • Description
  • Variables list (if any)
  • Tags for categorization
  • Creation and update timestamps

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.


⭐ Found this useful? Star the repo and share it!

Join Telegram Community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

upg_cli-1.0.0.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

upg_cli-1.0.0-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file upg_cli-1.0.0.tar.gz.

File metadata

  • Download URL: upg_cli-1.0.0.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.11 Linux/6.8.0-1021-azure

File hashes

Hashes for upg_cli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 aa8730be8b5db6562e57113c8331767ed9c113faee397e84cd7c3528bf1c7fa7
MD5 a53d6baf3958bf5c9f38846445e6eace
BLAKE2b-256 115b8e759bb9430039c7cd4cabf1f3c9cb75677a50990a2ceb645cf1a20912d0

See more details on using hashes here.

File details

Details for the file upg_cli-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: upg_cli-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.11 Linux/6.8.0-1021-azure

File hashes

Hashes for upg_cli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f2f007b36c006ede1e5c0ee7668a865639352bf1cb31841193537a830300f43
MD5 cf59b4c472f89c0b42ea99b091b35154
BLAKE2b-256 39957bde3015be92a6fdad0d77a8b4b4c30fffaf04d03e1d4664478a51520d05

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page