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
using HTTP, JSON3 | |
"Call the OpenAI JSON API and return the results." | |
function gpt3_api_call( | |
prompt, n_completions::Int=1; | |
endpoint::String = "https://api.openai.com/v1/completions", | |
api_key::String = get(ENV, "OPENAI_API_KEY", ""), | |
organization::String = get(ENV, "OPENAI_ORGANIZATION", ""), | |
n_retries::Int = 10, | |
model::String = "text-davinci-003", |