eocone commited on
Commit
161f95c
·
verified ·
1 Parent(s): 49bfc49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -16,18 +16,19 @@ def dog_average_longevity(breed: str) -> str:
16
  breed: a string representing the name of the dog breed.
17
  """
18
  #return "A string stating the average lifespan of the dog breed in years."
19
- query = f"average lifespan for {breed} dog in years"
 
20
 
21
- with DDGS() as ddgs:
22
  results = list(ddgs.text(query, max_results=5))
23
 
24
- if results:
25
  for result in results:
26
  lifespan = extract_lifespan(result)
27
  if lifespan:
28
  return f"The average lifespan of a {breed} dog is {lifespan} years."
29
 
30
- return "No reliable lifespan information found. Please check with a veterinarian."
31
 
32
  @tool
33
  def extract_lifespan(text: str) -> Optional[str]:
 
16
  breed: a string representing the name of the dog breed.
17
  """
18
  #return "A string stating the average lifespan of the dog breed in years."
19
+
20
+ query = f"average lifespan for {breed} dog in years"
21
 
22
+ with DDGS() as ddgs:
23
  results = list(ddgs.text(query, max_results=5))
24
 
25
+ if results:
26
  for result in results:
27
  lifespan = extract_lifespan(result)
28
  if lifespan:
29
  return f"The average lifespan of a {breed} dog is {lifespan} years."
30
 
31
+ return "No reliable lifespan information found. Please check with a veterinarian."
32
 
33
  @tool
34
  def extract_lifespan(text: str) -> Optional[str]: