Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magentic One Websurfer #192

Open
wants to merge 4 commits into
base: magentic-one
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
281 changes: 281 additions & 0 deletions autogen/agentchat/contrib/magentic_one/web_tool_definitions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,281 @@
TOOL_VISIT_URL = {
"type": "function",
"function": {
"name": "visit_url",
Copy link
Collaborator

@AgentGenie AgentGenie Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please give a magentic one specific name. General name may lead to overwriting other tools.
Also applies to following tool names.

"description": "Navigate directly to a provided URL using the browser's address bar. Prefer this tool over other navigation techniques in cases where the user provides a fully-qualified URL (e.g., choose it over clicking links, or inputing queries into search boxes).",
"parameters": {
"type": "object",
"properties": {
"reasoning": {
"type": "string",
"description": "A short explanation of the reasoning for calling this tool and taking this action.",
},
"url": {
"type": "string",
"description": "The URL to visit in the browser.",
},
},
"required": ["reasoning", "url"],
},
},
}

TOOL_WEB_SEARCH = {
"type": "function",
"function": {
"name": "web_search",
"description": "Performs a web search on Bing.com with the given query.",
"parameters": {
"type": "object",
"properties": {
"reasoning": {
"type": "string",
"description": "A short explanation of the reasoning for calling this tool and taking this action.",
},
"query": {
"type": "string",
"description": "The web search query to use.",
},
},
"required": ["reasoning", "query"],
},
},
}


TOOL_HISTORY_BACK = {
"type": "function",
"function": {
"name": "history_back",
"description": "Navigates back one page in the browser's history. This is equivalent to clicking the browser back button.",
"parameters": {
"type": "object",
"properties": {
"reasoning": {
"type": "string",
"description": "A short explanation of the reasoning for calling this tool and taking this action.",
},
},
"required": ["reasoning"],
},
},
}

TOOL_PAGE_UP = {
"type": "function",
"function": {
"name": "page_up",
"description": "Scrolls the entire browser viewport one page UP towards the beginning.",
"parameters": {
"type": "object",
"properties": {
"reasoning": {
"type": "string",
"description": "A short explanation of the reasoning for calling this tool and taking this action.",
},
},
"required": ["reasoning"],
},
},
}


TOOL_PAGE_DOWN = {
"type": "function",
"function": {
"name": "page_down",
"description": "Scrolls the entire browser viewport one page DOWN towards the end.",
"parameters": {
"type": "object",
"properties": {
"reasoning": {
"type": "string",
"description": "A short explanation of the reasoning for calling this tool and taking this action.",
},
},
"required": ["reasoning"],
},
},
}


TOOL_CLICK = {
"type": "function",
"function": {
"name": "click",
"description": "Clicks the mouse on the target with the given id.",
"parameters": {
"type": "object",
"properties": {
"reasoning": {
"type": "string",
"description": "A short explanation of the reasoning for calling this tool and taking this action.",
},
"target_id": {
"type": "integer",
"description": "The numeric id of the target to click.",
},
},
"required": ["reasoning", "target_id"],
},
},
}


TOOL_INPUT_TEXT = {
"type": "function",
"function": {
"name": "input_text",
"description": "Types the given text value into the specified field.",
"parameters": {
"type": "object",
"properties": {
"reasoning": {
"type": "string",
"description": "A short explanation of the reasoning for calling this tool and taking this action.",
},
"input_field_id": {
"type": "integer",
"description": "The numeric id of the input field to receive the text.",
},
"text_value": {
"type": "string",
"description": "The text to type into the input field.",
},
},
"required": ["reasoning", "input_field_id", "text_value"],
},
},
}


TOOL_SCROLL_ELEMENT_DOWN = {
"type": "function",
"function": {
"name": "scroll_element_down",
"description": "Scrolls a given html element (e.g., a div or a menu) DOWN.",
"parameters": {
"type": "object",
"properties": {
"reasoning": {
"type": "string",
"description": "A short explanation of the reasoning for calling this tool and taking this action.",
},
"target_id": {
"type": "integer",
"description": "The numeric id of the target to scroll down.",
},
},
"required": ["reasoning", "target_id"],
},
},
}


TOOL_SCROLL_ELEMENT_UP = {
"type": "function",
"function": {
"name": "scroll_element_up",
"description": "Scrolls a given html element (e.g., a div or a menu) UP.",
"parameters": {
"type": "object",
"properties": {
"reasoning": {
"type": "string",
"description": "A short explanation of the reasoning for calling this tool and taking this action.",
},
"target_id": {
"type": "integer",
"description": "The numeric id of the target to scroll UP.",
},
},
"required": ["reasoning", "target_id"],
},
},
}

TOOL_READ_PAGE_AND_ANSWER = {
"type": "function",
"function": {
"name": "answer_question",
"description": "Uses AI to answer a question about the current webpage's content.",
"parameters": {
"type": "object",
"properties": {
"reasoning": {
"type": "string",
"description": "A short explanation of the reasoning for calling this tool and taking this action.",
},
"question": {
"type": "string",
"description": "The question to answer.",
},
},
"required": ["reasoning", "question"],
},
},
}


TOOL_SUMMARIZE_PAGE = {
"type": "function",
"function": {
"name": "summarize_page",
"description": "Uses AI to summarize the entire page.",
"parameters": {
"type": "object",
"properties": {
"reasoning": {
"type": "string",
"description": "A short explanation of the reasoning for calling this tool and taking this action.",
},
},
"required": ["reasoning"],
},
},
}

TOOL_SLEEP = {
"type": "function",
"function": {
"name": "sleep",
"description": "Wait a short period of time. Call this function if the page has not yet fully loaded, or if it is determined that a small delay would increase the task's chances of success.",
"parameters": {
"type": "object",
"properties": {
"reasoning": {
"type": "string",
"description": "A short explanation of the reasoning for calling this tool and taking this action.",
},
},
"required": ["reasoning"],
},
},
}


TOOL_TYPE = {
"type": "function",
"function": {
"name": "input_text",
"description": "Types the given text value into the specified field.",
"parameters": {
"type": "object",
"properties": {
"reasoning": {
"type": "string",
"description": "A short explanation of the reasoning for calling this tool and taking this action.",
},
"input_field_id": {
"type": "integer",
"description": "The numeric id of the input field to receive the text.",
},
"text_value": {
"type": "string",
"description": "The text to type into the input field.",
},
},
"required": ["reasoning", "input_field_id", "text_value"],
},
},
}
Loading
Loading