Spaces:
Running
Running
Update pipeline.py
Browse files- pipeline.py +8 -11
pipeline.py
CHANGED
@@ -20,7 +20,7 @@ except LookupError:
|
|
20 |
english_words = set(words.words())
|
21 |
|
22 |
# LangChain / Groq / LLM imports
|
23 |
-
|
24 |
from langchain_community.embeddings import HuggingFaceEmbeddings
|
25 |
from langchain_community.vectorstores import FAISS
|
26 |
from langchain.chains import RetrievalQA, LLMChain
|
@@ -201,22 +201,19 @@ try:
|
|
201 |
logger.warning("No Groq API key found for fallback LLM")
|
202 |
|
203 |
# Initialize the Groq client as fallback
|
204 |
-
groq_fallback_llm =
|
205 |
model=GROQ_MODELS["default"],
|
206 |
temperature=0.7,
|
207 |
groq_api_key=fallback_groq_api_key,
|
208 |
max_tokens=2048
|
209 |
)
|
210 |
|
211 |
-
# Verify connection by checking models (optional)
|
212 |
-
try:
|
213 |
-
|
214 |
-
|
215 |
-
except Exception as e:
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
except Exception as e:
|
221 |
logger.error(f"Failed to initialize fallback Groq LLM: {e}")
|
222 |
|
|
|
20 |
english_words = set(words.words())
|
21 |
|
22 |
# LangChain / Groq / LLM imports
|
23 |
+
from langchain_groq import ChatGroq
|
24 |
from langchain_community.embeddings import HuggingFaceEmbeddings
|
25 |
from langchain_community.vectorstores import FAISS
|
26 |
from langchain.chains import RetrievalQA, LLMChain
|
|
|
201 |
logger.warning("No Groq API key found for fallback LLM")
|
202 |
|
203 |
# Initialize the Groq client as fallback
|
204 |
+
groq_fallback_llm = ChatGroq(
|
205 |
model=GROQ_MODELS["default"],
|
206 |
temperature=0.7,
|
207 |
groq_api_key=fallback_groq_api_key,
|
208 |
max_tokens=2048
|
209 |
)
|
210 |
|
211 |
+
# # Verify connection by checking models (optional)
|
212 |
+
# try:
|
213 |
+
# groq_fallback_llm.list_models()
|
214 |
+
# logger.info("Fallback Groq LLM initialized successfully")
|
215 |
+
# except Exception as e:
|
216 |
+
# logger.error(f"Fallback Groq LLM connection test failed: {e}")
|
|
|
|
|
|
|
217 |
except Exception as e:
|
218 |
logger.error(f"Failed to initialize fallback Groq LLM: {e}")
|
219 |
|