Skip to content

Conversation

Warkstee
Copy link

Fix HuggingFace Hub Compatibility Issue

I run local embedding with Hugging Face TEI. I noticed that RAG API fails with 'InferenceClient' object has no attribute 'post' error when using HuggingFace embeddings with HuggingFace Hub version 0.33.1 or later.

Error Details

AttributeError: 'InferenceClient' object has no attribute 'post'
  File "/usr/local/lib/python3.10/site-packages/langchain_huggingface/embeddings/huggingface_endpoint.py", line 112, in embed_documents
    responses = self.client.post(

Root Cause

  • HuggingFace Hub 0.33.1+ removed the post() method from InferenceClient
  • langchain-huggingface==0.1.0 still used the deprecated post() method
  • This created an incompatibility when the base image was updated with newer HuggingFace Hub versions

Solution

Updated LangChain packages to versions compatible with HuggingFace Hub 0.33.1+:

langchain 0.3.12 -> 0.3.26
langchain-community 0.3.12 -> 0.3.26
langchain-core 0.3.27 -> 0.3.66
langchain_text_splitters 0.3.3 -> 0.3.8
langchain-huggingface 0.1.0 -> 0.3.0

Testing

  • RAG API builds successfully
  • HuggingFace embeddings work correctly
  • No breaking changes detected

- Update langchain from 0.3.12 to 0.3.26
- Update langchain-community from 0.3.12 to 0.3.26
- Update langchain-core from 0.3.27 to 0.3.66
- Update langchain_text_splitters from 0.3.3 to 0.3.8
- Update langchain-huggingface from 0.1.0 to 0.3.0

Fixes 'InferenceClient' object has no attribute 'post' error
@Warkstee
Copy link
Author

Warkstee commented Aug 5, 2025

Hi this really is a pretty straight forward fix. I'd kindly appreciate it if someone took a look, so that I can revert back to the main branch. Thank you!

@danny-avila
Copy link
Owner

Hi this really is a pretty straight forward fix. I'd kindly appreciate it if someone took a look, so that I can revert back to the main branch. Thank you!

can you also update requirements.lite.txt ?

Secondly, I might merge this after #170 since it has more extensive package updates.

@danny-avila
Copy link
Owner

Hi this really is a pretty straight forward fix. I'd kindly appreciate it if someone took a look, so that I can revert back to the main branch. Thank you!

can you resolve the merge conflicts @Warkstee ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants