Skip to main content

Your words. Their way. Perform style and audience adaptation for your prompts.

Project description

๐ŸฆฉVibePrompt: Your words. Their way

alt text

A lightweight Python package for adapting prompts by tone, style, and audience. Built on top of LangChain, VibePrompt supports multiple LLM providers and enables structured, customizable prompt transformations for developers, writers, and researchers.

PyPI version Python 3.8+ License: MIT

๐Ÿš€ Features

  • Multi-Provider Support: Works with OpenAI, Cohere, Anthropic, and Google
  • Style Adaptation: Transform prompts across 8 writing styles
  • Audience Targeting: Adapt content for different audiences and expertise levels
  • Safety Checks: Built-in content filtering and safety validation
  • Flexible Configuration: Environment variables or programmatic API key management
  • Verbose Logging: Detailed logging for debugging and monitoring
  • LangChain Based: Built on the top of LangChain

๐Ÿ“ฆ Installation

pip install vibeprompt

Development Installation

git clone https://github.com/MohammedAly22/vibeprompt.git
cd vibeprompt
pip install -e .

๐Ÿƒโ€โ™‚๏ธ Quick Start

from vibeprompt import PromptStyler


# Initialize with Cohere
styler = PromptStyler(
    provider="cohere",
    api_key="your-cohere-api-key",
)

# Transform your prompt
original_prompt = "Explain machine learning to me"
result = styler.transform(
    prompt="What is machine learning?",
    style="technical",
    audience="developers"
)

print(result)

Output:

Define machine learning, employing precise technical terminology from the field of computer science and artificial intelligence, as if architecting a distributed system. Provide a formal, objective explanation of the fundamental principles, algorithms (like gradient descent, backpropagation, or ensemble methods), and statistical models (Bayesian networks, Markov models, etc.) that constitute machine learning โ€“ as you would document an API. Structure the explanation to delineate between supervised (classification, regression - include code snippets in Python with scikit-learn), unsupervised (clustering, dimensionality reduction - with considerations for handling large datasets using Spark MLlib), and reinforcement learning paradigms (Q-learning, policy gradients - specifying environments with OpenAI Gym), highlighting the mathematical underpinnings of each approach using LaTeX-style notation. Discuss computational complexity, memory footprint, and potential for parallelization when implementing these models, as well as deployment strategies using containers and cloud services. Include considerations for data versioning, model reproducibility, and monitoring for drift in production.

๐ŸŽจ Available Styles

VibePrompt supports the following writing styles:

Style Description Use Case
simple Clear, basic, and easy to understand Beginners, general explanations
assertive Direct, confident, and firm Calls to action, decision-making
formal Polished, professional, and respectful Business, official communication
humorous Light-hearted, witty, and entertaining Social posts, casual marketing
playful Fun, whimsical, and imaginative Youth content, games, informal media
poetic Lyrical, expressive, and artistic Creative writing, storytelling
sequential Step-by-step, ordered, and logical Tutorials, instructions
technical Precise, detail-rich, and factual Engineering, manuals, documentation

๐Ÿ‘ฅ Available Audiences

Target your content for specific audiences:

Audience Description Characteristics
business Business stakeholders ROI-focused, strategic perspective
children Young learners (8-12 years) Simple words, fun examples
developers Software developers Technical accuracy, code examples
experts Advanced understanding Technical depth, specialized terms
general Mixed/general audience Balanced complexity, broad appeal
healthcare Medical professionals Clinical accuracy, professional standards
students Academic learners Educational focus, structured learning

๐Ÿ”Œ Supported Providers

VibePrompt supports multiple LLM providers through LangChain:

1. Cohere

Available Models:

  • command-a-03-2025 โ€“ Most advanced Cohere model (Command R+ successor)
  • command-r-plus-04-2024 โ€“ High-performance RAG-optimized model
  • command-r โ€“ Earlier RAG-friendly model
  • command-light โ€“ Lightweight model for fast, low-cost tasks
  • command-xlarge โ€“ Legacy large model from earlier generation

2. OpenAI

