Spaces:
Build error
Build error
Update tool_handler.py
Browse files- tool_handler.py +9 -9
tool_handler.py
CHANGED
|
@@ -73,15 +73,15 @@ def treatment_tool(query: str, model="llama-3.3-70b-versatile", use_rag=True) ->
|
|
| 73 |
# Tool 3: Symptom Cause Analyzer
|
| 74 |
def symptom_search_tool(symptom_description: str, model="llama-3.3-70b-versatile", use_rag=True) -> str:
|
| 75 |
def perform_search(query):
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
|
| 86 |
try:
|
| 87 |
results = perform_search(symptom_description)
|
|
|
|
| 73 |
# Tool 3: Symptom Cause Analyzer
|
| 74 |
def symptom_search_tool(symptom_description: str, model="llama-3.3-70b-versatile", use_rag=True) -> str:
|
| 75 |
def perform_search(query):
|
| 76 |
+
url = "https://serpapi.com/search"
|
| 77 |
+
params = {
|
| 78 |
+
"engine": "google",
|
| 79 |
+
"q": f"{query} possible causes site:mayoclinic.org OR site:webmd.com OR site:nih.gov",
|
| 80 |
+
"api_key": "f61d6383185f187371e695158febad5a0dd4d1c75640bba50e62064503ed1c24"
|
| 81 |
+
}
|
| 82 |
+
response = requests.get(url, params=params)
|
| 83 |
+
results = response.json()
|
| 84 |
+
return results.get("organic_results", [])
|
| 85 |
|
| 86 |
try:
|
| 87 |
results = perform_search(symptom_description)
|