When love leaves you speechless, let the greatest poets in history speak for your heart.
An AI-powered love letter generator that uses Retrieval-Augmented Generation (RAG) to channel the voices of legendary poets like Shakespeare, Pablo Neruda, Elizabeth Barrett Browning, and Rumi to craft personalized, heartfelt love letters.
- π 4 Legendary Poets - Choose from Shakespeare, Neruda, Browning, or Rumi
- π§ RAG-Powered - Uses semantic search to find relevant poetic snippets
- π Free Local Embeddings - No API quota limits (HuggingFace + FAISS)
- π Personalized Letters - Weaves your details into authentic poetic style
- π Letter Archive - Save and revisit your love letters
- β¨ Poet Match Quiz - Discover which poet matches your love language
- π¨ Beautiful UI - Romantic parchment-style design with glassmorphism
git clone https://github.com/yourusername/cupids-archive.git
cd cupids-archivepip install -r requirements.txt# Windows PowerShell
$env:GOOGLE_API_KEY="your-api-key-here"
# Linux/Mac
export GOOGLE_API_KEY="your-api-key-here"Get your free API key from Google AI Studio
streamlit run app.pyNavigate to http://localhost:8501 π
| Technology | Version | Purpose |
|---|---|---|
| Python | 3.8+ | Core programming language |
| Streamlit | 1.28+ | Modern web UI framework for data apps |
| Package | Purpose |
|---|---|
| langchain-core | Core abstractions for LLM chains, prompts, and output parsers |
| langchain-google-genai | Integration with Google's Gemini models |
| langchain-huggingface | Integration with HuggingFace embedding models |
| langchain-community | Community integrations including FAISS vector store |
| Component | Technology | Description |
|---|---|---|
| Embeddings | HuggingFace all-MiniLM-L6-v2 |
Free, local sentence embeddings (384 dimensions) |
| Vector Store | FAISS (Facebook AI Similarity Search) | Efficient similarity search and clustering |
| LLM | Google Gemini Flash Lite | Fast, capable language model for generation |
| Library | Purpose |
|---|---|
| sentence-transformers | State-of-the-art sentence embeddings |
| faiss-cpu | Vector similarity search |
| langchain | LLM application framework |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β USER INPUT β
β "She has beautiful eyes and loves poetry" β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β EMBEDDING LAYER (Local - FREE!) β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β HuggingFaceEmbeddings β β
β β Model: all-MiniLM-L6-v2 β β
β β Output: 384-dimensional vector β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β VECTOR STORE (FAISS) β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β 24 poet snippets indexed β β
β β Similarity search: cosine distance β β
β β Returns: Top 3 most relevant snippets β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LANGCHAIN PIPELINE β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β βPromptTemplateβ -> β Gemini LLM β -> βStrOutputParserβ β
β β β β Flash Lite β β β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β OUTPUT β
β π Personalized Love Letter β
β Written in the style of chosen poet β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# 1. Embeddings (Free, Local)
embeddings = HuggingFaceEmbeddings(
model_name="all-MiniLM-L6-v2"
)
# 2. Vector Store
vector_db = FAISS.from_documents(documents, embeddings)
# 3. Retrieval
relevant_docs = vector_db.similarity_search(query, k=3)
# 4. LangChain Chain
chain = PromptTemplate | ChatGoogleGenerativeAI | StrOutputParsercupids-archive/
βββ app.py # Main Streamlit application
β βββ Page Config # Streamlit page setup
β βββ CSS Styling # Romantic UI theme
β βββ Poet Data # 4 poets with 6 snippets each
β βββ RAG Engine # FAISS + HuggingFace embeddings
β βββ UI Components # Landing, Quiz, Form, Display, Archive
β βββ Main Logic # View routing and state management
βββ requirements.txt # Python dependencies
βββ README.md # This documentation
βββ .gitignore # Git ignore rules
| Poet | Era | Style | Signature |
|---|---|---|---|
| π William Shakespeare | 16th-17th Century | Timeless romance, eloquent verse | Sonnets, metaphors, "thee/thou" |
| πΉ Pablo Neruda | 20th Century | Passionate, sensual, earthly love | Nature imagery, raw emotion |
| π Elizabeth Barrett Browning | 19th Century | Pure devotion, spiritual depth | "How do I love thee" |
| π Rumi | 13th Century | Transcendent, soul-deep, divine love | Mystical, philosophical |
Retrieval-Augmented Generation (RAG) combines:
- Retrieval: Finding relevant information from a knowledge base
- Generation: Using an LLM to generate responses based on retrieved context
-
Indexing (on startup):
- All 24 poet snippets are embedded using HuggingFace
- Vectors stored in FAISS for fast similarity search
-
Retrieval (when user submits):
- User's description is embedded
- FAISS finds the 3 most similar poet snippets
- Only snippets from the selected poet are used
-
Generation:
- LangChain creates a prompt with retrieved snippets
- Gemini generates a letter in the poet's authentic voice
- Output is parsed and displayed
| Choice | Reason |
|---|---|
| Local Embeddings | No API limits, privacy, works offline |
| FAISS | Industry standard, fast, memory efficient |
| LangChain | Clean abstractions, easy to extend |
| Gemini Flash Lite | Fast, cost-effective, good quality |
| Streamlit | Rapid prototyping, beautiful UI components |
Contributions are welcome! Ideas:
- Add more poets (Emily Dickinson, Lord Byron, etc.)
- Implement letter sharing/export features
- Add more quiz questions
- Improve the UI/UX
- Add multi-language support
MIT License - feel free to use this for your own projects!
Built with β€οΈ using:
- π¦ LangChain for LLM orchestration
- π€ HuggingFace for free embeddings
- β‘ FAISS for vector search
- β¨ Gemini for generation
- π Streamlit for the UI
"Love looks not with the eyes, but with the mind, and therefore is winged Cupid painted blind." - Shakespeare