From 5aa0f2b53dddbad7913438f396af4d15e0480c10 Mon Sep 17 00:00:00 2001 From: joaopauloschuler <43456488+joaopauloschuler@users.noreply.github.com> Date: Sat, 18 Jan 2025 14:31:19 -0300 Subject: [PATCH] Fixes bug no attribute 'logger' (#259) --- src/smolagents/agents.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/smolagents/agents.py b/src/smolagents/agents.py index 46bfa51..1b04fd0 100644 --- a/src/smolagents/agents.py +++ b/src/smolagents/agents.py @@ -910,13 +910,6 @@ class CodeAgent(MultiStepAgent): raise AgentError( "Tag '{{authorized_imports}}' should be provided in the prompt." ) - - if "*" in self.additional_authorized_imports: - self.logger.log( - "Caution: you set an authorization for all imports, meaning your agent can decide to import any package it deems necessary. This might raise issues if the package is not installed in your environment.", - 0, - ) - super().__init__( tools=tools, model=model, @@ -925,6 +918,12 @@ class CodeAgent(MultiStepAgent): planning_interval=planning_interval, **kwargs, ) + if "*" in self.additional_authorized_imports: + self.logger.log( + "Caution: you set an authorization for all imports, meaning your agent can decide to import any package it deems necessary. This might raise issues if the package is not installed in your environment.", + 0, + ) + if use_e2b_executor and len(self.managed_agents) > 0: raise Exception( f"You passed both {use_e2b_executor=} and some managed agents. Managed agents is not yet supported with remote code execution."