diff --git a/pr_agent/algo/ai_handler.py b/pr_agent/algo/ai_handler.py index 2dd8f731..a774e105 100644 --- a/pr_agent/algo/ai_handler.py +++ b/pr_agent/algo/ai_handler.py @@ -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 diff --git a/pr_agent/settings/.secrets_template.toml b/pr_agent/settings/.secrets_template.toml index 91aa275a..59f4625b 100644 --- a/pr_agent/settings/.secrets_template.toml +++ b/pr_agent/settings/.secrets_template.toml @@ -7,7 +7,8 @@ # See README for details about GitHub App deployment. [openai] -key = "" +key = "" # Acquire through https://platform.openai.com +org = "" # Optional, may be commented out. [github] # The type of deployment to create. Valid values are 'app' or 'user'.