mirror of
https://github.com/zylon-ai/private-gpt.git
synced 2025-12-22 20:12:55 +01:00
feat: Add optional metadata param to ingest routes
This commit is contained in:
parent
b62669784b
commit
d559d54e1a
6 changed files with 76 additions and 32 deletions
|
|
@ -69,11 +69,13 @@ class IngestionHelper:
|
|||
|
||||
@staticmethod
|
||||
def transform_file_into_documents(
|
||||
file_name: str, file_data: Path
|
||||
file_name: str, file_data: Path, file_metadata : dict | 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