Update app.py
Browse files
app.py
CHANGED
|
@@ -59,6 +59,7 @@ def extract_iocs(text: str) -> dict:
|
|
| 59 |
return {key: value for key, value in iocs.items() if value}
|
| 60 |
|
| 61 |
|
|
|
|
| 62 |
@tool
|
| 63 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 64 |
"""A tool that fetches the current local time in a specified timezone.
|
|
@@ -87,13 +88,16 @@ custom_role_conversions=None,
|
|
| 87 |
# Import tool from Hub
|
| 88 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 89 |
|
|
|
|
|
|
|
|
|
|
| 90 |
with open("prompts.yaml", 'r') as stream:
|
| 91 |
prompt_templates = yaml.safe_load(stream)
|
| 92 |
|
| 93 |
agent = CodeAgent(
|
| 94 |
model=model,
|
| 95 |
tools=[threat_lookup, check_ip_reputation, extract_iocs, get_current_time_in_timezone,
|
| 96 |
-
|
| 97 |
max_steps=6,
|
| 98 |
verbosity_level=1,
|
| 99 |
grammar=None,
|
|
|
|
| 59 |
return {key: value for key, value in iocs.items() if value}
|
| 60 |
|
| 61 |
|
| 62 |
+
# Other tools from the example template
|
| 63 |
@tool
|
| 64 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 65 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
| 88 |
# Import tool from Hub
|
| 89 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 90 |
|
| 91 |
+
# DuckDuckGoSearch tool
|
| 92 |
+
search_tool = DuckDuckGoSearchTool()
|
| 93 |
+
|
| 94 |
with open("prompts.yaml", 'r') as stream:
|
| 95 |
prompt_templates = yaml.safe_load(stream)
|
| 96 |
|
| 97 |
agent = CodeAgent(
|
| 98 |
model=model,
|
| 99 |
tools=[threat_lookup, check_ip_reputation, extract_iocs, get_current_time_in_timezone,
|
| 100 |
+
search_tool, image_generation_tool, final_answer], ## add your tools here (don't remove final answer)
|
| 101 |
max_steps=6,
|
| 102 |
verbosity_level=1,
|
| 103 |
grammar=None,
|