AuthenticationError Traceback (most recent call last)
in
16 {text}
17 “”"
—> 18 response = get_completion(prompt)
19 print(response)
in get_completion(prompt, model)
1 def get_completion(prompt, model=“gpt-3.5-turbo”):
2 messages = [{“role”: “user”, “content”: prompt}]
----> 3 response = openai.ChatCompletion.create(
4 model=model,
5 messages=messages,
~\anaconda3\lib\site-packages\openai\api_resources\chat_completion.py in create(cls, *args, **kwargs)
23 while True:
24 try:
—> 25 return super().create(*args, **kwargs)
26 except TryAgain as e:
27 if timeout is not None and time.time() > start + timeout:
~\anaconda3\lib\site-packages\openai\api_resources\abstract\engine_api_resource.py in create(cls, api_key, api_base, api_type, request_id, api_version, organization, **params)
147 url,
148 params,
→ 149 ) = cls.__prepare_create_request(
150 api_key, api_base, api_type, api_version, organization, **params
151 )
~\anaconda3\lib\site-packages\openai\api_resources\abstract\engine_api_resource.py in __prepare_create_request(cls, api_key, api_base, api_type, api_version, organization, **params)
104 params[“timeout”] = MAX_TIMEOUT
105
→ 106 requestor = api_requestor.APIRequestor(
107 api_key,
108 api_base=api_base,
~\anaconda3\lib\site-packages\openai\api_requestor.py in init(self, key, api_base, api_type, api_version, organization)
136 ):
137 self.api_base = api_base or openai.api_base
→ 138 self.api_key = key or util.default_api_key()
139 self.api_type = (
140 ApiType.from_str(api_type)
~\anaconda3\lib\site-packages\openai\util.py in default_api_key()
184 return openai.api_key
185 else:
→ 186 raise openai.error.AuthenticationError(
187 “No API key provided. You can set your API key in code using ‘openai.api_key = ’, or you can set the environment variable OPENAI_API_KEY=). If your API key is stored in a file, you can point the openai module at it with ‘openai.api_key_path = ’. You can generate API keys in the OpenAI web interface. See https://platform.openai.com/account/api-keys for details.”
188 )
AuthenticationError: No API key provided. You can set your API key in code using ‘openai.api_key = ’, or you can set the environment variable OPENAI_API_KEY=). If your API key is stored in a file, you can point the openai module at it with ‘openai.api_key_path = ’. You can generate API keys in the OpenAI web interface. See https://platform.openai.com/account/api-keys for details.