ChatGPT: Completions API doesn't reply as the web chat playground does?

Use this code instead :slight_smile:

curl https://api.openai.com/v1/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
  "model": "text-davinci-003",
  "prompt": "The following is a conversation with an AI assistant. The assistant is helpful, creative, clever, and very friendly.\n\nHuman: Hello, who are you?\nAI: I am an AI created by OpenAI. How can I help you today?\nHuman: ",
  "temperature": 0.9,
  "max_tokens": 150,
  "top_p": 1,
  "frequency_penalty": 0,
  "presence_penalty": 0.6,
  "stop": [" Human:", " AI:"]
}'

ChatGPT is just a tweak of PlayGround. Adding few parameters makes it ChatGPT:

  • Prompt the Completion program to become an AI Assitant
  • Go to new line and begin with β€œHuman:” or β€œAI:” at each line
2 Likes