File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
libs/langchain/langchain_classic/chat_models Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -406,11 +406,14 @@ def _init_chat_model_helper(
406406 from langchain_mistralai import ChatMistralAI
407407
408408 return ChatMistralAI (model = model , ** kwargs ) # type: ignore[call-arg,unused-ignore]
409+
409410 if model_provider == "huggingface" :
410411 _check_pkg ("langchain_huggingface" )
411- from langchain_huggingface import ChatHuggingFace
412+ from langchain_huggingface import ChatHuggingFace , HuggingFacePipeline
413+
414+ llm = HuggingFacePipeline .from_model_id (model_id = model , ** kwargs )
415+ return ChatHuggingFace (llm = llm )
412416
413- return ChatHuggingFace (model_id = model , ** kwargs )
414417 if model_provider == "groq" :
415418 _check_pkg ("langchain_groq" )
416419 from langchain_groq import ChatGroq
You can’t perform that action at this time.
0 commit comments