-
Notifications
You must be signed in to change notification settings - Fork 19.2k
docs(huggingface): add chat usage guide and regression tests for init_chat_model #33194
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
Open
Accidental-MVP
wants to merge
9
commits into
langchain-ai:master
Choose a base branch
from
Accidental-MVP:tests/hf-init-chat-model
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
docs(huggingface): add chat usage guide and regression tests for init_chat_model #33194
Accidental-MVP
wants to merge
9
commits into
langchain-ai:master
from
Accidental-MVP:tests/hf-init-chat-model
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for GitHub.
|
init_chat_model
; docs(huggingface): add chat usage guide4968b4e
to
9de7872
Compare
We've moved docs away from this repo - see https://github.com/langchain-ai/docs |
thanks! I’ll move the docs to langchain-ai/docs and keep this PR tests-only. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
documentation
Improvements or additions to documentation
langchain
Related to the package `langchain`
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add offline unit tests documenting the current Hugging Face initialization bug and a short docs page for HF chat usage.
Tests (unit, offline)
libs/langchain/tests/unit_tests/chat_models/test_init_chat_model_hf.py
.transformers.pipeline
andlangchain_huggingface.chat_models.huggingface.ChatHuggingFace
viamonkeypatch.setitem(sys.modules, ...)
.importlib.util.find_spec
so nested modules are treated as installed.task="text-generation"
explicitly to avoid default drift.TypeError
(sinceChatHuggingFace
is constructed withoutllm
):init_chat_model(..., model_provider="huggingface")
raisesmax_tokens
present (documenting themax_tokens → max_new_tokens
expectation)timeout
/max_retries
present (they shouldn't be sent to the pipeline)Docs
docs/docs/integrations/chat/huggingface.mdx
following the required template sections:transformers.pipeline
→ChatHuggingFace(llm=...)
.init_chat_model(..., model_provider="huggingface")
usage, clearly gated as future.langchain-huggingface
,transformers
) and prefermax_new_tokens
overmax_tokens
.Issue
Refs #28226
Related: #33167, #32941
Dependencies
None.
Test plan
Local (Windows/PowerShell), using the repo's
uv
test group:Expected: 3 passed (they assert the current
TypeError
), no hard failures.Lint & CI
ruff
locally:py -m pipx run ruff check libs/langchain/tests/unit_tests/chat_models/test_init_chat_model_hf.py --fix
py -m pipx run ruff format libs/langchain/tests/unit_tests/chat_models/test_init_chat_model_hf.py
Notes for reviewers
pytest.raises(TypeError)
) so we can flip them to assert the fixed behavior once the upstream change merges (pipeline created and passed asllm=...
).