Upsert a vector in pinecone

I’m receiving this error when I try to upsert the vector:

ValueError: Invalid vector value passed: cannot interpret type <class ‘str’>

this is my code
vector = ( question, embedding, tag ) index.upsert(list(vector))

I also try using dictionary, but it gives me the same error.

Also the type for question, embedding and tag are the following:

question: <class ‘str’>
embeddding: <class ‘list’>
tag: <class ‘dict’>

Hi @ccbb3899

as per documentation here: Insert data and Upsert

Try upserting “fake” data if you haven’t yet. Vector(s) should have an id (string) and values (array of floats). I am not sure what your id is. How does your question look like? If it really is a question I would instead put it in metadata instead.

Do check that the embedding you are inserting is array of floats and not strings as well.

values1 = [0,0,0,0,0 ... 0]
index.upsert([("id0", values1)], namespace='')

If this works, proceed to adding metadata as well.

metadata = { 'tag' : 'something here' }
values = [0,0,0,0,0 ... 0]
index.upsert([("id0", values, metadata)], namespace='')

If you won’t be able to find the problem, with your own upsert, check every value you are passing into the upsert vector.

Hope this helps


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.