From ddf2bba4510cfde28b5c8b336cc57759272537d1 Mon Sep 17 00:00:00 2001 From: Kevin King Date: Thu, 30 Jan 2025 13:23:58 -0500 Subject: [PATCH] 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 --- src/crewai/knowledge/source/excel_knowledge_source.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/crewai/knowledge/source/excel_knowledge_source.py b/src/crewai/knowledge/source/excel_knowledge_source.py index 32747bc7c2..ad73af2400 100644 --- a/src/crewai/knowledge/source/excel_knowledge_source.py +++ b/src/crewai/knowledge/source/excel_knowledge_source.py @@ -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 @@ 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.