I was able to resolve the issue. The problem is actually with the sparse vector tool specifically how it returns the results. The results are returned as such:
{
"response": {
"indices": [],
"values": []
}
}
Qdrant does not tolerate the “indices” and “values” being wrapped inside “response”.
To fix this, I edited the code in this section: 5. Retrieval using Sparse Vectors and ReRanker (Chat Agent Example)
Node: Qdrant with Cohere ReRank
Edit the code inside the node and replace the “5. Tool Definition” portion of the code with this:
// 5. Tool definition
const vectorStoreTool = new DynamicTool({
name,
description,
func: async (input) => {
const denseVector = await embeddings.embedQuery(input);
const sparseVector = JSON.parse(await sparseVectorTool.invoke(input));
console.log(denseVector);
console.log(sparseVector.response.indices);
const response = await client.query(collectionName, {
prefetch: [
{
query: denseVector,
using: 'default',
limit: 100
},
{
query: {
values: sparseVector.response.values,
indices: sparseVector.response.indices,
},
using: 'bm42',
limit: 100
},
],
query: { fusion: 'rrf' },
with_payload: true,
limit,
});
The specific area that was changed was:
{
query: {
values: sparseVector.response.values,
indices: sparseVector.response.indices,
},
using: 'bm42',
limit: 100
},
All I have done is “unwrapped” the values and indices and passed them to Qdrant as the API currently expects based on this documentation:
Hybrid Queries - Qdrant