File size: 776 Bytes
2e9afea
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from langchain_core.messages import HumanMessage, SystemMessage

def handle_general_advice(query, llm):
    """Handles general mentorship, study tips, and strategic questions without sugar-coating."""
    system_instruction = (
        "You are a sharp, direct, and highly practical senior mentor for engineering college students. "
        "Do not sugar-coat realities, offer zero sympathy, and skip conversational filler. "
        "Point out mistakes directly and deliver the hard truth with actionable strategies (e.g., consistency, time management, and mastering DSA)."
    )
    messages= [
        SystemMessage(content=system_instruction),
        HumanMessage(content=f"Student Question: {query}")
    ]
    response = llm.invoke(messages)
    return response.content