Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,16 +39,9 @@ def add(a: int, b: int) -> int:
|
|
| 39 |
return a + b
|
| 40 |
|
| 41 |
@tool
|
| 42 |
-
def
|
| 43 |
-
"""
|
| 44 |
-
|
| 45 |
-
search_docs = ArxivLoader(query=query, load_max_docs=3).load()
|
| 46 |
-
formatted_search_docs = "\n\n---\n\n".join(
|
| 47 |
-
[f'<Document source="{doc.metadata["source"]}"/>\n{doc.page_content[:1000]}\n</Document>'
|
| 48 |
-
for doc in search_docs])
|
| 49 |
-
return {"arvix_results": formatted_search_docs}
|
| 50 |
-
except Exception as e:
|
| 51 |
-
return {"arvix_results": f"Error: {str(e)}"}
|
| 52 |
|
| 53 |
@tool
|
| 54 |
def subtract(a: int, b: int) -> int:
|
|
@@ -62,6 +55,18 @@ def divide(a: int, b: int) -> int:
|
|
| 62 |
raise ValueError("Cannot divide by zero.")
|
| 63 |
return a / b
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
@tool
|
| 66 |
def wiki_search(query: str) -> str:
|
| 67 |
"""Search Wikipedia for a query and return maximum 2 results."""
|
|
|
|
| 39 |
return a + b
|
| 40 |
|
| 41 |
@tool
|
| 42 |
+
def modulus(a: int, b: int) -> int:
|
| 43 |
+
"""Get the modulus of two numbers."""
|
| 44 |
+
return a % b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
@tool
|
| 47 |
def subtract(a: int, b: int) -> int:
|
|
|
|
| 55 |
raise ValueError("Cannot divide by zero.")
|
| 56 |
return a / b
|
| 57 |
|
| 58 |
+
@tool
|
| 59 |
+
def arvix_search(query: str) -> str:
|
| 60 |
+
"""Search Arxiv for a query and return maximum 3 results."""
|
| 61 |
+
try:
|
| 62 |
+
search_docs = ArxivLoader(query=query, load_max_docs=3).load()
|
| 63 |
+
formatted_search_docs = "\n\n---\n\n".join(
|
| 64 |
+
[f'<Document source="{doc.metadata["source"]}"/>\n{doc.page_content[:1000]}\n</Document>'
|
| 65 |
+
for doc in search_docs])
|
| 66 |
+
return {"arvix_results": formatted_search_docs}
|
| 67 |
+
except Exception as e:
|
| 68 |
+
return {"arvix_results": f"Error: {str(e)}"}
|
| 69 |
+
|
| 70 |
@tool
|
| 71 |
def wiki_search(query: str) -> str:
|
| 72 |
"""Search Wikipedia for a query and return maximum 2 results."""
|