Raise errors if incompatible args are used with an executor (#1855)

* Raise errors if incompatible args are used with an executor

* spelling error
This commit is contained in:
Jack Gerrits
2024-03-04 16:46:40 -05:00
committed by GitHub
parent 799a24e04f
commit b604c44101

View File

@@ -197,6 +197,21 @@ class ConversableAgent(LLMAgent):
self._code_execution_config = code_execution_config
if self._code_execution_config.get("executor") is not None:
if "use_docker" in self._code_execution_config:
raise ValueError(
"'use_docker' in code_execution_config is not valid when 'executor' is set. Use the appropriate arg in the chosen executor instead."
)
if "work_dir" in self._code_execution_config:
raise ValueError(
"'work_dir' in code_execution_config is not valid when 'executor' is set. Use the appropriate arg in the chosen executor instead."
)
if "timeout" in self._code_execution_config:
raise ValueError(
"'timeout' in code_execution_config is not valid when 'executor' is set. Use the appropriate arg in the chosen executor instead."
)
# Use the new code executor.
self._code_executor = CodeExecutorFactory.create(self._code_execution_config)
self.register_reply([Agent, None], ConversableAgent._generate_code_execution_reply_using_executor)