From 63b79a88c6d10e23f7b21081ec17651df22033d5 Mon Sep 17 00:00:00 2001 From: kaneda2004 Date: Tue, 30 May 2023 19:02:16 -0700 Subject: [PATCH] Adding support for openai_organization env variable (#289) --- .env.template | 1 + autogpt/config/config.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.env.template b/.env.template index dd690308..d4d99baa 100644 --- a/.env.template +++ b/.env.template @@ -71,6 +71,7 @@ OPENAI_API_KEY=your-openai-api-key # TEMPERATURE=0 # USE_AZURE=False +# OPENAI_ORGANIZATION=your-openai-organization-key-if-applicable ### AZURE # moved to `azure.yaml.template` diff --git a/autogpt/config/config.py b/autogpt/config/config.py index 1e61b808..5f76bb74 100644 --- a/autogpt/config/config.py +++ b/autogpt/config/config.py @@ -64,6 +64,7 @@ class Config(metaclass=Singleton): ) self.openai_api_key = os.getenv("OPENAI_API_KEY") + self.openai_organization = os.getenv("OPENAI_ORGANIZATION") self.temperature = float(os.getenv("TEMPERATURE", "0")) self.use_azure = os.getenv("USE_AZURE") == "True" self.execute_local_commands = ( @@ -79,6 +80,9 @@ class Config(metaclass=Singleton): openai.api_base = self.openai_api_base openai.api_version = self.openai_api_version + if self.openai_organization is not None: + openai.organization = self.openai_organization + self.elevenlabs_api_key = os.getenv("ELEVENLABS_API_KEY") self.elevenlabs_voice_1_id = os.getenv("ELEVENLABS_VOICE_1_ID") self.elevenlabs_voice_2_id = os.getenv("ELEVENLABS_VOICE_2_ID")