Spaces:
Sleeping
Sleeping
Update app.py
Browse filesadded documentation
app.py
CHANGED
|
@@ -22,6 +22,16 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 22 |
|
| 23 |
@tool
|
| 24 |
def get_calories(meal:str) -> Union[str, None]:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
search_url = f"https://world.openfoodfacts.org/cgi/search.pl"
|
| 26 |
params = {
|
| 27 |
'search_terms': meal,
|
|
|
|
| 22 |
|
| 23 |
@tool
|
| 24 |
def get_calories(meal:str) -> Union[str, None]:
|
| 25 |
+
"""
|
| 26 |
+
Retrieves the calorie information for a given meal from the OpenFoodFacts API.
|
| 27 |
+
|
| 28 |
+
Args:
|
| 29 |
+
meal (str): The name or description of the meal to search for.
|
| 30 |
+
|
| 31 |
+
Returns:
|
| 32 |
+
Union[str, None]: The calorie information as a string in the format 'X kcal per 100g',
|
| 33 |
+
'No data found' if no information is available, or None if the request fails.
|
| 34 |
+
"""
|
| 35 |
search_url = f"https://world.openfoodfacts.org/cgi/search.pl"
|
| 36 |
params = {
|
| 37 |
'search_terms': meal,
|