Caseyrmorrison commited on
Commit
e77b0bc
·
1 Parent(s): 8f4bf10

update greeting

Browse files
Files changed (2) hide show
  1. agents.py +4 -2
  2. app.py +4 -0
agents.py CHANGED
@@ -70,12 +70,13 @@ class Relevant_Documents_Agent:
70
  self.embeddings = embeddings
71
  # Prompts
72
  self.prompt = """[INST]Answer STRICTLY with "Yes" or "No".
 
73
  Use the following context to check if the query is relevant or not.
74
  If the context is even slightly relevant then reply with "Yes" and
75
  if the context and query are poles apart then reply with "No".
76
- If the user queries with a general greeting such as "hello", mark this as relevant and return "Yes".
77
  Context: {context}
78
  Question: {query} [/INST]
 
79
  """
80
  # Data
81
  self.query = ""
@@ -100,7 +101,7 @@ class Answering_Agent:
100
  Utilize the insights from these texts to formulate a comprehensive and accurate response.
101
  Your goal is to synthesize the information, highlight key points, and ensure the answer is informative and directly addresses the user's question.
102
  You will also be given the previous history of chat as Context use it to influence the answer.
103
- If the user queries with any kind of general greeting such as "hello", respond with a general greeting as well.
104
  Relevant Text : {relevant_text}
105
  User's Query: {query}
106
  """)
@@ -124,3 +125,4 @@ class Answering_Agent:
124
 
125
  def generate_response(self):
126
  return self.chain.invoke(self.prompt)
 
 
70
  self.embeddings = embeddings
71
  # Prompts
72
  self.prompt = """[INST]Answer STRICTLY with "Yes" or "No".
73
+ This is important: If the user querie or the question below is a general greeting such as "hello" then you must reply with "Yes".
74
  Use the following context to check if the query is relevant or not.
75
  If the context is even slightly relevant then reply with "Yes" and
76
  if the context and query are poles apart then reply with "No".
 
77
  Context: {context}
78
  Question: {query} [/INST]
79
+ This is important: If the user querie or the question below is a general greeting such as "hello" then you must reply with "Yes".
80
  """
81
  # Data
82
  self.query = ""
 
101
  Utilize the insights from these texts to formulate a comprehensive and accurate response.
102
  Your goal is to synthesize the information, highlight key points, and ensure the answer is informative and directly addresses the user's question.
103
  You will also be given the previous history of chat as Context use it to influence the answer.
104
+ This is important: If the user queries with any kind of general greeting such as "hello", respond with a general greeting.
105
  Relevant Text : {relevant_text}
106
  User's Query: {query}
107
  """)
 
125
 
126
  def generate_response(self):
127
  return self.chain.invoke(self.prompt)
128
+
app.py CHANGED
@@ -97,6 +97,10 @@ class Head_Agent:
97
  # TODO: Get Query from Streamlit App
98
  # print("Query:", query)
99
 
 
 
 
 
100
  ## 1. Obnoxious Agent
101
  # Return yes/True = end
102
  # Return no/False = continue
 
97
  # TODO: Get Query from Streamlit App
98
  # print("Query:", query)
99
 
100
+ # Query for greeting
101
+ if query.lower() in ["hello", "hi", "hey"]:
102
+ return "Hello! How can I help you today?"
103
+
104
  ## 1. Obnoxious Agent
105
  # Return yes/True = end
106
  # Return no/False = continue