Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -44,10 +44,10 @@ def divide(a: int,b: int) -> float:
|
|
| 44 |
|
| 45 |
@tool
|
| 46 |
def web_search(query: str) -> str:
|
| 47 |
-
""" Search for a query on web and return best
|
| 48 |
|
| 49 |
-
search = DuckDuckGoSearchResults(num_results=
|
| 50 |
-
results = search.invoke(query)
|
| 51 |
|
| 52 |
'''formatted_results = "\n\n-----\n\n".join(
|
| 53 |
[
|
|
@@ -78,9 +78,9 @@ def web_search(query: str) -> str:
|
|
| 78 |
|
| 79 |
@tool
|
| 80 |
def wikipedia_search(query: str) -> str:
|
| 81 |
-
""" Search for a query on wikipedia and return best
|
| 82 |
|
| 83 |
-
loader = WikipediaLoader(query=query, load_max_docs=
|
| 84 |
search_results = loader.load() # Now, just call load() without arguments
|
| 85 |
|
| 86 |
formatted_search_results = "\n\n-----\n\n".join(
|
|
@@ -95,10 +95,10 @@ def wikipedia_search(query: str) -> str:
|
|
| 95 |
|
| 96 |
@tool
|
| 97 |
def arxiv_search(query: str) -> str:
|
| 98 |
-
""" Search for a query on arxiv and return best
|
| 99 |
|
| 100 |
# Similar to WikipediaLoader, query and load_max_docs are passed during initialization
|
| 101 |
-
loader = ArxivLoader(query=query, load_max_docs=
|
| 102 |
search_results = loader.load() # Call load() without arguments
|
| 103 |
|
| 104 |
formatted_search_results = "\n\n-----\n\n".join(
|
|
|
|
| 44 |
|
| 45 |
@tool
|
| 46 |
def web_search(query: str) -> str:
|
| 47 |
+
""" Search for a query on web and return best result."""
|
| 48 |
|
| 49 |
+
search = DuckDuckGoSearchResults(num_results=1)
|
| 50 |
+
results = search.invoke(input=query)
|
| 51 |
|
| 52 |
'''formatted_results = "\n\n-----\n\n".join(
|
| 53 |
[
|
|
|
|
| 78 |
|
| 79 |
@tool
|
| 80 |
def wikipedia_search(query: str) -> str:
|
| 81 |
+
""" Search for a query on wikipedia and return best result."""
|
| 82 |
|
| 83 |
+
loader = WikipediaLoader(query=query, load_max_docs=1)
|
| 84 |
search_results = loader.load() # Now, just call load() without arguments
|
| 85 |
|
| 86 |
formatted_search_results = "\n\n-----\n\n".join(
|
|
|
|
| 95 |
|
| 96 |
@tool
|
| 97 |
def arxiv_search(query: str) -> str:
|
| 98 |
+
""" Search for a query on arxiv and return best result."""
|
| 99 |
|
| 100 |
# Similar to WikipediaLoader, query and load_max_docs are passed during initialization
|
| 101 |
+
loader = ArxivLoader(query=query, load_max_docs=1)
|
| 102 |
search_results = loader.load() # Call load() without arguments
|
| 103 |
|
| 104 |
formatted_search_results = "\n\n-----\n\n".join(
|