The presence of metadata affects vector retrieval negatively

Just make sure that you don’t send the actual object to the LangChain Pinecone vector store code. Do this before you send the metadata object:

copy.deepcopy(metadata)

or just use, import pinecone and stay away from the LangChain.

batch_size = 90 
    
    for filename, embedding_metadata_pairs in data_dict.items():
        
        for i in range(0, len(embedding_metadata_pairs), batch_size):
                      
            batch = embedding_metadata_pairs[i:i + batch_size]
            
            batch_data = [(str(uuid.uuid4()), pair["embedding"], pair["metadata"]) for pair in batch]
           
            pinecone_index.upsert(batch_data, BotNameSpace)  # Adjusted line to match Pinecone's upsert method signature
1 Like