BioCodeFusion commited on
Commit
97b0074
·
verified ·
1 Parent(s): 1ee859e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -45
app.py CHANGED
@@ -18,51 +18,6 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
18
  """
19
  return "What magic will you build ?"
20
 
21
- @tool
22
- def grocery_info(version=1, grocery_id=1, sprak=2):
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
- Output:
30
- The first element is the grocery name
31
- The second element is the link for ingredient of the grocery to be used in the ingredients function
32
- """
33
-
34
- base_url = "https://dataportal.livsmedelsverket.se/livsmedel"
35
- grocery_api_url = f"{base_url}/api/v{version}/livsmedel/{grocery_id}?sprak={sprak}"
36
-
37
- response = requests.get(grocery_api_url)
38
- data = response.json()
39
-
40
- if response.status_code == 200:
41
- data = response.json()
42
- grocery_description = data.get("namn")
43
- grocery_ingredients = data.get("links")[2]['href']
44
- return grocery_description, grocery_ingredients_link
45
- else:
46
- return "Error: Unable to find grocery data."
47
-
48
- @tool
49
- def ingredients(link = grocery_ingredients_link):
50
- """A tool that fetches the the ingredient of a grocery, based on the url
51
- based on the grocery_ingredients_link output from the grocery_info function
52
- Args:
53
- url which is specific to get the grocery ingredients
54
-
55
- Output:
56
- a text string containing the ingredients
57
- """
58
-
59
- ingredient_api_url = f"{base_url}{ingred_url}"
60
-
61
- response=requests.get(ingredient_api_url)
62
- data=response.json()
63
-
64
- return data[0]['namn']
65
-
66
  @tool
67
  def get_current_time_in_timezone(timezone: str) -> str:
68
  """A tool that fetches the current local time in a specified timezone.
 
18
  """
19
  return "What magic will you build ?"
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
23
  """A tool that fetches the current local time in a specified timezone.