AutoGPT: NameError: name 'cfg' is not defined

Duplicates

  • I have searched the existing issues

Steps to reproduce 🕹

Version:

master ee8276c Merge pull request #615 from openaudible/patch-1

Trying to run the program:

(base) D:\GPT\Auto-GPT>python scripts\main.py
Traceback (most recent call last):
  File "D:\GPT\Auto-GPT\scripts\main.py", line 290, in <module>
    check_openai_api_key()
  File "D:\GPT\Auto-GPT\scripts\main.py", line 22, in check_openai_api_key
    if not cfg.openai_api_key:
NameError: name 'cfg' is not defined

(base) D:\GPT\Auto-GPT>

File: .env

#PINECONE_API_KEY=your-pinecone-api-key
#PINECONE_ENV=your-pinecone-region
OPENAI_API_KEY="XXXXXXXXXX Edited XXXXXXXXXXXXXXXXXXXX"
#ELEVENLABS_API_KEY=your-elevenlabs-api-key
SMART_LLM_MODEL="gpt-4"
FAST_LLM_MODEL="gpt-3.5-turbo"
#GOOGLE_API_KEY=
#CUSTOM_SEARCH_ENGINE_ID=
USE_AZURE=False
#OPENAI_API_BASE=your-base-url-for-azure
#OPENAI_API_VERSION=api-version-for-azure
#OPENAI_DEPLOYMENT_ID=deployment-id-for-azure

Current behavior 😯

Errors out.

Expected behavior 🤔

It should run normally

Your prompt 📝

(base) D:\GPT\Auto-GPT>python scripts\main.py

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (4 by maintainers)

Commits related to this issue

Most upvoted comments

In scripts/memory/base.py declare after the imports:

cfg = Config()

Switched order of lines 291/292 and works for me:

 cfg = Config()
 check_openai_api_key()

@erni-tf thanks, that worked. The next error is:

Traceback (most recent call last):
  File "C:\Users\ND\Documents\Projects\Auto-GPT\scripts\main.py", line 319, in <module>
    assistant_reply = chat.chat_with_ai(
TypeError: chat_with_ai() takes 5 positional arguments but 6 were given

Same issue.

Having the same issue

while #669 and #670 Do mention the issue. I would argue that this issue follows the issue template best and should be the issue to handle this