openai / openai-quickstart-node

Node.js example app from the OpenAI API quickstart tutorial
https://platform.openai.com/docs/quickstart?context=node
MIT License
2.55k stars 1.99k forks source link

Tried querying the "text-davinci-003" model via an API key today and got this error #115

Closed promiseve closed 9 months ago

promiseve commented 1 year ago

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

logankilpatrick commented 9 months ago

I am taking a pass at this in a new PR, thanks for the flag!