Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -67,7 +67,13 @@ def get_index(index_file_path):
|
|
| 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 |
|
| 72 |
# Check the confidence score of the response
|
| 73 |
if response.score < confidence_threshold:
|
|
|
|
| 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:
|