Find answers from the community

Updated 9 months ago

Hi, I have a question about the

Hi, I have a question about the RedisVectorStore tutorial, when I'm trying to load the vectors into my redis stack, its giving me this error
DataError: Invalid input of type: 'NoneType'. Convert to a bytes, string, int or float first.
I added my own code to iterate through the documents list (which is where the data is loaded to) to remove anything nonetype but its not finding anything thats nonetype.
Plain Text
loader = SimpleDirectoryReader("./data/paul_graham")
documents = loader.load_data()
for doc in documents:
    if type(doc) is None:
        documents.remove(doc)
        print("removed")

Does anyone know how to get rid of the nonetype data? Heres the tutorial I'm following: https://docs.llamaindex.ai/en/stable/examples/vector_stores/RedisIndexDemo.html#initialize-the-redis-vector-store
L
k
5 comments
this is probably referring to metadata, not the document itself
how would i remove the nonetype metadata then? or at least get around this
for doc in documents:
for key in doc.metadata.keys():
if doc.metadata[key] is None:
doc.metadata.pop(key)
something like that
it worked!! thank you very much!!
Add a reply
Sign up and join the conversation on Discord