vladd19 commited on
Commit
817246b
·
verified ·
1 Parent(s): e024006

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -44,7 +44,7 @@ def get_weather(
44
  @tool
45
  def get_universites_by_country(
46
  country: str,
47
- ) -> dict:
48
  """
49
  Ищет список университетов для указанной страны с помощью HipoLabs API.
50
 
@@ -60,7 +60,9 @@ def get_universites_by_country(
60
  url = f"http://universities.hipolabs.com/search?country={country}"
61
  response = requests.get(url, timeout=10)
62
  response.raise_for_status()
63
- return f"Университеты в {country}: {response.text.strip()}"
 
 
64
  except Exception as e:
65
  return f"Error fetching weather for {country}: {str(e)}"
66
 
 
44
  @tool
45
  def get_universites_by_country(
46
  country: str,
47
+ ) -> list:
48
  """
49
  Ищет список университетов для указанной страны с помощью HipoLabs API.
50
 
 
60
  url = f"http://universities.hipolabs.com/search?country={country}"
61
  response = requests.get(url, timeout=10)
62
  response.raise_for_status()
63
+ data = response.json()
64
+ names = [uni["name"] for uni in data]
65
+ return f"Университеты в {country}: {names}"
66
  except Exception as e:
67
  return f"Error fetching weather for {country}: {str(e)}"
68