Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Adding support for openai_organization env variable (#289)

kaneda200463b79a88c6d1
diff --git a/.env.template b/.env.template
index dd690308dd..d4d99baa2c 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 1e61b80856..5f76bb7455 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")