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

query mode "embedding" not supported by GPTSimpleVectorIndex? #222

Closed
adamsussman opened this issue Jan 14, 2023 · 4 comments · Fixed by #223
Closed

query mode "embedding" not supported by GPTSimpleVectorIndex? #222

adamsussman opened this issue Jan 14, 2023 · 4 comments · Fixed by #223

Comments

@adamsussman
Copy link

According to the documentation, GPTSimpleVectorIndex may be queried with "embedding" mode (last example of https://gpt-index.readthedocs.io/en/latest/how_to/embeddings.html). However when I do so, I get an error.

embed_model = LangchainEmbedding(HuggingFaceEmbeddings())
index = GPTSimpleVectorIndex.load_from_disk(
    save_path="index.json",
    embed_model=embed_model,
)

response = index.query(
    query_string,     
    mode="embedding",
)

error:

  File "/usr/local/lib/python3.10/site-packages/gpt_index/indices/base.py", line 334, in query
    return query_runner.query(query_str, self._index_struct)
  File "/usr/local/lib/python3.10/site-packages/gpt_index/indices/query/query_runner.py", line 100, in query
    query_cls = get_query_cls(index_struct_type, mode)
  File "/usr/local/lib/python3.10/site-packages/gpt_index/indices/query/query_map.py", line 79, in get_query_cls
    return MODE_TO_QUERY_MAP_SIMPLE[mode]

Is this an actual error or is it not possible/recommended to use embeddings with GPTSimpleVectorIndex? If I use Tree or List indices, then when I save them to disk, there are no actual embeddings, so I am confused on the correct set of classes to use for top-k embedding based queries.

@jerryjliu
Copy link
Collaborator

jerryjliu commented Jan 14, 2023

oh the mode="default" already does embedding-based lookup for GPTSimpleVectorIndex (since the entire index is centered around storing embeddings for text chunks and retrieving them). I can make this more clear in the docstring if that helps?

@adamsussman
Copy link
Author

That would definitely help. Or just accept both silently? Either way, its good to know that "default" means different things for different indices.

@adamsussman
Copy link
Author

But, also please correct the documentation, since the example does not work as written.

@jerryjliu
Copy link
Collaborator

yes will do!

viveksilimkhan1 pushed a commit to viveksilimkhan1/llama_index that referenced this issue Oct 30, 2023
* Fix Falcon HF warnings.

* Remove commented line.
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 a pull request may close this issue.

2 participants