Skip to content

Conversation

@MirrorDNA-Reflection-Protocol
Copy link
Contributor

Fixes #28226.

Issue: 'init_chat_model' was hardcoded to use 'HuggingFacePipeline', causing failures when users expected endpoint usage or when dependencies were mismatched.

Fix:

  1. Added 'ChatHuggingFace.from_model_id' factory method to 'langchain_huggingface' to support 'pipeline', 'endpoint', and 'text-gen' backends via a unified interface.
  2. Updated 'init_chat_model' helper to use this factory, passing kwargs correctly.

Verified:
Verified logic with local isolated reproduction script (due to env constraints).

@github-actions github-actions bot added integration PR made that is related to a provider partner package integration langchain-classic huggingface `langchain-huggingface` package issues & PRs fix For PRs that implement a fix labels Dec 9, 2025
@MirrorDNA-Reflection-Protocol MirrorDNA-Reflection-Protocol changed the title fix(chat_models): Helper logic for init_chat_model with HuggingFace fix(huggingface): Helper logic for init_chat_model with HuggingFace backend Dec 9, 2025
@github-actions github-actions bot added fix For PRs that implement a fix and removed fix For PRs that implement a fix labels Dec 9, 2025
@github-actions github-actions bot added the langchain `langchain` package issues & PRs label Dec 12, 2025
@ccurme ccurme merged commit bf6a5eb into langchain-ai:master Dec 12, 2025
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix For PRs that implement a fix huggingface `langchain-huggingface` package issues & PRs integration PR made that is related to a provider partner package integration langchain `langchain` package issues & PRs langchain-classic

Projects

None yet

Development

Successfully merging this pull request may close these issues.

init_chat_model doesn't work with huggingface models

2 participants