Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -16,9 +16,6 @@ from langchain_core.tools import tool
|
|
| 16 |
#from langchain.tools.retriever import create_retriever_tool
|
| 17 |
#from supabase.client import Client, create_client
|
| 18 |
|
| 19 |
-
#from huggingface_hub import login
|
| 20 |
-
#login(token=HF_TOKEN)
|
| 21 |
-
|
| 22 |
load_dotenv()
|
| 23 |
|
| 24 |
@tool
|
|
@@ -87,15 +84,15 @@ def wiki_search(query: str) -> str:
|
|
| 87 |
])
|
| 88 |
return {"wiki_results": formatted_search_docs}
|
| 89 |
|
| 90 |
-
|
| 91 |
@tool
|
| 92 |
def web_search(query: str) -> str:
|
| 93 |
-
|
| 94 |
-
"""Search Tavily for a query and return maximum 3 results.
|
| 95 |
|
| 96 |
Args:
|
| 97 |
query: The search query."""
|
| 98 |
-
|
| 99 |
search_docs = TavilySearchResults(max_results=3).invoke(query=query)
|
| 100 |
formatted_search_docs = "\n\n---\n\n".join(
|
| 101 |
[
|
|
@@ -104,7 +101,6 @@ def web_search(query: str) -> str:
|
|
| 104 |
])
|
| 105 |
return {"web_results": formatted_search_docs}
|
| 106 |
|
| 107 |
-
"""
|
| 108 |
|
| 109 |
@tool
|
| 110 |
def arvix_search(query: str) -> str:
|
|
@@ -165,7 +161,7 @@ tools = [
|
|
| 165 |
divide,
|
| 166 |
modulus,
|
| 167 |
wiki_search,
|
| 168 |
-
|
| 169 |
arvix_search,
|
| 170 |
]
|
| 171 |
|
|
|
|
| 16 |
#from langchain.tools.retriever import create_retriever_tool
|
| 17 |
#from supabase.client import Client, create_client
|
| 18 |
|
|
|
|
|
|
|
|
|
|
| 19 |
load_dotenv()
|
| 20 |
|
| 21 |
@tool
|
|
|
|
| 84 |
])
|
| 85 |
return {"wiki_results": formatted_search_docs}
|
| 86 |
|
| 87 |
+
|
| 88 |
@tool
|
| 89 |
def web_search(query: str) -> str:
|
| 90 |
+
|
| 91 |
+
"""Search Tavily for a query and return maximum 3 results.
|
| 92 |
|
| 93 |
Args:
|
| 94 |
query: The search query."""
|
| 95 |
+
|
| 96 |
search_docs = TavilySearchResults(max_results=3).invoke(query=query)
|
| 97 |
formatted_search_docs = "\n\n---\n\n".join(
|
| 98 |
[
|
|
|
|
| 101 |
])
|
| 102 |
return {"web_results": formatted_search_docs}
|
| 103 |
|
|
|
|
| 104 |
|
| 105 |
@tool
|
| 106 |
def arvix_search(query: str) -> str:
|
|
|
|
| 161 |
divide,
|
| 162 |
modulus,
|
| 163 |
wiki_search,
|
| 164 |
+
web_search,
|
| 165 |
arvix_search,
|
| 166 |
]
|
| 167 |
|