Spaces:
Runtime error
Runtime error
| """ | |
| Industry Selection Flow Demonstration | |
| Shows how industry is determined and used in the system. | |
| """ | |
| print(""" | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β π₯ INDUSTRY SELECTION FLOW β | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β STEP 1: Website Owner Creates Website β | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| Website Owner fills form: | |
| ββββββββββββββββββββββββββββββββββββ | |
| β Creating Website β | |
| β β | |
| β Domain: healthclinic.com β | |
| β Industry: [Healthcare βΌ] β β SELECTS INDUSTRY | |
| β Languages: [English, Urdu] β | |
| β β | |
| β [Create Website] β | |
| ββββββββββββββββββββββββββββββββββββ | |
| Saved to Database: | |
| ββββββββββββββββββββββββββββββββββββ | |
| β websites table β | |
| ββββββββββββββββββββββββββββββββββββ€ | |
| β id: 123 β | |
| β domain: healthclinic.com β | |
| β industry: "healthcare" β β STORED IN DB | |
| β languages: ["en", "ur"] β | |
| ββββββββββββββββββββββββββββββββββββ | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β STEP 2: User Visits Website β | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| User opens: https://healthclinic.com | |
| Chat widget loads: | |
| ββββββββββββββββββββββββββββββββββββ | |
| β π¬ How can we help you? β | |
| β β | |
| β [Language: Urdu βΌ] β | |
| β β | |
| β Type your message... β | |
| ββββββββββββββββββββββββββββββββββββ | |
| Widget knows: website_id = 123 | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β STEP 3: User Sends Message β | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| User types: "mujhe bukhar hai" (I have fever) | |
| Request sent to server: | |
| { | |
| "query": "mujhe bukhar hai", | |
| "website_id": 123, β Identifies website | |
| "language": "ur-roman" | |
| } | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β STEP 4: System Retrieves Website Info β | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| Server queries database: | |
| website = db.query(Website).filter(id == 123).first() | |
| β industry = website.industry # "healthcare" | |
| ββββββββββββββββββββββββββββββββββββ | |
| β Retrieved Info: β | |
| β - Website ID: 123 β | |
| β - Domain: healthclinic.com β | |
| β - Industry: healthcare β β USED FOR ROUTING | |
| β - Languages: [en, ur] β | |
| ββββββββββββββββββββββββββββββββββββ | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β STEP 5: Query Router Processes with Industry Context β | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| routing = await query_router.route_query( | |
| query="mujhe bukhar hai", | |
| website_id=123, | |
| industry="healthcare" β INDUSTRY DETERMINES BEHAVIOR | |
| ) | |
| With industry="healthcare": | |
| ββ Uses healthcare module | |
| ββ Enables symptom checker | |
| ββ Applies HIPAA compliance | |
| ββ Uses medical knowledge base | |
| ββ Returns health-specific advice | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β STEP 6: Industry-Specific Response Generated β | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| Because industry = "healthcare": | |
| ββββββββββββββββββββββββββββββββββββ | |
| β π€ BOT RESPONSE β | |
| ββββββββββββββββββββββββββββββββββββ€ | |
| β Symptoms Analyzed: fever β | |
| β Severity: MODERATE β | |
| β Urgency: URGENT β | |
| β β | |
| β Possible Conditions: β | |
| β - Flu β | |
| β - COVID-19 β | |
| β - Infection β | |
| β β | |
| β β οΈ Consult a healthcare β | |
| β professional soon. β | |
| β β | |
| β β οΈ Medical disclaimer shown β | |
| ββββββββββββββββββββββββββββββββββββ | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β π DIFFERENT INDUSTRY EXAMPLE β | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| If the same query came from a DIFFERENT website: | |
| Website 2 (university.edu): | |
| ββββββββββββββββββββββββββββββββββββ | |
| β id: 456 β | |
| β domain: university.edu β | |
| β industry: "education" β β DIFFERENT INDUSTRY | |
| ββββββββββββββββββββββββββββββββββββ | |
| Same query: "mujhe bukhar hai" | |
| With industry="education": | |
| ββ Uses education module (NOT healthcare) | |
| ββ NO symptom checker | |
| ββ NO HIPAA compliance | |
| ββ Uses academic knowledge base | |
| ββ Returns generic response | |
| Response would be: | |
| ββββββββββββββββββββββββββββββββββββ | |
| β I can help you with: β | |
| β - Admission requirements β | |
| β - Course information β | |
| β - Results and grading β | |
| β β | |
| β For medical assistance, β | |
| β please contact health services. β | |
| ββββββββββββββββββββββββββββββββββββ | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β π― KEY TAKEAWAYS β | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β Industry is SET PER WEBSITE (during website creation) | |
| ββ Stored in database: websites.industry | |
| β Industry is RETRIEVED FROM DATABASE for each query | |
| ββ Every query includes website_id β system looks up industry | |
| β ALL USERS on that website get SAME INDUSTRY responses | |
| ββ healthclinic.com β all users get healthcare responses | |
| ββ university.edu β all users get education responses | |
| β DIFFERENT WEBSITES can have DIFFERENT INDUSTRIES | |
| ββ Website A: Healthcare | |
| ββ Website B: Education | |
| ββ Website C: E-commerce | |
| β NOT GLOBAL - each website has its own industry setting | |
| β NOT PER-USER - industry is determined by website, not individual user | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β π EXAMPLE MULTI-WEBSITE SETUP β | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| ββββββββββββββββββββββββ¬ββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββ | |
| β Website β Industry β What Users Get β | |
| ββββββββββββββββββββββββΌββββββββββββββββββΌββββββββββββββββββββββββββββββββββ€ | |
| β healthclinic.com β Healthcare β β’ Symptom checker β | |
| β β β β’ Medical advice β | |
| β β β β’ HIPAA compliance β | |
| ββββββββββββββββββββββββΌββββββββββββββββββΌββββββββββββββββββββββββββββββββββ€ | |
| β university.edu β Education β β’ Course info β | |
| β β β β’ Admission help β | |
| β β β β’ Academic support β | |
| ββββββββββββββββββββββββΌββββββββββββββββββΌββββββββββββββββββββββββββββββββββ€ | |
| β onlinestore.com β E-commerce β β’ Product info β | |
| β β β β’ Order tracking β | |
| β β β β’ Shipping help β | |
| ββββββββββββββββββββββββ΄ββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββ | |
| """) | |
| print("\nβ Industry selection is PER-WEBSITE, not global!") | |
| print("β All users on a website get that website's industry-specific responses!") | |