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.
๐ฏ 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 |
|---|---|
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 |
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
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 prompt_amplifier-0.2.0.tar.gz.
File metadata
- Download URL: prompt_amplifier-0.2.0.tar.gz
- Upload date:
- Size: 77.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5dd5f542160766130348b805328aa7622237ba74e49d0d3113afb48d111a3358
|
|
| MD5 |
2f01ac09422a8acb61ef74fbf253e07c
|
|
| BLAKE2b-256 |
c77f36dc36908d5cf9943e6ceeda40219fad75a67046f798cd07f8e5da89814d
|
File details
Details for the file prompt_amplifier-0.2.0-py3-none-any.whl.
File metadata
- Download URL: prompt_amplifier-0.2.0-py3-none-any.whl
- Upload date:
- Size: 89.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca965937cc1e97e1f23d258b907c8e663bf395ce4b1ae0c632c6984c9485189e
|
|
| MD5 |
104e3062c17edff57fef01512c831b3b
|
|
| BLAKE2b-256 |
c1e3a3bfb3f17ba0b14443db56cf8a2f0397df485e18da8da2423408f636b7c0
|