SevioCreatives commited on
Commit
ad6bbbf
·
verified ·
1 Parent(s): 2cb77b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -6
app.py CHANGED
@@ -37,7 +37,7 @@ def get_weather(location: str)-> str:
37
  lon = place['lon']
38
  lat = place['lat']
39
 
40
- url = f'https://api.openweathermap.org/data/3.0/onecall?lat={lat}&lon={lon}&exclude=currently,minutely,hourly,alert&appid={'6969cb0fa02ea908feee8820d3a22689'}'
41
  try:
42
  weather_status = requests.get(url)
43
  return weather_status['daily'][0]['summary']
@@ -47,13 +47,26 @@ def get_weather(location: str)-> str:
47
 
48
 
49
  @tool
50
- def get_digital_asset_price(text: str, phone_number: str)-> str: #it's import to specify the return type
51
  #Keep this format for the description / args / args description but feel free to modify the tool
52
- """A tool that gets the current price of digital assets.
53
  Args:
54
- argument: the first argument
55
- arg2: the second argument
56
  """
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  return "What magic will you build ?"
58
 
59
  @tool
@@ -93,7 +106,7 @@ with open("prompts.yaml", 'r') as stream:
93
 
94
  agent = CodeAgent(
95
  model=model,
96
- tools=[get_current_time_in_timezone,get_weather,DuckDuckGoSearchTool,get_digital_asset_price, final_answer], ## add your tools here (don't remove final answer)
97
  max_steps=6,
98
  verbosity_level=1,
99
  grammar=None,
 
37
  lon = place['lon']
38
  lat = place['lat']
39
 
40
+ url = f'https://api.openweathermap.org/data/3.0/onecall?lat={lat}&lon={lon}&exclude=currently,minutely,hourly,alert&appid=6969cb0fa02ea908feee8820d3a22689'
41
  try:
42
  weather_status = requests.get(url)
43
  return weather_status['daily'][0]['summary']
 
47
 
48
 
49
  @tool
50
+ def get_gas_fee_estimate(start: str, end: str)-> str: #it's import to specify the return type
51
  #Keep this format for the description / args / args description but feel free to modify the tool
52
+ """A tool that estimates the gas fee for a transaction that occurs on the polygon blockchain.
53
  Args:
54
+ start: A string representing a valid wallet address (e.g., 0xfe3b557e8fb62b89f4916b721be55ceb828dbd73)
55
+ end: A second string representing a valid wallet address
56
  """
57
+ url = "https://polygon-mainnet.g.alchemy.com/v2/:alcht_B1m6mO9TW7lgiYa4cqlyZ2BFvD8gZQ"
58
+
59
+ payload = { "0": {
60
+ "from": {start},
61
+ "to": {end},
62
+ "value": "0x1"
63
+ } }
64
+ headers = {"Content-Type": "application/json"}
65
+ try:
66
+ response = requests.post(url, json=payload, headers=headers)
67
+ return f"The estimated gas fee is {response['result']}"
68
+ except error:
69
+
70
  return "What magic will you build ?"
71
 
72
  @tool
 
106
 
107
  agent = CodeAgent(
108
  model=model,
109
+ tools=[get_current_time_in_timezone,get_weather,DuckDuckGoSearchTool,get_gas_fee_estimate, final_answer], ## add your tools here (don't remove final answer)
110
  max_steps=6,
111
  verbosity_level=1,
112
  grammar=None,