AuthenticationErrorr

I just ran it in my jupyter notebook without changing anything and I got this error, what should I do?


AuthenticationError Traceback (most recent call last)
Cell In[4], line 12
1 prompt = f"“”
2 Your task is to help a marketing team create a
3 description for a retail website of a product based
(…)
10 Technical specifications: {fact_sheet_chair}
11 “”"
—> 12 response = get_completion(prompt)
13 print(response)

Cell In[2], line 3, 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,
6 temperature=0, # this is the degree of randomness of the model’s output
7 )
8 return response.choices[0].message[“content”]

File ~\anaconda3\lib\site-packages\openai\api_resources\chat_completion.py:25, in ChatCompletion.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:

File ~\anaconda3\lib\site-packages\openai\api_resources\abstract\engine_api_resource.py:149, in EngineAPIResource.create(cls, api_key, api_base, api_type, request_id, api_version, organization, **params)
127 @classmethod
128 def create(
129 cls,
(…)
136 **params,
137 ):
138 (
139 deployment_id,
140 engine,
141 timeout,
142 stream,
143 headers,
144 request_timeout,
145 typed_api_type,
146 requestor,
147 url,
148 params,
→ 149 ) = cls.__prepare_create_request(
150 api_key, api_base, api_type, api_version, organization, **params
151 )
153 response, _, api_key = requestor.request(
154 “post”,
155 url,
(…)
160 request_timeout=request_timeout,
161 )
163 if stream:
164 # must be an iterator

File ~\anaconda3\lib\site-packages\openai\api_resources\abstract\engine_api_resource.py:106, in EngineAPIResource.__prepare_create_request(cls, api_key, api_base, api_type, api_version, organization, **params)
103 elif timeout == 0:
104 params[“timeout”] = MAX_TIMEOUT
→ 106 requestor = api_requestor.APIRequestor(
107 api_key,
108 api_base=api_base,
109 api_type=api_type,
110 api_version=api_version,
111 organization=organization,
112 )
113 url = cls.class_url(engine, api_type, api_version)
114 return (
115 deployment_id,
116 engine,
(…)
124 params,
125 )

File ~\anaconda3\lib\site-packages\openai\api_requestor.py:134, in APIRequestor.init(self, key, api_base, api_type, api_version, organization)
125 def init(
126 self,
127 key=None,
(…)
131 organization=None,
132 ):
133 self.api_base = api_base or openai.api_base
→ 134 self.api_key = key or util.default_api_key()
135 self.api_type = (
136 ApiType.from_str(api_type)
137 if api_type
138 else ApiType.from_str(openai.api_type)
139 )
140 self.api_version = api_version or openai.api_version

File ~\anaconda3\lib\site-packages\openai\util.py:186, 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 OpenAI API 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 OpenAI API for details.

No API key has been provided, which is required to access the services. Please configure it to be able to use it