i want to use openai to build a chatbot. but i faced a problem right at the beginning. i generated an api key in openai website and i implemented the openai.api_key = ‘sk-…’ . but the first function in the guideline video is not working . it just print the exact sentences of the ‘prompt’.it seems it is not able to connect openai key . appreciate if anyone could help me on this issue.
Hi nedanm, welcome to the community! Just to check, are you trying this in the course’s Jupyter Notebook environment? For the course, you can leave the code unchanged, since it is using a default API key. You would only use your own ‘sk-…’ key when working outside of the course files. Hope that helps!
Thank you so much for your help. I v tried that in google colab . I v downloaded my own key .bur whatever i do , it seems the code can connect with open ai.
Best regards
Neda
@nedanm if you want you can send me your notebook (PLEASE ERASE YOUR API KEY) and I can try it myself. If you decide to do this, please send me the notebook via direct message, not here.
Yes Juan’s kind offer above might be quite helpful, that way we can try it out in the exact Google Colab environment you’re using. Additionally, feel free to let us know if it’s working in the course’s built-in Jupyter Notebook environment so that we can troubleshoot. Thanks!
Please visit this site to generate api key.
https://platform.openai.com/account/api-keys
After generating api-key, copy the key and paste in the following code snippet. Key usually starts with sk-
import openai
openai.api_key = "paste your generated key."