APIConnectionError: Error communicating with OpenAI: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/engines/text-davinci-003/completions (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x14ea861b14e0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
Describe the bug
APIConnectionError: Error communicating with OpenAI: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/engines/text-davinci-003/completions (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x14ea861b14e0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
To Reproduce
import openai
Use the API key for authentication
openai.api_key = "sk-XXXXXXXXXXXXXXXX"
Define the model to use
model_engine = "text-davinci-003"
Define the prompt to use as input
prompt = "Are all Indians into tech?"
Request a completion from the model
completions = openai.Completion.create( engine=model_engine, prompt=prompt, max_tokens=1024, n=1, stop=None, temperature=0.5, )
Get the first response from the completions
message = completions.choices[0].text
Print the response
print(message)
OS
No response
Node version
No response