Forum in maintenance, we will back soon 🙂
First connection with ChatGPT
Unable to make connection with ChatGPT, I still trying with Chat GPT help and still not working.
it is my_module, and not mymodule
please post your questions on the course's forum. you are a premium member.
@Hasan, is there a way to make this clearer in the course introduction?
Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack
@ssadvisor I remember I mention how to get support, but I will double check and try to make it clearer.
Hi Hasan,
I tried to connect ChatGPT but the command pip was not recognised.
Can you help me?
Thank you!
@linda-scotti what operating system are you using; Windows, Linux or MAC?
https://pip.pypa.io/en/stable/installation/
Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack
@linda-scotti okay, great. Did you get PIP installed?
Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack
@linda-scotti in your console try the following:
python3 -m ensurepip --upgrade
If that doesn't work then try downloading the script at https://bootstrap.pypa.io/get-pip.py and
python3 get-pip.py
Then in your virtual environment you should be able to:
pip install openai
Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack
@ssadvisor Sorry, it might sound like a stupid question, but what is the console? I am not a developer, so I need instructions for "dummies". Even better with screenshots or video.
I tried to paste
python3 -m ensurepip --upgrade
in the Visual Studio Code Terminal and didn't work. I don't know what a virtual environment is as well. I feel a bit lost.
@ssadvisor for some reason, I managed to install pip as you can see in the screenshot.
No idea how I did it, but it's there. I still get an error message for import openai. That's my next mystery to be solved.
@linda-scotti I would love to talk with you 1-on-1. It looks like you haven't installed the openai module with pip.
A virtual environment is recommended and a module you execute with python.
# virtual environment python3 -m venv venv source venv/bin/activate # install openai pip install openai
Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack
@ssadvisor Your guidance was helpful! I asked for some help from ChatGPT and it seems I managed to create a virtual environment and install openai. It still doesn't appear to work in Visual Studio.
@admin Hi Hasan, I kept getting an error because I had to change the interpreter in VS. Then I got another error that said I had to do an openai migration to upgrade my openai. Finally, after taking all these steps, I MADE it! I am so happy because I have zero programming knowledge and, with a lot of patience, determination and your help + ChatGPT advice, now it works!
I am in step 25 - Lesson: Connect Python With OpenAI API
import openai
openai.api_key="my-api-key"
def generate_text_with_openai(user_prompt):
completion = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": user_prompt}],
)
return completion.choices[0].message.content
# Example usage:
prompt = "Generate 5 catchy youtube titles about [email marketing tricks]"
response = generate_text_with_openai(prompt)
print(response)
Using the script from the lesson i get this error-message:
when having my first connection to chatgpt i have this error: You tried to access openai.ChatCompletion, but this is no longer supported in openai>=1.0.0 - see the README at https://github.com/openai/openai-python for the API.
You can run `openai migrate` to automatically upgrade your codebase to use the 1.0.0 interface.
Alternatively, you can pin your installation to the old version, e.g. `pip install openai==0.28`
A detailed migration guide is available here: https://github.com/openai/openai-python/discussions/742
i tried to go along the migration guide but it didn't work out.
@dario-rucci for following the course I would suggest the option to install the older version.
pip install --upgrade openai==0.28
You need the --upgrade option to remove the installed version and replace it with the specified version.
Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack
@ssadvisor Thank you! I just did it. It works again!