Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,6 +43,21 @@ def mutante_unicorn(animal_name:str) -> str: #it's import to specify the return
|
|
| 43 |
except Exception as e:
|
| 44 |
return f"Error creating a mutant unicorn for '{animal_name}': {str(e)}"
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
#image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 47 |
|
| 48 |
final_answer = FinalAnswerTool()
|
|
@@ -62,7 +77,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 62 |
|
| 63 |
agent = CodeAgent(
|
| 64 |
model=model,
|
| 65 |
-
tools=[final_answer, mutante_unicorn], # add your tools here (don't remove final answer)
|
| 66 |
max_steps=6,
|
| 67 |
verbosity_level=1,
|
| 68 |
grammar=None,
|
|
|
|
| 43 |
except Exception as e:
|
| 44 |
return f"Error creating a mutant unicorn for '{animal_name}': {str(e)}"
|
| 45 |
|
| 46 |
+
def describe_animal(animal_name:str) -> str:
|
| 47 |
+
"""Look up for the name of the animal inwikipedia using websearch tool, and then provide a 300 characters description about that animal
|
| 48 |
+
Args:
|
| 49 |
+
animal_name: The name of the animal to look up for in wikipedia
|
| 50 |
+
"""
|
| 51 |
+
#search_tool = DuckDuckGoSearchTool()
|
| 52 |
+
# Use DuckDuckGoSearchTool to search for the wikipedia url of the person and then visit the url
|
| 53 |
+
query = f"{animal_name} wikipedia"
|
| 54 |
+
#wikipedia_url = search_tool(query)
|
| 55 |
+
# Use the wikipedia url to get the person's description, location, and interesting facts
|
| 56 |
+
wikipedia_results = DuckDuckGoSearchTool(query)
|
| 57 |
+
#return f"Detailes description: {wikipedia_results['description']}, Location: {wikipedia_results['location']}, Interesting facts: {wikipedia_results['interesting facts']}"
|
| 58 |
+
return wikipedia_results
|
| 59 |
+
|
| 60 |
+
|
| 61 |
#image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 62 |
|
| 63 |
final_answer = FinalAnswerTool()
|
|
|
|
| 77 |
|
| 78 |
agent = CodeAgent(
|
| 79 |
model=model,
|
| 80 |
+
tools=[final_answer, mutante_unicorn, describe_animal], # add your tools here (don't remove final answer)
|
| 81 |
max_steps=6,
|
| 82 |
verbosity_level=1,
|
| 83 |
grammar=None,
|