fix: retrieve function_calling_llm from registered LLMs in CrewBase

This commit is contained in:
sakunkun
2025-03-11 11:40:33 +00:00
parent 41a670166a
commit 313038882c
3 changed files with 28 additions and 7 deletions

View File

@@ -31,6 +31,13 @@ class InternalCrew:
agents_config = "config/agents.yaml"
tasks_config = "config/tasks.yaml"
@llm
def local_llm(self):
return LLM(
model='openai/model_name',
api_key="None",
base_url="http://xxx.xxx.xxx.xxx:8000/v1")
@agent
def researcher(self):
return Agent(config=self.agents_config["researcher"])
@@ -105,6 +112,20 @@ def test_task_name():
), "Custom task name is not being set as expected"
def test_agent_function_calling_llm():
crew = InternalCrew()
llm = crew.local_llm()
obj_llm_agent = crew.researcher()
assert (
obj_llm_agent.function_calling_llm is llm
), "agent's function_calling_llm is incorrect"
str_llm_agent = crew.reporting_analyst()
assert (
str_llm_agent.function_calling_llm.model == "online_llm"
), "agent's function_calling_llm is incorrect"
@pytest.mark.vcr(filter_headers=["authorization"])
def test_before_kickoff_modification():
crew = InternalCrew()