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

Prevent duplicate embeddings when traversing a tree #719

Merged
merged 1 commit into from
Mar 14, 2023

Conversation

kpister
Copy link
Contributor

@kpister kpister commented Mar 12, 2023

Hey guys, I noticed my queries were getting embedded many times as the query traverses the tree_index.

This would be one way to solve the problem, another might be adding a @cache to the embedding function.
The PR should reduce the time and cost of running tree embedding queries.

Copy link
Collaborator

@Disiok Disiok left a comment

Choose a reason for hiding this comment

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

Great catch on the duplicate calls to embed the query!

Looks like it should work. Need to quickly double check if there's any conflict with #721 but happy to help get this merged in.

Copy link
Collaborator

@Disiok Disiok left a comment

Choose a reason for hiding this comment

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

Actually, one minor thing: I think the same can be applied to gpt_index/indices/query/vector_store/base.py. Could you quickly make this change before we merge it in?

@Disiok
Copy link
Collaborator

Disiok commented Mar 14, 2023

Will merge this for now and fix the remaining lines in a follow up PR.

@Disiok Disiok merged commit 0732388 into run-llama:main Mar 14, 2023
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.

None yet

2 participants