You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to use the hierarchical process with a crew while using Langchain's implementation of OpenAI Chat (langchain_openai.ChatOpenAI) but keep encountering the following error:
File ".../.../.../lib/python3.12/site-packages/crewai/agent.py", line 131, in __init__
super().__init__(**config, **data)
File ".../.../.../lib/python3.12/site-packages/pydantic/main.py", line 171, in __init__
self.__pydantic_validator__.validate_python(data, self_instance=self)
File ".../.../.../lib/python3.12/site-packages/crewai/agent.py", line 172, in set_agent_executor
self.set_cache_handler(self.cache_handler)
File ".../.../.../lib/python3.12/site-packages/crewai/agent.py", line 244, in set_cache_handler
self.create_agent_executor()
File ".../.../.../lib/python3.12/site-packages/crewai/agent.py", line 303, in create_agent_executor
bind = self.llm.bind(stop=[self.i18n.slice("observation")])
^^^^^^^^^^^^^
File ".../.../.../lib/python3.12/site-packages/pydantic/main.py", line 767, in __getattr__
raise AttributeError(f'{type(self).__name__!r} object has no attribute {item!r}')
AttributeError: 'Agent' object has no attribute 'bind'
Double-checked and ChatOpenAI does have attribute defined, as mentioned in langchain's documentation and manually checking the library's code locally.
Code used is the following:
from crewai import Agent, Task, Crew, Process
from langchain_openai import ChatOpenAI
connectionLLM = ChatOpenAI(
api_key="------"
)
manager = Agent(
role='Project Manager',
goal='Coordinate the project to ensure a seamless integration of research findings into compelling narratives',
verbose=True,
backstory="""With a strategic mindset and a knack for leadership, you excel at guiding teams towards
their goals, ensuring projects not only meet but exceed expectations.""",
allow_delegation=True,
llm = connectionLLM
)
researcher = Agent(
role='Senior Researcher',
goal=f'Uncover groundbreaking technologies around {topic}',
verbose=True,
backstory="""Driven by curiosity, you're at the forefront of innovation, eager to explore and share
knowledge that could change the world.""",
llm = connectionLLM
)
# Define the writer agent
writer = Agent(
role='Writer',
goal=f'Narrate compelling tech stories around {topic}',
verbose=True,
backstory="""With a flair for simplifying complex topics, you craft engaging narratives that captivate
and educate, bringing new discoveries to light in an accessible manner.""",
llm = connectionLLM
)
list_ideas = Task(
description="List of 5 interesting ideas to explore for an article about {topic}.",
expected_output="Bullet point list of 5 ideas for an article.",
tools=[search_tool],
agent=researcher,
async_execution=True
)
list_important_history = Task(
description="Research the history of {topic} and identify the 5 most important events.",
expected_output="Bullet point list of 5 important events.",
tools=[search_tool],
agent=researcher,
async_execution=True
)
write_article = Task(
description=f"Compose an insightful article on {topic}, including its history and the latest interesting ideas.",
expected_output="A 4 paragraph article about AI in healthcare.",
tools=[search_tool],
agent=writer,
context=[list_ideas, list_important_history], # Depends on the completion of the two asynchronous tasks
)
manager_task = Task(
description=f"""Oversee the integration of research findings and narrative development to produce a final comprehensive
report on {topic}. Ensure the research is accurately represented and the narrative is engaging and informative.""",
expected_output=f'A final comprehensive report that combines the research findings and narrative on {topic}.',
agent=manager
)
crew = Crew(
agents=[manager, researcher, writer],
tasks=[list_ideas, list_important_history, write_article, manager_task],
process=Process.hierarchical,
manager_llm= manager
)
results = crew.kickoff()
error persists in Python version is 3.11.0 and 3.12 with the following langchain and crewai versions:
Using sequential process does not throw the error.
The text was updated successfully, but these errors were encountered:
alvarod91100
changed the title
'Agent' getting error when using 'bind' with Langchain's Chat Model when using Hierarchical Process
'Agent' getting error when using 'bind' with Langchain's Chat Model using Hierarchical Process
Apr 25, 2024
Trying to use the hierarchical process with a crew while using Langchain's implementation of OpenAI Chat (
langchain_openai.ChatOpenAI
) but keep encountering the following error:Double-checked and ChatOpenAI does have attribute defined, as mentioned in langchain's documentation and manually checking the library's code locally.
Code used is the following:
error persists in Python version is 3.11.0 and 3.12 with the following langchain and crewai versions:
Using sequential process does not throw the error.
The text was updated successfully, but these errors were encountered: