pratikshahp commited on
Commit
ac02fee
·
verified ·
1 Parent(s): e55e53b

Update helper.py

Browse files
Files changed (1) hide show
  1. helper.py +8 -7
helper.py CHANGED
@@ -1,13 +1,14 @@
1
  import os
2
  from dotenv import load_dotenv, find_dotenv
3
- import json
4
 
5
- # Load environment variables
6
  def load_env():
 
7
  _ = load_dotenv(find_dotenv())
8
 
9
- # Load the Together API key
10
- def get_together_api_key():
11
- load_env()
12
- together_api_key = os.getenv("TOGETHER_API_KEY")
13
- return together_api_key
 
 
 
1
  import os
2
  from dotenv import load_dotenv, find_dotenv
 
3
 
 
4
  def load_env():
5
+ """Load environment variables from the .env file."""
6
  _ = load_dotenv(find_dotenv())
7
 
8
+ def get_together_api_key() -> str:
9
+ """Retrieve the Together API key from the environment variables."""
10
+ load_env()
11
+ api_key = os.getenv("TOGETHER_API_KEY")
12
+ if not api_key:
13
+ raise ValueError("TOGETHER_API_KEY is not set in the environment variables.")
14
+ return api_key