Skip to content

Commit

Permalink
polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
davorrunje committed Sep 24, 2024
1 parent b396c60 commit 466f63a
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 17 deletions.
5 changes: 4 additions & 1 deletion docs/docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ search:
- [User guide](user-guide/index.md)
- [Runtimes](user-guide/runtime/index.md)
- [AutoGen](user-guide/runtime/autogen/index.md)
- Tools
- Agents
- [WebSurfer](user-guide/runtime/autogen/websurfer.md)
- [User interaction](user-guide/runtime/autogen/interactions.md)
- [CrewAI](user-guide/runtime/crewai/basics.md)
Expand Down Expand Up @@ -92,6 +92,9 @@ search:
- autogen
- [AutoGenWorkflows](api/fastagency/runtime/autogen/AutoGenWorkflows.md)
- [IOStreamAdapter](api/fastagency/runtime/autogen/IOStreamAdapter.md)
- agent
- websurfer
- [WebSurferAgent](api/fastagency/runtime/autogen/agent/websurfer/WebSurferAgent.md)
- base
- [AutoGenWorkflows](api/fastagency/runtime/autogen/base/AutoGenWorkflows.md)
- [CurrentMessage](api/fastagency/runtime/autogen/base/CurrentMessage.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
# 0.5 - API
# 2 - Release
# 3 - Contributing
# 5 - Template Page
# 10 - Default
search:
boost: 0.5
---

::: fastagency.runtime.autogen.agent.websurfer.WebSurferAgent
2 changes: 1 addition & 1 deletion docs/docs/navigation_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ search:
- [User guide](user-guide/index.md)
- [Runtimes](user-guide/runtime/index.md)
- [AutoGen](user-guide/runtime/autogen/index.md)
- Tools
- Agents
- [WebSurfer](user-guide/runtime/autogen/websurfer.md)
- [User interaction](user-guide/runtime/autogen/interactions.md)
- [CrewAI](user-guide/runtime/crewai/basics.md)
Expand Down
19 changes: 4 additions & 15 deletions docs/docs_src/user_guide/runtime/autogen/websurfer.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import os

from autogen import UserProxyAgent
from autogen.agentchat import ConversableAgent

from fastagency import UI, FastAgency
from fastagency.runtime.autogen import AutoGenWorkflows
from fastagency.runtime.autogen.tools import WebSurferTool
from fastagency.runtime.autogen.agent.websurfer import WebSurferAgent
from fastagency.ui.console import ConsoleUI

llm_config = {
Expand All @@ -31,26 +30,16 @@ def websurfer_workflow(
llm_config=llm_config,
human_input_mode="NEVER",
)
assistant_agent = ConversableAgent(
web_surfer = WebSurferAgent(
name="Assistant_Agent",
system_message="You are a useful assistant",
llm_config=llm_config,
human_input_mode="NEVER",
)

web_surfer = WebSurferTool(
name_prefix="Web_Surfer",
llm_config=llm_config,
summarizer_llm_config=llm_config,
)

web_surfer.register(
caller=assistant_agent,
human_input_mode="NEVER",
executor=user_agent,
)

chat_result = user_agent.initiate_chat(
assistant_agent,
web_surfer,
message=initial_message,
summary_method="reflection_with_llm",
max_turns=3,
Expand Down
Empty file.
42 changes: 42 additions & 0 deletions fastagency/runtime/autogen/agent/websurfer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from typing import Any, Union

from autogen import AssistantAgent, ConversableAgent

from ..tools import WebSurferTool


class WebSurferAgent(AssistantAgent): # type: ignore[misc]
def __init__(
self,
*args: Any,
name: str,
llm_config: dict[str, Any],
summarizer_llm_config: dict[str, Any],
executor: Union[ConversableAgent, list[ConversableAgent]],
system_message: str = "You are a web surfer",
**kwargs: Any,
):
"""Initialize the WebSurferAgent.
Args:
*args (Any): The positional arguments.
name (str): The name of the agent.
llm_config (dict[str, Any]): The LLM configuration.
summarizer_llm_config (dict[str, Any]): The summarizer LLM configuration.
executor (Union[ConversableAgent, list[ConversableAgent]]): The executor agent(s).
system_message (str): The system message.
**kwargs (Any): The keyword arguments.
"""
super().__init__(
*args,
name=name,
system_message=system_message,
llm_config=llm_config,
**kwargs,
)
self.web_surfer_tool = WebSurferTool(
name_prefix="Web_Surfer",
llm_config=llm_config,
summarizer_llm_config=summarizer_llm_config,
)
self.web_surfer_tool.register(caller=self, executor=executor)

0 comments on commit 466f63a

Please sign in to comment.