Fix for using turbo model and other minor cleanups
This commit is contained in:
parent
08e711074f
commit
f616567155
21
titlegen.py
21
titlegen.py
|
@ -19,20 +19,19 @@ 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
|
||||||
|
|
||||||
writer.writerow(row)
|
writer.writerow(row)
|
||||||
outfile.close()
|
outfile.close()
|
||||||
file.close()
|
file.close()
|
||||||
|
|
Loading…
Reference in New Issue