Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,17 +7,15 @@ from tools.final_answer import FinalAnswerTool
|
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
-
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
def get_wikipedia_movie_summary(movie_title:str) -> str:
|
| 13 |
-
"""A tool that queries
|
| 14 |
Args:
|
| 15 |
movie_title: the English name of the movie
|
| 16 |
"""
|
| 17 |
# Wikipedia API endpoint
|
| 18 |
url = "https://en.wikipedia.org/w/api.php"
|
| 19 |
|
| 20 |
-
# Parameters for the API request
|
| 21 |
params = {
|
| 22 |
"action": "query",
|
| 23 |
"format": "json",
|
|
@@ -54,15 +52,11 @@ model = HfApiModel(
|
|
| 54 |
custom_role_conversions=None,
|
| 55 |
)
|
| 56 |
|
| 57 |
-
|
| 58 |
-
# Import tool from Hub
|
| 59 |
-
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 60 |
-
|
| 61 |
with open("prompts.yaml", 'r') as stream:
|
| 62 |
prompt_templates = yaml.safe_load(stream)
|
| 63 |
|
| 64 |
name = "Bootyful Bot"
|
| 65 |
-
|
| 66 |
- Bootyful Bot will search wikipedia for a movie name
|
| 67 |
- Bootyful Bot will read the page and tell whether the movie was inspired by factual events or not
|
| 68 |
- In case it is, tell user about the events
|
|
@@ -73,14 +67,13 @@ task = """
|
|
| 73 |
|
| 74 |
agent = CodeAgent(
|
| 75 |
model=model,
|
| 76 |
-
tools=[
|
| 77 |
max_steps=6,
|
| 78 |
verbosity_level=1,
|
| 79 |
grammar=None,
|
| 80 |
planning_interval=None,
|
| 81 |
name=name,
|
| 82 |
-
description=
|
| 83 |
-
task=task,
|
| 84 |
prompt_templates=prompt_templates
|
| 85 |
)
|
| 86 |
|
|
|
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
|
|
|
| 10 |
@tool
|
| 11 |
def get_wikipedia_movie_summary(movie_title:str) -> str:
|
| 12 |
+
"""A tool that queries Wikipedia for a movie title in English and returns a page's introduction.
|
| 13 |
Args:
|
| 14 |
movie_title: the English name of the movie
|
| 15 |
"""
|
| 16 |
# Wikipedia API endpoint
|
| 17 |
url = "https://en.wikipedia.org/w/api.php"
|
| 18 |
|
|
|
|
| 19 |
params = {
|
| 20 |
"action": "query",
|
| 21 |
"format": "json",
|
|
|
|
| 52 |
custom_role_conversions=None,
|
| 53 |
)
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
with open("prompts.yaml", 'r') as stream:
|
| 56 |
prompt_templates = yaml.safe_load(stream)
|
| 57 |
|
| 58 |
name = "Bootyful Bot"
|
| 59 |
+
task_description = """
|
| 60 |
- Bootyful Bot will search wikipedia for a movie name
|
| 61 |
- Bootyful Bot will read the page and tell whether the movie was inspired by factual events or not
|
| 62 |
- In case it is, tell user about the events
|
|
|
|
| 67 |
|
| 68 |
agent = CodeAgent(
|
| 69 |
model=model,
|
| 70 |
+
tools=[final_answer, get_wikipedia_movie_summary], ## add your tools here (don't remove final answer)
|
| 71 |
max_steps=6,
|
| 72 |
verbosity_level=1,
|
| 73 |
grammar=None,
|
| 74 |
planning_interval=None,
|
| 75 |
name=name,
|
| 76 |
+
description=task_description,
|
|
|
|
| 77 |
prompt_templates=prompt_templates
|
| 78 |
)
|
| 79 |
|