Compare commits

..

26 Commits

Author SHA1 Message Date
Brandon Hancock
bebf8e9eb1 resolve conflicts 2024-12-23 13:10:29 -05:00
Brandon Hancock (bhancock_ai)
abdc7133d5 Merge branch 'main' into feat/docling 2024-12-23 13:07:26 -05:00
Brandon Hancock (bhancock_ai)
9dda698b66 Merge branch 'main' into feat/docling 2024-12-23 10:13:48 -05:00
Lorenze Jay
6faa0317b2 added docs 2024-12-18 10:02:50 -08:00
Lorenze Jay
bc230b4edf Merge branch 'main' of github.com:crewAIInc/crewAI into feat/docling 2024-12-18 09:56:43 -08:00
Lorenze Jay
f380f8ee23 linted 2024-12-18 09:56:32 -08:00
Lorenze Jay
c3d31deff6 renamed to CrewDoclingSource 2024-12-18 07:22:14 -08:00
Lorenze Jay
aedaf01d19 Merge branch 'main' of github.com:crewAIInc/crewAI into feat/docling 2024-12-17 13:44:33 -08:00
Lorenze Jay
436a458072 fix types 2024-12-17 10:18:48 -08:00
Lorenze Jay
7885c5f906 fixed run types 2024-12-17 10:05:36 -08:00
Lorenze Jay
ef7a101631 Merge branch 'main' of github.com:crewAIInc/crewAI into feat/docling 2024-12-16 21:55:33 -08:00
Lorenze Jay
e14a49f82c fix test and types 2024-12-16 21:52:36 -08:00
Lorenze Jay
0921f71fd2 linted 2024-12-16 20:23:42 -08:00
Lorenze Jay
10c04d54a9 enabling local files to work and type cleanup 2024-12-16 20:21:47 -08:00
Lorenze Jay
356eb07d5f fix run-types 2024-12-16 20:09:54 -08:00
Lorenze Jay
c2ed1f2355 added test for multiple sources for file_paths 2024-12-16 19:44:29 -08:00
Lorenze Jay
76c640b985 use file_paths instead of file_path 2 2024-12-16 19:41:10 -08:00
Lorenze Jay
054bc266b9 logged but file_path is backwards compatible 2024-12-16 16:30:47 -08:00
Lorenze Jay
f1c9caa8ec fixed logic 2024-12-15 22:48:45 -08:00
Lorenze Jay
610ea40c2d needs to be list 2024-12-15 22:34:41 -08:00
Lorenze Jay
b14f6ffa59 run_type docs 2024-12-15 22:32:08 -08:00
Lorenze Jay
56172ecf1d organized imports 2024-12-15 22:25:40 -08:00
Lorenze Jay
ee74ad0d6d fix import 2024-12-15 22:23:17 -08:00
Lorenze Jay
a67ec7e37a use file_paths instead of file_path 2024-12-15 22:21:19 -08:00
Lorenze Jay
625c21da5b docling support installation 2024-12-15 22:16:07 -08:00
Lorenze Jay
04cb9afae5 added tool for docling support 2024-12-15 22:15:49 -08:00

View File

@@ -71,29 +71,28 @@ class BaseFileKnowledgeSource(BaseKnowledgeSource, ABC):
def _process_file_paths(self) -> List[Path]:
"""Convert file_path to a list of Path objects."""
# Check if old file_path is being used
if hasattr(self, "file_path") and self.file_path is not None:
self._logger.log(
"warning",
"The 'file_path' attribute is deprecated and will be removed in a future version. Please use 'file_paths' instead.",
color="yellow",
)
self.file_paths = self.file_path
if self.file_paths is None:
raise ValueError("Your source must be provided with a file_paths: []")
# Convert single path to list
path_list: List[Union[Path, str]] = (
[self.file_paths]
if isinstance(self.file_paths, (str, Path))
else list(self.file_paths)
if isinstance(self.file_paths, list)
else []
)
if not path_list:
raise ValueError(
"file_path/file_paths must be a Path, str, or a list of these types"
paths = (
[self.file_path]
if isinstance(self.file_path, (str, Path))
else self.file_path
)
else:
if self.file_paths is None:
raise ValueError("Your source must be provided with a file_paths: []")
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 path_list]
return [self.convert_to_path(path) for path in paths]