Commit Graph

1 Commits

Author SHA1 Message Date
Devin AI
82bb304147 Add metadata support to Knowledge Source classes
- Implement _coerce_to_records function to handle both string and dict formats
- Update KnowledgeStorage.save() to accept list[str] | list[dict[str, Any]]
- Add metadata (filepath, chunk_index, source_type) to all Knowledge Source classes:
  - TextFileKnowledgeSource
  - PDFKnowledgeSource
  - CSVKnowledgeSource
  - JSONKnowledgeSource
  - ExcelKnowledgeSource (includes sheet_name for multi-sheet files)
  - StringKnowledgeSource
  - CrewDoclingSource
- Add comprehensive tests for metadata functionality
- Maintain backward compatibility with existing string-based chunks

Fixes #3812

Co-Authored-By: João <joao@crewai.com>
2025-10-30 09:04:35 +00:00