Spaces:
Sleeping
Sleeping
Update pipeline.py
Browse files- pipeline.py +3 -1
pipeline.py
CHANGED
|
@@ -205,6 +205,7 @@ def run_pipeline(query: str) -> str:
|
|
| 205 |
refusal_text = refusal_chain.run({"topic": "this topic"})
|
| 206 |
return tailor_chain.run({"response": refusal_text}).strip()
|
| 207 |
|
|
|
|
| 208 |
# Initialize chains and vectorstores
|
| 209 |
try:
|
| 210 |
classification_chain = get_classification_chain()
|
|
@@ -223,10 +224,11 @@ try:
|
|
| 223 |
gemini_llm = LiteLLMModel(model_id="gemini/gemini-pro", api_key=os.environ.get("GEMINI_API_KEY"))
|
| 224 |
wellness_rag_chain = build_rag_chain(gemini_llm, wellness_vectorstore)
|
| 225 |
brand_rag_chain = build_rag_chain(gemini_llm, brand_vectorstore)
|
| 226 |
-
|
| 227 |
print("Pipeline initialized successfully!")
|
| 228 |
except Exception as e:
|
| 229 |
print(f"Error initializing pipeline: {str(e)}")
|
| 230 |
|
|
|
|
| 231 |
def run_with_chain(query: str) -> str:
|
| 232 |
return run_pipeline(query)
|
|
|
|
| 205 |
refusal_text = refusal_chain.run({"topic": "this topic"})
|
| 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()
|
|
|
|
| 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:
|
| 234 |
return run_pipeline(query)
|