Skip to content

fix(huggingface): avoid hf api calls when using local HuggingFaceEndpoint#35633

Merged
ccurme (ccurme) merged 2 commits intolangchain-ai:masterfrom
dv-gorasiya:fix/huggingface-local-endpoint-no-egress-30333
Mar 29, 2026
Merged

fix(huggingface): avoid hf api calls when using local HuggingFaceEndpoint#35633
ccurme (ccurme) merged 2 commits intolangchain-ai:masterfrom
dv-gorasiya:fix/huggingface-local-endpoint-no-egress-30333

Conversation

@dv-gorasiya
Copy link
Copy Markdown
Contributor

When HuggingFaceEndpoint is used with a local/custom endpoint_url (e.g. TGI on localhost), we don't pass the HF API token into the inference client so it doesn't try to hit Hugging Face. Fixes #30333.

@github-actions github-actions Bot added integration PR made that is related to a provider partner package integration huggingface `langchain-huggingface` package issues & PRs external fix For PRs that implement a fix labels Mar 7, 2026
…oint

When endpoint_url is a local or custom URL we don't pass the HF API token
to the inference client so it doesn't try to hit Hugging Face (fixes 401/404
and egress on air-gapped systems). Fixes langchain-ai#30333.
@dv-gorasiya Darshan Gorasiya (dv-gorasiya) force-pushed the fix/huggingface-local-endpoint-no-egress-30333 branch from d67b0ec to 3737fc8 Compare March 7, 2026 11:20
@dv-gorasiya
Copy link
Copy Markdown
Contributor Author

Related: Dev Patel (@Devpatel1901) and others discussed this on the issue. A detailed workaround/solution was also shared last year here: Solution (TGI/local endpoint). This PR implements the fix in langchain-huggingface so local endpoint_url no longer triggers HF API calls.

@github-actions github-actions Bot added the size: S 50-199 LOC label Mar 9, 2026
@ccurme ccurme (ccurme) merged commit aba72f7 into langchain-ai:master Mar 29, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external 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 size: S 50-199 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ChatHuggingface is reaching out to huggingface when using local HuggingFaceEndpoint

2 participants