mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
fix: Modify the order of init_chat_model import ollama package. (#24977)
This commit is contained in:
parent
fe1820cdaf
commit
54e9ea433a
@ -347,16 +347,14 @@ def _init_chat_model_helper(
|
||||
_check_pkg("langchain_ollama")
|
||||
from langchain_ollama import ChatOllama
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
# For backwards compatibility
|
||||
try:
|
||||
_check_pkg("langchain_community")
|
||||
from langchain_community.chat_models import ChatOllama
|
||||
except ImportError:
|
||||
# If both langchain-ollama and langchain-community aren't available, raise
|
||||
# an error related to langchain-ollama
|
||||
_check_pkg("langchain_ollama")
|
||||
# For backwards compatibility
|
||||
try:
|
||||
_check_pkg("langchain_community")
|
||||
from langchain_community.chat_models import ChatOllama
|
||||
except ImportError:
|
||||
# If both langchain-ollama and langchain-community aren't available,
|
||||
# raise an error related to langchain-ollama
|
||||
_check_pkg("langchain_ollama")
|
||||
|
||||
return ChatOllama(model=model, **kwargs)
|
||||
elif model_provider == "together":
|
||||
|
Loading…
Reference in New Issue
Block a user