corquaerit commited on
Commit
62ef376
·
verified ·
1 Parent(s): beec040

Update app.py

Browse files

inlcuded a currency converter

Files changed (1) hide show
  1. app.py +15 -0
app.py CHANGED
@@ -52,6 +52,21 @@ def ddg_tool(query:str, area:str, max_results:int=5) -> list:
52
 
53
  return results
54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
  final_answer = FinalAnswerTool()
57
 
 
52
 
53
  return results
54
 
55
+ @tool
56
+ def forex_tool(query:str,amt:float, base_currency:str, conv_currency:str)-> float:
57
+ """A tool that searches for the current forex rate of 2 currencies
58
+ and outputs how much your money is worth by multiplying your amount with the
59
+ other country's rate.
60
+ Args:
61
+ query: the foreign exchnage rates between the two currencies(e.g 1 usd to 15 ghs)
62
+ amt: the amount of money to be converted
63
+ base_currency:the base currency that has to be converted (e.g usd)
64
+ conv_currency:the currency to be converted into(e.g ghs)
65
+ """
66
+ forex_tool= DDGS()
67
+ search_result = DDGS().text(query)
68
+ amount_worth = amt * float(conv_currency)
69
+ return amount_worth
70
 
71
  final_answer = FinalAnswerTool()
72