Spaces:
Sleeping
Sleeping
Update pipeline.py
Browse files- pipeline.py +14 -0
pipeline.py
CHANGED
|
@@ -173,6 +173,20 @@ def do_web_search(query: str) -> str:
|
|
| 173 |
response = manager_agent.run(search_query)
|
| 174 |
return response
|
| 175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
|
| 177 |
# # Orchestrator: run_with_chain
|
| 178 |
# def run_with_chain(query: str) -> str:
|
|
|
|
| 173 |
response = manager_agent.run(search_query)
|
| 174 |
return response
|
| 175 |
|
| 176 |
+
# Modify the classification logic to recognize box breathing
|
| 177 |
+
def classify_query(query: str) -> str:
|
| 178 |
+
wellness_keywords = ["box breathing", "meditation", "yoga", "mindfulness", "breathing exercises"]
|
| 179 |
+
|
| 180 |
+
if any(keyword in query.lower() for keyword in wellness_keywords):
|
| 181 |
+
return "Wellness"
|
| 182 |
+
|
| 183 |
+
# If not recognized as wellness, use the classification chain
|
| 184 |
+
class_result = classification_chain.invoke({"query": query})
|
| 185 |
+
classification = class_result.get("text", "").strip()
|
| 186 |
+
|
| 187 |
+
if classification == "OutOfScope":
|
| 188 |
+
return "OutOfScope"
|
| 189 |
+
return classification
|
| 190 |
|
| 191 |
# # Orchestrator: run_with_chain
|
| 192 |
# def run_with_chain(query: str) -> str:
|