Spaces:
Sleeping
Sleeping
| 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 |