Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,17 +14,16 @@ with open('movies.json') as f:
|
|
| 14 |
|
| 15 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 16 |
@tool
|
| 17 |
-
def movie_info(
|
| 18 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 19 |
"""A tool that does nothing yet
|
| 20 |
Args:
|
| 21 |
-
|
| 22 |
"""
|
| 23 |
-
|
| 24 |
-
|
| 25 |
try:
|
| 26 |
# read and create an object of information about a movie requested.
|
| 27 |
-
filtered_movies = [movie for movie in movies if movie["Title"].lower() ==
|
| 28 |
if len(filtered_movies) > 0:
|
| 29 |
output = ""
|
| 30 |
for movie in filtered_movies:
|
|
@@ -37,7 +36,7 @@ def movie_info(arg1:str)-> str: #it's import to specify the return type
|
|
| 37 |
output += "\n"
|
| 38 |
else:
|
| 39 |
output = "No information on that movie found!"
|
| 40 |
-
print (
|
| 41 |
return output
|
| 42 |
except Exception as e:
|
| 43 |
return f"Error movies json and formatting."
|
|
@@ -75,7 +74,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 75 |
|
| 76 |
agent = CodeAgent(
|
| 77 |
model=model,
|
| 78 |
-
tools=[final_answer,
|
| 79 |
max_steps=6,
|
| 80 |
verbosity_level=1,
|
| 81 |
grammar=None,
|
|
|
|
| 14 |
|
| 15 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 16 |
@tool
|
| 17 |
+
def movie_info(movie_name:str)-> str: #it's import to specify the return type
|
| 18 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 19 |
"""A tool that does nothing yet
|
| 20 |
Args:
|
| 21 |
+
movie_name: name of the movie
|
| 22 |
"""
|
| 23 |
+
|
|
|
|
| 24 |
try:
|
| 25 |
# read and create an object of information about a movie requested.
|
| 26 |
+
filtered_movies = [movie for movie in movies if movie["Title"].lower() == movie_name.lower()]
|
| 27 |
if len(filtered_movies) > 0:
|
| 28 |
output = ""
|
| 29 |
for movie in filtered_movies:
|
|
|
|
| 36 |
output += "\n"
|
| 37 |
else:
|
| 38 |
output = "No information on that movie found!"
|
| 39 |
+
print (output)
|
| 40 |
return output
|
| 41 |
except Exception as e:
|
| 42 |
return f"Error movies json and formatting."
|
|
|
|
| 74 |
|
| 75 |
agent = CodeAgent(
|
| 76 |
model=model,
|
| 77 |
+
tools=[final_answer, ], ## add your tools here (don't remove final answer)
|
| 78 |
max_steps=6,
|
| 79 |
verbosity_level=1,
|
| 80 |
grammar=None,
|