mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-16 18:25:17 +02:00
Make post process agent disable-able
This commit is contained in:
parent
645d0c27f9
commit
3fe8677d21
2 changed files with 18 additions and 0 deletions
|
|
@ -13,6 +13,7 @@ from .helpers.transfer import create_transfer_function_to_agent, create_transfer
|
||||||
from .helpers.state import add_recent_messages_to_history, construct_state_from_response, reset_current_turn, reset_current_turn_agent_history
|
from .helpers.state import add_recent_messages_to_history, construct_state_from_response, reset_current_turn, reset_current_turn_agent_history
|
||||||
from .helpers.instructions import add_transfer_instructions_to_child_agents, add_transfer_instructions_to_parent_agents, add_rag_instructions_to_agent, add_error_escalation_instructions, get_universal_system_message, add_universal_system_message_to_agent
|
from .helpers.instructions import add_transfer_instructions_to_child_agents, add_transfer_instructions_to_parent_agents, add_rag_instructions_to_agent, add_error_escalation_instructions, get_universal_system_message, add_universal_system_message_to_agent
|
||||||
from .helpers.control import get_latest_assistant_msg, get_latest_non_assistant_messages, get_last_agent_name
|
from .helpers.control import get_latest_assistant_msg, get_latest_non_assistant_messages, get_last_agent_name
|
||||||
|
from src.swarm.types import Response
|
||||||
|
|
||||||
from src.utils.common import common_logger
|
from src.utils.common import common_logger
|
||||||
logger = common_logger
|
logger = common_logger
|
||||||
|
|
@ -474,6 +475,21 @@ def run_turn(messages, start_agent_name, agent_configs, tool_configs, available_
|
||||||
turn_messages.extend(response.messages)
|
turn_messages.extend(response.messages)
|
||||||
logger.info("Response post-processed")
|
logger.info("Response post-processed")
|
||||||
|
|
||||||
|
else:
|
||||||
|
logger.info("No post-processing agent found. Duplicating last response and setting to external.")
|
||||||
|
duplicate_msg = deepcopy(turn_messages[-1])
|
||||||
|
duplicate_msg["response_type"] = "external"
|
||||||
|
duplicate_msg["sender"] = duplicate_msg["sender"] + ' >> External'
|
||||||
|
response = Response(
|
||||||
|
messages=[duplicate_msg],
|
||||||
|
tokens_used=tokens_used,
|
||||||
|
agent=last_agent,
|
||||||
|
error_msg=''
|
||||||
|
)
|
||||||
|
response.messages = order_messages(response.messages)
|
||||||
|
turn_messages.extend(response.messages)
|
||||||
|
logger.info("Last response duplicated and set to external")
|
||||||
|
|
||||||
if guardrails_agent_config:
|
if guardrails_agent_config:
|
||||||
logger.info("Guardrails agent not implemented (ignoring)")
|
logger.info("Guardrails agent not implemented (ignoring)")
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ You are an helpful customer support assistant
|
||||||
description: "",
|
description: "",
|
||||||
instructions: "Ensure that the agent response is terse and to the point.",
|
instructions: "Ensure that the agent response is terse and to the point.",
|
||||||
model: "gpt-4o-mini",
|
model: "gpt-4o-mini",
|
||||||
|
toggleAble: true,
|
||||||
locked: true,
|
locked: true,
|
||||||
global: true,
|
global: true,
|
||||||
ragReturnType: "chunks",
|
ragReturnType: "chunks",
|
||||||
|
|
@ -90,6 +91,7 @@ You are an helpful customer support assistant
|
||||||
"description": "Minimal post processing",
|
"description": "Minimal post processing",
|
||||||
"instructions": "- Avoid adding any additional phrases such as 'Let me know if you need anything else!' or similar.",
|
"instructions": "- Avoid adding any additional phrases such as 'Let me know if you need anything else!' or similar.",
|
||||||
"model": "gpt-4o",
|
"model": "gpt-4o",
|
||||||
|
"toggleAble": true,
|
||||||
"locked": true,
|
"locked": true,
|
||||||
"global": true,
|
"global": true,
|
||||||
"ragReturnType": "chunks",
|
"ragReturnType": "chunks",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue