This repository has been archived by the owner on Dec 9, 2024. It is now read-only.
Fix Payload Duplication Bug in build_payloads Function by Copying Metadata for Each Chunk #89
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request resolves the Issue #88.
Description
Overview: This pull request addresses the issue of duplicated text in the payloads generated by the
build_payloads
function. Previously, each payload incorrectly contained the same text due to a shared reference todoc.metadata
, which caused in-place updates across all payloads.Changes Made:
Updated
build_payloads
to create a shallow copy ofdoc.metadata
for each chunk. This ensures each payload dictionary is independent, containing the correct text for each specific chunk.Added a comment for clarity.
Testing: Tested the function with multiple chunks, confirming that each payload now contains the expected text and metadata without interference.
Example:
News document from Alpaca.
Payloads uploaded to Qdrant.
Qdrant Query used to verify the issue fix.