Flowise icon indicating copy to clipboard operation
Flowise copied to clipboard

[BUG] LlamaIndex returns "Cannot initialize VectorStoreIndex without nodes or indexStruct" with vector store retriever

Open automaton82 opened this issue 1 year ago • 5 comments

Describe the bug Create a brand new deployment of Flowise with no data, ideally a brand new docker image with local database storage.

Setup a vector store retriever flow with LlamaIndex as per below, then ask a question to it. Do not first run an upsert, just ask a question immediately.

You will get the error:

2024-03-05 17:32:01 [ERROR]: [server]: Error: Error: Cannot initialize VectorStoreIndex without nodes or indexStruct
Error: Error: Cannot initialize VectorStoreIndex without nodes or indexStruct
    at buildFlow (E:\git\Flowise\packages\server\dist\utils\index.js:333:19)
    at async App.buildChatflow (E:\git\Flowise\packages\server\dist\index.js:1734:40)
    at async E:\git\Flowise\packages\server\dist\index.js:1161:13

To Reproduce Steps to reproduce the behavior:

  1. Create this flow: image

Or import the JSON file: llamaIndex test Chatflow.json

Try to ask any question.

Expected behavior This should probably work.

Screenshots image

Flow llamaIndex test Chatflow.json

Setup Using latest build from the repo, built locally on Windows.

automaton82 avatar Mar 05 '24 22:03 automaton82

Note the query engine appears to have the same issue, so presumably this is a problem with the simplestore node.

automaton82 avatar Mar 05 '24 22:03 automaton82

I replicated the same issue with a fresh Docker image, so it's not the pathing on Windows (vectorstore has the wrong / in the path, but that doesn't seem to be the issue given the same thing happens on Docker Linux image).

automaton82 avatar Mar 05 '24 23:03 automaton82

Okay I figured it out.

This only fails the very first time, before the database has been created. It won't create the database if the call to do the embeddings comes in the prediction call. If you first run the upsert, then do the query, it will succeed.

What's more, all subsequent calls, even with new chatflows, documents and other things will upsert correctly on-the-fly once the database has been created.

automaton82 avatar Mar 06 '24 01:03 automaton82

so if we do the upsert first then query, it works fine?

HenryHengZJ avatar Mar 07 '24 12:03 HenryHengZJ

I believe it would, yes. As a note this is what the LangChain nodes do, at least if you use the in-memory vector store.

A prediction will cause an upsert.

Only issue is there's no way to delete the previous entries, I opened a discussion about that since it will grow indefinitely (at least with SimpleStore).

automaton82 avatar Mar 07 '24 12:03 automaton82