Find answers from the community

Updated 2 months ago

Hi I am currently playing around the

Hi, I am currently playing around the SQLAutoVectorQueryEngine, but facing some difficulty. Specifically, I always run into this error message: ValueError: Metadata filters not implemented for SimpleVectorStore yet..

After studying the source code, I believe the root cause comes from the VectorIndexAutoRetriever. When the retriever creates the structured schema of the user's query, the LLM returns an empty array for the filters if there is no filter needed, according to the prompt. This empty array filter later transformed to an empty dictionary and used as MetadataFilters for index retriever. It seems like an empty dictionary is not allowed for SimpleVectorStore. The example from the documentation uses Pinecone vector store, so it may work (I don't have Pinecone so cannot replicate it).

My suggestion is when creating the index retriever, we only assign filters if is not empty, for instance:

filters = MetadataFilters(filters=query_spec.filters) if query_spec.filters else None retriever = VectorIndexRetriever( self._index, filters=filters, similarity_top_k=similarity_top_k, )

Please let me know what you think, thanks
L
1 comment
That makes sense! Would be an easy PR πŸ™‚
Add a reply
Sign up and join the conversation on Discord