mirror of
https://github.com/zylon-ai/private-gpt.git
synced 2025-12-22 23:22:57 +01:00
Merge 9177a0ad73 into b7ee43788d
This commit is contained in:
commit
494bb9eea9
6 changed files with 136 additions and 24 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import logging
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from llama_index.core.readers import StringIterableReader
|
||||
from llama_index.core.readers.base import BaseReader
|
||||
|
|
@ -69,11 +70,13 @@ class IngestionHelper:
|
|||
|
||||
@staticmethod
|
||||
def transform_file_into_documents(
|
||||
file_name: str, file_data: Path
|
||||
file_name: str, file_data: Path, file_metadata: dict[str, Any] | 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