"The impediment to action advances action. What stands in the way becomes the way." — Marcus Aurelius
A multi-page Streamlit application for exploring Stoic philosophy — rotating quotes, philosopher profiles, and an AI-powered Stoic advisor that draws on a curated knowledge base to answer your questions with genuine wisdom.
Live App → stoicisim-daily.streamlit.app
| Page | Description |
|---|---|
| Home | A Stoic quote that rotates every minute, cycling through all 102 quotes before repeating. Never the same quote twice in a row. |
| Stoic Philosophers | Expandable cards for 13 key Stoic figures across 23 centuries — from Zeno of Citium to James Stockdale. Each card includes a biography, key work, and a curious historical fact. Fully searchable. |
| Stoic Chat | An AI advisor powered by Groq (Llama 3.1) and a local RAG pipeline. Ask anything about Stoic philosophy, ethics, or how to apply ancient wisdom to modern life. |
The Stoic Chat page is more than a chatbot with a Stoic system prompt. It uses a Retrieval-Augmented Generation (RAG) pipeline:
- At startup, every quote and philosopher bio is embedded using
sentence-transformers/all-MiniLM-L6-v2— a local model, no API required. - Embeddings are stored as a numpy array in memory — no external vector store needed.
- On each user message, the question is embedded and cosine similarity is computed directly against the full corpus to retrieve the most relevant passages.
- The retrieved context is injected dynamically into the system prompt, so the model always answers grounded in the most relevant Stoic knowledge for that specific question.
- Relevance is determined by cosine similarity — not a keyword list. A question like "how do I stop worrying about things I can't change?" matches Stoic content even without a single Stoic keyword.
The LLM itself is Llama 3.1 served via Groq — fast, free tier, and no OpenAI dependency.
The RAG index is built in a background thread when the app starts on the Home page, so by the time a user navigates to the chat, it is usually already ready.
Stoic-App/
├── Home.py # Entry point — quote of the day + RAG preload
├── pages/
│ ├── 1_Stoic_Philosophers.py # Philosopher profile cards
│ └── 2_Stoic_Chat.py # AI chat interface
├── src/
│ ├── data/
│ │ ├── stoic_quotes.py # Quote dataset (102 quotes, 13 philosophers)
│ │ └── stoic_figures.py # Philosopher dataset (13 profiles)
│ ├── rag/
│ │ ├── __init__.py
│ │ └── retriever.py # Corpus builder, ChromaDB index, query function
│ └── utils/
│ ├── helper.py # Image loading & standardisation
│ └── styles.py # Global CSS (Cinzel + Lora fonts)
├── assets/
│ └── images/ # Philosopher portraits (public domain)
├── .streamlit/
│ ├── secrets.toml # API keys — gitignored, never commit
│ └── secrets.toml.example # Template for new contributors
└── requirements.txt
git clone <repository-url>
cd Stoic-Apppip install -r requirements.txtNote:
sentence-transformerspulls in PyTorch (~1.5 GB). The first install takes a few minutes. The embedding model itself (~80 MB) is downloaded automatically on first run.
Sign up at console.groq.com — it takes about two minutes and the free tier is generous.
cp .streamlit/secrets.toml.example .streamlit/secrets.tomlEdit .streamlit/secrets.toml:
GROQ_API_KEY = "gsk_..."streamlit run Home.pyOn first launch, the RAG index builds in the background (~5 seconds). Subsequent runs within the same session are instant.
The app includes a curated corpus of 102 quotes and 13 philosopher profiles spanning the full arc of Stoic history:
| Era | Philosophers |
|---|---|
| Early Stoa (3rd–2nd c. BCE) | Zeno of Citium, Cleanthes, Chrysippus |
| Middle Stoa (2nd–1st c. BCE) | Panaetius, Posidonius, Hecaton of Rhodes |
| Roman Republic (1st c. BCE) | Cato the Younger |
| Roman Imperial (1st–2nd c. CE) | Seneca, Musonius Rufus, Epictetus, Marcus Aurelius, Hierocles |
| Modern (20th c.) | James Stockdale |
Quotes cover a wide range of themes — death and impermanence, anger and conflict, friendship, grief, duty, wealth, learning, solitude, and the relationship between reason and nature — so the RAG system has genuine coverage regardless of what a user asks.
streamlit>=1.26.0
groq>=0.9.0
pillow>=10.0.0
requests>=2.31.0
python-dotenv>=1.0.0
numpy>=1.24.0
pandas>=2.0.0
toml>=0.10.2
sentence-transformers>=2.7.0