Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,15 +10,15 @@ from tools.final_answer import FinalAnswerTool
|
|
| 10 |
from Gradio_UI import GradioUI
|
| 11 |
|
| 12 |
@tool
|
| 13 |
-
def dog_average_longevity(
|
| 14 |
"""A tool that uses DuckDuckGo to search the web and returns the average lifespan for a given dog breed.
|
| 15 |
Parameters:
|
| 16 |
-
|
| 17 |
Returns:
|
| 18 |
str: The average lifespan of the specified dog breed in years.
|
| 19 |
"""
|
| 20 |
|
| 21 |
-
query = f"average lifespan for {
|
| 22 |
|
| 23 |
with DDGS() as ddgs:
|
| 24 |
results = list(ddgs.text(query, max_results=5))
|
|
@@ -27,7 +27,7 @@ def dog_average_longevity(breed: str) -> str:
|
|
| 27 |
for result in results:
|
| 28 |
lifespan = extract_lifespan(result)
|
| 29 |
if lifespan:
|
| 30 |
-
return f"The average lifespan of a {
|
| 31 |
|
| 32 |
return "No reliable lifespan information found. Please check with a veterinarian."
|
| 33 |
|
|
|
|
| 10 |
from Gradio_UI import GradioUI
|
| 11 |
|
| 12 |
@tool
|
| 13 |
+
def dog_average_longevity(dog_breed: str) -> str:
|
| 14 |
"""A tool that uses DuckDuckGo to search the web and returns the average lifespan for a given dog breed.
|
| 15 |
Parameters:
|
| 16 |
+
dog_breed (str): The breed of the dog (e.g., "Labrador").
|
| 17 |
Returns:
|
| 18 |
str: The average lifespan of the specified dog breed in years.
|
| 19 |
"""
|
| 20 |
|
| 21 |
+
query = f"average lifespan for {dog_breed} dog in years"
|
| 22 |
|
| 23 |
with DDGS() as ddgs:
|
| 24 |
results = list(ddgs.text(query, max_results=5))
|
|
|
|
| 27 |
for result in results:
|
| 28 |
lifespan = extract_lifespan(result)
|
| 29 |
if lifespan:
|
| 30 |
+
return f"The average lifespan of a {dog_breed} dog is {lifespan} years."
|
| 31 |
|
| 32 |
return "No reliable lifespan information found. Please check with a veterinarian."
|
| 33 |
|