Skip to content

Instantly share code, notes, and snippets.

@turnipsoup
Last active December 2, 2022 06:09
Show Gist options
  • Save turnipsoup/604dfd2bfe3d969b578b271384a37fa9 to your computer and use it in GitHub Desktop.
Save turnipsoup/604dfd2bfe3d969b578b271384a37fa9 to your computer and use it in GitHub Desktop.
Take an input text file and have GPT-3 return a numbered list of action items
"""
Takes the passed text file and sends it to OpenAI GPT-3 to turn it into a To-Do list.
"""
import os, sys, openai
openai.api_key = os.getenv("OPENAI_API_KEY")
text = open(sys.argv[1], "r").read().strip()
res = openai.Completion.create(
model="text-davinci-003",
prompt=f"extract action items from the following and create a numbered list: {text}\n-----",
max_tokens=256,
temperature=0.1
)
print(res.choices[0].text.strip())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment