Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import requests
|
|
4 |
import pytz
|
5 |
import yaml
|
6 |
from tools.final_answer import FinalAnswerTool
|
|
|
7 |
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
@@ -18,6 +19,29 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
18 |
"""
|
19 |
return "What magic will you build ?"
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
@tool
|
22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
23 |
"""A tool that fetches the current local time in a specified timezone.
|
@@ -55,7 +79,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
55 |
|
56 |
agent = CodeAgent(
|
57 |
model=model,
|
58 |
-
tools=[final_answer], ## add your tools here (don't remove final answer)
|
59 |
max_steps=6,
|
60 |
verbosity_level=1,
|
61 |
grammar=None,
|
|
|
4 |
import pytz
|
5 |
import yaml
|
6 |
from tools.final_answer import FinalAnswerTool
|
7 |
+
from langchain_community.document_loaders import ArxivLoader
|
8 |
|
9 |
from Gradio_UI import GradioUI
|
10 |
|
|
|
19 |
"""
|
20 |
return "What magic will you build ?"
|
21 |
|
22 |
+
|
23 |
+
@tool
|
24 |
+
def arxiv_fetch_paper_tool(arxiv_id : str) -> str:
|
25 |
+
""" An Tool that would fetch research papers from ArXiV collection and parse it and return the PDF text"""
|
26 |
+
loader = ArxivLoader(query=arxiv_id)
|
27 |
+
docs = loader.load()
|
28 |
+
title = docs[0].metadata.get("title", "this paper")
|
29 |
+
return "\n".join([doc.page_content for doc in docs]), title
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
# @tool
|
35 |
+
# def write_python_code(coding_problem:str) -> str:
|
36 |
+
# """A tool that would code to solve user request in Python on a jupyter notebook environment
|
37 |
+
# Args:
|
38 |
+
# coding_problem: the problem statement needed to be solved by writing python code.
|
39 |
+
# Returns the code that has to be replaced in the notebook cell.
|
40 |
+
# """
|
41 |
+
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
@tool
|
46 |
def get_current_time_in_timezone(timezone: str) -> str:
|
47 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
79 |
|
80 |
agent = CodeAgent(
|
81 |
model=model,
|
82 |
+
tools=[final_answer,arxiv_fetch_paper_tool], ## add your tools here (don't remove final answer)
|
83 |
max_steps=6,
|
84 |
verbosity_level=1,
|
85 |
grammar=None,
|