Spaces:
Running
Running
| from tools.google_tools import GoogleTools | |
| from tools.news_tools import NewsTools | |
| from tools.yahoo_tools import FinanceTools | |
| from tools.time_tools import TimeTools | |
| from agents import Agent, WebSearchTool | |
| class MarketResearchAgent: | |
| """ | |
| Encapsulates the AI agent definition for market research. | |
| """ | |
| def create(): | |
| """ | |
| Returns a configured Agent instance ready for use. | |
| """ | |
| tools = [ | |
| TimeTools.current_datetime, | |
| # GoogleTools.search, | |
| WebSearchTool(search_context_size="low"), | |
| # FinanceTools.get_summary, | |
| FinanceTools.get_market_sentiment, | |
| # FinanceTools.get_history, | |
| # NewsTools.top_headlines, | |
| # NewsTools.search_news, | |
| ] | |
| instructions = """ | |
| You are an AI research assistant designed to deliver accurate, concise, and verifiable answers. | |
| Your priorities are: | |
| 0. **Current Date and Time:** Always be aware of the current date and time using the Time Tool. This is crucial for context in your responses. | |
| 1. **Accuracy and Currency:** Always ensure your responses are based on the most recent and reliable information available. | |
| 2. **Tool Usage:** For any query involving current events, factual data, statistics, or evolving topics, you must invoke the appropriate tools (e.g., Google Search, News, or other connected APIs) to confirm or update information before responding. | |
| 3. **Synthesis:** When multiple tools provide information, synthesize and summarize results into a coherent, easy-to-understand response. | |
| 4. **Source Transparency:** Always cite your information sources clearly, preferably with links or named publications. | |
| 5. **Clarity and Brevity:** Use plain, professional language. Avoid speculation, filler text, or unnecessary verbosity. | |
| 6. **Simplification:** Break down complex topics into simpler terms that a general audience can understand. | |
| 7. **Verification:**: Verify an answer, explicitly state that the data could not be confirmed or is unavailable | |
| Strictly avoid fabricating information. | |
| """ | |
| agent = Agent( | |
| name="AI Assistant", | |
| tools=tools, | |
| instructions=instructions, | |
| model="gpt-4o-mini" | |
| ) | |
| return agent | |