peterpull commited on
Commit
e5fb371
·
1 Parent(s): 229c2d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -13
app.py CHANGED
@@ -66,20 +66,8 @@ def get_index(index_file_path):
66
  # passes the prompt to the chatbot
67
  def chatbot(input_text, mentioned_person='Mediator John Haynes', confidence_threshold=0.5):
68
  index = get_index(INDEX_FILE)
69
- prompt = f"You are {mentioned_person}: {input_text}\n\n At the end of your answer ask a provocative question."
70
  response = index.query(prompt, response_mode="compact")
71
- if isinstance(response, list):
72
- response_text = response[0].text
73
- confidence = response[0].score
74
- else:
75
- response_text = response.text
76
- confidence = response.score
77
-
78
- # Check the confidence score of the response
79
- if response.score < confidence_threshold:
80
- response_text = "I'm not sure how to respond to that."
81
- else:
82
- response_text = response.response
83
 
84
  store_message(input_text, response_text)
85
  print(f"Chat input: {input_text}\nChatbot response: {response_text}")
 
66
  # passes the prompt to the chatbot
67
  def chatbot(input_text, mentioned_person='Mediator John Haynes', confidence_threshold=0.5):
68
  index = get_index(INDEX_FILE)
69
+ prompt = f"You are {mentioned_person}. Answer this: {input_text}. Only reply from the contextual data, or say you don't know. At the end of your answer ask a provocative question."
70
  response = index.query(prompt, response_mode="compact")
 
 
 
 
 
 
 
 
 
 
 
 
71
 
72
  store_message(input_text, response_text)
73
  print(f"Chat input: {input_text}\nChatbot response: {response_text}")