Error while upserting data

        new_row = pd.DataFrame({"id": [content_id], "vector": [embedding], 'metadata': [{'content': chunk_text}]})
        df = pd.concat([df, new_row], ignore_index=True)
    index.upsert(vectors=zip(, df.vector, df['metadata'].apply(lambda x: x['content'])))

I am trying to upsert the data but i encountered error metadata: invalid value

I don’t think you can pass an iterator to the upsert function. It needs to be a list such as:

# list of tuples:
                 ('id1', [1.0, 2.0, 3.0], {'key': 'value'}),
                 ('id2', [1.0, 2.0, 3.0])]
# or

# list of objects:
                 {'id': 'id1', 'values': [1.0, 2.0, 3.0], 'metadata': {'key': 'value'}},
                 {'id': 'id2', 'values': [1.0, 2.0, 3.0]}]
1 Like

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