-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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 #1927
base: main
Are you sure you want to change the base?
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.
|
@@ -130,6 +131,10 @@ class BaseAgent(ABC, BaseModel): | |||
max_tokens: Optional[int] = Field( | |||
default=None, description="Maximum number of tokens for the agent's execution." | |||
) | |||
knowledge_sources: Optional[List[BaseKnowledgeSource]] = Field( |
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.
If we add this here, shouldn't we drop it from agent.py?
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 ^
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.
@@ -256,13 +261,21 @@ def copy(self: T) -> T: # type: ignore # Signature of "copy" incompatible with | |||
"tools_handler", | |||
"cache_handler", | |||
"llm", | |||
"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 an agent with knowledge sources?
@@ -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?
No description provided.