david-clifford commited on
Commit
57aecae
·
verified ·
1 Parent(s): 7c31550

Simplify back to basics

Browse files
Files changed (1) hide show
  1. app.py +3 -27
app.py CHANGED
@@ -23,33 +23,9 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
23
  """
24
  return "What magic will you build ?"
25
 
26
- ## Copied from https://huggingface.co/spaces/iamnamas/nse_stockprice_agent
27
- @tool
28
- def nse_stock_price_tool(stock_ticker:str)-> str:
29
- """A tool that is used to retrieve the latest closing price of a stock based on the stock ticker from the Indian Stock Exchange (NSE).
30
- example: 'RELIANCE.NS'
31
- Args:
32
- stock_ticker: The stock ticker/symbol for the stock listed in NSE. The exact string input needs to be provided to the function.
33
- Returns:
34
- result_string: A string containing the stock_ticker along with the amount in Rupees.
35
- example: "RELIANCE NS: 1237.22 Rupees."
36
- """
37
- try:
38
- import math
39
- import yfinance as yf
40
- stock_symbol = stock_ticker
41
- data = yf.download(tickers=stock_symbol, period='1d', interval='1m')
42
- if len(data):
43
- latest_data = data.tail(1)
44
- latest_price = latest_data['Close'].values[0]
45
- return (f"{stock_symbol}: {round(latest_price, 2)} Rupees.")
46
- else:
47
- return "INVALID TICKER/STOCK"
48
- except Exception as e:
49
- traceback.print_exc()
50
- return "INVALID REQUEST"
51
-
52
- # Writing my first custom tool
53
  @tool
54
  def toss_a_die(k: int) -> int:
55
  """A tool to toss a k-sided die / dice and return the value showing on that die / dice.
 
23
  """
24
  return "What magic will you build ?"
25
 
26
+ ## https://huggingface.co/spaces/iamnamas/nse_stockprice_agent ## Look up the price of an NSE stock like TATAMOTORS or ADANINT
27
+ ## https://huggingface.co/spaces/DenverJones/First_agent_template/blob/main/app.py ## randomly select a Motivational Quote
28
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  @tool
30
  def toss_a_die(k: int) -> int:
31
  """A tool to toss a k-sided die / dice and return the value showing on that die / dice.