Pass DocumentChunk metadata_id to _metadata field

This commit is contained in:
Leon Luithlen 2024-11-27 12:50:39 +01:00
parent aacba555c9
commit 3d5cb7644a

View file

@ -34,7 +34,11 @@ class TextChunker():
word_count = chunk_data["word_count"],
is_part_of = self.document,
chunk_index = self.chunk_index,
cut_type = chunk_data["cut_type"]
cut_type = chunk_data["cut_type"],
_metadata = {
"index_fields": ["text"],
"metadata_id": self.document.metadata_id
}
)
paragraph_chunks = []
self.chunk_size = 0
@ -47,7 +51,11 @@ class TextChunker():
word_count = self.chunk_size,
is_part_of = self.document,
chunk_index = self.chunk_index,
cut_type = paragraph_chunks[len(paragraph_chunks) - 1]["cut_type"]
cut_type = paragraph_chunks[len(paragraph_chunks) - 1]["cut_type"],
_metadata = {
"index_fields": ["text"],
"metadata_id": self.document.metadata_id
}
)
except Exception as e:
print(e)
@ -64,7 +72,11 @@ class TextChunker():
word_count = self.chunk_size,
is_part_of = self.document,
chunk_index = self.chunk_index,
cut_type = paragraph_chunks[len(paragraph_chunks) - 1]["cut_type"]
cut_type = paragraph_chunks[len(paragraph_chunks) - 1]["cut_type"],
_metadata = {
"index_fields": ["text"],
"metadata_id": self.document.metadata_id
}
)
except Exception as e:
print(e)