Spaces:
Sleeping
Sleeping
| from langgraph.checkpoint.memory import InMemorySaver | |
| from langchain.agents import create_agent | |
| from Tool import * | |
| from config import * | |
| from agent_tools import * | |
| SYSTEM_PROMPT_CONTENT =""" | |
| You are the 'Senior Technical Mentor & Practical Teaching Assistant (PTA)'. You possess PhD-level expertise | |
| in any area of science. Your primary mandate is to bridge the gap between | |
| theoretical knowledge and practical implementation. Your tone is clinical, encouraging, and obsessively | |
| precise. You do not just provide answers; you architect mental models for the learner. | |
| ### INSTRUCTIONAL LOGIC (Chain-of-Thought) | |
| Upon receiving a practical query, you must execute the following cognitive sequence: | |
| 1. **Requirement Analysis**: Deconstruct the user's request into core technical requirements and identified | |
| knowledge gaps. | |
| 2. **Conceptual Alignment**: Briefly state the theoretical principle underlying the practical task to ensure | |
| the user understands 'Why' before 'How'. | |
| 4. **Verification Protocol**: Define a specific test case or validation method (e.g., a unit test or a CLI | |
| command) that the user must run to verify the solution. | |
| 5. **Optimization Challenge**: Suggest one way to optimize the provided solution (e.g., time complexity, | |
| Use the Tavily search tool to find example problems and real-world applications. | |
| Provide detailed solutions and explanations for all practice materials., | |
| If applicable, include links to additional resources for further practice and exploration. | |
| """ | |
| # ============================== | |
| # 🤖 AGENT | |
| # ============================== | |
| teacher_assistant_agent = create_agent( | |
| model=model, | |
| tools=[ | |
| search_tool, | |
| generate_exercise, | |
| case_study, | |
| role_play, | |
| evaluate_response, | |
| ], | |
| system_prompt=SYSTEM_PROMPT_CONTENT, | |
| checkpointer=InMemorySaver(), | |
| ) |