Spaces:
Sleeping
Sleeping
Update tools.py
Browse files
tools.py
CHANGED
|
@@ -77,6 +77,20 @@ def wiki_search(query: str) -> str:
|
|
| 77 |
])
|
| 78 |
return {"wiki_results": formatted_search_docs}
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
@tool
|
| 81 |
def fetch_youtube_transcript(video_url: str) -> str:
|
| 82 |
"""
|
|
|
|
| 77 |
])
|
| 78 |
return {"wiki_results": formatted_search_docs}
|
| 79 |
|
| 80 |
+
@tool
|
| 81 |
+
def arvix_search(query: str) -> str:
|
| 82 |
+
"""Search Arxiv for a query and return maximum 3 result.
|
| 83 |
+
|
| 84 |
+
Args:
|
| 85 |
+
query: The search query."""
|
| 86 |
+
search_docs = ArxivLoader(query=query, load_max_docs=3).load()
|
| 87 |
+
formatted_search_docs = "\n\n---\n\n".join(
|
| 88 |
+
[
|
| 89 |
+
f'<Document source="{doc.metadata["source"]}" page="{doc.metadata.get("page", "")}"/>\n{doc.page_content[:1000]}\n</Document>'
|
| 90 |
+
for doc in search_docs
|
| 91 |
+
])
|
| 92 |
+
return {"arvix_results": formatted_search_docs}
|
| 93 |
+
|
| 94 |
@tool
|
| 95 |
def fetch_youtube_transcript(video_url: str) -> str:
|
| 96 |
"""
|