mohammedfaisalkhan4000 commited on
Commit
fbb9ddd
·
verified ·
1 Parent(s): a8d696c

new took money exhange

Browse files
Files changed (1) hide show
  1. app.py +24 -1
app.py CHANGED
@@ -18,6 +18,29 @@ 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 get_current_time_in_timezone(timezone: str) -> str:
23
  """A tool that fetches the current local time in a specified timezone.
@@ -55,7 +78,7 @@ with open("prompts.yaml", 'r') as stream:
55
 
56
  agent = CodeAgent(
57
  model=model,
58
- tools=[final_answer,get_current_time_in_timezone], ## add your tools here (don't remove final answer)
59
  max_steps=6,
60
  verbosity_level=1,
61
  grammar=None,
 
18
  """
19
  return "What magic will you build ?"
20
 
21
+ from openai import tool
22
+
23
+ @tool
24
+ def money_transfer_tool(amount_in_inr: float, exchange_rate: float, fee_percent: float) -> str:
25
+ """A tool to calculate the amount received in USD after transferring money from India to the US.
26
+ Args:
27
+ amount_in_inr: The amount in Indian Rupees you want to send.
28
+ exchange_rate: The INR to USD exchange rate (e.g., 83.0 INR = 1 USD).
29
+ fee_percent: The transfer fee percentage charged by the bank or service.
30
+ """
31
+ # Calculate the fee
32
+ fee_amount = (fee_percent / 100) * amount_in_inr
33
+ amount_after_fee = amount_in_inr - fee_amount
34
+
35
+ # Convert to USD
36
+ usd_received = amount_after_fee / exchange_rate
37
+
38
+ return (f"Amount to send: ₹{amount_in_inr:,.2f}\n"
39
+ f"Fee deducted ({fee_percent}%): ₹{fee_amount:,.2f}\n"
40
+ f"Amount after fee: ₹{amount_after_fee:,.2f}\n"
41
+ f"Final USD received: ${usd_received:,.2f}")
42
+
43
+
44
  @tool
45
  def get_current_time_in_timezone(timezone: str) -> str:
46
  """A tool that fetches the current local time in a specified timezone.
 
78
 
79
  agent = CodeAgent(
80
  model=model,
81
+ tools=[final_answer,get_current_time_in_timezone, money_transfer_tool], ## add your tools here (don't remove final answer)
82
  max_steps=6,
83
  verbosity_level=1,
84
  grammar=None,