Skip to main content

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

Project description

Prompt Amplifier ๐Ÿ”จ

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]

Basic Usage

from prompt_amplifier import PromptForge

# Initialize with defaults (TF-IDF embedder, in-memory store)
forge = PromptForge()

# Load your documents
forge.load_documents("./docs/")

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

print(result.prompt)      # The expanded prompt
print(result.context)     # Retrieved context chunks
print(result.metadata)    # Stats and metadata

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

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

prompt_amplifier-0.1.1.tar.gz (61.8 kB view details)

Uploaded Source

Built Distribution

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

prompt_amplifier-0.1.1-py3-none-any.whl (69.5 kB view details)

Uploaded Python 3

File details

Details for the file prompt_amplifier-0.1.1.tar.gz.

File metadata

  • Download URL: prompt_amplifier-0.1.1.tar.gz
  • Upload date:
  • Size: 61.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for prompt_amplifier-0.1.1.tar.gz
Algorithm Hash digest
SHA256 521e67d3da556722281acfe3418132d98c564bfdcbdd6459c708c11d84d5883b
MD5 59575f86551545d5c808a2ac334114ed
BLAKE2b-256 af1b0b3afb45370925223fc9912c0b4272e531ba32b27d4a5844eacc5a8a7e2c

See more details on using hashes here.

File details

Details for the file prompt_amplifier-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for prompt_amplifier-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 02916e7e7ace935dc8f533373ad6cbb1a85f6dd8573fadf6b750ed727f9ab933
MD5 0fe5ef8dd1e782b99afa1eb7cd6cabba
BLAKE2b-256 a72de7c525950de7e41a8efa4e8bd89fbfa7c26cc4ea4bdd9711aa535f4e6d49

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