The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
langchain[patch]: init_chat_model() to import ChatOllama from langchain-ollama and fallback on langchain-community (#24821)
Jerron Limd8f3ea82db25
diff --git a/libs/langchain/langchain/chat_models/base.py b/libs/langchain/langchain/chat_models/base.pyindex 9a3f8b7151..82730f6eea 100644--- a/libs/langchain/langchain/chat_models/base.py+++ b/libs/langchain/langchain/chat_models/base.py@@ -118,7 +118,7 @@ def init_chat_model(- mistralai (langchain-mistralai)- huggingface (langchain-huggingface)- groq (langchain-groq)- - ollama (langchain-community)+ - ollama (langchain-ollama)Will attempt to infer model_provider from model if not specified. Thefollowing providers will be inferred based on these model prefixes:@@ -336,8 +336,12 @@ def _init_chat_model_helper(return ChatFireworks(model=model, **kwargs)elif model_provider == "ollama":- _check_pkg("langchain_community")- from langchain_community.chat_models import ChatOllama+ try:+ _check_pkg("langchain_ollama")+ from langchain_ollama import ChatOllama+ except ImportError:+ _check_pkg("langchain_community")+ from langchain_community import ChatOllamareturn ChatOllama(model=model, **kwargs)elif model_provider == "together":