Prompt To Build An Ai LLM Projects
Create a complete LLM-powered project called "Teacher AI" that helps students learn any
topic interactively. The AI should:
- Accept a topic and explain it in simple language
- Answer student questions step-by-step
- Quiz the student with MCQs or fill-in-the-blanks
- Provide feedback on answers
- Folder Strucure
- Source Code Of Each File
Include:
- Project description
- All required Python libraries
- Full working code using Streamlit and any open-source LLM (like GROQ or OpenAI)
- Instructions to run the project locally
Make it beginner-friendly, fast to use, and suitable for education.
Project Title: Teacher AI : An Interactive Learning Assistant
Description:
Teacher AI is a Streamlit-based app powered by a large language model (LLM). It helps
students understand topics, ask follow-up questions, and test their understanding with
quizzes.
---
Requirements:
Install required packages:
pip install streamlit groq python-dotenv
---
Environment Setup:
Create a `.env` file in the same directory and add your Groq API key:
GROQ_API_KEY=your_groq_api_key_here
---
Source Code ode: teacher_ai_app.py
```python
import streamlit as st
import os
from groq import Groq
from dotenv import load_dotenv
load_dotenv()
groq_api_key = [Link]("GROQ_API_KEY")
client = Groq(api_key=groq_api_key)
st.set_page_config(page_title="Teacher AI", page_icon=":books:")
[Link]("Teacher AI – Learn Anything, Interactively")
mode = [Link]("Choose a mode:", ["Explain a Topic", "Ask a Question", "Quiz Me"])
if mode == "Explain a Topic":
topic = st.text_input("Enter a topic you want to learn:")
if [Link]("Explain"):
with [Link]("Teaching..."):
response = [Link](
model="mixtral-8x7b-32768",
messages=[
{"role": "system", "content": "You are a friendly teacher who explains things simply."},
{"role": "user", "content": f"Explain the topic '{topic}' in simple terms."}
[Link]([Link][0].[Link])
elif mode == "Ask a Question":
question = st.text_input("Ask a question:")
if [Link]("Answer"):
with [Link]("Thinking..."):
response = [Link](
model="mixtral-8x7b-32768",
messages=[
{"role": "system", "content": "You are a helpful tutor who gives step-by-step
answers."},
{"role": "user", "content": f"Answer this question step-by-step: {question}"}
[Link]([Link][0].[Link])
elif mode == "Quiz Me":
topic = st.text_input("Enter a topic for the quiz:")
if [Link]("Generate Quiz"):
with [Link]("Creating quiz..."):
response = [Link](
model="mixtral-8x7b-32768",
messages=[
{"role": "system", "content": "You are a teacher who creates short quizzes with
answers."},
{"role": "user", "content": f"Create a 3-question multiple-choice quiz on '{topic}' with
correct answers."}
[Link]([Link][0].[Link])
```
---
How to Run:
1. Save the code as `teacher_ai_app.py`
2. Set up your `.env` file
3. Run:
```bash
streamlit run teacher_ai_app.py
```
============================
END OF FILE
============================