Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,17 +19,14 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
@tool
|
| 22 |
-
def grocery_info(
|
| 23 |
"""A tool that fetches the grocery information from the Swedish Food Agency api
|
| 24 |
Args:
|
| 25 |
-
version: version of tool argument.
|
| 26 |
grocery_id: The id of the grocery (e.g, and int expected)
|
| 27 |
-
language: Choose between Swedish or English language: (1 for Swedish, set to two for English)
|
| 28 |
-
|
| 29 |
"""
|
| 30 |
|
| 31 |
base_url = "https://dataportal.livsmedelsverket.se/livsmedel"
|
| 32 |
-
grocery_api_url = f"{base_url}/api/
|
| 33 |
|
| 34 |
response = requests.get(grocery_api_url)
|
| 35 |
data = response.json()
|
|
|
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
@tool
|
| 22 |
+
def grocery_info(grocery_id:int) -> str:
|
| 23 |
"""A tool that fetches the grocery information from the Swedish Food Agency api
|
| 24 |
Args:
|
|
|
|
| 25 |
grocery_id: The id of the grocery (e.g, and int expected)
|
|
|
|
|
|
|
| 26 |
"""
|
| 27 |
|
| 28 |
base_url = "https://dataportal.livsmedelsverket.se/livsmedel"
|
| 29 |
+
grocery_api_url = f"{base_url}/api/v1/livsmedel/{grocery_id}?sprak=2"
|
| 30 |
|
| 31 |
response = requests.get(grocery_api_url)
|
| 32 |
data = response.json()
|