Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update rag examples to use fresh faiss index every time #998

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

hardikjshah
Copy link
Contributor

@hardikjshah hardikjshah commented Feb 7, 2025

What does this PR do?

In several examples we use the same faiss index , which means running it multiple times fills up the index with duplicates which eventually degrades the model performance on RAG as multiple copies of the same irrelevant chunks might be picked up several times.

Fix is to ensure we create a new index each time.

Resolves issue in this discussion - #995

Test Plan

Re-ran the getting started guide multiple times to see the same output

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Feb 7, 2025
@hardikjshah hardikjshah changed the title bug: Update rag examples to use fresh faiss index every time fix: Update rag examples to use fresh faiss index every time Feb 7, 2025
@@ -1673,7 +1674,7 @@
" for i, url in enumerate(urls)\n",
"]\n",
"\n",
"vector_db_id = \"test-vector-db\"\n",
"vector_db_id = f\"test-vector-db-{uuid.uuid4().hex}\"\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oooh good find

Copy link
Contributor

@ashwinb ashwinb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx

@ashwinb ashwinb merged commit 28a0fe5 into main Feb 7, 2025
4 of 5 checks passed
@ashwinb ashwinb deleted the fix_rag_quick_start branch February 7, 2025 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants