Created
May 26, 2025 08:53
-
-
Save petrosDemetrakopoulos/581f2636df30b6ff60271f25d1d0f41d to your computer and use it in GitHub Desktop.
Customer query using AI Waterfall
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def process_customer_query(query): | |
# Level 1: Check for FAQ matches | |
faq_match = check_faq_database(query) | |
if faq_match: | |
return faq_match | |
# Level 2: Intent classification with lightweight ML | |
intent, confidence = classify_intent_ml(query) | |
if confidence > 0.8: | |
return handle_known_intent(intent, query) | |
# Level 3: Few-shot with smaller model | |
if len(query.split()) < 20: # Simple queries | |
return handle_with_gpt35(query) | |
# Level 4: Full LLM reasoning for complex cases | |
return handle_with_gpt4(query) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment