DrishtiSharma commited on
Commit
0625cfa
·
verified ·
1 Parent(s): 146cb5e

Update app3.py

Browse files
Files changed (1) hide show
  1. app3.py +11 -4
app3.py CHANGED
@@ -19,14 +19,21 @@ logger = logging.getLogger(__name__)
19
  api_key = os.getenv("OPENAI_API_KEY")
20
  pandasai_api_key = os.getenv("PANDASAI_API_KEY")
21
 
22
- # Check for missing keys
23
- if not api_key or not pandasai_api_key:
 
 
 
 
 
 
 
24
  raise EnvironmentError(
25
- "API keys are missing! Ensure both 'OPENAI_API_KEY' and 'PANDASAI_API_KEY' are set in the environment."
26
  )
27
 
28
  # Title of the app
29
- st.title("PandasAI Data Analyzer with RAG")
30
 
31
  # Function to load datasets into session
32
  def load_dataset_into_session():
 
19
  api_key = os.getenv("OPENAI_API_KEY")
20
  pandasai_api_key = os.getenv("PANDASAI_API_KEY")
21
 
22
+ # Check for missing keys and raise specific errors
23
+ missing_keys = []
24
+ if not api_key:
25
+ missing_keys.append("OPENAI_API_KEY")
26
+ if not pandasai_api_key:
27
+ missing_keys.append("PANDASAI_API_KEY")
28
+
29
+ if missing_keys:
30
+ missing_keys_str = ", ".join(missing_keys)
31
  raise EnvironmentError(
32
+ f"The following API key(s) are missing: {missing_keys_str}. Please set them in the environment."
33
  )
34
 
35
  # Title of the app
36
+ st.title("Data Analyzer")
37
 
38
  # Function to load datasets into session
39
  def load_dataset_into_session():