From f81f8dda2aa566e0dff45df184f0eaafeccb4cf1 Mon Sep 17 00:00:00 2001 From: Rohan Sharma <117426013+RS-labhub@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:17:59 +0000 Subject: [PATCH] added some checks for the provider Signed-off-by: Rohan Sharma <117426013+RS-labhub@users.noreply.github.com> --- main.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 3851cdc..6974d33 100644 --- a/main.py +++ b/main.py @@ -22,17 +22,20 @@ def check_env_vars(): required_vars = [ - "AZURE_OPENAI_ENDPOINT", - "AZURE_OPENAI_API_KEY", - "AZURE_OPENAI_API_VERSION", + "LLM_PROVIDER", "MODEL", "GITHUB_TOKEN", "SUPABASE_URL", "SUPABASE_KEY", ] - # Add provider-specific checks + # Check if required environment variables are set provider = os.getenv("LLM_PROVIDER", "") + if not provider: + print("Error: LLM_PROVIDER is not specified. Please set LLM_PROVIDER in your environment variables.") + return False + + # Add provider-specific checks if provider == "AzureOpenAI": required_vars.extend(["AZURE_OPENAI_ENDPOINT", "AZURE_OPENAI_API_KEY", "AZURE_OPENAI_API_VERSION"]) elif provider == "OpenAI": @@ -43,6 +46,9 @@ def check_env_vars(): required_vars.append("GOOGLE_API_KEY") elif provider == "Groq": required_vars.append("GROQ_API_KEY") + else: + print(f"Error: Unsupported LLM_PROVIDER '{provider}'. Supported providers are: AzureOpenAI, OpenAI, Anthropic, Google, Groq.") + return False missing_vars = [var for var in required_vars if not os.environ.get(var)] if missing_vars: