-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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?
…n_using_knowledge
…n_using_knowledge
…n_using_knowledge
…le custom knowledge_storage (#1927) * fix breakage when cloning agent/crew using knowledge_sources * fixed typo * better * ensure use of other knowledge storage works * fix copy and custom storage * added tests * normalized name * updated cassette * fix test * remove fixture * fixed test * fix * add fixture to this * add fixture to this * patch twice since * fix again * with fixtures * better mocks * fix * simple * try * another * hopefully fixes test * hopefully fixes test * this should fix it ! * WIP: test check with prints * try this * exclude knowledge * fixes * just drop clone for now * rm print statements * printing agent_copy * checker * linted * cleanup * better docs --------- Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com>
No description provided.