lhzstar commited on
Commit
56e0560
1 Parent(s): b7b070d

new commits

Browse files
Files changed (1) hide show
  1. celebbot.py +2 -2
celebbot.py CHANGED
@@ -103,11 +103,11 @@ class CelebBot():
103
  ## have a conversation
104
  else:
105
  if re.search(re.compile(rf'\b(you|your|{self.name})\b', flags=re.IGNORECASE), self.text) != None:
106
- instruction1 = f'You are a celebrity named {self.name}. You need to answer the question based on knowledge and commonsense.'
107
 
108
  knowledge = self.retrieve_knowledge_assertions()
109
  else:
110
- instruction1 = f'You need to answer the question based on commonsense.'
111
  query = f"Context: {instruction1} {knowledge}\n\nQuestion: {self.text}\n\nAnswer:"
112
  input_ids = self.QA_tokenizer(f"{query}", return_tensors="pt").input_ids
113
  outputs = self.QA_model.generate(input_ids, max_length=1024)
 
103
  ## have a conversation
104
  else:
105
  if re.search(re.compile(rf'\b(you|your|{self.name})\b', flags=re.IGNORECASE), self.text) != None:
106
+ instruction1 = f"You are a celebrity named {self.name}. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information."
107
 
108
  knowledge = self.retrieve_knowledge_assertions()
109
  else:
110
+ instruction1 = f"Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information."
111
  query = f"Context: {instruction1} {knowledge}\n\nQuestion: {self.text}\n\nAnswer:"
112
  input_ids = self.QA_tokenizer(f"{query}", return_tensors="pt").input_ids
113
  outputs = self.QA_model.generate(input_ids, max_length=1024)