markpeace commited on
Commit
33b89d4
1 Parent(s): 46fc259

Now checks for classificatory credits

Browse files
Files changed (2) hide show
  1. agent/_create.py +1 -1
  2. agent/toolset.py +12 -1
agent/_create.py CHANGED
@@ -83,7 +83,7 @@ def agent(payload):
83
 
84
  from langchain_core.messages import HumanMessage
85
 
86
- input = payload.get("input") or "What is Rise for?"
87
  inputs = [HumanMessage(content=input)]
88
 
89
  response = app.invoke(inputs, {"configurable": {"thread_id": memory.thread_id} } )
 
83
 
84
  from langchain_core.messages import HumanMessage
85
 
86
+ input = payload.get("input") or "Can I earn credit?"
87
  inputs = [HumanMessage(content=input)]
88
 
89
  response = app.invoke(inputs, {"configurable": {"thread_id": memory.thread_id} } )
agent/toolset.py CHANGED
@@ -25,6 +25,17 @@ def frequently_asked_questions(input: str):
25
  result = qa.invoke(input)
26
  return result
27
 
 
 
 
 
 
 
 
 
 
 
 
28
  class RecommendActivityInput(BaseModel):
29
  profile: str = Field(description="should be a penportrait of the user describing their interests and objectives. If they have a specific thing they are interested in, it should state that")
30
 
@@ -49,7 +60,7 @@ def recommend_activity(profile: str) -> str:
49
  result = qa.invoke("recommend an activity relevant to the following profile: "+profile)
50
  return result
51
 
52
- tools = [frequently_asked_questions]
53
 
54
  from langgraph.prebuilt import ToolExecutor
55
 
 
25
  result = qa.invoke(input)
26
  return result
27
 
28
+ @tool
29
+ def check_eligibility(input: str):
30
+ """
31
+ Use this to check whether a student is eligible to earn classificatory credits
32
+ """
33
+ from flask import request
34
+
35
+ from langchain_community.document_loaders import WebBaseLoader
36
+ document = WebBaseLoader("https://rise.mmu.ac.uk/wp-content/themes/rise/helpers/user/student_eligibility/chatbotquery.php?query=eligibility&wpid="+request.values.get("user_id")).load()
37
+ return document[0].page_content
38
+
39
  class RecommendActivityInput(BaseModel):
40
  profile: str = Field(description="should be a penportrait of the user describing their interests and objectives. If they have a specific thing they are interested in, it should state that")
41
 
 
60
  result = qa.invoke("recommend an activity relevant to the following profile: "+profile)
61
  return result
62
 
63
+ tools = [frequently_asked_questions, check_eligibility]
64
 
65
  from langgraph.prebuilt import ToolExecutor
66