Persona Support Agent is a Streamlit app that classifies a customer message into a support persona, retrieves relevant knowledge-base snippets from ChromaDB, and generates a persona-aware response with Gemini.
- Detects the likely customer persona from the message.
- Searches a local ChromaDB knowledge base for related support content.
- Generates a tailored answer based on the detected persona.
- Escalates to a human specialist when the request looks risky or billing-related.
- Python
- Streamlit
- Google Gemini API via
google-genai - ChromaDB for vector storage and retrieval
- LangChain text splitter for chunking seeded documents
- pypdf for reading support PDFs from the knowledge-base folder
app.py- main Streamlit applicationsrc/- modular app logic for config, classifier, RAG, generator, and escalationrequirements.txt- Python dependenciesdata/- support documents used to seed the vector databaseREADME.md- project overview and setup guidechroma_db/- local ChromaDB storage created at runtime
flowchart TD
A[User Message] --> B[Persona Classifier]
B --> C[ChromaDB Retrieval]
C --> D[Top-K Support Chunks]
D --> E[Persona-Adaptive Generator]
E --> F{Retrieval Quality OK?}
F -- Yes --> G[Support Response]
F -- No or Sensitive Issue --> H[Escalate to Human]
H --> I[Structured Handoff JSON]
The app follows the same reference flow: classify the persona, retrieve relevant support content, generate a context-grounded answer, and escalate when the query is sensitive or the retrieval confidence is low.
- Python 3.10 or newer
- A valid Gemini API key
- Internet access for Gemini API calls
- Create and activate a virtual environment.
- Install the dependencies:
pip install -r requirements.txt- Create a
.envfile in the project root with your Gemini API key:
GEMINI_API_KEY=your_api_key_hereThe app now loads documents from the data/ folder instead of relying on inline seed text. It expects support content in:
.mdfiles for markdown help articles.txtfiles for plain-text notes.pdffiles for longer instructions or reference guides
On first run, the app chunks and embeds those files into a persistent ChromaDB collection named support_kb.
Current support documents include API troubleshooting, authentication, billing, login recovery, password reset, invoice handling, service status, refund escalation, and account access guidance.
Start the Streamlit app with:
streamlit run app.pyThen open the local URL shown in the terminal.
- Live app URL: add your deployed URL here
- Screen recording: add your video link here
- The app loads environment variables and checks for
GEMINI_API_KEY. - It creates or opens a persistent ChromaDB collection called
support_kb. - On first run, it seeds the collection from the files in
data/. - When a user submits a message, the app:
- classifies the persona,
- creates an embedding for the query,
- retrieves the closest knowledge-base chunks,
- generates a response using Gemini,
- or escalates if the issue looks like billing or low-confidence retrieval.
I forgot my password. How do I reset it?Why was I charged twice for the same order?We need a high-level summary of the issue and timeline.
- The app uses a local persistent ChromaDB folder, so deleting
chroma_db/will reset the seeded knowledge base. - Keep the
data/folder populated with support content so the app can rebuild the vector store if needed. - Keep
.envout of version control. - If you change model names or API behavior, update both
app.pyandrequirements.txtaccordingly.
- If the app stops with a missing environment variable error, confirm
.envcontainsGEMINI_API_KEY. - If Streamlit shows dependency errors, reinstall packages with
pip install -r requirements.txt. - If responses seem incorrect, remove
chroma_db/to reseed the knowledge base on the next run.