| title | Thoughtful AI Support Agent |
|---|---|
| emoji | 🤖 |
| colorFrom | blue |
| colorTo | green |
| sdk | gradio |
| app_file | app.py |
| pinned | false |
A simple customer support agent that:
- answers from a hardcoded Thoughtful AI FAQ using fuzzy retrieval
- falls back to an LLM when no FAQ match is found (optional)
python -m venv .venv
# Windows: .venv\Scripts\activate
source .venv/bin/activate
pip install -r requirements.txt
python app.pyOpen the URL printed in your terminal (usually http://127.0.0.1:7860).
Set an API key:
export OPENAI_API_KEY="YOUR_KEY"
# optional:
export OPENAI_MODEL="gpt-5.2"
python app.pyIf OPENAI_API_KEY is not set, the app will still run and will gracefully respond when no FAQ match is found.
- Create a new Replit (Python)
- Add these files
- Add
OPENAI_API_KEY(Secrets) if you want LLM fallback - Run:
python app.py
Option A: Import this zip
- Create a new Repl → choose Python
- Upload and extract this project zip into the Repl
- Click Run (the
.replitfile runspython app.py)
Option B: Import from GitHub
- Create a new Repl → Import from GitHub
- Paste your repo URL
- Click Run
- Add
OPENAI_API_KEYin Replit → Secrets (lock icon) - Optionally add
OPENAI_MODEL(defaults togpt-5.2)
Notes:
- Replit sets a
PORTenvironment variable automatically;app.pyuses it for Gradio. - If installs ever fail, open the Shell and run:
pip install -r requirements.txt
- Create a new Space on Hugging Face and choose Gradio.
- Upload these files (or push via git).
- (Optional) Add
OPENAI_API_KEYandOPENAI_MODELunder Settings → Secrets. - Wait for the build and open the Space URL.
This build avoids ChatInterface(type=...) for compatibility with older Gradio versions on some hosts.
For a lightweight demo without entering payment details, you can use Groq's free tier by setting:
GROQ_API_KEY- (optional)
GROQ_MODEL(default:llama-3.3-70b-versatile)
On Hugging Face Spaces: Settings → Secrets.
If you set both GROQ_API_KEY and OPENAI_API_KEY, Groq is used first.
The LLM fallback includes a short, hardcoded context summary of Thoughtful AI (derived from thoughtful.ai), plus the FAQ Q/A pairs, to keep responses grounded when a user's question doesn't match an FAQ entry.
Edit THOUGHTFUL_AI_CONTEXT in llm_fallback.py if you want to add more product/company details.