Skip to content
Open
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
6 changes: 5 additions & 1 deletion ex_app/lib/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,15 @@ async def call_model(
## if the next step is a tool call
if state_snapshot.next == (CONFIRM_TOOLS_NODE, ):
if task['input']['confirmation'] == 0:
if task['input']['input'] != '':
rejection_message = f"The user denied the tool call. The user said: '{task['input']['input']}'. Continue assisting and adapt the tool call to follow the user's instructions."
else:
rejection_message = "The user denied the tool call. Continue assisting but do not use the tool call for now."
new_input = {
"messages": [
ToolMessage(
tool_call_id=tool_call["id"],
content=f"API call denied by user. Reasoning: '{task['input']['input']}'. Continue assisting, accounting for the user's input. If the user gave additional instructrions, adapt the tool call.",
content=rejection_message,
)
for tool_call in state_snapshot.values['messages'][-1].tool_calls
]
Expand Down
Loading