Added an override for the content field from the inheritted BaseFileKnowledgeSource to account for the change in the load_content method to support excel files with multiple tabs/sheets. This change should ensure it passes the type check test, as it failed before since content was assigned a different type in BaseFileKnowledgeSource

This commit is contained in:
Kevin King
2025-01-30 13:23:58 -05:00
parent 8a8698e539
commit ddf2bba451

View File

@@ -1,5 +1,6 @@
from pathlib import Path
from typing import Dict, List
from pydantic import Field
from crewai.knowledge.source.base_file_knowledge_source import BaseFileKnowledgeSource
@@ -7,6 +8,9 @@ from crewai.knowledge.source.base_file_knowledge_source import BaseFileKnowledge
class ExcelKnowledgeSource(BaseFileKnowledgeSource):
"""A knowledge source that stores and queries Excel file content using embeddings."""
# override content to be a dict of file paths to sheet names to csv content
content: Dict[Path, Dict[str, str]] = Field(default_factory=dict)
def load_content(self) -> Dict[Path, Dict[str, str]]:
"""Load and preprocess Excel file content from multiple sheets.