Using helper_functions.py outside of Jupyter notebook?

I have downloaded “helper_functions.py” from within the Jupyter notebook used in the labs, however I get openai.AuthenticationError: Error code: 401 if I try to call print_llm_response from a local Python script. Is there a way to create an AzureOpenAI client from outside of a lab session within the course?

Here is the full error message:

openai.AuthenticationError: Error code: 401 - {'error': {'code': '401', 'message': 'Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource.'}}
1 Like

Oh nvm - the instructions are already provided! :face_with_hand_over_mouth:

# ### If you want to use your own OpenAI key, uncomment these cells below and comment out the other get_llm_response function cells: ...
1 Like