-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from PathOnAI/tool_refactor
1) add ToolRegistry, 2) only pass tools to function calling based age…
- Loading branch information
Showing
14 changed files
with
205 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from dotenv import load_dotenv | ||
import argparse | ||
|
||
_ = load_dotenv() | ||
from litewebagent.agents.webagent import setup_function_calling_web_agent | ||
|
||
def main(args): | ||
# Use the features from command-line arguments | ||
features = args.features.split(',') if args.features else None | ||
branching_factor = args.branching_factor if args.branching_factor else None | ||
|
||
# Use the tool_names from command-line arguments | ||
tool_names = args.tool_names.split(',') if args.tool_names else ["navigation", "select_option", "upload_file"] | ||
|
||
agent = setup_function_calling_web_agent(args.starting_url, args.goal, model_name=args.model, agent_type=args.agent_type, | ||
features=features, tool_names=tool_names, branching_factor=branching_factor, log_folder=args.log_folder, | ||
storage_state=args.storage_state) | ||
|
||
response = agent.send_prompt(args.plan) | ||
print(response) | ||
print(agent.messages) | ||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(description="Run web automation tasks with different agent types.") | ||
parser.add_argument('--agent_type', type=str, default="FunctionCallingAgent", | ||
choices=["FunctionCallingAgent", "HighLevelPlanningAgent", "ContextAwarePlanningAgent"], | ||
help="Type of agent to use (default: FunctionCallingAgent)") | ||
parser.add_argument('--model', type=str, default="gpt-4o-mini", | ||
help="Model to use for the agent (default: gpt-4o-mini)") | ||
parser.add_argument('--starting_url', type=str, required=True, | ||
help="Starting URL for the web automation task") | ||
parser.add_argument('--plan', type=str, required=True, | ||
help="Plan for the web automation task") | ||
parser.add_argument('--goal', type=str, required=True, | ||
help="Goal for the web automation task") | ||
parser.add_argument('--storage_state', type=str, default="state.json", | ||
help="Storage state json file") | ||
parser.add_argument('--features', type=str, default="axtree", | ||
help="Comma-separated list of features to use (default: axtree)") | ||
parser.add_argument('--tool_names', type=str, default="navigation,select_option,upload_file", | ||
help="Comma-separated list of tool names to use (default: navigation,select_option,upload_file)") | ||
parser.add_argument('--branching_factor', type=int, default=None) | ||
parser.add_argument('--log_folder', type=str, default='log', help='Path to the log folder') | ||
args = parser.parse_args() | ||
main(args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.