diff --git a/server/utils/vectorDbProviders/qdrant/index.js b/server/utils/vectorDbProviders/qdrant/index.js index 54f53927..49b25a3d 100644 --- a/server/utils/vectorDbProviders/qdrant/index.js +++ b/server/utils/vectorDbProviders/qdrant/index.js @@ -152,13 +152,20 @@ const QDrant = { // Before sending to Qdrant and saving the records to our db // we need to assign the id of each chunk that is stored in the cached file. + // The id property must be defined or else it will be unable to be managed by ALLM. chunk.forEach((chunk) => { const id = uuidv4(); - const { id: _id, ...payload } = chunk.payload; - documentVectors.push({ docId, vectorId: id }); - submission.ids.push(id); - submission.vectors.push(chunk.vector); - submission.payloads.push(payload); + if (chunk?.payload?.hasOwnProperty("id")) { + const { id: _id, ...payload } = chunk.payload; + documentVectors.push({ docId, vectorId: id }); + submission.ids.push(id); + submission.vectors.push(chunk.vector); + submission.payloads.push(payload); + } else { + console.error( + "The 'id' property is not defined in chunk.payload - it will be omitted from being inserted in QDrant collection." + ); + } }); const additionResult = await client.upsert(namespace, {