Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,6 +26,7 @@ import streamlit.components.v1 as components
|
|
| 26 |
import html
|
| 27 |
from streamlit_chat import message
|
| 28 |
import uuid
|
|
|
|
| 29 |
|
| 30 |
# Set page config
|
| 31 |
st.set_page_config(
|
|
@@ -839,11 +840,17 @@ def load_bigquery_table(dataset_id, table_id, limit=1000):
|
|
| 839 |
}
|
| 840 |
|
| 841 |
def setup_groq_client():
|
| 842 |
-
"""Setup GROQ client with API key from
|
| 843 |
-
|
| 844 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 845 |
else:
|
| 846 |
-
st.sidebar.warning("
|
| 847 |
return None
|
| 848 |
|
| 849 |
def get_assistant_response(client, prompt, context=None, model="llama3-70b-8192"):
|
|
|
|
| 26 |
import html
|
| 27 |
from streamlit_chat import message
|
| 28 |
import uuid
|
| 29 |
+
from dotenv import load_dotenv
|
| 30 |
|
| 31 |
# Set page config
|
| 32 |
st.set_page_config(
|
|
|
|
| 840 |
}
|
| 841 |
|
| 842 |
def setup_groq_client():
|
| 843 |
+
"""Setup GROQ client with API key from environment variables"""
|
| 844 |
+
# Load environment variables from .env file
|
| 845 |
+
load_dotenv()
|
| 846 |
+
|
| 847 |
+
# Get API key from environment variable
|
| 848 |
+
api_key = os.environ.get("GROQ_API")
|
| 849 |
+
|
| 850 |
+
if api_key:
|
| 851 |
+
return Groq(api_key=api_key)
|
| 852 |
else:
|
| 853 |
+
st.sidebar.warning("GROQ_API environment variable not found. Chatbot functionality will be limited.")
|
| 854 |
return None
|
| 855 |
|
| 856 |
def get_assistant_response(client, prompt, context=None, model="llama3-70b-8192"):
|