langchain/libs/partners/huggingface
Lucain a2023a1e96
huggingface; fix huggingface_endpoint.py (initialize clients only with supported kwargs) (#26378)
## Description

By default, `HuggingFaceEndpoint` instantiates both the
`InferenceClient` and the `AsyncInferenceClient` with the
`"server_kwargs"` passed as input. This is an issue as both clients
might not support exactly the same kwargs. This has been highlighted in
https://github.com/huggingface/huggingface_hub/issues/2522 by
@morgandiverrez with the `trust_env` parameter. In order to make
`langchain` integration future-proof, I do think it's wiser to forward
only the supported parameters to each client. Parameters that are not
supported are simply ignored with a warning to the user. From a
`huggingface_hub` maintenance perspective, this allows us much more
flexibility as we are not constrained to support the exact same kwargs
in both clients.

## Issue

https://github.com/huggingface/huggingface_hub/issues/2522

## Dependencies

None

## Twitter 

https://x.com/Wauplin

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-09-20 16:05:24 -07:00
..
langchain_huggingface huggingface; fix huggingface_endpoint.py (initialize clients only with supported kwargs) (#26378) 2024-09-20 16:05:24 -07:00
scripts multiple: pydantic 2 compatibility, v0.3 (#26443) 2024-09-13 14:38:45 -07:00
tests huggingface[patch]: xfail test (#26479) 2024-09-13 23:16:06 +00:00
.gitignore huggingface: init package (#21097) 2024-05-13 20:53:15 +00:00
LICENSE huggingface: init package (#21097) 2024-05-13 20:53:15 +00:00
Makefile standard-tests[patch]: add Ser/Des test 2024-09-04 10:24:06 -07:00
poetry.lock huggingface: release 0.1 (#26463) 2024-09-13 22:39:49 +00:00
pyproject.toml huggingface: release 0.1 (#26463) 2024-09-13 22:39:49 +00:00
README.md huggingface: init package (#21097) 2024-05-13 20:53:15 +00:00

langchain-huggingface

This package contains the LangChain integrations for huggingface related classes.

Installation and Setup

  • Install the LangChain partner package
pip install langchain-huggingface