mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-11 00:58:30 +00:00
fix breakage when cloning agent/crew using knowledge_sources and enable 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>
This commit is contained in:
@@ -29,7 +29,13 @@ class BaseFileKnowledgeSource(BaseKnowledgeSource, ABC):
|
||||
def validate_file_path(cls, v, info):
|
||||
"""Validate that at least one of file_path or file_paths is provided."""
|
||||
# Single check if both are None, O(1) instead of nested conditions
|
||||
if v is None and info.data.get("file_path" if info.field_name == "file_paths" else "file_paths") is None:
|
||||
if (
|
||||
v is None
|
||||
and info.data.get(
|
||||
"file_path" if info.field_name == "file_paths" else "file_paths"
|
||||
)
|
||||
is None
|
||||
):
|
||||
raise ValueError("Either file_path or file_paths must be provided")
|
||||
return v
|
||||
|
||||
|
||||
Reference in New Issue
Block a user