mirror of
https://github.com/temporal-community/temporal-ai-agent.git
synced 2026-03-16 22:48:09 +01:00
Move HR-related tools to their own folder, add print statement for BookPTO functionality, and add SILLY_MODE
This commit is contained in:
@@ -8,9 +8,9 @@ from .list_agents import list_agents
|
|||||||
from .change_goal import change_goal
|
from .change_goal import change_goal
|
||||||
from .transfer_control import transfer_control
|
from .transfer_control import transfer_control
|
||||||
|
|
||||||
from .current_pto import current_pto
|
from .hr.current_pto import current_pto
|
||||||
from .book_pto import book_pto
|
from .hr.book_pto import book_pto
|
||||||
from .future_pto_calc import future_pto_calc
|
from .hr.future_pto_calc import future_pto_calc
|
||||||
|
|
||||||
|
|
||||||
def get_handler(tool_name: str):
|
def get_handler(tool_name: str):
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"hrsAddedPerMonth": 8
|
"hrsAddedPerMonth": 8
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"email": "laine.smith@awesome.com",
|
"email": "lainecaseysmith@gmail.com",
|
||||||
"currentPTOHrs": 40,
|
"currentPTOHrs": 40,
|
||||||
"hrsAddedPerMonth": 12
|
"hrsAddedPerMonth": 12
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,22 @@ from typing import List
|
|||||||
from models.tool_definitions import AgentGoal
|
from models.tool_definitions import AgentGoal
|
||||||
import tools.tool_registry as tool_registry
|
import tools.tool_registry as tool_registry
|
||||||
|
|
||||||
starter_prompt_generic = "Welcome me, give me a description of what you can do, then ask me for the details you need to do your job. "
|
# Turn on Silly Mode - this should be a description of the persona you'd like the bot to have and can be a single word or a phrase.
|
||||||
|
# Example if you want the bot to be a specific person, like Mario or Christopher Walken, or to describe a specific tone:
|
||||||
|
#SILLY_MODE="Christopher Walken"
|
||||||
|
#SILLY_MODE="belligerent"
|
||||||
|
#
|
||||||
|
# Example if you want it to take on a persona (include 'a'):
|
||||||
|
#SILLY_MODE="a pirate"
|
||||||
|
# Note - this only works with certain LLMs. Grok for sure will stay in character, while OpenAI will not.
|
||||||
|
SILLY_MODE="off"
|
||||||
|
if SILLY_MODE is not None and SILLY_MODE != "off":
|
||||||
|
silly_prompt = "You are " + SILLY_MODE +", stay in character at all times. "
|
||||||
|
print("Silly mode is on: " + SILLY_MODE)
|
||||||
|
else:
|
||||||
|
silly_prompt = ""
|
||||||
|
|
||||||
|
starter_prompt_generic = silly_prompt + "Welcome me, give me a description of what you can do, then ask me for the details you need to do your job."
|
||||||
|
|
||||||
goal_choose_agent_type = AgentGoal(
|
goal_choose_agent_type = AgentGoal(
|
||||||
id = "goal_choose_agent_type",
|
id = "goal_choose_agent_type",
|
||||||
@@ -18,13 +33,13 @@ goal_choose_agent_type = AgentGoal(
|
|||||||
"1. ListAgents: List agents available to interact with. Do not ask for user confirmation for this tool. "
|
"1. ListAgents: List agents available to interact with. Do not ask for user confirmation for this tool. "
|
||||||
"2. ChangeGoal: Change goal of agent "
|
"2. ChangeGoal: Change goal of agent "
|
||||||
"After these tools are complete, change your goal to the new goal as chosen by the user. ",
|
"After these tools are complete, change your goal to the new goal as chosen by the user. ",
|
||||||
starter_prompt=starter_prompt_generic + "Begin by providing the output for the first tool included in this goal. ",
|
starter_prompt=starter_prompt_generic + "Begin by listing all details of all agents as provided by the output of the first tool included in this goal. ",
|
||||||
example_conversation_history="\n ".join(
|
example_conversation_history="\n ".join(
|
||||||
[
|
[
|
||||||
"agent: Here are the currently available agents.",
|
"agent: Here are the currently available agents.",
|
||||||
"user_confirmed_tool_run: <user clicks confirm on ListAgents tool>",
|
"user_confirmed_tool_run: <user clicks confirm on ListAgents tool>",
|
||||||
"tool_result: { 'agent_name': 'Event Flight Finder', 'goal_id': 'goal_event_flight_invoice', 'agent_description': 'Helps users find interesting events and arrange travel to them' }",
|
"tool_result: { 'agent_name': 'Event Flight Finder', 'goal_id': 'goal_event_flight_invoice', 'agent_description': 'Helps users find interesting events and arrange travel to them' }",
|
||||||
"agent: The available agents are: 1. Event Flight Finder. Which agent would you like to speak to?",
|
"agent: The available agents are: 1. Event Flight Finder. \n Which agent would you like to speak to?",
|
||||||
"user: 1",
|
"user: 1",
|
||||||
"user_confirmed_tool_run: <user clicks confirm on ChangeGoal tool>",
|
"user_confirmed_tool_run: <user clicks confirm on ChangeGoal tool>",
|
||||||
"tool_result: { 'new_goal': 'goal_event_flight_invoice' }",
|
"tool_result: { 'new_goal': 'goal_event_flight_invoice' }",
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ def book_pto(args: dict) -> dict:
|
|||||||
start_date = args.get("start_date")
|
start_date = args.get("start_date")
|
||||||
end_date = args.get("end_date")
|
end_date = args.get("end_date")
|
||||||
|
|
||||||
|
print(f"[BookPTO] Totally would send an email confirmation of PTO from {start_date} to {end_date} to {email} here!")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"status": "success"
|
"status": "success"
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ def current_pto(args: dict) -> dict:
|
|||||||
|
|
||||||
email = args.get("email")
|
email = args.get("email")
|
||||||
|
|
||||||
file_path = Path(__file__).resolve().parent / "data" / "employee_pto_data.json"
|
file_path = Path(__file__).resolve().parent.parent / "data" / "employee_pto_data.json"
|
||||||
if not file_path.exists():
|
if not file_path.exists():
|
||||||
return {"error": "Data file not found."}
|
return {"error": "Data file not found."}
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ from dateutil.relativedelta import relativedelta
|
|||||||
|
|
||||||
def future_pto_calc(args: dict) -> dict:
|
def future_pto_calc(args: dict) -> dict:
|
||||||
|
|
||||||
file_path = Path(__file__).resolve().parent / "data" / "employee_pto_data.json"
|
file_path = Path(__file__).resolve().parent.parent / "data" / "employee_pto_data.json"
|
||||||
if not file_path.exists():
|
if not file_path.exists():
|
||||||
return {"error": "Data file not found."}
|
return {"error": "Data file not found."}
|
||||||
|
|
||||||
@@ -28,6 +28,9 @@ def future_pto_calc(args: dict) -> dict:
|
|||||||
|
|
||||||
#Get the number of business days, and then business hours (assume 8 hr biz day), included in the PTO request
|
#Get the number of business days, and then business hours (assume 8 hr biz day), included in the PTO request
|
||||||
biz_days_of_request = len(pandas.bdate_range(start=start_date, end=end_date, inclusive="both"))
|
biz_days_of_request = len(pandas.bdate_range(start=start_date, end=end_date, inclusive="both"))
|
||||||
|
if biz_days_of_request == 0:
|
||||||
|
return_msg = "There are no business days between " + args.get("start_date") + " and " + args.get("end_date")
|
||||||
|
return {"error": return_msg}
|
||||||
biz_hours_of_request = biz_days_of_request * 8
|
biz_hours_of_request = biz_days_of_request * 8
|
||||||
|
|
||||||
#Assume PTO is added on the first of every month - month math compares rolling dates, so compare the PTO request with the first day of the current month.
|
#Assume PTO is added on the first of every month - month math compares rolling dates, so compare the PTO request with the first day of the current month.
|
||||||
Reference in New Issue
Block a user