OthersideAI / self-operating-computer

A framework to enable multimodal models to operate a computer.
https://www.hyperwriteai.com/self-operating-computer
MIT License
8.21k stars 1.09k forks source link

[BUG] Brief Description of the Issue #199

Open BootsOfTango opened 6 days ago

BootsOfTango commented 6 days ago

Found a bug? Please fill out the sections below. 👍

Describe the bug

[Self-Operating Computer | claude-3] Hello, I can help you with anything. What would you like done? [User] move mouse little to the right [Self-Operating Computer][claude-3] That did not work. Trying another method [Self-Operating Computer][Operate] That did not work. Trying again Error code: 401 - {'error': {'message': 'Incorrect API key provided: google/g*****free. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}} [Self-Operating Computer][Error] -> cannot access local variable 'content' where it is not associated with a value PS C:\Users\Tango>

Steps to Reproduce

  1. installed normally
  2. tried Google: Gemma 2 9B (free) api from open source and did not work
  3. changed claude m version you suggested on page
  4. got that msg above

Expected Behavior

work normally

Actual Behavior:

msg above

Environment

Latryna commented 5 days ago

You should enter the entire API key, including the sk-proj- prefix. The entire API key looks like this: sk-proj-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, where xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx is the rest of the key.

How to enter the API key in the configuration file:

Here's how to do it:

  1. Open the configuration file (config.py) in your text editor.

  2. Find where you define your OpenAI API key.

  3. Enter entire API key: Replace "your_api_key" with your full API key, including the sk-proj- prefix. Example:

classConfig:
 def __init__(self):
 load_dotenv()
 self.verbose = False
 self.openai_api_key = "sk-proj-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # Enter your entire API key here
 self.google_api_key = None
 self.anthropic_api_key = None

Alternatively, use the .env file:

  1. Create an .env file in the root of your project if you don't already have one.

  2. Add the API key to the .env file:

    OPENAI_API_KEY=sk-proj-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  3. Load the environment variable in config.py: Make sure load_dotenv() is used to load environment variables and openai_api_key is set with os.getenv():

from dotenv import load_dotenv
import pers

classConfig:
 def __init__(self):
 load_dotenv()
 self.verbose = False
 self.openai_api_key = os.getenv("OPENAI_API_KEY")
 self.google_api_key = None
 self.anthropic_api_key = None

.env way works for me.

BootsOfTango commented 5 days ago

Screenshot 2024-07-03 000616

im getting the same msg after i tried your first config method

i dont even understand what you mean with env,

Im not good with computers but I really want this for my grandma