Skip to content
site logo mobile

Forum in maintenance, we will back soon 🙂

First connection wi...
 
Notifications
Clear all

First connection with ChatGPT

20 Posts
5 Users
10 Likes
631 Views
(@robert-dias)
Posts: 5
Active Member Customer
Premium Member
Pythonista Prodigy Badge
Topic starter
 

Unable to make connection with ChatGPT, I still trying with Chat GPT help and still not working.

Problems
OpenAI
Debug

 

 
Posted : 07/30/2023 6:10 am
howardtw1984 reacted
Hasan Aboul Hasan
(@admin)
Posts: 984
Member Admin
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power Member
 

it is my_module, and not mymodule

please post your questions on the course's forum. you are a premium member.

 
Posted : 07/30/2023 9:27 am
SSAdvisor reacted
SSAdvisor
(@ssadvisor)
Posts: 955
Noble Member
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power 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

 
Posted : 07/30/2023 1:42 pm
Hasan Aboul Hasan
(@admin)
Posts: 984
Member Admin
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power Member
 

@ssadvisor I remember I mention how to get support, but I will double check and try to make it clearer.

 
Posted : 07/31/2023 1:21 pm
(@linda-scotti)
Posts: 7
Active Member Customer
Premium Member
Pythonista Prodigy Badge
 

Hi Hasan, 

I tried to connect ChatGPT but the command pip was not recognised.

Can you help me? 

Thank you!

Screenshot 2023 10 31 at 15.35.02
Screenshot 2023 10 31 at 15.35.52
 
Posted : 10/31/2023 3:38 pm
SSAdvisor
(@ssadvisor)
Posts: 955
Noble Member
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power Member
 

@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

 
Posted : 10/31/2023 6:25 pm
(@linda-scotti)
Posts: 7
Active Member Customer
Premium Member
Pythonista Prodigy Badge
 

@ssadvisor I am using a MAC, MacBook Pro 2020

Thank you!

 
Posted : 11/01/2023 9:20 am
SSAdvisor
(@ssadvisor)
Posts: 955
Noble Member
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power Member
 

@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

 
Posted : 11/01/2023 2:09 pm
(@linda-scotti)
Posts: 7
Active Member Customer
Premium Member
Pythonista Prodigy Badge
 

@ssadvisor no, I don't understand what I have to do.

 
Posted : 11/01/2023 5:32 pm
SSAdvisor
(@ssadvisor)
Posts: 955
Noble Member
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power Member
 

@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

 
Posted : 11/02/2023 5:12 pm
Linda Scotti reacted
(@linda-scotti)
Posts: 7
Active Member Customer
Premium Member
Pythonista Prodigy Badge
 

@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.

 
Posted : 11/03/2023 4:53 pm
(@linda-scotti)
Posts: 7
Active Member Customer
Premium Member
Pythonista Prodigy Badge
 

@ssadvisor for some reason, I managed to install pip as you can see in the screenshot.

Screenshot 2023 11 03 at 17.04.42

 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.

Screenshot 2023 11 03 at 17.07.33
 
Posted : 11/03/2023 5:08 pm
SSAdvisor
(@ssadvisor)
Posts: 955
Noble Member
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power Member
 

@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

 
Posted : 11/04/2023 2:26 pm
Linda Scotti reacted
(@linda-scotti)
Posts: 7
Active Member Customer
Premium Member
Pythonista Prodigy Badge
 

@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.

Screenshot 2023 11 09 at 16.33.15
 
Posted : 11/09/2023 4:48 pm
Hasan Aboul Hasan
(@admin)
Posts: 984
Member Admin
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power Member
 

@linda-scotti what is the error you are getting?

 
Posted : 11/10/2023 12:20 pm
Linda Scotti reacted
(@linda-scotti)
Posts: 7
Active Member Customer
Premium Member
Pythonista Prodigy Badge
 

@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!

 
Posted : 11/11/2023 11:40 am
DariDar
(@dari-dar)
Posts: 42
Trusted Member Customer
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
Power Member
 

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.

This post was modified 6 months ago by DariDar
 
Posted : 11/11/2023 6:07 pm
SSAdvisor
(@ssadvisor)
Posts: 955
Noble Member
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power Member
 

@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

 
Posted : 11/12/2023 1:14 am
DariDar reacted
DariDar
(@dari-dar)
Posts: 42
Trusted Member Customer
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
Power Member
 

@ssadvisor Thank you! I just did it. It works again!

 
Posted : 11/12/2023 2:42 pm
Hasan Aboul Hasan
(@admin)
Posts: 984
Member Admin
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power Member
 
I updated the course scripts to meet the latest openai updates.
 
Posted : 11/15/2023 11:36 am
DariDar reacted
Share: