mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 15:48:29 +00:00
resolve conflicts
This commit is contained in:
@@ -86,15 +86,13 @@ class BaseFileKnowledgeSource(BaseKnowledgeSource, ABC):
|
||||
else:
|
||||
if self.file_paths is None:
|
||||
raise ValueError("Your source must be provided with a file_paths: []")
|
||||
paths = (
|
||||
[self.file_paths]
|
||||
if isinstance(self.file_paths, (str, Path))
|
||||
else self.file_paths
|
||||
)
|
||||
|
||||
if not isinstance(paths, list):
|
||||
raise ValueError(
|
||||
"file_path/file_paths must be a Path, str, or a list of these types"
|
||||
)
|
||||
elif isinstance(self.file_paths, list) and len(self.file_paths) == 0:
|
||||
raise ValueError("Empty file_paths are not allowed")
|
||||
else:
|
||||
paths = (
|
||||
[self.file_paths]
|
||||
if isinstance(self.file_paths, (str, Path))
|
||||
else self.file_paths
|
||||
)
|
||||
|
||||
return [self.convert_to_path(path) for path in paths]
|
||||
|
||||
@@ -50,11 +50,11 @@ class CrewDoclingSource(BaseKnowledgeSource):
|
||||
)
|
||||
self.file_paths = self.file_path
|
||||
self.safe_file_paths = self.validate_content()
|
||||
self.content = self.load_content()
|
||||
self.content = self._load_content()
|
||||
|
||||
def load_content(self) -> List[DoclingDocument]:
|
||||
def _load_content(self) -> List[DoclingDocument]:
|
||||
try:
|
||||
return self.convert_source_to_docling_documents()
|
||||
return self._convert_source_to_docling_documents()
|
||||
except ConversionError as e:
|
||||
self._logger.log(
|
||||
"error",
|
||||
@@ -74,7 +74,7 @@ class CrewDoclingSource(BaseKnowledgeSource):
|
||||
self.chunks.extend(list(new_chunks_iterable))
|
||||
self._save_documents()
|
||||
|
||||
def convert_source_to_docling_documents(self) -> List[DoclingDocument]:
|
||||
def _convert_source_to_docling_documents(self) -> List[DoclingDocument]:
|
||||
conv_results_iter = self.document_converter.convert_all(self.safe_file_paths)
|
||||
return [result.document for result in conv_results_iter]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user