Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -103,25 +103,27 @@ def print_header_json_file(filepath):
|
|
| 103 |
index = get_index(INDEX_FILE)
|
| 104 |
|
| 105 |
# passes the prompt to the chatbot
|
| 106 |
-
def chatbot(input_text,
|
| 107 |
hyde= HyDEQueryTransform(include_original=True)
|
| 108 |
-
prompt = f"In character as
|
| 109 |
response = index.query(prompt, response_mode="default", verbose=True, query_transform=hyde)
|
| 110 |
store_message(input_text,response)
|
| 111 |
|
| 112 |
# return the response
|
| 113 |
-
return response.response
|
| 114 |
|
| 115 |
|
| 116 |
with open('about.txt', 'r') as file:
|
| 117 |
about = file.read()
|
| 118 |
|
| 119 |
-
examples=[["
|
| 120 |
description="GPT3_Chatbot drawing on contextual mediation material, v0.6H"
|
| 121 |
title="The MediatorBot"
|
| 122 |
|
| 123 |
iface = Interface(
|
| 124 |
fn=chatbot,
|
|
|
|
|
|
|
| 125 |
inputs=Textbox("Enter your question"),
|
| 126 |
outputs="text",
|
| 127 |
title=title,
|
|
|
|
| 103 |
index = get_index(INDEX_FILE)
|
| 104 |
|
| 105 |
# passes the prompt to the chatbot
|
| 106 |
+
def chatbot(input_text, history=[]):
|
| 107 |
hyde= HyDEQueryTransform(include_original=True)
|
| 108 |
+
prompt = f"In character as John Haynes, please respond to: {input_text}. Only reply with contextual information or say you cannot find an answer. End with a reflective question."
|
| 109 |
response = index.query(prompt, response_mode="default", verbose=True, query_transform=hyde)
|
| 110 |
store_message(input_text,response)
|
| 111 |
|
| 112 |
# return the response
|
| 113 |
+
return response.response,history
|
| 114 |
|
| 115 |
|
| 116 |
with open('about.txt', 'r') as file:
|
| 117 |
about = file.read()
|
| 118 |
|
| 119 |
+
examples=[["What are three excellent questions to ask at intake?"],["How do you handle high conflict divorce cases?"],["What metaphors do you steer parties away from in mediation? Which do you prefer?"]]
|
| 120 |
description="GPT3_Chatbot drawing on contextual mediation material, v0.6H"
|
| 121 |
title="The MediatorBot"
|
| 122 |
|
| 123 |
iface = Interface(
|
| 124 |
fn=chatbot,
|
| 125 |
+
inputs=[Textbox("Enter your question"), "state"],
|
| 126 |
+
outputs=["chatbot", "state"],
|
| 127 |
inputs=Textbox("Enter your question"),
|
| 128 |
outputs="text",
|
| 129 |
title=title,
|