Skip to content

Commit

Permalink
Support running a demo of Open DeepResearch (#806)
Browse files Browse the repository at this point in the history
  • Loading branch information
albertvillanova authored Feb 26, 2025
1 parent 2b8ecd0 commit d24a207
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
11 changes: 11 additions & 0 deletions examples/open_deep_research/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from run import create_agent

from smolagents.gradio_ui import GradioUI


agent = create_agent()

demo = GradioUI(agent)

if __name__ == "__main__":
demo.launch()
20 changes: 12 additions & 8 deletions examples/open_deep_research/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,17 @@ def parse_args():
os.makedirs(f"./{BROWSER_CONFIG['downloads_folder']}", exist_ok=True)


def main():
args = parse_args()
def create_agent(model_id="o1"):
text_limit = 100000

model = LiteLLMModel(
args.model_id,
model_id,
custom_role_conversions=custom_role_conversions,
max_completion_tokens=8192,
reasoning_effort="high",
)
document_inspection_tool = TextInspectorTool(model, text_limit)

browser = SimpleTextBrowser(**BROWSER_CONFIG)

WEB_TOOLS = [
GoogleSearchTool(provider="serper"),
VisitTool(browser),
Expand All @@ -107,7 +104,6 @@ def main():
ArchiveSearchTool(browser),
TextInspectorTool(model, text_limit),
]

text_webbrowser_agent = ToolCallingAgent(
model=model,
tools=WEB_TOOLS,
Expand All @@ -129,15 +125,23 @@ def main():

manager_agent = CodeAgent(
model=model,
tools=[visualizer, document_inspection_tool],
tools=[visualizer, TextInspectorTool(model, text_limit)],
max_steps=12,
verbosity_level=2,
additional_authorized_imports=AUTHORIZED_IMPORTS,
planning_interval=4,
managed_agents=[text_webbrowser_agent],
)

answer = manager_agent.run(args.question)
return manager_agent


def main():
args = parse_args()

agent = create_agent(model_id=args.model_id)

answer = agent.run(args.question)

print(f"Got this answer: {answer}")

Expand Down

0 comments on commit d24a207

Please sign in to comment.