Add support for OpenAI organization in the secrets file

This commit is contained in:
Ori Kotek
2023-07-06 09:52:01 +03:00
parent 4b4d91dfe9
commit b94734e69a
2 changed files with 4 additions and 1 deletions

View File

@ -12,6 +12,8 @@ class AiHandler:
def __init__(self):
try:
openai.api_key = settings.openai.key
if settings.get("OPENAI.ORG", None):
openai.organization = settings.openai.org
except AttributeError as e:
raise ValueError("OpenAI key is required") from e

View File

@ -7,7 +7,8 @@
# See README for details about GitHub App deployment.
[openai]
key = "<API_KEY>"
key = "<API_KEY>" # Acquire through https://platform.openai.com
org = "<ORGANIZATION>" # Optional, may be commented out.
[github]
# The type of deployment to create. Valid values are 'app' or 'user'.