Spaces:
Sleeping
Sleeping
| # agent.py | |
| from smolagents import ToolCallingAgent | |
| from smolagents.models import HfApiModel | |
| from smolagents.tools import tool | |
| import requests | |
| def get_stock_price(ticker: str) -> str: | |
| # (same code as above) | |
| ... | |
| model = HfApiModel(model_id="mistralai/Mistral-7B-Instruct-v0.2") | |
| agent = ToolCallingAgent( | |
| tools=[get_stock_price], | |
| model=model, | |
| max_steps=3, | |
| name="stock_price_agent", | |
| description="Gets real-time stock prices for a given ticker." | |
| ) | |
| def answer_question(question: str) -> str: | |
| return agent.run(question) | |