aymanemalih commited on
Commit
8b8b5d5
·
1 Parent(s): 89c134b

Update gpt.py

Browse files
Files changed (1) hide show
  1. gpt.py +2 -2
gpt.py CHANGED
@@ -4,13 +4,13 @@ model = "gpt-3.5-turbo"
4
 
5
  def get_keywords(question):
6
  prompt = f"Extract 10 keywords from the following question, including synonyms. Use only lowercase letters:\n\n{question}"
7
- response = openai.Completion.create(model=model, prompt=prompt, max_tokens=60)
8
  keywords = response.choices[0].text.strip().split(', ')
9
  return keywords
10
 
11
  def answer_question(chunk, question):
12
  prompt = f"Based on the following information, what is the answer to this question?\n\nText:\n{chunk}\n\nQuestion:\n{question}"
13
- response = openai.Completion.create(model=model, prompt=prompt, max_tokens=150)
14
  answer = response.choices[0].text.strip()
15
  return answer
16
 
 
4
 
5
  def get_keywords(question):
6
  prompt = f"Extract 10 keywords from the following question, including synonyms. Use only lowercase letters:\n\n{question}"
7
+ response = openai.completions.create(model=model, prompt=prompt, max_tokens=60)
8
  keywords = response.choices[0].text.strip().split(', ')
9
  return keywords
10
 
11
  def answer_question(chunk, question):
12
  prompt = f"Based on the following information, what is the answer to this question?\n\nText:\n{chunk}\n\nQuestion:\n{question}"
13
+ response = openai.completions.create(model=model, prompt=prompt, max_tokens=150)
14
  answer = response.choices[0].text.strip()
15
  return answer
16