This project showcases prompt design and an AI Assistant that supports three functions:
- Answer Questions
- Summarize Text
- Generate Creative Content
Two interfaces are provided:
- CLI (
python main.py) - Web App (
streamlit run app.py)
- Python 3.10+ recommended
- Create a virtual environment and install deps:
python -m venv .venv source .venv/bin/activate # Windows: .venv\Scripts\activate pip install -r requirements.txt
- Set your OpenAI API key (or equivalent) in
.env:OPENAI_API_KEY=sk-... MODEL=gpt-4o-mini - Run the CLI:
python main.py
- Run the Web App:
streamlit run app.py
If you don't have an API key, you can toggle Demo Mode in both the CLI and Web App to see how prompts are constructed. Demo mode fabricates safe sample responses so you can test the UX and feedback loop.
- Prompt catalog (
prompts.json) with three alternative prompts per function, varying tone, structure, and specificity. - Feedback loop: After each response, the user can mark helpful (yes/no) and add comments. The app stores feedback in
feedback.jsonland lightly adapts future prompts (adds constraints, changes style) based on aggregated feedback. - Separation of concerns: Prompt templates are external; the code composes them with variables and function-specific guardrails.
- Reproducibility: All inputs/outputs are logged to
session_logs/with timestamps.
main.py– CLI entry point.app.py– Streamlit UI.prompts.json– Prompt templates.feedback.jsonl– Appends after each run (created automatically).session_logs/– JSON dumps per interaction.requirements.txt– Python deps.AI_Assistant_User_Guide.pptx– Brief user guide (also included below).
Answer Questions
- "What is the capital of France?"
- "Can you explain the significance of the Eiffel Tower?"
- "Tell me three facts about Paris."
Summarize Text
- "Summarize the following article: [paste text]"
- "What are the main points of this text: [paste text]?"
- "Provide a brief overview of this document: [paste text]."
Generate Creative Content
- "Write a short story about a dragon and a princess."
- "Create a poem about autumn."
- "Generate an idea for a science fiction novel."
MIT