Closed BaseInfinity closed 1 year ago
Seems to be a bug with getting environment variables from the calling bash shell in poetry.
A quick work around that works is to just pass the api key in chromegpt/agent/zeroshot.py
:
43 class ZeroShotAgent(ChromeGPTAgent):
44 def __init__(self, model: str = "gpt-3.5-turbo", verbose: bool = False) -> None:
45 """Initialize the ZeroShotAgent."""
46 self.model = model
47 self.agent = get_zeroshot_agent(
48 llm=ChatOpenAI(model_name=model, temperature=0, openai_api_key='{YOUR_API_KEY_HERE}'), # type: ignore
49 verbose=verbose,
50 )
Replace YOUR_API_KEY_HERE with your key.
Seems to be a bug with getting environment variables from the calling bash shell in poetry.
A quick work around that works is to just pass the api key in
chromegpt/agent/zeroshot.py
:43 class ZeroShotAgent(ChromeGPTAgent): 44 def __init__(self, model: str = "gpt-3.5-turbo", verbose: bool = False) -> None: 45 """Initialize the ZeroShotAgent.""" 46 self.model = model 47 self.agent = get_zeroshot_agent( 48 llm=ChatOpenAI(model_name=model, temperature=0, openai_api_key='{YOUR_API_KEY_HERE}'), # type: ignore 49 verbose=verbose, 50 )
Replace YOUR_API_KEY_HERE with your key.
Ahh okay, I'll try that tomorrow and give it another whirl
Side note There's different functions that use the api key for each agent so make sure you read the error logs for the right line to change
For example:
{...}
File "/Users/nr/chromegpt/Chrome-GPT/chromegpt/agent/autogpt/autogpt.py", line 25, in __init__
llm=ChatOpenAI(model_name=model, temperature=0), # type: ignore
{...}
Would mean you should change that line to: llm=ChatOpenAI(model_name=model, temperature=0, openai_api_key='{YOUR_API_KEY_HERE}'), # type: ignore
Just in case anyone else has this problem :)
This appears to be fixed in the latest version but ty for the quick response!
I've exported the API key and still am having issues getting it to read:
I also searched the REPO for use case of both
OPENAI_API_KEY
andopenai_api_key
and found nothing so I'm a bit confused