fix: specify dict type, fix bulk ingestion with metadata

This commit is contained in:
Nathan Lenas 2024-07-23 09:18:27 +02:00
parent 8863154baa
commit 50388f6a33
6 changed files with 112 additions and 42 deletions

View file

@ -69,13 +69,13 @@ class IngestionHelper:
@staticmethod
def transform_file_into_documents(
file_name: str, file_data: Path, file_metadata : dict | None = None
file_name: str, file_data: Path, file_metadata: dict[str, str] | None = None
) -> list[Document]:
documents = IngestionHelper._load_file_to_documents(file_name, file_data)
for document in documents:
document.metadata.update(file_metadata or {})
document.metadata["file_name"] = file_name
IngestionHelper._exclude_metadata(documents)
return documents