Update src/api/agent.py
Browse files- src/api/agent.py +45 -2
src/api/agent.py
CHANGED
|
@@ -179,7 +179,7 @@ KU_CAMPUS_RE = re.compile(
|
|
| 179 |
RESEARCH_CUE_RE = re.compile(
|
| 180 |
r"\b(find|search|look for|show me|get me|give me|locate|recommend|suggest"
|
| 181 |
r"|articles?|papers?|books?|journals?|studies|literature|research|systematic review"
|
| 182 |
-
r"|evidence|sources|database|databases|peer reviewed|
|
| 183 |
r"|approach(es)?|method(s|ology)?|technique[s]?|application[s]?|framework[s]?"
|
| 184 |
r"|model[s]?|algorithm[s]?|publication[s]?|recent work|current state|state of the art)\b",
|
| 185 |
re.IGNORECASE,
|
|
@@ -462,6 +462,9 @@ CRITICAL RULES:
|
|
| 462 |
6. Only use general_recent for truly live data changing by the minute (news, scores, weather, stocks).
|
| 463 |
7. When in doubt between library_info and anything else, choose library_info if the question involves a library service, person, or resource.
|
| 464 |
8. "sensitive" covers: (a) criticism/negative commentary about KU or UAE, (b) sexual or adult content, (c) political attacks on UAE/Gulf governments, (d) religiously offensive content. Academic research on politics, health, or social issues = general or search_academic.
|
|
|
|
|
|
|
|
|
|
| 465 |
|
| 466 |
EXAMPLES — follow these exactly:
|
| 467 |
{"message": "who is the research librarian", "intent": "library_info"}
|
|
@@ -469,6 +472,23 @@ EXAMPLES — follow these exactly:
|
|
| 469 |
{"message": "I cannot access a library database from home", "intent": "library_info"}
|
| 470 |
{"message": "can I access journals off campus", "intent": "library_info"}
|
| 471 |
{"message": "who should I contact for research support", "intent": "library_info"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 472 |
{"message": "what is quantum computing", "intent": "search_academic"}
|
| 473 |
{"message": "explain CRISPR gene editing", "intent": "search_academic"}
|
| 474 |
{"message": "best practices in cybersecurity", "intent": "search_academic"}
|
|
@@ -2188,12 +2208,35 @@ def _contact_footer_for_query(question: str, context: Optional[SearchContextPayl
|
|
| 2188 |
'<a href="tel:+97123124278">+971 2 312 4278</a>'
|
| 2189 |
)
|
| 2190 |
return footer
|
| 2191 |
-
elif any(t in q for t in [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2192 |
"e-resource", "remote access", "access problem", "off campus"]):
|
| 2193 |
specialist = _find_staff_by_token("rani")
|
| 2194 |
elif any(t in q for t in ["website", "system", "technical", "login issue", "page not loading"]):
|
| 2195 |
specialist = _find_staff_by_token("walter")
|
| 2196 |
elif context and context.intent == "search_medical":
|
|
|
|
| 2197 |
specialist = _find_staff_by_token("jason")
|
| 2198 |
elif context and context.intent == "search_academic":
|
| 2199 |
specialist = _find_staff_by_token("nikesh")
|
|
|
|
| 179 |
RESEARCH_CUE_RE = re.compile(
|
| 180 |
r"\b(find|search|look for|show me|get me|give me|locate|recommend|suggest"
|
| 181 |
r"|articles?|papers?|books?|journals?|studies|literature|research|systematic review"
|
| 182 |
+
r"|evidence|sources|database|databases|peer reviewed|advances?"
|
| 183 |
r"|approach(es)?|method(s|ology)?|technique[s]?|application[s]?|framework[s]?"
|
| 184 |
r"|model[s]?|algorithm[s]?|publication[s]?|recent work|current state|state of the art)\b",
|
| 185 |
re.IGNORECASE,
|
|
|
|
| 462 |
6. Only use general_recent for truly live data changing by the minute (news, scores, weather, stocks).
|
| 463 |
7. When in doubt between library_info and anything else, choose library_info if the question involves a library service, person, or resource.
|
| 464 |
8. "sensitive" covers: (a) criticism/negative commentary about KU or UAE, (b) sexual or adult content, (c) political attacks on UAE/Gulf governments, (d) religiously offensive content. Academic research on politics, health, or social issues = general or search_academic.
|
| 465 |
+
9. APC, article processing charges, open access publishing, OA fees, open access waivers, open access journal policies, Creative Commons licences = ALWAYS library_info. NEVER search_academic or search_medical.
|
| 466 |
+
10. Research support, research consultation, bibliometrics, ORCID, Khazna, SciVal, scholarly communication, where to publish, journal selection = ALWAYS library_info. NEVER search_academic.
|
| 467 |
+
11. "research on X" / "find research on X" / "research about X" where X is an academic topic = search_academic. Only the word "research" alone with a topic = article search, NOT a library service question.
|
| 468 |
|
| 469 |
EXAMPLES — follow these exactly:
|
| 470 |
{"message": "who is the research librarian", "intent": "library_info"}
|
|
|
|
| 472 |
{"message": "I cannot access a library database from home", "intent": "library_info"}
|
| 473 |
{"message": "can I access journals off campus", "intent": "library_info"}
|
| 474 |
{"message": "who should I contact for research support", "intent": "library_info"}
|
| 475 |
+
{"message": "what is an APC", "intent": "library_info"}
|
| 476 |
+
{"message": "how do I pay article processing charges", "intent": "library_info"}
|
| 477 |
+
{"message": "does KU cover APC fees", "intent": "library_info"}
|
| 478 |
+
{"message": "how to publish open access", "intent": "library_info"}
|
| 479 |
+
{"message": "open access publishing at KU", "intent": "library_info"}
|
| 480 |
+
{"message": "is there an OA fund at Khalifa University", "intent": "library_info"}
|
| 481 |
+
{"message": "Walter Hall open access", "intent": "library_info"}
|
| 482 |
+
{"message": "who handles open access at KU library", "intent": "library_info"}
|
| 483 |
+
{"message": "creative commons licence for my paper", "intent": "library_info"}
|
| 484 |
+
{"message": "who is the research librarian", "intent": "library_info"}
|
| 485 |
+
{"message": "I need research support", "intent": "library_info"}
|
| 486 |
+
{"message": "bibliometrics help", "intent": "library_info"}
|
| 487 |
+
{"message": "how do I register for ORCID", "intent": "library_info"}
|
| 488 |
+
{"message": "deposit in Khazna", "intent": "library_info"}
|
| 489 |
+
{"message": "research on machine learning", "intent": "search_academic"}
|
| 490 |
+
{"message": "find research on climate change", "intent": "search_academic"}
|
| 491 |
+
{"message": "research about AI in healthcare", "intent": "search_medical"}
|
| 492 |
{"message": "what is quantum computing", "intent": "search_academic"}
|
| 493 |
{"message": "explain CRISPR gene editing", "intent": "search_academic"}
|
| 494 |
{"message": "best practices in cybersecurity", "intent": "search_academic"}
|
|
|
|
| 2208 |
'<a href="tel:+97123124278">+971 2 312 4278</a>'
|
| 2209 |
)
|
| 2210 |
return footer
|
| 2211 |
+
elif any(t in q for t in [
|
| 2212 |
+
"apc", "article processing charge", "article processing fee",
|
| 2213 |
+
"open access fee", "oa fee", "oa fund", "oa publishing",
|
| 2214 |
+
"publish open access", "open access publish", "how to publish open access",
|
| 2215 |
+
"open access journal", "open access mandate", "open access policy",
|
| 2216 |
+
"waiver", "gold open access", "diamond open access", "hybrid journal",
|
| 2217 |
+
"creative commons", "cc by", "cc licence", "openaccess", "open access",
|
| 2218 |
+
]):
|
| 2219 |
+
# Open Access & APC → Walter Brian Hall (OA lead at KU Library)
|
| 2220 |
+
specialist = _find_staff_by_token("walter")
|
| 2221 |
+
elif any(t in q for t in [
|
| 2222 |
+
"research support", "research service", "research consultation",
|
| 2223 |
+
"research librarian", "research help", "research advice",
|
| 2224 |
+
"scholarly communication", "bibliometric", "research impact",
|
| 2225 |
+
"citation analysis", "h-index", "journal ranking", "impact factor",
|
| 2226 |
+
"orcid", "khazna", "repository", "scival", "scopus profile",
|
| 2227 |
+
"author profile", "research data", "data management",
|
| 2228 |
+
"libguide", "research guide", "ai tool", "ai for research",
|
| 2229 |
+
"publication advice", "journal selection", "where to publish",
|
| 2230 |
+
]):
|
| 2231 |
+
# Research services → Nikesh Narayanan (Research & Access Services Librarian)
|
| 2232 |
+
specialist = _find_staff_by_token("nikesh")
|
| 2233 |
+
elif any(t in q for t in ["database access", "proxy", "eresource",
|
| 2234 |
"e-resource", "remote access", "access problem", "off campus"]):
|
| 2235 |
specialist = _find_staff_by_token("rani")
|
| 2236 |
elif any(t in q for t in ["website", "system", "technical", "login issue", "page not loading"]):
|
| 2237 |
specialist = _find_staff_by_token("walter")
|
| 2238 |
elif context and context.intent == "search_medical":
|
| 2239 |
+
# Medical/clinical research questions only → Jason Fetty (Medical Librarian)
|
| 2240 |
specialist = _find_staff_by_token("jason")
|
| 2241 |
elif context and context.intent == "search_academic":
|
| 2242 |
specialist = _find_staff_by_token("nikesh")
|