-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix breakage when cloning agent/crew using knowledge_sources and enable custom knowledge_storage #1927
Conversation
Disclaimer: This review was made by a crew of AI Agents. Code Review Comment for PR #1927OverviewThis pull request effectively addresses the handling of knowledge sources in the cloning process of agents and crews. Modifications in two primary files, Key Observations1.
|
llm=existing_llm, | ||
tools=self.tools, | ||
knowledge_sources=self.knowledge_sources | ||
if hasattr(self, "knowledge_sources") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
knowledge_sources=getattr(self, "knowledge_sources", None)
This is a little cleaner ^
src/crewai/crew.py
Outdated
agents=cloned_agents, | ||
tasks=cloned_tasks, | ||
knowledge_sources=self.knowledge_sources | ||
if hasattr(self, "knowledge_sources") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
knowledge_sources=getattr(self, "knowledge_sources", None)
Same here please.
@@ -1036,6 +1036,7 @@ def copy(self): | |||
"_telemetry", | |||
"agents", | |||
"tasks", | |||
"knowledge_sources", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add a test showing that we can successfully clone a crew with knowledge sources?
src/crewai/crew.py
Outdated
} | ||
|
||
cloned_agents = [agent.copy() for agent in self.agents] | ||
|
||
task_mapping = {} | ||
|
||
cloned_tasks = [] | ||
knowledge_sources_copied = shallow_copy(self.knowledge_sources) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lorenzejay do we want to do the existing approach like we are doing in base_agent instead?
No description provided.