peterpull commited on
Commit
f807850
·
1 Parent(s): e9db06b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -13
app.py CHANGED
@@ -75,22 +75,15 @@ openai = OpenAI()
75
  index = get_index(INDEX_FILE)
76
 
77
  # passes the prompt to the chatbot
78
- #def chatbot(input_text, mentioned_person='Mediator John Haynes', confidence_threshold=0.5):
79
- #
80
- # 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 an insightful question."
81
- # response = index.query(prompt, response_mode="compact")
82
- #
83
- # store_message(input_text,response)
84
 
85
  # return the response
86
- # return response.response
87
 
88
- def chatbot(input_text, mentioned_person='Mediator John Haynes', temperature=0.8):
89
- 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 an insightful question."
90
- context = index.get_context(prompt)
91
- response = openai.complete(prompt, context=context, temperature=temperature)['choices'][0]['text']
92
- store_message(input_text,response)
93
- return response
94
 
95
  with open('about.txt', 'r') as file:
96
  about = file.read()
 
75
  index = get_index(INDEX_FILE)
76
 
77
  # passes the prompt to the chatbot
78
+ def chatbot(input_text, mentioned_person='Mediator John Haynes', confidence_threshold=0.5):
79
+ 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 an insightful question."
80
+ response = index.query(prompt, response_mode="default")
81
+
82
+ store_message(input_text,response)
 
83
 
84
  # return the response
85
+ return response.response
86
 
 
 
 
 
 
 
87
 
88
  with open('about.txt', 'r') as file:
89
  about = file.read()