lautel commited on
Commit
1419eb8
·
verified ·
1 Parent(s): 34c3352

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -10
app.py CHANGED
@@ -34,12 +34,12 @@ def get_current_time_in_timezone(timezone: str) -> str:
34
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
35
 
36
  @tool
37
- def get_random_dog_info():
38
  """
39
  Fetches a random dog image and fact from dogapi.dog.
40
 
41
  Returns:
42
- A dictionary with the dog image URL and a dog fact.
43
  """
44
  base_url = "https://dogapi.dog/api/v2"
45
 
@@ -48,15 +48,9 @@ def get_random_dog_info():
48
  fact_response = requests.get(f"{base_url}/facts")
49
  fact_response.raise_for_status()
50
  fact = fact_response.json()['data'][0]['attributes']['body']
51
-
52
- return {
53
- "image_url": image_url,
54
- "fact": fact
55
- }
56
-
57
  except requests.RequestException as e:
58
- print("API call failed:", e)
59
- return None
60
 
61
 
62
  final_answer = FinalAnswerTool()
 
34
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
35
 
36
  @tool
37
+ def get_random_dog_info() -> str:
38
  """
39
  Fetches a random dog image and fact from dogapi.dog.
40
 
41
  Returns:
42
+ A string with a random dog fact.
43
  """
44
  base_url = "https://dogapi.dog/api/v2"
45
 
 
48
  fact_response = requests.get(f"{base_url}/facts")
49
  fact_response.raise_for_status()
50
  fact = fact_response.json()['data'][0]['attributes']['body']
51
+ return fact
 
 
 
 
 
52
  except requests.RequestException as e:
53
+ return f"API call failed: {str(e)}"
 
54
 
55
 
56
  final_answer = FinalAnswerTool()