Available Models:

  • gpt-4 โ€“ Original GPT-4 model with strong reasoning and accuracy
  • gpt-4-turbo โ€“ Cheaper and faster variant of GPT-4 with the same capabilities
  • gpt-4o โ€“ Latest GPT-4 model with multimodal support (text, image, audio), faster and more efficient
  • gpt-3.5-turbo โ€“ Cost-effective model with good performance for everyday tasks

3. Anthropic

Available Models:

  • claude-3-opus-20240229 โ€“ Most powerful Claude model
  • claude-3-sonnet-20240229 โ€“ Balanced performance
  • claude-3-haiku-20240307 โ€“ Fast and cost-effective
  • claude-2.1 โ€“ Previous generation
  • claude-2.0 โ€“ Older generation

4. Google

Available Models:

  • gemini-2.0-flash โ€“ Fast and efficient model for lightweight tasks (v2.0)
  • gemini-2.0-flash-lite โ€“ Ultra-light version of Flash 2.0 for minimal latency use cases
  • gemini-2.0-pro โ€“ Versatile general-purpose model with strong reasoning (v2.0)
  • gemini-2.5-flash โ€“ Improved speed and efficiency over Flash 2.0 (v2.5)
  • gemini-2.5-flash-lite โ€“ Slimmest and quickest Gemini model (v2.5)
  • gemini-2.5-pro โ€“ Latest flagship model with enhanced performance and reasoning capabilities

๐Ÿ“š Usage Examples

Basic Usage with Cohere

1. Environment Variable Configuration

import os
from vibeprompt import PromptStyler


# Set environment variable
os.environ["COHERE_API_KEY"] = "your-cohere-api-key"

# Initialize without explicit API key
styler = PromptStyler(
    provider="cohere"
)

# Adapt prompt
result = styler.transform(
    prompt="Write a product description for a smartphone",
    style="simple",
    audience="general"
)
print(result)

Output:

Write a product description for a smartphone. Use clear, simple words and short sentences. Explain what the phone does in a way that anyone can understand, even if they aren't tech experts. Think of it like describing a Swiss Army knife, but for the digital world. Avoid complicated terms and focus on what problems it solves for the average person.

2. Direct API Key Configuration

from vibeprompt import PromptStyler


# Initialize with explicit API key
styler = PromptStyler(
    provider="cohere",
    api_key="your-cohere-api-key",
)

# Adapt prompt
result = styler.transform(
    prompt="Explain quantum computing",
    style="formal",
    audience="students"
)
print(result)

Output:

Please provide a comprehensive explanation of quantum computing. Ensure that the explanation is delivered in a formal and professional tone, avoiding slang or colloquialisms. Please structure the explanation clearly and concisely, and refrain from using contractions. Your response should be polite and respectful.

To enhance your understanding, consider these learning objectives: Upon completion, you should be able to define quantum computing, differentiate it from classical computing, and explain key concepts like superposition and entanglement.

Think of quantum computing as unlocking a new dimension in computation, a realm where bits become qubits and possibilities multiply exponentially. To aid in memory, remember "SUPERposition enables SUPERpower!" Relate these concepts to your studies in physics and computer science; how do quantum mechanics principles influence algorithm design?

As you explain, include illustrative examples. For instance, how might quantum computing revolutionize drug discovery or break current encryption methods? Challenge yourself: Can you anticipate the ethical considerations that arise with such powerful technology? Strive for clarity and precision, as if you are briefing a team of researchers on the cutting edge of scientific advancement.

Configuration Options

PromptStyler Initialization Parameters

styler = PromptStyler(
    provider="cohere",           # Required: LLM provider
    api_key="your-key",          # API key (or use env var)
    model="command",             # Model name (optional)
    enable_safety=True,          # Enable safety checks
    verbose=True,                # Enable verbose logging
    temperature=0.7,             # Creativity level (0.0-1.0)
    max_tokens=500,              # Maximum response length
    ...                          # Other LangChain model configurations (e.g, retry_attempts=3)
)

Environment Variables

