abdullah9873 commited on
Commit
2cf6131
·
verified ·
1 Parent(s): 4c246b3

Upload connection.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. connection.py +2 -1
connection.py CHANGED
@@ -8,7 +8,8 @@ load_dotenv()
8
  openai_api_key = os.getenv("OPENAI_API_KEY")
9
 
10
  if not openai_api_key:
11
- raise ValueError("OPENAI_API_KEY is not set. Please add it to your .env file.")
 
12
 
13
  # Create OpenAI client (NO base_url needed)
14
  openai_client = AsyncOpenAI(
 
8
  openai_api_key = os.getenv("OPENAI_API_KEY")
9
 
10
  if not openai_api_key:
11
+ print("WARNING: OPENAI_API_KEY is not set. The chatbot will fail when processing requests.")
12
+ openai_api_key = "missing-key" # Prevent AsyncOpenAI from crashing immediately on init
13
 
14
  # Create OpenAI client (NO base_url needed)
15
  openai_client = AsyncOpenAI(