Skip to content

Instantly share code, notes, and snippets.

@mpangrazzi
Created September 6, 2022 13:16
Show Gist options
  • Save mpangrazzi/1bd69f11d4c4f3c20ce652634ed6020e to your computer and use it in GitHub Desktop.
Save mpangrazzi/1bd69f11d4c4f3c20ce652634ed6020e to your computer and use it in GitHub Desktop.
Call OpenAI API asking GPT-3 for a Completion
import openai
res = openai.Completion.create(
model="text-davinci-002",
prompt="How are you?\n",
temperature=0,
max_tokens=64,
top_p=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