Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -38,9 +38,9 @@ def divide(a: int,b: int) -> float:
|
|
| 38 |
|
| 39 |
@tool
|
| 40 |
def web_search(query: str) -> str:
|
| 41 |
-
""" Search for a query on web and return best
|
| 42 |
|
| 43 |
-
search_results = TavilySearchResults(max_results =
|
| 44 |
|
| 45 |
formatted_search_results = "\n\n-----\n\n".join(
|
| 46 |
[
|
|
@@ -53,9 +53,9 @@ def web_search(query: str) -> str:
|
|
| 53 |
|
| 54 |
@tool
|
| 55 |
def wikipedia_search(query: str) -> str:
|
| 56 |
-
""" Search for a query on wikipedia and return best
|
| 57 |
|
| 58 |
-
loader = WikipediaLoader(query=query, load_max_docs=
|
| 59 |
search_results = loader.load() # Now, just call load() without arguments
|
| 60 |
|
| 61 |
formatted_search_results = "\n\n-----\n\n".join(
|
|
@@ -70,10 +70,10 @@ def wikipedia_search(query: str) -> str:
|
|
| 70 |
|
| 71 |
@tool
|
| 72 |
def arxiv_search(query: str) -> str:
|
| 73 |
-
""" Search for a query on arxiv and return best
|
| 74 |
|
| 75 |
# Similar to WikipediaLoader, query and load_max_docs are passed during initialization
|
| 76 |
-
loader = ArxivLoader(query=query, load_max_docs=
|
| 77 |
search_results = loader.load() # Call load() without arguments
|
| 78 |
|
| 79 |
formatted_search_results = "\n\n-----\n\n".join(
|
|
@@ -86,7 +86,7 @@ def arxiv_search(query: str) -> str:
|
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
-
system_prompt = """You are a general AI assistant. I will ask you a question. Use your tools to report your thoughts, and finish your answer with the following template:
|
| 90 |
FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
|
| 91 |
If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise.
|
| 92 |
If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise.
|
|
|
|
| 38 |
|
| 39 |
@tool
|
| 40 |
def web_search(query: str) -> str:
|
| 41 |
+
""" Search for a query on web and return best 2 result."""
|
| 42 |
|
| 43 |
+
search_results = TavilySearchResults(max_results = 2).invoke(input=query)
|
| 44 |
|
| 45 |
formatted_search_results = "\n\n-----\n\n".join(
|
| 46 |
[
|
|
|
|
| 53 |
|
| 54 |
@tool
|
| 55 |
def wikipedia_search(query: str) -> str:
|
| 56 |
+
""" Search for a query on wikipedia and return best 2 result."""
|
| 57 |
|
| 58 |
+
loader = WikipediaLoader(query=query, load_max_docs=2)
|
| 59 |
search_results = loader.load() # Now, just call load() without arguments
|
| 60 |
|
| 61 |
formatted_search_results = "\n\n-----\n\n".join(
|
|
|
|
| 70 |
|
| 71 |
@tool
|
| 72 |
def arxiv_search(query: str) -> str:
|
| 73 |
+
""" Search for a query on arxiv and return best 2 result."""
|
| 74 |
|
| 75 |
# Similar to WikipediaLoader, query and load_max_docs are passed during initialization
|
| 76 |
+
loader = ArxivLoader(query=query, load_max_docs=2)
|
| 77 |
search_results = loader.load() # Call load() without arguments
|
| 78 |
|
| 79 |
formatted_search_results = "\n\n-----\n\n".join(
|
|
|
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
+
system_prompt = """You are a general AI assistant. I will ask you a question. Use your tools and think carefully to report your thoughts, and finish your answer with the following template:
|
| 90 |
FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
|
| 91 |
If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise.
|
| 92 |
If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise.
|