Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,17 +13,17 @@ from Gradio_UI import GradioUI
|
|
| 13 |
@tool
|
| 14 |
def my_custom_tool(pokemon_name: str) -> str: # it's import to specify the return type
|
| 15 |
# Keep this format for the description / args / args description but feel free to modify the tool
|
| 16 |
-
"""A tool that
|
| 17 |
Args:
|
| 18 |
pokemon_name: A string representing a existing pokemon name (e.g., 'Metapod')
|
| 19 |
-
Returns a json with all the info from a Pokemon
|
| 20 |
"""
|
| 21 |
try:
|
| 22 |
pokemon = requests.get(
|
| 23 |
f"https://pokeapi.co/api/v2/pokemon/{pokemon_name.casefold()}"
|
| 24 |
)
|
| 25 |
|
| 26 |
-
return
|
| 27 |
except Exception as ex:
|
| 28 |
return "An error ocurred: " + ex.with_traceback()
|
| 29 |
|
|
|
|
| 13 |
@tool
|
| 14 |
def my_custom_tool(pokemon_name: str) -> str: # it's import to specify the return type
|
| 15 |
# Keep this format for the description / args / args description but feel free to modify the tool
|
| 16 |
+
"""A tool that fetches information about a pokemon given its name.
|
| 17 |
Args:
|
| 18 |
pokemon_name: A string representing a existing pokemon name (e.g., 'Metapod')
|
| 19 |
+
Returns a json with all the info from a Pokemon.
|
| 20 |
"""
|
| 21 |
try:
|
| 22 |
pokemon = requests.get(
|
| 23 |
f"https://pokeapi.co/api/v2/pokemon/{pokemon_name.casefold()}"
|
| 24 |
)
|
| 25 |
|
| 26 |
+
return pokemon.json()
|
| 27 |
except Exception as ex:
|
| 28 |
return "An error ocurred: " + ex.with_traceback()
|
| 29 |
|