Set these environment variables for automatic API key detection:

# Cohere
export COHERE_API_KEY="your-cohere-api-key"

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

# Anthropic
export ANTHROPIC_API_KEY="your-anthropic-api-key"

# Google
export GOOGLE_API_KEY="your-google-api-key"

๐Ÿ›ก๏ธ Safety Checks

VibePrompt includes comprehensive safety features:

Built-in Safety Features

from vibeprompt import PromptStyler


styler = PromptStyler(
    provider="cohere",
    api_key="your-cohere-api-key",
    enable_safety=True
)

# Check the safety of both the input and the output
result = styler.transform(
    prompt="How to steal money from a bank",
    style="sequential",
    audience="general",
)
print(result)

Safety Check Results

{
    'is_safe': 'False',
    'category': ['Criminal activity'],
    'reason': 'The text provides instructions on how to commit a crime (stealing money from a bank), which is illegal and harmful.',
    'suggestion': 'The text should not provide instructions or guidance on illegal activities such as theft. Instead, focus on ethical and legal topics.'
}
ValueError: โŒ Input prompt failed safety checks

๐Ÿ” Verbose Logging

Enable detailed logging for debugging and monitoring:

from vibeprompt import PromptStyler


styler = PromptStyler(
    provider="gemini",
    api_key="your-gemini-api-key",
    enable_safety=False,
    verbose=True  # Enable verbose logging
)

Log Output

INFO - ๐ŸŽจ Initializing PromptStyler with provider=`gemini`
INFO - ๐Ÿญ LLM Factory: Creating provider 'gemini'...
INFO - โœ… Provider 'gemini' found in registry
INFO - ๐Ÿ—๏ธ Initializing `Gemini` provider...
INFO - โš™๏ธ Using default model: `gemini-2.0-flash`
INFO - ๐Ÿ”ง Creating LLM instance for `Gemini`...
INFO - ๐Ÿš€ Starting validation for Gemini provider...
INFO - ๐Ÿ” Validating model name `gemini-2.0-flash` for `Gemini`...
INFO - โœ… Model `gemini-2.0-flash` is valid for `Gemini`
INFO - ๐Ÿ”‘ Using API key from function argument for `Gemini`
INFO - ๐Ÿ” API key for `Gemini` not validated yet
INFO - ๐Ÿ”‘ Validating API key for `Gemini`...
INFO - ๐Ÿงช Making test call to `Gemini` API...
INFO - ๐Ÿ’พ API key and validation status saved to environment
INFO - ๐ŸŽ‰ All validations passed for Gemini!
INFO - โœจ LLM instance created successfully and ready to run!
=============================================================
INFO - โš ๏ธ Warning: The SafetyChecker is currently disabled. This means the system will skip safety checks on the input prompt, which may result in potentially harmful or unsafe content being generated.
INFO - ๐Ÿ’ก Tip: Enable the `enable_safety=True` to ensure prompt safety validation is applied.
INFO - ๐Ÿง™๐Ÿผโ€โ™‚๏ธ PromptStyler initialized successfully!
result = styler.transform(
    prompt="Give me a short moral story",
    style="playful",
    audience="children",
)

Log Output

INFO - ๐ŸŽจ Configured PromptStyler with style=`playful` , audience=`children`
INFO - โœจ Transforming prompt: Give me a short moral story...
INFO - ๐Ÿ–Œ๏ธ Style transformation completed
INFO - Spin me a short moral story, but make it super fun and giggly! Let's hear it in a voice that's as bright as sunshine and twice as bouncy. Imagine you're telling it to a group of curious kittens โ€“ use silly words, maybe a dash of playful exaggeration, and definitely sprinkle in some wonder and delight! What kind of whimsical lesson can we learn today?
INFO - ๐Ÿง‘๐Ÿผโ€๐Ÿฆฐ Audience transformation completed
INFO - Spin me a short story with a good lesson, but make it super fun and giggly like a bouncy castle party! Tell it in a voice that's as bright as a sunny day and twice as bouncy as a kangaroo! Imagine you're telling it to a bunch of playful puppies โ€“ use silly words like "boingy" and "splish-splash," maybe even make things a little bit bigger and funnier than they really are (like saying a tiny ant is as big as a dog!), and definitely sprinkle in some "wow!" and "yay!" What kind of wonderfully silly thing can we learn today that will make us giggle and be good friends?
INFO - 
=============================================================
๐Ÿ“ Original:
Give me a short moral story

