adding manager_llm

This commit is contained in:
João Moura
2024-02-05 20:46:47 -08:00
parent 2f0bf3b325
commit 09bec0e28b
8 changed files with 68 additions and 102 deletions

View File

@@ -2,6 +2,7 @@
import json
import pydantic_core
import pytest
from crewai.agent import Agent
@@ -144,6 +145,8 @@ def test_crew_creation():
@pytest.mark.vcr(filter_headers=["authorization"])
def test_hierarchical_process():
from langchain_openai import ChatOpenAI
task = Task(
description="Come up with a list of 5 interesting ideas to explore for an article, then write one amazing paragraph highlight for each idea that showcases how good an article about this topic could be. Return the list of ideas with their paragraph and your notes.",
)
@@ -151,6 +154,7 @@ def test_hierarchical_process():
crew = Crew(
agents=[researcher, writer],
process=Process.hierarchical,
manager_llm=ChatOpenAI(temperature=0, model="gpt-4"),
tasks=[task],
)
@@ -175,6 +179,19 @@ def test_hierarchical_process():
)
def test_manager_llm_requirement_for_hierarchical_process():
task = Task(
description="Come up with a list of 5 interesting ideas to explore for an article, then write one amazing paragraph highlight for each idea that showcases how good an article about this topic could be. Return the list of ideas with their paragraph and your notes.",
)
with pytest.raises(pydantic_core._pydantic_core.ValidationError):
Crew(
agents=[researcher, writer],
process=Process.hierarchical,
tasks=[task],
)
@pytest.mark.vcr(filter_headers=["authorization"])
def test_crew_with_delegating_agents():
tasks = [