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: I’d like to cancel my subscription.\nAI:”,
“temperature”: 0.9,
“max_tokens”: 150,
“top_p”: 1,
“frequency_penalty”: 0.0,
“presence_penalty”: 0.6,
“stop”: [" Human:“, " AI:”]
}’
" l’d like … " would be considered asymmetrical for single quotes.
Run above code on the linux terminal will encounter error:
bash: unexpected EOF while looking for matching `"’
bash: syntax error: unexpected end of file
curl https://api.openai.com/v1/completions -H “Authorization: Bearer $OPENAI_API_KEY” -H “Content-Type: application/json”
-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: I’d like to cancel my subscription.\nAI:”,
“max_tokens”: 7,
“temperature”: 0,
“top_p”: 1,
“n”: 1,
“stream”: false,
“logprobs”: null,
“stop”: “xyz”
}’
-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: I’d like to cancel my subscription.\nAI:",
"temperature": 0.9,
"max_tokens": 150,
"top_p": 1,
"frequency_penalty": 0.0,
"presence_penalty": 0.6,
"stop": [" Human:", " AI:"]
}'
I’ve made the following changes:
Replaced the curly quotes “ ” with straight quotes " ".
Fixed the single quotes issue for ‘l’d like …’ by using straight single quotes ’ '.
Added backslashes \ at the end of each line to allow for line breaks in the command.
Copy and paste the corrected command into your terminal, and it should work as expected.
Thanks Paul. I was just trying to help the OP on Mar 23. Thanks for the enhancements (weird how those double quotes got mangled]!
Just curious, why did it take over 30 days to approve my message? Is it because it contained code? If so, let me know so I can respond to someone in a timely way.