Spaces:
Sleeping
Sleeping
Update pipeline.py
Browse files- 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 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 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:
|