Halo commited on
Commit
57e6c41
1 Parent(s): 1b67450

Update app

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -99,7 +99,7 @@ def load_recommender(path, start_page=1):
99
  return 'Corpus Loaded.'
100
 
101
 
102
- def generate_text(openAI_key, prompt, model_name="text-davinci-003"):
103
  openai.api_key = openAI_key
104
  if model_name.startswith('gpt'):
105
  completions = openai.ChatCompletion.create(
@@ -139,10 +139,11 @@ def generate_answer(question, openAI_key, model_name):
139
  "search results which has nothing to do with the question. Only answer what is asked. The "\
140
  "answer should be short and concise. "
141
 
142
- prompt += f"Query: {question}\nAnswer:"
143
  if model_name.startswith('gpt'):
144
  answer = generate_text(openAI_key, prompt, question, model_name)
145
  else:
 
146
  answer = generate_text(openAI_key, prompt, model_name)
147
  return answer
148
 
 
99
  return 'Corpus Loaded.'
100
 
101
 
102
+ def generate_text(openAI_key, prompt, question, model="gpt-3.5-turbo"):
103
  openai.api_key = openAI_key
104
  if model_name.startswith('gpt'):
105
  completions = openai.ChatCompletion.create(
 
139
  "search results which has nothing to do with the question. Only answer what is asked. The "\
140
  "answer should be short and concise. "
141
 
142
+
143
  if model_name.startswith('gpt'):
144
  answer = generate_text(openAI_key, prompt, question, model_name)
145
  else:
146
+ prompt += f"Query: {question}\nAnswer:"
147
  answer = generate_text(openAI_key, prompt, model_name)
148
  return answer
149