nat / natbot

Drive a browser with GPT-3
MIT License
1.9k stars 280 forks source link

Getting started + Requirements.txt #8

Open sfxworks opened 2 years ago

sfxworks commented 2 years ago

On first run:

Traceback (most recent call last):
  File "/home/sam/git/natbot/natbot.py", line 8, in <module>
    from playwright.sync_api import sync_playwright
ModuleNotFoundError: No module named 'playwright'

So, so far I know I need playwright, OpenAI

Traceback (most recent call last):
  File "/home/sam/git/natbot/natbot.py", line 11, in <module>
    import openai
ModuleNotFoundError: No module named 'openai'

Then I need to run this to prepare

playwright._impl._api_types.Error: Executable doesn't exist at /home/sam/.cache/ms-playwright/chromium-1024/chrome-linux/chrome
╔════════════════════════════════════════════════════════════╗
║ Looks like Playwright was just installed or updated.       ║
║ Please run the following command to download new browsers: ║
║                                                            ║
║     playwright install                                     ║
║                                                            ║
║ <3 Playwright Team                                         ║
╚════════════════════════════════════════════════════════════╝

and I also need an API key

openai.error.AuthenticationError: No API key provided. You can set your API key in code using 'openai.api_key = <API-KEY>', or you can set the environment variable OPENAI_API_KEY=<API-KEY>). If your API key is stored in a file, you can point the openai module at it with 'openai.api_key_path = <PATH>'. You can generate API keys in the OpenAI web interface. See https://onboard.openai.com for details, or email support@openai.com if you have any questions.
sfxworks commented 2 years ago

After all this is done I can confirm it works :D

Krasnomakov commented 1 year ago
Screenshot 2022-12-03 at 22 07 35

I did everything but still have the error

enorms commented 1 year ago

@Krasnomakov It does seem openai is installed but somehow it's not getting the value. Setting openai.api_key = "key" worked for me, as did injecting via console like OPENAI_API_KEY=key python natbot.py. What happens if you remove line 15 and run it. If that doesn't work, what happens if you revert to the original code for line 14 (and 15 still removed) and try running from console as above