Mohammad Haghir commited on
Commit ·
9079ca4
1
Parent(s): b081e2b
new model
Browse files- agent_utils.py +4 -2
agent_utils.py
CHANGED
|
@@ -10,7 +10,7 @@ import pandas as pd
|
|
| 10 |
|
| 11 |
def wiki_ret(question: str) -> str:
|
| 12 |
""" Retrieve docs from wikipedia """
|
| 13 |
-
|
| 14 |
# Search
|
| 15 |
search_docs = WikipediaLoader(query=question,
|
| 16 |
load_max_docs=2).load()
|
|
@@ -29,6 +29,7 @@ def wiki_ret(question: str) -> str:
|
|
| 29 |
|
| 30 |
def arxiv_ret(query: str, max_results: int = 3) -> str:
|
| 31 |
"""Search arXiv for a given query and return a summary of top results."""
|
|
|
|
| 32 |
search = arxiv.Search(
|
| 33 |
query=query,
|
| 34 |
max_results=max_results,
|
|
@@ -48,6 +49,7 @@ def arxiv_ret(query: str, max_results: int = 3) -> str:
|
|
| 48 |
|
| 49 |
def tavily_ret(query: str, max_results: int = 3) -> str:
|
| 50 |
"""Use Tavily to retrieve web-based information about a topic."""
|
|
|
|
| 51 |
api_key = os.getenv("TAVILY_API_KEY")
|
| 52 |
if not api_key:
|
| 53 |
return "Tavily API key not found."
|
|
@@ -71,7 +73,7 @@ def handle_file_tool(input: dict) -> str:
|
|
| 71 |
"""Reads the file attached to a question"""
|
| 72 |
question = input.get("question", "")
|
| 73 |
file_url = input.get("file", "")
|
| 74 |
-
print(file_url)
|
| 75 |
|
| 76 |
if not file_url:
|
| 77 |
return "No file provided."
|
|
|
|
| 10 |
|
| 11 |
def wiki_ret(question: str) -> str:
|
| 12 |
""" Retrieve docs from wikipedia """
|
| 13 |
+
print("wiki")
|
| 14 |
# Search
|
| 15 |
search_docs = WikipediaLoader(query=question,
|
| 16 |
load_max_docs=2).load()
|
|
|
|
| 29 |
|
| 30 |
def arxiv_ret(query: str, max_results: int = 3) -> str:
|
| 31 |
"""Search arXiv for a given query and return a summary of top results."""
|
| 32 |
+
print("arxiv")
|
| 33 |
search = arxiv.Search(
|
| 34 |
query=query,
|
| 35 |
max_results=max_results,
|
|
|
|
| 49 |
|
| 50 |
def tavily_ret(query: str, max_results: int = 3) -> str:
|
| 51 |
"""Use Tavily to retrieve web-based information about a topic."""
|
| 52 |
+
print("tavily")
|
| 53 |
api_key = os.getenv("TAVILY_API_KEY")
|
| 54 |
if not api_key:
|
| 55 |
return "Tavily API key not found."
|
|
|
|
| 73 |
"""Reads the file attached to a question"""
|
| 74 |
question = input.get("question", "")
|
| 75 |
file_url = input.get("file", "")
|
| 76 |
+
print("file_url: ", file_url)
|
| 77 |
|
| 78 |
if not file_url:
|
| 79 |
return "No file provided."
|