Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,11 +34,12 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 34 |
import requests
|
| 35 |
|
| 36 |
@tool
|
| 37 |
-
def get_book() -> List[PotterBook]:
|
| 38 |
-
"""A tool that fetches the Harry Potter books with information about them.
|
| 39 |
Args:
|
|
|
|
| 40 |
"""
|
| 41 |
-
response = requests.get('https://potterapi-fedeperin.vercel.app/
|
| 42 |
datos = response.json()
|
| 43 |
libros = [PotterBook(**libro) for libro in datos]
|
| 44 |
return libros
|
|
|
|
| 34 |
import requests
|
| 35 |
|
| 36 |
@tool
|
| 37 |
+
def get_book(lang:str='en') -> List[PotterBook]:
|
| 38 |
+
"""A tool that fetches the Harry Potter books with information about them. Look for it in the language we are asking for
|
| 39 |
Args:
|
| 40 |
+
lang: Available languages to look for ['es', 'en', 'fr', 'it', 'pt', 'uk']. In case language is not in the list use by default 'en'.
|
| 41 |
"""
|
| 42 |
+
response = requests.get(f'https://potterapi-fedeperin.vercel.app/{lang}/books')
|
| 43 |
datos = response.json()
|
| 44 |
libros = [PotterBook(**libro) for libro in datos]
|
| 45 |
return libros
|