mirror of
https://github.com/microsoft/autogen.git
synced 2026-04-20 03:02:16 -04:00
refactor: [conversable_agent] remove raise from property access (#2006)
* refactor: [conversable_agent] remove raise from property access raising exception seems drastic, can we return None and let the called fail in case it receives a None? * Update conversable_agent.py --------- Co-authored-by: Chi Wang <wang.chi@microsoft.com>
This commit is contained in:
@@ -270,13 +270,10 @@ class ConversableAgent(LLMAgent):
|
||||
self._description = description
|
||||
|
||||
@property
|
||||
def code_executor(self) -> CodeExecutor:
|
||||
"""The code executor used by this agent. Raise if code execution is disabled."""
|
||||
def code_executor(self) -> Optional[CodeExecutor]:
|
||||
"""The code executor used by this agent. Returns None if code execution is disabled."""
|
||||
if not hasattr(self, "_code_executor"):
|
||||
raise ValueError(
|
||||
"No code executor as code execution is disabled. "
|
||||
"To enable code execution, set code_execution_config."
|
||||
)
|
||||
return None
|
||||
return self._code_executor
|
||||
|
||||
def register_reply(
|
||||
|
||||
Reference in New Issue
Block a user