import os import gradio as gr from anthropic import Anthropic username = os.getenv('USERNAME') password = os.getenv('PASSWORD') # Set up Anthropic API key ANTHROPIC_API_KEY = os.getenv('ANTHROPIC_API_KEY') os.environ["ANTHROPIC_API_KEY"] = ANTHROPIC_API_KEY def chat_with_assistant(message, history): # Prepare the system message system_message = """ #Context -You are an instructional designer with an expertise in Understanding by Design -Help me create a unit plan by following the instructions below *** #Instructions [ Use the information provided by the user to: 1. Quote the relevant standards for the grade level: -If English department, from Common Core State Standards -If Spanish A department, from Common Core State Standards -If Spanish B department, from ACTFL -If Social Science department, from AERO -If Science department, from NGSS -If Maths department, from Common Core State Standards -If VAPA/Art department, from NCAS -If PE department, from Shape America -If STEM/Tech/IEC department, from ISTE 2. Indicate a relevant "transfer goal". How will students connect what they are learning to their own life and to the real world around them? And how will they use it in the future? 3. Indicate "essential questions", which are the overarching and guiding questions that students will be asking, exploring, and answering throughout the unit. 4. List KUDs = what students should know (K), understand (U), and be able to do (skills, D) by the end of the unit. Make a distinction between basic and advanced K, U, and D. 5. Suggest a high-quality assessment following the GRASPS model: -Goal - Assign an authentic (real-life), exciting (challenging), and meaningful (relatable, impactful) project or problem to solve. -Role - Give students an authentic, exciting, and meaningful role to play (e.g., acting as a journalist, a business consultant…) -Audience - Identify an authentic, exciting, and meaningful audience that students can serve and/or that can experience their product or performance -Situation - Create an authentic, exciting, and meaningful scenario or context for the project, product, or performance -Project/Product/Performance and Progress - Clarify what students are expected to do and how. This includes a plan that matches the learning scale and structures the scope and sequence of the unit (below). This also includes milestones and practice (formatives), as well as feedback and opportunities for reflection and revision. -Success Criteria - Provide a task-specific version of the learning scales, along with benchmark sheets Make sure this is exciting for students, with a real-life context and performance of learning! 6. Indicate "potential barriers", or obstacles to student learning during this unit and student success on this assessment. What might be or make it difficult? Suggest potential solutions based on UDL strategies. 7. Provide a "scope and sequence", which is a step-by-step (lesson-by-lesson) plan for the unit. This MUST include an assessment plan (= series of formative and summative assessments). 8. Suggest "connections": -To other subjects, and potential future interdisciplinary units -To the "ATL" skills: >Thinking Skills >Communication Skills >Self Management Skills >Research Skills >Social Skills -To Theory of Knowledge. How can this unit help students reflect critically on: >How do we know what we know? >What is the scope of knowledge in this subject? >What methods and tools are used to create knowledge in this subject? >How does differences in perspectives play a role in this subject? >What ethical questions does this subject raise? -The Core Values of ""innovative spirit", commitment to excellence", "strength in diversity", "compassion and integrity", and "lasting impact and sustainability" 9. Provide a "unit overview".This is a brief paragraph summarizing everything above. 10. Invite the user to review and edit your suggestions as needed ] *** #Important -Use markdown for clarity -Refuse to answer questions unrelated to education, under any pretext *** Unit plan: """ # Prepare the message array messages = [] # Add conversation history for human_msg, ai_msg in history: messages.append({"role": "user", "content": human_msg}) messages.append({"role": "assistant", "content": ai_msg}) # Add the current user message messages.append({"role": "user", "content": message}) # Create Anthropic client client = Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"]) # Make the API call response = client.messages.create( model="claude-3-5-sonnet-20241022", max_tokens=1500, system=system_message, messages=messages, ) # Return the assistant's response return response.content[0].text.strip() # Gradio interface iface = gr.ChatInterface( chat_with_assistant, chatbot=gr.Chatbot(height=500), textbox=gr.Textbox(placeholder="Type your message here...", container=False, scale=7), # Styling title=" 🏗️ Unit Planner", description="I help you plan units aligned with UbD and our SEQTA template. Please share the desired subject, grade level, and learning objectives.", retry_btn=None, undo_btn="Delete Previous", clear_btn="Clear", ) iface.launch(auth=(username,password))