langchain/libs/community/langchain_community/llms
Miroslav aee55eda39
community: Skip Login to HuggubgFaceHub when token is not set (#21561)
Thank you for contributing to LangChain!

- [ ] **HuggingFaceEndpoint**: "Skip Login to HuggingFaceHub"
  - Where:  langchain, community, llm, huggingface_endpoint
 


- [ ] **PR message**: ***Delete this entire checklist*** and replace
with
- **Description:** Skip login to huggingface hub when when
`huggingfacehub_api_token` is not set. This is needed when using custom
`endpoint_url` outside of HuggingFaceHub.
- **Issue:** the issue # it fixes
https://github.com/langchain-ai/langchain/issues/20342 and
https://github.com/langchain-ai/langchain/issues/19685
    - **Dependencies:** None


- [ ] **Add tests and docs**: 
  1. Tested with locally available TGI endpoint
  2.  Example Usage
```python
from langchain_community.llms import HuggingFaceEndpoint

llm = HuggingFaceEndpoint(
    endpoint_url='http://localhost:8080',
    server_kwargs={
        "headers": {"Content-Type": "application/json"}
    }
)
resp = llm.invoke("Tell me a joke")
print(resp)
```
 Also tested against HF Endpoints
 ```python
 from langchain_community.llms import HuggingFaceEndpoint
huggingfacehub_api_token = "hf_xyz"
repo_id = "mistralai/Mistral-7B-Instruct-v0.2"
llm = HuggingFaceEndpoint(
    huggingfacehub_api_token=huggingfacehub_api_token,
    repo_id=repo_id,
)
resp = llm.invoke("Tell me a joke")
print(resp)
 ```
Additional guidelines:
- Make sure optional dependencies are imported within a function.
- Please do not add dependencies to pyproject.toml files (even optional
ones) unless they are required for unit tests.
- Most PRs should not touch more than one package.
- Changes should be backwards compatible.
- If you are adding something to community, do not re-import it in
langchain.

If no one reviews your PR within a few days, please @-mention one of
baskaryan, efriis, eyurtsev, hwchase17.

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-07-12 22:10:32 +00:00
..
grammars community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 2023-12-11 13:53:30 -08:00
__init__.py community: minor changes sambanova integration (#21231) 2024-05-06 13:28:35 -07:00
ai21.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
aleph_alpha.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
amazon_api_gateway.py community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 2023-12-11 13:53:30 -08:00
anthropic.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
anyscale.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
aphrodite.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
arcee.py community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 2023-12-11 13:53:30 -08:00
aviary.py community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 2023-12-11 13:53:30 -08:00
azureml_endpoint.py infra: rm unused # noqa violations (#22049) 2024-05-22 15:21:08 -07:00
baichuan.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
baidu_qianfan_endpoint.py community[patch]: QianfanLLMEndpoint fix type information for the keys (#24128) 2024-07-11 16:24:26 +00:00
bananadev.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
baseten.py community: refactor Baseten integration with new API endpoints & docs (#15017) 2023-12-22 12:46:24 -08:00
beam.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
bedrock.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
bigdl_llm.py community[minor]: import fix (#20995) 2024-04-29 10:32:50 -04:00
bittensor.py community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 2023-12-11 13:53:30 -08:00
cerebriumai.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
chatglm3.py patch: remove usage of llm, chat model __call__ (#20788) 2024-04-24 19:39:23 -04:00
chatglm.py patch: remove usage of llm, chat model __call__ (#20788) 2024-04-24 19:39:23 -04:00
clarifai.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
cloudflare_workersai.py community[patch]: docstrings update (#20301) 2024-04-11 16:23:27 -04:00
cohere.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
ctransformers.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
ctranslate2.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
databricks.py infra: update mypy 1.10, ruff 0.5 (#23721) 2024-07-03 10:33:27 -07:00
deepinfra.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
deepsparse.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
edenai.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
exllamav2.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
fake.py community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 2023-12-11 13:53:30 -08:00
fireworks.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
forefrontai.py community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 2023-12-11 13:53:30 -08:00
friendli.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
gigachat.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
google_palm.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
gooseai.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
gpt4all.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
gradient_ai.py community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 2023-12-11 13:53:30 -08:00
huggingface_endpoint.py community: Skip Login to HuggubgFaceHub when token is not set (#21561) 2024-07-12 22:10:32 +00:00
huggingface_hub.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
huggingface_pipeline.py [HuggingFace Pipeline] add streaming support (#23852) 2024-07-09 17:02:00 -04:00
huggingface_text_gen_inference.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
human.py community[patch]: docstrings update (#20301) 2024-04-11 16:23:27 -04:00
ipex_llm.py community[minor]: import fix (#20995) 2024-04-29 10:32:50 -04:00
javelin_ai_gateway.py community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 2023-12-11 13:53:30 -08:00
koboldai.py patch: remove usage of llm, chat model __call__ (#20788) 2024-04-24 19:39:23 -04:00
konko.py infra: update mypy 1.10, ruff 0.5 (#23721) 2024-07-03 10:33:27 -07:00
layerup_security.py infra: update mypy 1.10, ruff 0.5 (#23721) 2024-07-03 10:33:27 -07:00
llamacpp.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
llamafile.py core, openai: support custom token encoders (#20762) 2024-04-23 13:57:05 +00:00
loading.py infra: update mypy 1.10, ruff 0.5 (#23721) 2024-07-03 10:33:27 -07:00
manifest.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
minimax.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
mlflow_ai_gateway.py community[patch]: docstrings update (#20301) 2024-04-11 16:23:27 -04:00
mlflow.py community[patch]: docstrings update (#20301) 2024-04-11 16:23:27 -04:00
mlx_pipeline.py community[patch]: Fix MLX LLM Stream (#20575) 2024-05-20 17:17:08 -07:00
modal.py community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 2023-12-11 13:53:30 -08:00
moonshot.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
mosaicml.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
nlpcloud.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
oci_data_science_model_deployment_endpoint.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
oci_generative_ai.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
octoai_endpoint.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
ollama.py Update ollama.py with optional raw setting. (#21486) 2024-06-14 17:19:26 -07:00
opaqueprompts.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
openai.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
openllm.py infra: update mypy 1.10, ruff 0.5 (#23721) 2024-07-03 10:33:27 -07:00
openlm.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
pai_eas_endpoint.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
petals.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
pipelineai.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
predibase.py community: Support both Predibase SDK-v1 and SDK-v2 in Predibase-LangChain integration (#20859) 2024-04-24 13:31:01 -07:00
predictionguard.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
promptlayer_openai.py community[patch]: docstrings update (#20301) 2024-04-11 16:23:27 -04:00
replicate.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
rwkv.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
sagemaker_endpoint.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
sambanova.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
self_hosted_hugging_face.py community[minor]: import fix (#20995) 2024-04-29 10:32:50 -04:00
self_hosted.py ci: Add script to check for pickle usage in community (#22863) 2024-06-13 16:13:15 -04:00
solar.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
sparkllm.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
stochasticai.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
symblai_nebula.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
textgen.py community[patch]: upgrade to recent version of mypy (#21616) 2024-05-13 14:55:07 -04:00
titan_takeoff.py community[patch]: upgrade to recent version of mypy (#21616) 2024-05-13 14:55:07 -04:00
together.py infra: update mypy 1.10, ruff 0.5 (#23721) 2024-07-03 10:33:27 -07:00
tongyi.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
utils.py infra: update mypy 1.10, ruff 0.5 (#23721) 2024-07-03 10:33:27 -07:00
vertexai.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
vllm.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
volcengine_maas.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
watsonxllm.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
weight_only_quantization.py community[minor]: import fix (#20995) 2024-04-29 10:32:50 -04:00
writer.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
xinference.py community[patch]: upgrade to recent version of mypy (#21616) 2024-05-13 14:55:07 -04:00
yandex.py core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841) 2024-07-08 16:09:29 -04:00
yuan2.py patch: remove usage of llm, chat model __call__ (#20788) 2024-04-24 19:39:23 -04:00