Update app.py
#516
by
mariangeliki
- opened
app.py
CHANGED
@@ -55,7 +55,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
55 |
|
56 |
agent = CodeAgent(
|
57 |
model=model,
|
58 |
-
tools=[final_answer], ## add your tools here (don't remove final answer)
|
59 |
max_steps=6,
|
60 |
verbosity_level=1,
|
61 |
grammar=None,
|
@@ -65,5 +65,18 @@ agent = CodeAgent(
|
|
65 |
prompt_templates=prompt_templates
|
66 |
)
|
67 |
|
|
|
68 |
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
agent = CodeAgent(
|
57 |
model=model,
|
58 |
+
tools=[final_answer,get_stock_price], ## add your tools here (don't remove final answer)
|
59 |
max_steps=6,
|
60 |
verbosity_level=1,
|
61 |
grammar=None,
|
|
|
65 |
prompt_templates=prompt_templates
|
66 |
)
|
67 |
|
68 |
+
import yfinance as yf
|
69 |
|
70 |
+
@tool
|
71 |
+
def get_stock_price(symbol: str) -> str:
|
72 |
+
"""Returns today's closing price of the stock"""
|
73 |
+
try:
|
74 |
+
stock =yf.Ticker(symbol)
|
75 |
+
data = stock.history(period="1d")
|
76 |
+
return(get_stock_price)
|
77 |
+
|
78 |
+
GradioUI(agent).launch()
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
|