Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ from huggingface_hub import InferenceClient
|
|
12 |
import random
|
13 |
import json
|
14 |
import warnings
|
15 |
-
from
|
16 |
|
17 |
# Suppress all deprecation warnings
|
18 |
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
@@ -54,9 +54,10 @@ classifier = MultinomialNB()
|
|
54 |
classifier.fit(X, np.arange(len(approved_topics)))
|
55 |
|
56 |
class CommunicationExpertAgent(Agent):
|
57 |
-
role:
|
58 |
-
goal:
|
59 |
-
backstory:
|
|
|
60 |
|
61 |
async def run(self, query):
|
62 |
sanitized_query = re.sub(r'[<>&\']', '', query)
|
@@ -68,9 +69,10 @@ class CommunicationExpertAgent(Agent):
|
|
68 |
return rephrased_query
|
69 |
|
70 |
class ResponseExpertAgent(Agent):
|
71 |
-
role:
|
72 |
-
goal:
|
73 |
-
backstory:
|
|
|
74 |
|
75 |
async def run(self, rephrased_query):
|
76 |
response = await hf_client.text_generation(rephrased_query, max_new_tokens=500, temperature=0.7)
|
|
|
12 |
import random
|
13 |
import json
|
14 |
import warnings
|
15 |
+
from typing import Literal
|
16 |
|
17 |
# Suppress all deprecation warnings
|
18 |
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
|
|
54 |
classifier.fit(X, np.arange(len(approved_topics)))
|
55 |
|
56 |
class CommunicationExpertAgent(Agent):
|
57 |
+
role: Literal["Communication Expert"] = "Communication Expert"
|
58 |
+
goal: Literal["To interpret and rephrase user queries with empathy and respect"] = "To interpret and rephrase user queries with empathy and respect"
|
59 |
+
backstory: Literal["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."] = \
|
60 |
+
"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."
|
61 |
|
62 |
async def run(self, query):
|
63 |
sanitized_query = re.sub(r'[<>&\']', '', query)
|
|
|
69 |
return rephrased_query
|
70 |
|
71 |
class ResponseExpertAgent(Agent):
|
72 |
+
role: Literal["Response Expert"] = "Response Expert"
|
73 |
+
goal: Literal["To provide accurate, helpful, and emotionally intelligent responses to user queries"] = "To provide accurate, helpful, and emotionally intelligent responses to user queries"
|
74 |
+
backstory: Literal["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."] = \
|
75 |
+
"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."
|
76 |
|
77 |
async def run(self, rephrased_query):
|
78 |
response = await hf_client.text_generation(rephrased_query, max_new_tokens=500, temperature=0.7)
|