File size: 561 Bytes
f9fe76c
 
 
 
 
 
 
 
 
 
 
 
7367624
 
f9fe76c
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os
import streamlit as st
from langchain_google_genai import ChatGoogleGenerativeAI

api_key = st.secrets.get("GEMINI_API_KEY", os.getenv("GEMINI_API_KEY"))

if not api_key:
    st.error("⚠️ GEMINI_API_KEY not found. Please add it in the Secrets tab.")
    st.stop()

try:
    llm = ChatGoogleGenerativeAI(
        model="gemma-3-12b-it",
        temperature=1,
        google_api_key=api_key
    )
    print("✅ LLM initialized successfully")
except Exception as e:
    st.error(f"Error initializing the LLM: {e}")
    llm = None

embeddings = None