Last active
March 29, 2023 10:55
-
-
Save kxzk/ec496e49f1c81c2a24077dadd2034589 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function data_gpt -a prompt data | |
set prompt_input (echo "$prompt: $data" | string join ' ') | |
curl https://api.openai.com/v1/chat/completions -s \ | |
-H "Content-Type: application/json" \ | |
-H "Authorization: Bearer $OPENAI_API_KEY" \ | |
-d '{ | |
"model": "gpt-4", | |
"messages": [{"role": "user", "content": "'$prompt_input'"}], | |
"temperature": 0.7 | |
}' | jq -r '.choices[0].message.content' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment