mirror of
https://github.com/zylon-ai/private-gpt.git
synced 2025-12-22 23:22:57 +01:00
fix: specify dict type, fix bulk ingestion with metadata
This commit is contained in:
parent
8863154baa
commit
50388f6a33
6 changed files with 112 additions and 42 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue