This is a unified task-routing AI assistant built using Streamlit and powered by the phi model running locally with Ollama. It supports three intelligent task modes:
- Q&A
- Summarization
- Roleplay (Doctor, Lawyer, Customer Support Agent)
All tasks are routed dynamically with appropriate prompting under the hood. The app features a sleek UI and intelligent input management.
- Clean, minimal interface
- Local LLM integration using Ollama
- Task-aware prompt selection (
Q&A,Summarization,Roleplay) - Role-based dynamic prompts for Roleplay mode
- Chat history display with
"You"and"AI Assistant"names - Input box clears automatically after sending
- Python 3.8+
- Ollama (running the
phimodel locally) - Required Python libraries:
pip install streamlit requests
Ask concise, factual questions. The model will generate brief answers.
Prompt Structure:
Answer the following question concisely.
Question: {user_input}
Answer:
Paste an article, paragraph, or notes. The assistant will summarize it in bullet points.
Prompt Structure:
Summarize the following article in bullet points.
Article: {user_input}
Summary:
Choose a role and talk to the assistant like you're speaking to:
- Doctor
- Lawyer
- Customer Support Agent
Prompt Structure Example (Doctor):
You are an experienced medical doctor specialized in general medicine.
The user asks: '{user_input}'
Doctor:
-
Ensure Ollama is installed and running.
-
Pull the Phi model:
ollama pull phi
-
Start your app:
streamlit run app.py
-
Open in browser:
http://localhost:8501/
UI Interface with Q&A option selection
Option for Role appears upon Roleplay selection
Demo chat with the AI model
- Streamlit
- Ollama
- phi Language Model
Task-Based-AI-Assistant/
├── task_based_ai_assistant.py # Main Streamlit app
├── images # Folder containing preview images
├── img1.png
├── img2.png
├── img3.png
├── README.md # README file briefing about the app
├── image1.png # AI Bot Image used in UI- Make sure
phiis running locally via Ollama API (http://localhost:11434). - Internet is not required once the model is downloaded.
- Easily extendable to include more tasks or roles.


