SatyamD31 anejaprerna commited on
Commit
5813bdb
·
verified ·
1 Parent(s): a9d35a1

Update rag.py (#6)

Browse files

- Update rag.py (345f3073d50d49c54065d6fc088646a8993e4933)


Co-authored-by: Prerna Aneja <[email protected]>

Files changed (1) hide show
  1. rag.py +2 -8
rag.py CHANGED
@@ -39,10 +39,6 @@ class FinancialChatbot:
39
  "attack", "genocide", "mass shooting", "credit card number"
40
  ]
41
 
42
- self.NON_RELEVANT_WORDS = [
43
- "France", "country", "rainbow", "water"
44
- ]
45
-
46
  # Relevance threshold
47
  self.min_similarity_threshold = 0.7
48
 
@@ -102,12 +98,10 @@ class FinancialChatbot:
102
  result[:] = ["Hi, how can I help you?", 1.0]
103
  return
104
 
105
- query_lower = query.lower()
106
- for word in self.NON_RELEVANT_WORDS :
107
- result[:] = ["No relevant information found.", 0.0]
108
  return
109
 
110
-
111
  if not self.moderate_query(query):
112
  result[:] = ["I'm unable to process your request due to inappropriate language.", 0.0]
113
  return
 
39
  "attack", "genocide", "mass shooting", "credit card number"
40
  ]
41
 
 
 
 
 
42
  # Relevance threshold
43
  self.min_similarity_threshold = 0.7
44
 
 
98
  result[:] = ["Hi, how can I help you?", 1.0]
99
  return
100
 
101
+ if query.lower() in ["france","capital","air","rainbow","water","sun"]:
102
+ result[:] = ["No relevant information found", 1.0]
 
103
  return
104
 
 
105
  if not self.moderate_query(query):
106
  result[:] = ["I'm unable to process your request due to inappropriate language.", 0.0]
107
  return