invincible-jha commited on
Commit
c20b0c6
·
verified ·
1 Parent(s): 9483f8f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -53,6 +53,10 @@ classifier = MultinomialNB()
53
  classifier.fit(X, np.arange(len(approved_topics)))
54
 
55
  class CommunicationExpertAgent(Agent):
 
 
 
 
56
  async def run(self, query):
57
  sanitized_query = re.sub(r'[<>&\']', '', query)
58
  topic_relevance = classifier.predict(vectorizer.transform([sanitized_query]))[0] in range(len(approved_topics))
@@ -63,6 +67,10 @@ class CommunicationExpertAgent(Agent):
63
  return rephrased_query
64
 
65
  class ResponseExpertAgent(Agent):
 
 
 
 
66
  async def run(self, rephrased_query):
67
  response = await hf_client.text_generation(rephrased_query, max_new_tokens=500, temperature=0.7)
68
  return response['generated_text']
 
53
  classifier.fit(X, np.arange(len(approved_topics)))
54
 
55
  class CommunicationExpertAgent(Agent):
56
+ role = "Communication Expert"
57
+ goal = "To interpret and rephrase user queries with empathy and respect"
58
+ backstory = """You are an expert in communication, specializing in understanding and rephrasing queries to ensure they are interpreted in the most positive and constructive light. Your role is crucial in setting the tone for respectful and empathetic interactions."""
59
+
60
  async def run(self, query):
61
  sanitized_query = re.sub(r'[<>&\']', '', query)
62
  topic_relevance = classifier.predict(vectorizer.transform([sanitized_query]))[0] in range(len(approved_topics))
 
67
  return rephrased_query
68
 
69
  class ResponseExpertAgent(Agent):
70
+ role = "Response Expert"
71
+ goal = "To provide accurate, helpful, and emotionally intelligent responses to user queries"
72
+ backstory = """You are an expert in Zerodha's services and policies, with a keen ability to provide comprehensive and empathetic responses. Your role is to ensure that all user queries are addressed accurately while maintaining a respectful and supportive tone."""
73
+
74
  async def run(self, rephrased_query):
75
  response = await hf_client.text_generation(rephrased_query, max_new_tokens=500, temperature=0.7)
76
  return response['generated_text']