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

Langchain x Huggingface: Critical Bug - HuggingFaceEndpoint connects to random mistral-nemo endpoint #29565

Open
5 tasks done
SMAntony opened this issue Feb 3, 2025 · 1 comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature investigate Flagged for investigation.

Comments

@SMAntony
Copy link

SMAntony commented Feb 3, 2025

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

from langchain_huggingface import HuggingFaceEmbeddings

endpoint_url = "https://www.google.com/" #or any random endpoint

llm = HuggingFaceEndpoint(
    name="chat_agent",
    endpoint_url=endpoint_url,
    task="text-generation",
    # callbacks=common_callbacks + self.callbacks,
    # streaming=streaming,
    # stop_sequences=self.stop_sequences,
    seed=None,
    # **self.generation_config,
)

llm.invoke("hi") # goes to a api-inference huggingface Mistral-Nemo-Instruct endpoint
# Not sure if it is designed to be accessed.
# \.venv\Lib\site-packages\huggingface_hub\utils\_deprecation.py:131: FutureWarning: 'post' (from 'huggingface_hub.inference._client') is deprecated and will be removed from version '0.31.0'. Making direct POST requests to the inference server is not supported anymore. Please use task methods instead (e.g. `InferenceClient.chat_completion`). If your use case is not supported, please open an issue in https://github.com/huggingface/huggingface_hub.
#  warnings.warn(warning_message, FutureWarning)
# '\ndef create():\n  while True:\n    name = input("Enter your name: ")\n    if name.isalpha():\n      print(f"Hello, {name}!")\n      break\n    else:\n      print("Invalid name. Please enter a name with only letters.")\n\ncreate()'

Error Message and Stack Trace (if applicable)

No response

Description

  • I am trying to connect to the endpoint url and infer from it
  • But it is connecting to some different huggingface inference api when calling llm.invoke()
  • This shouldn't be the expected behavior

System Info

System Information
------------------
> OS:  Windows
> OS Version:  10.0.26100
> Python Version:  3.11.9 (tags/v3.11.9:de54cf5, Apr  2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]

Package Information
-------------------
> langchain_core: 0.3.33
> langchain: 0.3.17
> langchain_community: 0.3.16
> langsmith: 0.3.4
> langchain_chroma: 0.1.4
> langchain_experimental: 0.3.4
> langchain_huggingface: 0.1.2
> langchain_openai: 0.2.0
> langchain_qdrant: 0.1.4
> langchain_text_splitters: 0.3.5
> langgraph_sdk: 0.1.51

Optional packages not installed
-------------------------------
> langserve

Other Dependencies
------------------
> aiohttp: 3.11.11
> async-timeout: 5.0.1
> chromadb: 0.5.20
> dataclasses-json: 0.6.7
> fastapi: 0.111.0
> fastembed: Installed. No version info available.
> httpx: 0.28.1
> httpx-sse: 0.4.0
> huggingface-hub: 0.28.1
> jsonpatch: 1.33
> langsmith-pyo3: Installed. No version info available.
> numpy: 1.26.4
> openai: 1.61.0
> orjson: 3.10.15
> packaging: 24.2
> pydantic: 2.10.6
> pydantic-settings: 2.7.1
> pytest: Installed. No version info available.
> PyYAML: 6.0.2
> qdrant-client: 1.13.2
> requests: 2.32.3
> requests-toolbelt: 1.0.0
> rich: 13.9.4
> sentence-transformers: 3.4.1
> SQLAlchemy: 2.0.37
> tenacity: 9.0.0
> tiktoken: 0.8.0
> tokenizers: 0.21.0
> transformers: 4.48.2
> typing-extensions: 4.12.2
> zstandard: 0.23.0
@langcarl langcarl bot added the investigate Flagged for investigation. label Feb 3, 2025
@SMAntony SMAntony changed the title Langchain X Huggingface: Critical Bug - HuggingFaceEndpoint connects with random mistral-nemo endpoint Langchain x Huggingface: Critical Bug - HuggingFaceEndpoint connects to random mistral-nemo endpoint Feb 3, 2025
@dosubot dosubot bot added the 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature label Feb 3, 2025
@SMAntony
Copy link
Author

SMAntony commented Feb 3, 2025

I think this is a issue with huggingface_hub. After downgrading to hf_hub version 0.27.0 (from latest), this issue is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature investigate Flagged for investigation.
Projects
None yet
Development

No branches or pull requests

1 participant