golang-examples/example-gpt-3/curl-test-api-key.sh

33 lines
1000 B
Bash
Executable File

#!/bin/bash
#
export OPENAI_API_KEY=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
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "Convert this text to a programmatic command:\n\nExample: Ask Constance if we need some bread\nOutput: send-msg `find constance` Do we need some bread?\n\nReach out to the ski store and figure out if I can get my skis fixed before I leave on Thursday",
"temperature": 0,
"max_tokens": 100,
"top_p": 1.0,
"frequency_penalty": 0.2,
"presence_penalty": 0.0,
"stop": ["\n"]
}'
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "What color is the sky?",
"temperature": 0,
"max_tokens": 100,
"top_p": 1.0,
"frequency_penalty": 0.2,
"presence_penalty": 0.0,
"stop": ["\n"]
}'