From bd1cfbad01f25a04165eec630bc54ddce1a3fb1e Mon Sep 17 00:00:00 2001 From: Joshua Smith Date: Tue, 18 Mar 2025 15:44:03 -0400 Subject: [PATCH] two more HR scenarios added --- adding-goals-and-tools.md | 3 +- tools/__init__.py | 3 ++ tools/goal_registry.py | 55 ++++++++++++++++++++++++++++++++++ tools/hr/checkpaybankstatus.py | 15 ++++++++++ tools/tool_registry.py | 13 ++++++++ 5 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 tools/hr/checkpaybankstatus.py diff --git a/adding-goals-and-tools.md b/adding-goals-and-tools.md index db5878b..c1630b5 100644 --- a/adding-goals-and-tools.md +++ b/adding-goals-and-tools.md @@ -5,7 +5,7 @@ It may be helpful to review the [architecture](./architecture.md) for a guide an ### Adding a Goal 1. Open [/tools/goal_registry.py](tools/goal_registry.py) - this file contains descriptions of goals and the tools used to achieve them -2. Pick a name for your goal! +2. Pick a name for your goal! (such as "goal_hr_schedule_pto") 3. Fill out the required elements: - `id`: needs to be the same as the name - `agent_name`: user-facing name for the agent/chatbot @@ -61,6 +61,7 @@ if tool_name == "CurrentPTO": return current_pto ``` +TODO probably update this it's out of date :point_down: ### Configuring the Starting Goal The agent can be configured to pursue different goals using the `AGENT_GOAL` environment variable in your `.env` file. diff --git a/tools/__init__.py b/tools/__init__.py index c27b8c2..41f85c4 100644 --- a/tools/__init__.py +++ b/tools/__init__.py @@ -11,6 +11,7 @@ from .transfer_control import transfer_control from .hr.current_pto import current_pto from .hr.book_pto import book_pto from .hr.future_pto_calc import future_pto_calc +from .hr.checkpaybankstatus import checkpaybankstatus from .give_hint import give_hint from .guess_location import guess_location @@ -41,6 +42,8 @@ def get_handler(tool_name: str): return book_pto if tool_name == "FuturePTOCalc": return future_pto_calc + if tool_name == "CheckPayBankStatus": + return checkpaybankstatus if tool_name == "GiveHint": return give_hint if tool_name == "GuessLocation": diff --git a/tools/goal_registry.py b/tools/goal_registry.py index 67b5cc0..ba60843 100644 --- a/tools/goal_registry.py +++ b/tools/goal_registry.py @@ -222,6 +222,58 @@ goal_hr_schedule_pto = AgentGoal( ), ) +# This goal uses the data/employee_pto_data.json file as dummy data. +goal_hr_check_pto = AgentGoal( + id = "goal_hr_check_pto", + category_tag="hr", + agent_name="Check PTO Amount", + agent_friendly_description="Check your available PTO.", + tools=[ + tool_registry.current_pto_tool, + tool_registry.list_agents_tool, #last tool must be list_agents to fasciliate changing back to picking an agent again at the end + ], + description="The user wants to check their paid time off (PTO) after today's date. To assist with that goal, help the user gather args for these tools in order: " + "1. CurrentPTO: Tell the user how much PTO they currently have ", + starter_prompt=starter_prompt_generic, + example_conversation_history="\n ".join( + [ + "user: I'd like to check my time off amounts at the current time", + "agent: Sure! I can help you out with that. May I have your email address?", + "user: bob.johnson@emailzzz.com", + "agent: Great! I can tell you how much PTO you currently have accrued.", + "user_confirmed_tool_run: ", + "tool_result: { 'num_hours': 400, 'num_days': 50 }", + "agent: You have 400 hours, or 50 days, of PTO available.", + ] + ), +) + +# This goal uses the data/employee_pto_data.json file as dummy data. +goal_hr_check_paycheck_bank_integration_status = AgentGoal( + id = "goal_hr_check_paycheck_bank_integration_status", + category_tag="hr", + agent_name="Check paycheck bank integration status", + agent_friendly_description="Check your available PTO.", + tools=[ + tool_registry.paycheck_bank_integration_status_check, + tool_registry.list_agents_tool, #last tool must be list_agents to fasciliate changing back to picking an agent again at the end + ], + description="The user wants to check their bank integration used to deposit their paycheck. To assist with that goal, help the user gather args for these tools in order: " + "1. CheckPayBankStatus: Tell the user the status of their paycheck bank integration ", + starter_prompt=starter_prompt_generic, + example_conversation_history="\n ".join( + [ + "user: I'd like to check paycheck bank integration", + "agent: Sure! I can help you out with that. May I have your email address?", + "user: bob.johnson@emailzzz.com", + "agent: Great! I can tell you what the status is for your paycheck bank integration.", + "user_confirmed_tool_run: ", + "tool_result: { 'status': connected }", + "agent: Your paycheck bank deposit integration is properly connected.", + ] + ), +) + #Add the goals to a list for more generic processing, like listing available agents goal_list: List[AgentGoal] = [] goal_list.append(goal_choose_agent_type) @@ -229,3 +281,6 @@ goal_list.append(goal_pirate_treasure) goal_list.append(goal_event_flight_invoice) goal_list.append(goal_match_train_invoice) goal_list.append(goal_hr_schedule_pto) +goal_list.append(goal_hr_check_pto) +goal_list.append(goal_hr_check_paycheck_bank_integration_status) + diff --git a/tools/hr/checkpaybankstatus.py b/tools/hr/checkpaybankstatus.py new file mode 100644 index 0000000..0f98e71 --- /dev/null +++ b/tools/hr/checkpaybankstatus.py @@ -0,0 +1,15 @@ +from pathlib import Path +import json + + +def checkpaybankstatus(args: dict) -> dict: + + email = args.get("email") + + if email == "grinch@grinch.com": + print("THE GRINCH IS FOUND!") + return {"status": "no money for the grinch"} + + # could do logic here or look up data but for now everyone but the grinch is getting paid + return_msg = "connected" + return {"status": return_msg} \ No newline at end of file diff --git a/tools/tool_registry.py b/tools/tool_registry.py index 74ecd1a..79a4225 100644 --- a/tools/tool_registry.py +++ b/tools/tool_registry.py @@ -239,4 +239,17 @@ book_pto_tool = ToolDefinition( description="Indication of user's desire to book PTO", ), ], +) + +paycheck_bank_integration_status_check = ToolDefinition( + name="CheckPayBankStatus", + description="Check status of Bank Integration for Paychecks. " + "Returns the status of the bank integration, connected or disconnected. ", + arguments=[ + ToolArgument( + name="email", + type="string", + description="email address of user", + ), + ], ) \ No newline at end of file