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

HuggingFaceBgeEmbeddings was marked as deprecated without proper replacement #29768

Open
5 tasks done
sam-bercovici opened this issue Feb 13, 2025 · 0 comments
Open
5 tasks done

Comments

@sam-bercovici
Copy link

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

The following code will generate the warning bellow:

from langchain_community.embeddings import HuggingFaceBgeEmbeddings

e = HuggingFaceBgeEmbeddings(model_name="BAAI/bge-m3", model_kwargs = {'trust_remote_code': True}, encode_kwargs= {'normalize_embeddings': True}, query_instruction='')

Warning:
LangChainDeprecationWarning: The class HuggingFaceBgeEmbeddings was deprecated in LangChain 0.2.2 and will be removed in 1.0. An updated version of the class exists in the :class:~langchain-huggingface package and should be used instead. To use it run pip install -U :class:~langchain-huggingface and import as from :class:~langchain_huggingface import HuggingFaceEmbeddings

The warning suggest to switch to use HuggingFaceEmbeddings, but it does not have support for the query_instruction parameter.

How can I pass the query_instruction and/or embed_instruction using HuggingFaceEmbeddings ?

Error Message and Stack Trace (if applicable)

Warning:
LangChainDeprecationWarning: The class HuggingFaceBgeEmbeddings was deprecated in LangChain 0.2.2 and will be removed in 1.0. An updated version of the class exists in the :class:~langchain-huggingface package and should be used instead. To use it run pip install -U :class:~langchain-huggingface and import as from :class:~langchain_huggingface import HuggingFaceEmbeddings

Description

  • using the "BAAI/bge-m3" and getting a warning.

System Info

python -m langchain_core.sys_info

System Information

OS: Linux
OS Version: #1 SMP Tue Nov 5 00:21:55 UTC 2024
Python Version: 3.12.8 | packaged by conda-forge | (main, Dec 5 2024, 14:24:40) [GCC 13.3.0]

Package Information

langchain_core: 0.3.33
langchain: 0.3.17
langchain_community: 0.3.16
langsmith: 0.1.125
langchain_anthropic: 0.3.5
langchain_chroma: 0.2.1
langchain_experimental: 0.3.4
langchain_groq: 0.2.3
langchain_huggingface: 0.1.2
langchain_ollama: 0.2.3
langchain_openai: 0.3.3
langchain_text_splitters: 0.3.4
langchain_xai: 0.2.0

Optional packages not installed

langserve

Other Dependencies

aiohttp: 3.10.5
anthropic: 0.42.0
async-timeout: Installed. No version info available.
chromadb: 0.6.3
dataclasses-json: 0.6.7
defusedxml: 0.7.1
fastapi: 0.115.0
groq: 0.11.0
httpx: 0.27.2
httpx-sse: 0.4.0
huggingface-hub: 0.25.1
jsonpatch: 1.33
numpy: 1.26.4
ollama: 0.4.4
openai: 1.61.0
orjson: 3.10.7
packaging: 24.1
pydantic: 2.9.2
pydantic-settings: 2.5.2
PyYAML: 6.0.2
requests: 2.32.3
sentence-transformers: 3.4.1
SQLAlchemy: 2.0.35
tenacity: 8.5.0
tiktoken: 0.7.0
tokenizers: 0.21.0
transformers: 4.48.2
typing-extensions: 4.12.2

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

No branches or pull requests

1 participant