resolve conflicts

This commit is contained in:
Brandon Hancock
2024-12-23 13:10:29 -05:00
parent abdc7133d5
commit bebf8e9eb1
2 changed files with 12 additions and 14 deletions

View File

@@ -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]

View File

@@ -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]