Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +23 -10
src/streamlit_app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import os
|
| 2 |
import streamlit as st
|
| 3 |
from supabase.client import create_client
|
|
|
|
| 4 |
from langchain_google_genai import GoogleGenerativeAIEmbeddings, ChatGoogleGenerativeAI
|
| 5 |
from streamlit_mic_recorder import speech_to_text
|
| 6 |
|
|
@@ -8,6 +9,8 @@ from streamlit_mic_recorder import speech_to_text
|
|
| 8 |
SUPABASE_URL = os.getenv("SUPABASE_URL")
|
| 9 |
SUPABASE_KEY = os.getenv("SUPABASE_KEY")
|
| 10 |
GEMINI_KEY = os.getenv("GEMINI_KEY")
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# --- 1. SETTINGS & KEYS ---
|
| 13 |
|
|
@@ -21,16 +24,26 @@ if not SUPABASE_URL:
|
|
| 21 |
# --- 2. INITIALIZE CLIENTS ---
|
| 22 |
# Using Gemini 3 Flash (Stable 2026 version) for the fastest industrial response
|
| 23 |
supabase = create_client(SUPABASE_URL, SUPABASE_KEY)
|
| 24 |
-
llm = ChatGoogleGenerativeAI(
|
| 25 |
-
model="gemini-2.5-flash-lite", # Exact name from your list
|
| 26 |
-
google_api_key=GEMINI_KEY,
|
| 27 |
-
temperature=0.1,
|
| 28 |
-
|
| 29 |
-
)
|
| 30 |
-
embeddings = GoogleGenerativeAIEmbeddings(
|
| 31 |
-
model="models/gemini-embedding-001",
|
| 32 |
-
google_api_key=GEMINI_KEY,
|
| 33 |
-
task_type="retrieval_query" # Critical for the app search to work
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
)
|
| 35 |
|
| 36 |
# --- 3. UI SETUP ---
|
|
|
|
| 1 |
import os
|
| 2 |
import streamlit as st
|
| 3 |
from supabase.client import create_client
|
| 4 |
+
from langchain_groq import ChatGroq
|
| 5 |
from langchain_google_genai import GoogleGenerativeAIEmbeddings, ChatGoogleGenerativeAI
|
| 6 |
from streamlit_mic_recorder import speech_to_text
|
| 7 |
|
|
|
|
| 9 |
SUPABASE_URL = os.getenv("SUPABASE_URL")
|
| 10 |
SUPABASE_KEY = os.getenv("SUPABASE_KEY")
|
| 11 |
GEMINI_KEY = os.getenv("GEMINI_KEY")
|
| 12 |
+
# --- FETCH SECRETS ---
|
| 13 |
+
GROQ_API_KEY = os.getenv("GROQ_API_KEY")
|
| 14 |
|
| 15 |
# --- 1. SETTINGS & KEYS ---
|
| 16 |
|
|
|
|
| 24 |
# --- 2. INITIALIZE CLIENTS ---
|
| 25 |
# Using Gemini 3 Flash (Stable 2026 version) for the fastest industrial response
|
| 26 |
supabase = create_client(SUPABASE_URL, SUPABASE_KEY)
|
| 27 |
+
#llm = ChatGoogleGenerativeAI(
|
| 28 |
+
# model="gemini-2.5-flash-lite", # Exact name from your list
|
| 29 |
+
# google_api_key=GEMINI_KEY,
|
| 30 |
+
# temperature=0.1,
|
| 31 |
+
# max_output_tokens=1000
|
| 32 |
+
#)
|
| 33 |
+
#embeddings = GoogleGenerativeAIEmbeddings(
|
| 34 |
+
# model="models/gemini-embedding-001",
|
| 35 |
+
# google_api_key=GEMINI_KEY,
|
| 36 |
+
# task_type="retrieval_query" # Critical for the app search to work
|
| 37 |
+
#)
|
| 38 |
+
|
| 39 |
+
# --- INITIALIZE GROQ LLM ---
|
| 40 |
+
# Llama 3.3 70B is the 'Pro' level model for complex industrial reasoning.
|
| 41 |
+
# Llama 3.1 8B is the 'Instant' model if you want lighting speed.
|
| 42 |
+
llm = ChatGroq(
|
| 43 |
+
model_name="llama-3.3-70b-versatile",
|
| 44 |
+
groq_api_key=GROQ_API_KEY,
|
| 45 |
+
temperature=0.1, # Low temperature for technical accuracy
|
| 46 |
+
max_tokens=1024
|
| 47 |
)
|
| 48 |
|
| 49 |
# --- 3. UI SETUP ---
|