Spaces:
Sleeping
Sleeping
File size: 2,382 Bytes
1c3e7e5 |
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 |
import random
from intent_mapper import detect_intent
def load_text(filename: str) -> str:
with open(filename, "r", encoding="utf-8") as f:
return f.read().strip()
# Load knowledge files (FLAT FILES)
PROFILE = load_text("futurelab_profile.txt")
SERVICES = load_text("services.txt")
WORKSHOPS = load_text("workshops.txt")
INTRO_LINES = [
"Good question.",
"Sure, let me explain.",
"Here’s a quick overview.",
"Happy to clarify.",
]
FOLLOW_UP_LINES = [
"Let me know if you’d like more details.",
"You can also ask about our services or workshops.",
]
def get_response(user_input: str) -> str:
intent = detect_intent(user_input)
intro = random.choice(INTRO_LINES)
follow_up = random.choice(FOLLOW_UP_LINES)
if intent == "profile":
return f"{intro}\n\n{PROFILE}\n\n{follow_up}"
if intent == "focus":
return (
"Futurelab Studios focuses on AI enablement and adoption. "
"We help organizations and individuals apply AI in practical, "
"responsible ways through consulting, education, and AI-first tools."
)
if intent == "consulting":
return (
"Yes, Futurelab Studios provides AI consulting. "
"We work with organizations to identify real business use cases, "
"design AI-driven workflows, and support responsible AI adoption."
)
if intent == "adoption":
return (
"Futurelab helps organizations adopt AI by combining strategic "
"consulting, hands-on workshops, and the development of custom "
"AI tools that fit naturally into existing workflows."
)
if intent == "global":
return (
"Yes, Futurelab Studios works with a global audience. "
"We collaborate with organizations and professionals across "
"different regions and design our AI solutions and workshops "
"to be globally relevant."
)
if intent == "services":
return f"{intro}\n\n{SERVICES}\n\n{follow_up}"
if intent == "workshops":
return f"{intro}\n\n{WORKSHOPS}\n\n{follow_up}"
# Brand-safe fallback
return (
"I can help you understand what Futurelab Studios does, "
"how we help organizations adopt AI, or what services "
"and workshops we offer."
)
|