Skip to content

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

@promiseve

Description

@promiseve

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)

Code snippets

No response

OS

macOS

Python version

Python v3.7.1

Library version

openai-python v0.26.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions