| from core.intent import detect_intent |
| from core.sentiment import analyze_sentiment |
| from core.recommender import recommend_action |
| from rag.retriever import retrieve_context |
| from utils.scoring import confidence_score |
|
|
| class CXAgent: |
| def handle_query(self, query: str): |
| intent = detect_intent(query) |
| sentiment = analyze_sentiment(query) |
| context = retrieve_context(query) |
|
|
| response = f"{context}\n\nBased on your request, here is how we can help you." |
|
|
| action = recommend_action(intent, sentiment) |
| confidence = confidence_score(intent, sentiment) |
|
|
| return { |
| "response": response, |
| "intent": intent, |
| "sentiment": sentiment, |
| "action": action, |
| "confidence": confidence |
| } |
|
|