Update agents/tools.py
Browse files- agents/tools.py +4 -0
agents/tools.py
CHANGED
|
@@ -1,4 +1,8 @@
|
|
| 1 |
from langchain.tools import tool
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
@tool("search_news", return_direct=False)
|
| 4 |
def search_news_tool(query: str, max_results: int = 5) -> str:
|
|
|
|
| 1 |
from langchain.tools import tool
|
| 2 |
+
try:
|
| 3 |
+
from duckduckgo_search import DDGS
|
| 4 |
+
except Exception:
|
| 5 |
+
DDGS = None # optional; handle gracefully below
|
| 6 |
|
| 7 |
@tool("search_news", return_direct=False)
|
| 8 |
def search_news_tool(query: str, max_results: int = 5) -> str:
|