Created
September 29, 2023 07:29
-
-
Save ljnmedium/a9b27ee5ae3ab537204e36972ae46296 to your computer and use it in GitHub Desktop.
add_data.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
values = embedd_model.encode([b['content'] for b in batch]) | |
sparse_values = sparsed_model.encode([b['content'] for b in batch]) | |
# Create unique IDs | |
ids = [str(b['metadata']['id']) for b in batch] | |
# Add all to upsert list | |
to_upsert = [{'id': i, 'values': v, 'metadata':m , 'sparse_values': sv} for (i,v,m,sv) in zip(ids,values, metas, sparse_values)] | |
# Upsert/insert these records to pinecone | |
index.upsert(vectors=to_upsert, namespace="Eiffage") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment