A simple conversational agent that answers questions about Thoughtful AI's agents (EVA, CAM, PHIL) using a predefined dataset, with a friendly fallback for unrelated questions.
- Conversational UI: Web-based chat interface (Gradio).
- Predefined answers: Matches user questions to a hardcoded QA set in
temp.json. - Similarity matching: Uses fuzzy matching so rephrased questions still get the right answer.
- Fallback: When no good match is found, responds with a helpful message and suggests related topics.
- Error handling: Handles empty input, missing dataset, and invalid JSON gracefully.
-
Python: Use Python 3.10+ (for
list[dict]type hints; works on 3.9 withfrom __future__ import annotationsif needed). -
Install dependencies:
pip install -r requirements.txt
-
Dataset: Ensure
temp.jsonis in the same directory asagent.py(included in this repo).
python app.pyThen open the URL shown in the terminal (e.g. http://127.0.0.1:7860) in your browser.
agent.py– Core logic: load QA dataset, similarity matching,get_answer()with fallback.app.py– Gradio chat UI and entry point.temp.json– Predefined questions and answers about Thoughtful AI.requirements.txt– Python dependencies.
- Try questions like: "What does EVA do?", "Tell me about Thoughtful AI's Agents", "How does PHIL work?"
- Rephrased or partial questions (e.g. "EVA?" or "benefits of your agents") are matched when similar enough to the dataset.
- Off-topic questions receive the fallback message guiding users back to agent-related topics.
- Functionality: Conversation flow and retrieval from the dataset are implemented; fallback is used when no match is found.
- Code quality: Single-purpose functions, type hints, and a clear split between agent logic and UI.
- Robustness: Empty input, missing/corrupt
temp.json, and unexpected errors inget_answerare handled with clear user-facing messages.