This PR adds support for asymmetric embeddings in the HuggingFace models used in LlamaIndex. Asymmetric embeddings allow for different models or parameters to be used for query and passage (document) embeddings, which is useful for tasks like semantic search.
Changes Made
Modified the HuggingFaceLLM class in llama_index/llms/huggingface.py to support different models or parameters for query and passage embeddings.
Modified the ServiceContext class in llama_index/indices/service_context.py to allow setting different models or parameters for query and passage embeddings.
Updated the documentation in docs/core_modules/model_modules/embeddings/usage_pattern.md and docs/core_modules/model_modules/embeddings/root.md to reflect the new feature of asymmetric embeddings.
Testing
Tested the changes with the BEIR benchmark to ensure compatibility and correctness.
Description
This PR adds support for asymmetric embeddings in the HuggingFace models used in LlamaIndex. Asymmetric embeddings allow for different models or parameters to be used for query and passage (document) embeddings, which is useful for tasks like semantic search.
Changes Made
HuggingFaceLLM
class inllama_index/llms/huggingface.py
to support different models or parameters for query and passage embeddings.ServiceContext
class inllama_index/indices/service_context.py
to allow setting different models or parameters for query and passage embeddings.docs/core_modules/model_modules/embeddings/usage_pattern.md
anddocs/core_modules/model_modules/embeddings/root.md
to reflect the new feature of asymmetric embeddings.Testing
Related Issue
This PR addresses issue #13.
Checklist
Fixes #13.
To checkout this PR branch, run the following command in your terminal: