From 9f8293349cf3faace7cde78c56d03c7acde5ba4b Mon Sep 17 00:00:00 2001 From: Brandon Hancock Date: Thu, 9 Jan 2025 16:29:29 -0500 Subject: [PATCH] improve function llm logic --- src/crewai/agent.py | 3 ++- src/crewai/crew.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/crewai/agent.py b/src/crewai/agent.py index 8b55513d2..b7f0b2896 100644 --- a/src/crewai/agent.py +++ b/src/crewai/agent.py @@ -142,7 +142,8 @@ class Agent(BaseAgent): self.agent_ops_agent_name = self.role self.llm = create_llm(self.llm) - self.function_calling_llm = create_llm(self.function_calling_llm) + if self.function_calling_llm and not isinstance(self.function_calling_llm, LLM): + self.function_calling_llm = create_llm(self.function_calling_llm) if not self.agent_executor: self._setup_agent_executor() diff --git a/src/crewai/crew.py b/src/crewai/crew.py index 5df5f59d7..b2857d827 100644 --- a/src/crewai/crew.py +++ b/src/crewai/crew.py @@ -246,7 +246,7 @@ class Crew(BaseModel): if self.output_log_file: self._file_handler = FileHandler(self.output_log_file) self._rpm_controller = RPMController(max_rpm=self.max_rpm, logger=self._logger) - if self.function_calling_llm: + if self.function_calling_llm and not isinstance(self.function_calling_llm, LLM): self.function_calling_llm = create_llm(self.function_calling_llm) self._telemetry = Telemetry()