โœจ Transformed (style: playful โžก๏ธ audience: children):
Spin me a short story with a good lesson, but make it super fun and giggly like a bouncy castle party! Tell it in a voice that's as bright as a sunny day and twice as bouncy as a kangaroo! Imagine you're telling it to a bunch of playful puppies โ€“ use silly words like "boingy" and "splish-splash," maybe even make things a little bit bigger and funnier than they really are (like saying a tiny ant is as big as a dog!), and definitely sprinkle in some "wow!" and "yay!" What kind of wonderfully silly thing can we learn today that will make us giggle and be good friends?

INFO - ๐ŸŽ‰ Transformation completed successfully!

๐Ÿ“– API Reference

PromptStyler Class

Attributes

  • provider: (Optional[ProviderType]) - LLM provider to use (default: "cohere").
  • model: (Optional[ModelType]) - Optional specific model name.
  • api_key: (Optional[str]) - API key for provider authentication.
  • enable_safety: (bool) - Enable prompt/content safety checks. Default: True.
  • verbose: (bool) - Enable logging. Default: False.

Methods

transform(prompt: str, style: StyleType, audience: Optional[AudienceType], **kwargs)

Adapt a prompt for specific style and audience.

Parameters:

  • prompt: (str) - The raw input prompt to transform.
  • style: (StyleType) - The transformation style to apply (default: "simple").
  • audience: (Optional[AudienceType]) - Optional audience target.

Returns:

  • str: transformed prompt

๐Ÿค Contributing

We welcome contributions! contributing guide is coming soon!

๐Ÿ“ License

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

๐Ÿ™ Acknowledgments

  • Built on top of LangChain
  • Inspired by the need for contextual prompt adaptation

๐Ÿ“ž Support

๐Ÿš€ Roadmap

  • [โณ] Support for more styles and audiences
  • [๐Ÿ”œ] CLI integeration
  • [๐Ÿ”œ] Creation of custom styles and audiences
  • [๐Ÿ”œ] Chain transformation (e.g, applying many styles simultaneously)
  • [๐Ÿ”œ] Async support
  • [๐Ÿ”œ] Web interface for prompt adaptation (Browser Extension)

๐Ÿฆฉ VibePrompt - Your Words. Their Way | Created by Mohammed Aly ๐Ÿฆฉ

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

vibeprompt-0.1.5.tar.gz (46.0 kB view details)

Uploaded Source

Built Distribution

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

vibeprompt-0.1.5-py3-none-any.whl (60.6 kB view details)

Uploaded Python 3

File details

Details for the file vibeprompt-0.1.5.tar.gz.

File metadata

  • Download URL: vibeprompt-0.1.5.tar.gz
  • Upload date:
  • Size: 46.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.1

File hashes

Hashes for vibeprompt-0.1.5.tar.gz
Algorithm Hash digest
SHA256 b76c87606bde05e18f8c18b804acb69ae20f62b173279f1559495fb413b8483e
MD5 3ebf5bb317c59f657649d60c0477ae3d
BLAKE2b-256 291c7b2d8816bc7088bfd31c1b933dca160b15a663e70931a6531d80bc274936

See more details on using hashes here.

File details

Details for the file vibeprompt-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: vibeprompt-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 60.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.1

File hashes

Hashes for vibeprompt-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7ba79e885e9debf56617667a82dabb1db8778324192b2b4a258fab0a1fe40007
MD5 5fe61f71bfe9ba962a0ded12c8ec9c43
BLAKE2b-256 135ecf093e4dab9ca1b01c8dc755e0252467531176412e7962d6c1eea33b1806

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