blumski commited on
Commit
bd514c5
·
verified ·
1 Parent(s): f1cfa4b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -29
app.py CHANGED
@@ -19,34 +19,6 @@ 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
 
22
- @tool
23
- def get_coordinates_osm(location_name:str) -> str:
24
-
25
- """A tool that fetches gps coordinates of a given place in the world
26
- Args:
27
- arg1: the name of the location (e.g., 'Kinshasa, Gombe').
28
- """
29
- headers = {
30
- 'User-Agent': 'MyGeocodingApp/1.0 (youremail@example.com)'
31
- }
32
- location_name = location_name.replace(" ", "+")
33
- base_url = "https://nominatim.openstreetmap.org/search"
34
- full_url = f"{base_url}?q={requests.utils.quote(location_name)}&format=json&limit=5"
35
-
36
- response = requests.get(full_url, headers=headers)
37
-
38
- if response.status_code != 200:
39
- raise Exception("Erreur lors de la requête à l'API OpenStreetMap")
40
-
41
- response_list = response.json()
42
-
43
- if len(response_list) == 0:
44
- raise Exception("Aucune réponse trouvée pour cette recherche")
45
-
46
- latitude = float(response_list[0]['lat'])
47
- longitude = float(response_list[0]['lon'])
48
-
49
- return {'latitude': latitude, 'longitude': longitude}
50
 
51
  @tool
52
  def get_current_time_in_timezone(timezone: str) -> str:
@@ -85,7 +57,7 @@ with open("prompts.yaml", 'r') as stream:
85
 
86
  agent = CodeAgent(
87
  model=model,
88
- tools=[final_answer, get_coordinates_osm], ## add your tools here (don't remove final answer)
89
  max_steps=6,
90
  verbosity_level=1,
91
  grammar=None,
 
19
  return "What magic will you build ?"
20
 
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  @tool
24
  def get_current_time_in_timezone(timezone: str) -> str:
 
57
 
58
  agent = CodeAgent(
59
  model=model,
60
+ tools=[final_answer], ## add your tools here (don't remove final answer)
61
  max_steps=6,
62
  verbosity_level=1,
63
  grammar=None,