Skip to content

add metadata in similarity search#18

Open
Canada-wet wants to merge 1 commit intoalejandro-ao:mainfrom
Canada-wet:henry_branch
Open

add metadata in similarity search#18
Canada-wet wants to merge 1 commit intoalejandro-ao:mainfrom
Canada-wet:henry_branch

Conversation

@Canada-wet
Copy link

Hi thanks for the brilliant video, just saw a comment asking for metadata like pages for similarity search. I played around it and made a bit changes, and this works for me. Please check if this can help

@yuvrajpowar
Copy link

why is purpose of this statment, metadata_input = [metadatas[i]]*len(texts_temp)?

@Canada-wet
Copy link
Author

why is purpose of this statment, metadata_input = [metadatas[i]]*len(texts_temp)?

So when we split the texts, we also need to duplicate the corresponding metadata to ensure they still match each other for FAISS vectorDB creation.

e.g.

initial_text = 'I love watching YouTube videos. I am also a YouTuber myself.'
initial_metadata = [{'source':'random_blog1', 'page': 6}]

split_text = ['I love watching YouTube videos.', 'I am also a YouTuber myself.']
split_metadata = [{'source':'random_blog1', 'page': 6}, {'source':'random_blog1', 'page': 6}]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants