Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,15 +22,56 @@ os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
|
|
| 22 |
|
| 23 |
llm = ChatOpenAI(model_name="gpt-3.5-turbo", temperature=0.2)
|
| 24 |
|
| 25 |
-
# Prompt templates
|
| 26 |
templates = {
|
| 27 |
"flashcard": PromptTemplate(
|
| 28 |
input_variables=["context", "query"],
|
| 29 |
template="""
|
| 30 |
{context}
|
| 31 |
|
| 32 |
-
Create 5 flashcards based on: "{query}"
|
| 33 |
-
Each
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
"""
|
| 35 |
)
|
| 36 |
}
|
|
|
|
| 22 |
|
| 23 |
llm = ChatOpenAI(model_name="gpt-3.5-turbo", temperature=0.2)
|
| 24 |
|
| 25 |
+
# ✅ Prompt templates
|
| 26 |
templates = {
|
| 27 |
"flashcard": PromptTemplate(
|
| 28 |
input_variables=["context", "query"],
|
| 29 |
template="""
|
| 30 |
{context}
|
| 31 |
|
| 32 |
+
Create 5 flashcards based on the topic: "{query}"
|
| 33 |
+
Each flashcard should include:
|
| 34 |
+
- A clear question
|
| 35 |
+
- A short answer
|
| 36 |
+
Focus on high school geometry understanding.
|
| 37 |
+
"""
|
| 38 |
+
),
|
| 39 |
+
"lesson plan": PromptTemplate(
|
| 40 |
+
input_variables=["context", "query"],
|
| 41 |
+
template="""
|
| 42 |
+
Given the following retrieved SOL text:
|
| 43 |
+
{context}
|
| 44 |
+
|
| 45 |
+
Generate a Geometry lesson plan based on: "{query}"
|
| 46 |
+
Include:
|
| 47 |
+
1. Simple explanation of the concept.
|
| 48 |
+
2. Real-world example.
|
| 49 |
+
3. Engaging class activity.
|
| 50 |
+
Be concise and curriculum-aligned for high school.
|
| 51 |
+
"""
|
| 52 |
+
),
|
| 53 |
+
"worksheet": PromptTemplate(
|
| 54 |
+
input_variables=["context", "query"],
|
| 55 |
+
template="""
|
| 56 |
+
{context}
|
| 57 |
+
|
| 58 |
+
Create a student worksheet for: "{query}"
|
| 59 |
+
Include:
|
| 60 |
+
- Concept summary
|
| 61 |
+
- A worked example
|
| 62 |
+
- 3 practice problems
|
| 63 |
+
"""
|
| 64 |
+
),
|
| 65 |
+
"proofs": PromptTemplate(
|
| 66 |
+
input_variables=["context", "query"],
|
| 67 |
+
template="""
|
| 68 |
+
{context}
|
| 69 |
+
|
| 70 |
+
Generate a proof-focused geometry lesson plan for: "{query}"
|
| 71 |
+
Include:
|
| 72 |
+
- Student-friendly explanation
|
| 73 |
+
- Real-world connection
|
| 74 |
+
- One short class activity
|
| 75 |
"""
|
| 76 |
)
|
| 77 |
}
|