FIX Redundant code block in run_agent_with_retry
This commit is contained in:
parent
9f3e6b9ae8
commit
0ae6bea9d5
|
|
@ -697,22 +697,21 @@ def run_agent_with_retry(
|
||||||
return f"Agent has crashed: {crash_message}"
|
return f"Agent has crashed: {crash_message}"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Ensure messages have thinking blocks if needed before each run
|
# Check if we need to ensure thinking blocks
|
||||||
config = get_config_repository().get_all()
|
config = get_config_repository().get_all()
|
||||||
if is_anthropic_claude(config):
|
provider = config.get("provider", "")
|
||||||
provider = config.get("provider", "")
|
model_name = config.get("model", "")
|
||||||
model_name = config.get("model", "")
|
|
||||||
|
|
||||||
# Only apply to Claude 3.7 models with thinking enabled
|
# Only apply to Claude 3.7 models with thinking enabled
|
||||||
if (provider.lower() == "anthropic" and
|
if (provider.lower() == "anthropic" and
|
||||||
"claude-3-7" in model_name.lower() and
|
"claude-3-7" in model_name.lower() and
|
||||||
not config.get("disable_thinking", False)):
|
not config.get("disable_thinking", False)):
|
||||||
|
|
||||||
# Get model configuration to check if thinking is supported
|
# Get model configuration to check if thinking is supported
|
||||||
model_config = models_params.get(provider, {}).get(model_name, {})
|
model_config = models_params.get(provider, {}).get(model_name, {})
|
||||||
if model_config.get("supports_thinking", False):
|
if model_config.get("supports_thinking", False):
|
||||||
logger.debug("Ensuring thinking blocks for Claude 3.7 before agent run")
|
logger.debug("Ensuring thinking blocks for Claude 3.7 before agent run")
|
||||||
msg_list = _ensure_thinking_block(msg_list, config)
|
msg_list = _ensure_thinking_block(msg_list, config)
|
||||||
|
|
||||||
_run_agent_stream(agent, msg_list)
|
_run_agent_stream(agent, msg_list)
|
||||||
if fallback_handler:
|
if fallback_handler:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue