Spaces:
Running
Running
Adeen commited on
Commit ·
f025f98
1
Parent(s): f018f6e
Switch LLM backend to Groq (Llama 3.3 70B)
Browse filesFiles changed (2)
- app.py+9-5
- requirements.txt+1-1
8 unmodified lines910111213141566 unmodified lines82838485868788899068 unmodified lines1591601611621631641658 unmodified linesfrom langchain_community.embeddings import HuggingFaceEmbeddingsfrom langchain_community.document_loaders import PyPDFLoaderfrom langchain_community.vectorstores import Chromafrom langchain_google_genai import ChatGoogleGenerativeAIfrom langchain_text_splitters import RecursiveCharacterTextSplitter# Configuration66 unmodified linesreturn vectorstore@st.cache_resourcedef get_llm(api_key: str) -> ChatGoogleGenerativeAI:# We use Gemini as the backend, but we don't need to brand it in the UIllm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", google_api_key=api_key)return llmdef build_context(chunks) -> str:68 unmodified linesst.session_state["messages"] = []# API Key Handlingapi_key = os.environ.get("GEMINI_API_KEY")if not api_key:st.warning("⚠️ Backend connection not established. Please check your configuration.")return8 unmodified lines910111213141566 unmodified lines8283848586878889909192939468 unmodified lines1631641651661671681698 unmodified linesfrom langchain_community.embeddings import HuggingFaceEmbeddingsfrom langchain_community.document_loaders import PyPDFLoaderfrom langchain_community.vectorstores import Chromafrom langchain_groq import ChatGroqfrom langchain_text_splitters import RecursiveCharacterTextSplitter# Configuration66 unmodified linesreturn vectorstore@st.cache_resourcedef get_llm(api_key: str) -> ChatGroq:# Using Llama 3.3 70B via Groq for lightning-fast RAGllm = ChatGroq(model="llama-3.3-70b-versatile",groq_api_key=api_key,temperature=0.3,)return llmdef build_context(chunks) -> str:68 unmodified linesst.session_state["messages"] = []# API Key Handlingapi_key = os.environ.get("GROQ_API_KEY")if not api_key:st.warning("⚠️ Backend connection not established. Please check your configuration.")return
3 unmodified lines456783 unmodified linespypdfsentence-transformersstreamlitlangchain-google-genaipython-dotenv3 unmodified lines456783 unmodified linespypdfsentence-transformersstreamlitlangchain-groqpython-dotenv
app.py+9-5
requirements.txt+1-1