ghostleek commited on
Commit
b485d81
·
verified ·
1 Parent(s): 4129ad2

fix: update groq api key access and proxy issues (#4)

Browse files

- fix: update groq api key access and proxy issues (23dd68f16016f2a0670903b8f4f2e47ca881d316)

Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -43,7 +43,21 @@ inject_ga()
43
 
44
  # Initialize the Groq client
45
  GROQ_API_KEY = os.getenv("GROQ_API_KEY")
46
- client = Groq()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
  if "session_uuid" not in st.session_state:
49
  st.session_state.update({
 
43
 
44
  # Initialize the Groq client
45
  GROQ_API_KEY = os.getenv("GROQ_API_KEY")
46
+
47
+ # Ensure the API key is present
48
+ if not GROQ_API_KEY:
49
+ raise ValueError("GROQ_API_KEY environment variable is missing.")
50
+
51
+ # Initialize the client with the API key
52
+ client = Groq(api_key=GROQ_API_KEY)
53
+
54
+ # check http proxy
55
+ print("HTTP_PROXY:", os.getenv("HTTP_PROXY"))
56
+ print("HTTPS_PROXY:", os.getenv("HTTPS_PROXY"))
57
+
58
+ # Clear proxies if not required
59
+ os.environ.pop("HTTP_PROXY", None)
60
+ os.environ.pop("HTTPS_PROXY", None)
61
 
62
  if "session_uuid" not in st.session_state:
63
  st.session_state.update({