Phoenix21 commited on
Commit
3c486f4
·
verified ·
1 Parent(s): fa78b18

Update pipeline.py

Browse files
Files changed (1) hide show
  1. pipeline.py +18 -22
pipeline.py CHANGED
@@ -206,28 +206,24 @@ def run_pipeline(query: str) -> str:
206
  return tailor_chain.run({"response": refusal_text}).strip()
207
 
208
  # Initialize chains and vectorstores
209
- # Initialize chains and vectorstores
210
- try:
211
- classification_chain = get_classification_chain()
212
- refusal_chain = get_refusal_chain()
213
- tailor_chain = get_tailor_chain()
214
- cleaner_chain = get_cleaner_chain()
215
-
216
- wellness_csv = "AIChatbot.csv"
217
- brand_csv = "BrandAI.csv"
218
- wellness_store_dir = "faiss_wellness_store"
219
- brand_store_dir = "faiss_brand_store"
220
-
221
- wellness_vectorstore = build_or_load_vectorstore(wellness_csv, wellness_store_dir)
222
- brand_vectorstore = build_or_load_vectorstore(brand_csv, brand_store_dir)
223
-
224
- gemini_llm = LiteLLMModel(model_id="gemini/gemini-pro", api_key=os.environ.get("GEMINI_API_KEY"))
225
- wellness_rag_chain = build_rag_chain(gemini_llm, wellness_vectorstore)
226
- brand_rag_chain = build_rag_chain(gemini_llm, brand_vectorstore)
227
-
228
- print("Pipeline initialized successfully!")
229
- except Exception as e:
230
- print(f"Error initializing pipeline: {str(e)}")
231
 
232
 
233
  def run_with_chain(query: str) -> str:
 
206
  return tailor_chain.run({"response": refusal_text}).strip()
207
 
208
  # Initialize chains and vectorstores
209
+ classification_chain = get_classification_chain()
210
+ refusal_chain = get_refusal_chain()
211
+ tailor_chain = get_tailor_chain()
212
+ cleaner_chain = get_cleaner_chain()
213
+
214
+ wellness_csv = "AIChatbot.csv"
215
+ brand_csv = "BrandAI.csv"
216
+ wellness_store_dir = "faiss_wellness_store"
217
+ brand_store_dir = "faiss_brand_store"
218
+
219
+ wellness_vectorstore = build_or_load_vectorstore(wellness_csv, wellness_store_dir)
220
+ brand_vectorstore = build_or_load_vectorstore(brand_csv, brand_store_dir)
221
+
222
+ gemini_llm = LiteLLMModel(model_id="gemini/gemini-pro", api_key=os.environ.get("GEMINI_API_KEY"))
223
+ wellness_rag_chain = build_rag_chain(gemini_llm, wellness_vectorstore)
224
+ brand_rag_chain = build_rag_chain(gemini_llm, brand_vectorstore)
225
+
226
+ print("Pipeline initialized successfully!")
 
 
 
 
227
 
228
 
229
  def run_with_chain(query: str) -> str: