Skip to content

Commit

Permalink
added some checks for the provider
Browse files Browse the repository at this point in the history
Signed-off-by: Rohan Sharma <[email protected]>
  • Loading branch information
RS-labhub committed Dec 18, 2024
1 parent 2d0244e commit f81f8dd
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand All @@ -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:
Expand Down

0 comments on commit f81f8dd

Please sign in to comment.