feat: personalize agent interaction with customer name
- Update prompt to use customer name for personalized greetings - Pass state to tools via agent execution - schedule_appointment now gets customer_id from state if not provided
This commit is contained in:
@@ -228,7 +228,7 @@ class Agent:
|
||||
tool_results: list[BaseMessage] = []
|
||||
|
||||
for tool_call in last_message.tool_calls:
|
||||
result = self._execute_tool(tool_call)
|
||||
result = self._execute_tool(tool_call, state)
|
||||
tool_results.append(result)
|
||||
|
||||
if self._post_tool_hook:
|
||||
@@ -236,7 +236,7 @@ class Agent:
|
||||
|
||||
return {"messages": state["messages"] + tool_results}
|
||||
|
||||
def _execute_tool(self, tool_call: dict) -> ToolMessage:
|
||||
def _execute_tool(self, tool_call: dict, state: MessagesState) -> ToolMessage:
|
||||
"""
|
||||
Ejecuta una herramienta individual con manejo de errores.
|
||||
"""
|
||||
@@ -253,6 +253,7 @@ class Agent:
|
||||
|
||||
try:
|
||||
tool = self._tools_by_name[tool_name]
|
||||
tool_args["state"] = state
|
||||
observation = tool.invoke(tool_args)
|
||||
|
||||
return ToolMessage(
|
||||
|
||||
Reference in New Issue
Block a user