Fix for using turbo model and other minor cleanups

This commit is contained in:
Ashik K 2023-04-06 17:31:20 +02:00
parent 08e711074f
commit f616567155
1 changed files with 10 additions and 11 deletions

View File

@ -19,17 +19,16 @@ with open(sys.argv[1], "r") as file:
# in one sentence:" and the text in the 5th column # in one sentence:" and the text in the 5th column
prompt = "Summarize this in one English sentence of not more than 4 words:" + row[4] prompt = "Summarize this in one English sentence of not more than 4 words:" + row[4]
response = openai.Completion.create( completion = openai.ChatCompletion.create( # 1. Change the function Completion to ChatCompletion
model="gpt-3.5-turbo", model = 'gpt-3.5-turbo',
prompt=prompt, messages = [
temperature=0.7, {'role': 'user', 'content': prompt}
max_tokens=64, ],
top_p=1.0, temperature = 0
frequency_penalty=0.0,
presence_penalty=0.0
) )
# write the response as the last column in each row of the same csv file # write the response as the last column in each row of the same csv file
row.append(response) row.append(completion['choices'][0]['message']['content'])
print(row) print(row)
# write the row to the csv file # write the row to the csv file