Skip to main content

Prompt Amplifier

Prompt Amplifier Logo

Transform short prompts into detailed, structured instructions using context-aware retrieval.

PyPI version Python 3.9+ License


🎯 What is Prompt Amplifier?

Prompt Amplifier is a library for Prompt Amplification — the process of transforming short, ambiguous user intents into comprehensive, well-structured prompts that LLMs can execute effectively.

from prompt_amplifier import PromptForge

forge = PromptForge()
forge.load_documents("./company_docs/")

# Short, vague input
short_prompt = "How's the deal going?"

# Detailed, structured output
detailed = forge.expand(short_prompt)

Before (user input):

"How's the deal going?"

After (expanded prompt):

"Generate a Deal Health Assessment report with the following structure:

1. Executive Summary - Overall health status (Healthy/Warning/Critical)

2. Key Metrics Table

Metric Current Target Status
Winscore ... ... ...
POC Progress ... ... ...

3. Risk Factors - List blocking issues from Success Plan

4. Recommended Actions - Prioritized next steps

Use data from: Deal Profile, Success Plan, Activity Log..."


✨ Features

  • 📄 Multi-format Document Loading — PDF, DOCX, Excel, CSV, TXT, Markdown, HTML
  • 🔢 Pluggable Embedders — TF-IDF, BM25, Sentence Transformers, OpenAI, Cohere, Google
  • 💾 Vector Store Support — In-memory, ChromaDB, FAISS, Pinecone, Qdrant, Weaviate
  • 🔍 Smart Retrieval — Vector search, hybrid (BM25 + Vector), reranking
  • 🤖 LLM Backends — OpenAI, Anthropic, Google Gemini, Ollama (local)
  • 📋 Domain Schemas — Define field structures for your domain
  • 🔌 Extensible — Easy to add custom loaders, embedders, and vector stores

🚀 Quick Start

Installation

# Core library
pip install prompt-amplifier

# With common extras
pip install prompt-amplifier[loaders,embeddings-local,vectorstore-chroma]

# Everything
pip install prompt-amplifier[all]

API Key Setup

⚠️ Required for expand(): The prompt expansion feature requires an LLM API key.

import os

# Option 1: Google Gemini (has free tier!)
os.environ["GOOGLE_API_KEY"] = "your-key-from-aistudio.google.com"

# Option 2: OpenAI
os.environ["OPENAI_API_KEY"] = "sk-your-key"

# Option 3: Anthropic
os.environ["ANTHROPIC_API_KEY"] = "sk-ant-your-key"

Basic Usage

import os
os.environ["GOOGLE_API_KEY"] = "your-key"  # Required for expand()

from prompt_amplifier import PromptForge
from prompt_amplifier.generators import GoogleGenerator

# Initialize with Google Gemini (free tier available)
forge = PromptForge(generator=GoogleGenerator())

# Add your documents
forge.add_texts([
    "POC Health: Healthy means all milestones on track.",
    "Winscore ranges from 0-100, measuring deal probability.",
])

# Expand a short prompt
result = forge.expand("Give me a POC health check")

print(result.prompt)      # The expanded prompt
print(result.expansion_ratio)  # How much longer it got

Search Without API Key

from prompt_amplifier import PromptForge

# No API key needed for search!
forge = PromptForge()
forge.add_texts(["doc1", "doc2", "doc3"])

# Search works without LLM
results = forge.search("my query")
for r in results.results:
    print(r.chunk.content)

With Persistent Vector Store

from prompt_amplifier import PromptForge
from prompt_amplifier.vectorstores import ChromaStore
from prompt_amplifier.embedders import SentenceTransformerEmbedder

forge = PromptForge(
    embedder=SentenceTransformerEmbedder("all-MiniLM-L6-v2"),
    vectorstore=ChromaStore(
        collection_name="my_docs",
        persist_directory="./chroma_db"
    )
)

# First run: embeds and stores
forge.load_documents("./docs/")

# Subsequent runs: uses existing embeddings
result = forge.expand("Summarize the project status")

With Cloud Vector Store (Pinecone)

from prompt_amplifier import PromptForge
from prompt_amplifier.vectorstores import PineconeStore
from prompt_amplifier.embedders import OpenAIEmbedder

