Skip to content

Commit

Permalink
Ensure decriptions appear each on one line. Fix web_surfer's desc (#5390
Browse files Browse the repository at this point in the history
)

Some agent descriptions were split over multiple lines in the M1
orchestrator. This PR ensures that each description appears on one, and
only one, line. This makes it easier for smaller models to understand.
  • Loading branch information
afourney authored Feb 6, 2025
1 parent d86540e commit ac74305
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import logging
import re
from typing import Any, Dict, List, Mapping

from autogen_core import AgentId, CancellationToken, DefaultTopicId, MessageContext, event, rpc
Expand Down Expand Up @@ -80,14 +81,12 @@ def __init__(
self._plan = ""
self._n_rounds = 0
self._n_stalls = 0
self._team_description = "\n".join(
[
f"{topic_type}: {description}".strip()
for topic_type, description in zip(
self._participant_topic_types, self._participant_descriptions, strict=True
)
]
)

# Produce a team description. Each agent sould appear on a single line.
self._team_description = ""
for topic_type, description in zip(self._participant_topic_types, self._participant_descriptions, strict=True):
self._team_description += re.sub(r"\s+", " ", f"{topic_type}: {description}").strip() + "\n"
self._team_description = self._team_description.strip()

def _get_task_ledger_facts_prompt(self, task: str) -> str:
return ORCHESTRATOR_TASK_LEDGER_FACTS_PROMPT.format(task=task)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ async def main() -> None:

DEFAULT_DESCRIPTION = """
A helpful assistant with access to a web browser.
Ask them to perform web searches, open pages, and interact with content (e.g., clicking links, scrolling the viewport, etc., filling in form fields, etc.).
Ask them to perform web searches, open pages, and interact with content (e.g., clicking links, scrolling the viewport, filling in form fields, etc.).
It can also summarize the entire page, or answer questions based on the content of the page.
It can also be asked to sleep and wait for pages to load, in cases where the pages seem to be taking a while to load.
It can also be asked to sleep and wait for pages to load, in cases where the page seems not yet fully loaded.
"""
DEFAULT_START_PAGE = "https://www.bing.com/"

Expand Down

0 comments on commit ac74305

Please sign in to comment.