Spaces:
Runtime error
Runtime error
File size: 2,099 Bytes
bdab2da | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="gpt-4o-mini", temperature=0.3)
def research_agent(state):
topic = state["topic"]
country = state["country"]
prompt = f"""
Find 5 potential PhD programs for a student interested in {topic}
in {country}. Include university, department, possible funding,
deadline estimate, and why it fits.
"""
result = llm.invoke(prompt).content
return {"research_results": result}
def matching_agent(state):
prompt = f"""
Based on these PhD programs, identify likely professor profiles
and score fit from 1-10.
Programs:
{state["research_results"]}
Student profile:
{state["profile"]}
"""
result = llm.invoke(prompt).content
return {"matches": result}
def outreach_agent(state):
prompt = f"""
Write personalized PhD outreach email drafts based on:
Matches:
{state["matches"]}
Student profile:
{state["profile"]}
"""
result = llm.invoke(prompt).content
return {"emails": result}
def document_agent(state):
prompt = f"""
Create a Statement of Purpose outline for this PhD applicant.
Topic:
{state["topic"]}
Profile:
{state["profile"]}
Matches:
{state["matches"]}
"""
result = llm.invoke(prompt).content
return {"sop_outline": result}
def deadline_agent(state):
prompt = f"""
Create an application tracking checklist with deadlines,
required documents, professor outreach status, and next actions.
Research:
{state["research_results"]}
Matches:
{state["matches"]}
"""
result = llm.invoke(prompt).content
return {"deadline_plan": result}
def decision_agent(state):
prompt = f"""
Summarize the best PhD application strategy using all outputs:
Research:
{state["research_results"]}
Matches:
{state["matches"]}
Emails:
{state["emails"]}
SOP:
{state["sop_outline"]}
Deadlines:
{state["deadline_plan"]}
"""
result = llm.invoke(prompt).content
return {"final_plan": result} |