forge = PromptForge(
    embedder=OpenAIEmbedder(model="text-embedding-3-small"),
    vectorstore=PineconeStore(
        api_key="your-api-key",
        index_name="prompt-amplifier-prod"
    ),
    generator="gpt-4o"
)

📖 Documentation


🧩 Architecture

┌─────────────────────────────────────────────────────────────┐
│                     Prompt Amplifier                         │
├─────────────────────────────────────────────────────────────┤
│                                                              │
│   Documents    →   Chunker   →   Embedder   →   VectorStore │
│   (PDF, DOCX)      (split)       (encode)       (persist)   │
│                                                              │
├─────────────────────────────────────────────────────────────┤
│                                                              │
│   User Query   →   Embedder  →   Retriever  →   Generator   │
│   "short"          (encode)      (search)       (expand)    │
│                                                              │
└─────────────────────────────────────────────────────────────┘

🔌 Supported Integrations

Document Loaders

Format Loader
PDF PDFLoader
Word DocxLoader
Excel ExcelLoader
CSV CSVLoader
Text TxtLoader
Markdown MarkdownLoader
HTML HTMLLoader
JSON JSONLoader

Embedders

Provider Class Type
TF-IDF TFIDFEmbedder Free, Local
BM25 BM25Embedder Free, Local
Sentence Transformers SentenceTransformerEmbedder Free, Local
OpenAI OpenAIEmbedder Paid API
Cohere CohereEmbedder Paid API
Google GoogleEmbedder Paid API
Voyage AI VoyageEmbedder Paid API

Vector Stores

Store Class Type
In-Memory MemoryStore Local
ChromaDB ChromaStore Local
FAISS FAISSStore Local
LanceDB LanceDBStore Local
Pinecone PineconeStore Cloud
Qdrant QdrantStore Local/Cloud
Weaviate WeaviateStore Cloud
pgvector PGVectorStore Self-host

LLM Generators

Provider Class
OpenAI OpenAIGenerator
Anthropic AnthropicGenerator
Google Gemini GoogleGenerator
Ollama OllamaGenerator
HuggingFace HuggingFaceGenerator

🧪 Research

Prompt Amplifier was developed as part of research into Prompt Amplification — systematically transforming short user intents into detailed, structured prompts.

Key contributions:

  • Formalization of the prompt expansion problem
  • Comparison of embedding strategies for prompt enhancement
  • Evaluation metrics for prompt quality
  • Benchmark datasets across multiple domains

📄 Paper: [Coming Soon]


🤝 Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

# Clone the repo
git clone https://github.com/DeccanX/Prompt-Amplifier.git
cd Prompt-Amplifier

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run linting
ruff check src/
black src/

📜 License

Apache 2.0 — See LICENSE for details.


🙏 Acknowledgments

Built with inspiration from:


Made with ❤️ by Rajesh More for the AI community

Metadata

Release files for prompt-amplifier 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prompt-amplifier 0.2.2
File Size Uploaded Provenance Actions
prompt_amplifier-0.2.2.tar.gz 85.5 kB Without provenance Details for prompt_amplifier-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for prompt-amplifier 0.2.2
File Interpreter ABI Platform Actions
prompt_amplifier-0.2.2-py3-none-any.whl Python 3 none any Details for prompt_amplifier-0.2.2-py3-none-any.whl

Total release size: 186.7 kB

Release files / prompt_amplifier-0.2.2.tar.gz

Download URL prompt_amplifier-0.2.2.tar.gz
Size 85.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2cddae049ac75592923cc00441b4dc54633ca2425dafa2302cafca52d239d76e
BLAKE2b-256 checksum
How to use checksums
bf692e3a30492685da88c981e608b40922cda9443ba8952e34529188b78705ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / prompt_amplifier-0.2.2-py3-none-any.whl

Download URL prompt_amplifier-0.2.2-py3-none-any.whl
Size 101.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
63f46a386525910a76354cc81fa3eef592dd903c02891732e379f9878f4f8a87
BLAKE2b-256 checksum
How to use checksums
c41daecd819040f080c1e59a4d4edb8c032c082e815fd51dd10511372a89a0d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Security for prompt-amplifier 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page