The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
langchain[patch]: Migrate chat models to optional community imports (#21090)
Eugene Yurtsev57e8e70daad6
diff --git a/libs/langchain/langchain/chat_models/anthropic.py b/libs/langchain/langchain/chat_models/anthropic.pyindex 2a1f287ffd..aa92589617 100644--- a/libs/langchain/langchain/chat_models/anthropic.py+++ b/libs/langchain/langchain/chat_models/anthropic.py@@ -1,7 +1,28 @@-from langchain_community.chat_models.anthropic import (- ChatAnthropic,- convert_messages_to_prompt_anthropic,-)+from typing import TYPE_CHECKING, Any++from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.anthropic import (+ ChatAnthropic,+ convert_messages_to_prompt_anthropic,+ )++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "convert_messages_to_prompt_anthropic": "langchain_community.chat_models.anthropic",+ "ChatAnthropic": "langchain_community.chat_models.anthropic",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+__all__ = ["convert_messages_to_prompt_anthropic",diff --git a/libs/langchain/langchain/chat_models/anyscale.py b/libs/langchain/langchain/chat_models/anyscale.pyindex d49021b4cb..279b3be853 100644--- a/libs/langchain/langchain/chat_models/anyscale.py+++ b/libs/langchain/langchain/chat_models/anyscale.py@@ -1,5 +1,23 @@-from langchain_community.chat_models.anyscale import (- ChatAnyscale,-)+from typing import TYPE_CHECKING, Any-__all__ = ["ChatAnyscale"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.anyscale import ChatAnyscale++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"ChatAnyscale": "langchain_community.chat_models.anyscale"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "ChatAnyscale",+]diff --git a/libs/langchain/langchain/chat_models/azure_openai.py b/libs/langchain/langchain/chat_models/azure_openai.pyindex 42380cd0e5..93441c7e49 100644--- a/libs/langchain/langchain/chat_models/azure_openai.py+++ b/libs/langchain/langchain/chat_models/azure_openai.py@@ -1,3 +1,23 @@-from langchain_community.chat_models.azure_openai import AzureChatOpenAI+from typing import TYPE_CHECKING, Any-__all__ = ["AzureChatOpenAI"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.azure_openai import AzureChatOpenAI++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"AzureChatOpenAI": "langchain_community.chat_models.azure_openai"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "AzureChatOpenAI",+]diff --git a/libs/langchain/langchain/chat_models/azureml_endpoint.py b/libs/langchain/langchain/chat_models/azureml_endpoint.pyindex 4acdfad01f..ebcc0fdccd 100644--- a/libs/langchain/langchain/chat_models/azureml_endpoint.py+++ b/libs/langchain/langchain/chat_models/azureml_endpoint.py@@ -1,6 +1,30 @@-from langchain_community.chat_models.azureml_endpoint import (- AzureMLChatOnlineEndpoint,- LlamaContentFormatter,-)+from typing import TYPE_CHECKING, Any-__all__ = ["LlamaContentFormatter", "AzureMLChatOnlineEndpoint"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.azureml_endpoint import (+ AzureMLChatOnlineEndpoint,+ LlamaContentFormatter,+ )++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "LlamaContentFormatter": "langchain_community.chat_models.azureml_endpoint",+ "AzureMLChatOnlineEndpoint": "langchain_community.chat_models.azureml_endpoint",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "LlamaContentFormatter",+ "AzureMLChatOnlineEndpoint",+]diff --git a/libs/langchain/langchain/chat_models/baichuan.py b/libs/langchain/langchain/chat_models/baichuan.pyindex 4448858193..bee1ba3f5f 100644--- a/libs/langchain/langchain/chat_models/baichuan.py+++ b/libs/langchain/langchain/chat_models/baichuan.py@@ -1,6 +1,22 @@-from langchain_community.chat_models.baichuan import (- ChatBaichuan,-)+from typing import TYPE_CHECKING, Any++from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.baichuan import ChatBaichuan++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"ChatBaichuan": "langchain_community.chat_models.baichuan"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+__all__ = ["ChatBaichuan",diff --git a/libs/langchain/langchain/chat_models/baidu_qianfan_endpoint.py b/libs/langchain/langchain/chat_models/baidu_qianfan_endpoint.pyindex ba3a023ec8..e9db4d9bc6 100644--- a/libs/langchain/langchain/chat_models/baidu_qianfan_endpoint.py+++ b/libs/langchain/langchain/chat_models/baidu_qianfan_endpoint.py@@ -1,5 +1,27 @@-from langchain_community.chat_models.baidu_qianfan_endpoint import (- QianfanChatEndpoint,-)+from typing import TYPE_CHECKING, Any-__all__ = ["QianfanChatEndpoint"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.baidu_qianfan_endpoint import (+ QianfanChatEndpoint,+ )++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "QianfanChatEndpoint": "langchain_community.chat_models.baidu_qianfan_endpoint"+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "QianfanChatEndpoint",+]diff --git a/libs/langchain/langchain/chat_models/bedrock.py b/libs/langchain/langchain/chat_models/bedrock.pyindex 4b0f49a147..d2d2817284 100644--- a/libs/langchain/langchain/chat_models/bedrock.py+++ b/libs/langchain/langchain/chat_models/bedrock.py@@ -1,3 +1,27 @@-from langchain_community.chat_models.bedrock import BedrockChat, ChatPromptAdapter+from typing import TYPE_CHECKING, Any-__all__ = ["ChatPromptAdapter", "BedrockChat"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.bedrock import BedrockChat, ChatPromptAdapter++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "ChatPromptAdapter": "langchain_community.chat_models.bedrock",+ "BedrockChat": "langchain_community.chat_models.bedrock",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "ChatPromptAdapter",+ "BedrockChat",+]diff --git a/libs/langchain/langchain/chat_models/cohere.py b/libs/langchain/langchain/chat_models/cohere.pyindex 63cbc46711..b43df81d43 100644--- a/libs/langchain/langchain/chat_models/cohere.py+++ b/libs/langchain/langchain/chat_models/cohere.py@@ -1,5 +1,23 @@-from langchain_community.chat_models.cohere import (- ChatCohere,-)+from typing import TYPE_CHECKING, Any-__all__ = ["ChatCohere"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.cohere import ChatCohere++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"ChatCohere": "langchain_community.chat_models.cohere"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "ChatCohere",+]diff --git a/libs/langchain/langchain/chat_models/databricks.py b/libs/langchain/langchain/chat_models/databricks.pyindex b73d49b04b..58dc3f3b75 100644--- a/libs/langchain/langchain/chat_models/databricks.py+++ b/libs/langchain/langchain/chat_models/databricks.py@@ -1,3 +1,23 @@-from langchain_community.chat_models.databricks import ChatDatabricks+from typing import TYPE_CHECKING, Any-__all__ = ["ChatDatabricks"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.databricks import ChatDatabricks++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"ChatDatabricks": "langchain_community.chat_models.databricks"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "ChatDatabricks",+]diff --git a/libs/langchain/langchain/chat_models/ernie.py b/libs/langchain/langchain/chat_models/ernie.pyindex 6dbdb34e07..284af4a62c 100644--- a/libs/langchain/langchain/chat_models/ernie.py+++ b/libs/langchain/langchain/chat_models/ernie.py@@ -1,3 +1,23 @@-from langchain_community.chat_models.ernie import ErnieBotChat+from typing import TYPE_CHECKING, Any-__all__ = ["ErnieBotChat"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.ernie import ErnieBotChat++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"ErnieBotChat": "langchain_community.chat_models.ernie"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "ErnieBotChat",+]diff --git a/libs/langchain/langchain/chat_models/everlyai.py b/libs/langchain/langchain/chat_models/everlyai.pyindex edeeea78ea..87c11debf5 100644--- a/libs/langchain/langchain/chat_models/everlyai.py+++ b/libs/langchain/langchain/chat_models/everlyai.py@@ -1,5 +1,23 @@-from langchain_community.chat_models.everlyai import (- ChatEverlyAI,-)+from typing import TYPE_CHECKING, Any-__all__ = ["ChatEverlyAI"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.everlyai import ChatEverlyAI++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"ChatEverlyAI": "langchain_community.chat_models.everlyai"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "ChatEverlyAI",+]diff --git a/libs/langchain/langchain/chat_models/fake.py b/libs/langchain/langchain/chat_models/fake.pyindex 24c98e115d..261d5fa5f3 100644--- a/libs/langchain/langchain/chat_models/fake.py+++ b/libs/langchain/langchain/chat_models/fake.py@@ -1,6 +1,30 @@-from langchain_community.chat_models.fake import (- FakeListChatModel,- FakeMessagesListChatModel,-)+from typing import TYPE_CHECKING, Any-__all__ = ["FakeMessagesListChatModel", "FakeListChatModel"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.fake import (+ FakeListChatModel,+ FakeMessagesListChatModel,+ )++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "FakeMessagesListChatModel": "langchain_community.chat_models.fake",+ "FakeListChatModel": "langchain_community.chat_models.fake",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "FakeMessagesListChatModel",+ "FakeListChatModel",+]diff --git a/libs/langchain/langchain/chat_models/fireworks.py b/libs/langchain/langchain/chat_models/fireworks.pyindex 0e5fd2cefc..a3908b2a87 100644--- a/libs/langchain/langchain/chat_models/fireworks.py+++ b/libs/langchain/langchain/chat_models/fireworks.py@@ -1,6 +1,22 @@-from langchain_community.chat_models.fireworks import (- ChatFireworks,-)+from typing import TYPE_CHECKING, Any++from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.fireworks import ChatFireworks++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"ChatFireworks": "langchain_community.chat_models.fireworks"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+__all__ = ["ChatFireworks",diff --git a/libs/langchain/langchain/chat_models/gigachat.py b/libs/langchain/langchain/chat_models/gigachat.pyindex 9dff7f28eb..a59eda70b0 100644--- a/libs/langchain/langchain/chat_models/gigachat.py+++ b/libs/langchain/langchain/chat_models/gigachat.py@@ -1,5 +1,23 @@-from langchain_community.chat_models.gigachat import (- GigaChat,-)+from typing import TYPE_CHECKING, Any-__all__ = ["GigaChat"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.gigachat import GigaChat++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"GigaChat": "langchain_community.chat_models.gigachat"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "GigaChat",+]diff --git a/libs/langchain/langchain/chat_models/google_palm.py b/libs/langchain/langchain/chat_models/google_palm.pyindex 6acab6dee7..e9bb012c2b 100644--- a/libs/langchain/langchain/chat_models/google_palm.py+++ b/libs/langchain/langchain/chat_models/google_palm.py@@ -1,6 +1,30 @@-from langchain_community.chat_models.google_palm import (- ChatGooglePalm,- ChatGooglePalmError,-)+from typing import TYPE_CHECKING, Any-__all__ = ["ChatGooglePalm", "ChatGooglePalmError"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.google_palm import (+ ChatGooglePalm,+ ChatGooglePalmError,+ )++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "ChatGooglePalm": "langchain_community.chat_models.google_palm",+ "ChatGooglePalmError": "langchain_community.chat_models.google_palm",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "ChatGooglePalm",+ "ChatGooglePalmError",+]diff --git a/libs/langchain/langchain/chat_models/human.py b/libs/langchain/langchain/chat_models/human.pyindex 2b7448ca91..e3752193b3 100644--- a/libs/langchain/langchain/chat_models/human.py+++ b/libs/langchain/langchain/chat_models/human.py@@ -1,5 +1,23 @@-from langchain_community.chat_models.human import (- HumanInputChatModel,-)+from typing import TYPE_CHECKING, Any-__all__ = ["HumanInputChatModel"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.human import HumanInputChatModel++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"HumanInputChatModel": "langchain_community.chat_models.human"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "HumanInputChatModel",+]diff --git a/libs/langchain/langchain/chat_models/hunyuan.py b/libs/langchain/langchain/chat_models/hunyuan.pyindex a5a7d121ae..53fe84548d 100644--- a/libs/langchain/langchain/chat_models/hunyuan.py+++ b/libs/langchain/langchain/chat_models/hunyuan.py@@ -1,6 +1,22 @@-from langchain_community.chat_models.hunyuan import (- ChatHunyuan,-)+from typing import TYPE_CHECKING, Any++from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.hunyuan import ChatHunyuan++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"ChatHunyuan": "langchain_community.chat_models.hunyuan"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+__all__ = ["ChatHunyuan",diff --git a/libs/langchain/langchain/chat_models/javelin_ai_gateway.py b/libs/langchain/langchain/chat_models/javelin_ai_gateway.pyindex 131e3c33a8..0f89edbdf1 100644--- a/libs/langchain/langchain/chat_models/javelin_ai_gateway.py+++ b/libs/langchain/langchain/chat_models/javelin_ai_gateway.py@@ -1,6 +1,30 @@-from langchain_community.chat_models.javelin_ai_gateway import (- ChatJavelinAIGateway,- ChatParams,-)+from typing import TYPE_CHECKING, Any-__all__ = ["ChatJavelinAIGateway", "ChatParams"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.javelin_ai_gateway import (+ ChatJavelinAIGateway,+ ChatParams,+ )++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "ChatJavelinAIGateway": "langchain_community.chat_models.javelin_ai_gateway",+ "ChatParams": "langchain_community.chat_models.javelin_ai_gateway",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "ChatJavelinAIGateway",+ "ChatParams",+]diff --git a/libs/langchain/langchain/chat_models/jinachat.py b/libs/langchain/langchain/chat_models/jinachat.pyindex 816dfa55c5..dba660e199 100644--- a/libs/langchain/langchain/chat_models/jinachat.py+++ b/libs/langchain/langchain/chat_models/jinachat.py@@ -1,6 +1,22 @@-from langchain_community.chat_models.jinachat import (- JinaChat,-)+from typing import TYPE_CHECKING, Any++from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.jinachat import JinaChat++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"JinaChat": "langchain_community.chat_models.jinachat"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+__all__ = ["JinaChat",diff --git a/libs/langchain/langchain/chat_models/konko.py b/libs/langchain/langchain/chat_models/konko.pyindex 4f7d5c2cb7..fd5ba7c450 100644--- a/libs/langchain/langchain/chat_models/konko.py+++ b/libs/langchain/langchain/chat_models/konko.py@@ -1,5 +1,23 @@-from langchain_community.chat_models.konko import (- ChatKonko,-)+from typing import TYPE_CHECKING, Any-__all__ = ["ChatKonko"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.konko import ChatKonko++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"ChatKonko": "langchain_community.chat_models.konko"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "ChatKonko",+]diff --git a/libs/langchain/langchain/chat_models/litellm.py b/libs/langchain/langchain/chat_models/litellm.pyindex 87e4ad7347..69ebcd9163 100644--- a/libs/langchain/langchain/chat_models/litellm.py+++ b/libs/langchain/langchain/chat_models/litellm.py@@ -1,3 +1,30 @@-from langchain_community.chat_models.litellm import ChatLiteLLM, ChatLiteLLMException+from typing import TYPE_CHECKING, Any-__all__ = ["ChatLiteLLM", "ChatLiteLLMException"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.litellm import (+ ChatLiteLLM,+ ChatLiteLLMException,+ )++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "ChatLiteLLM": "langchain_community.chat_models.litellm",+ "ChatLiteLLMException": "langchain_community.chat_models.litellm",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "ChatLiteLLM",+ "ChatLiteLLMException",+]diff --git a/libs/langchain/langchain/chat_models/meta.py b/libs/langchain/langchain/chat_models/meta.pyindex 5284601ff3..22fa97e08c 100644--- a/libs/langchain/langchain/chat_models/meta.py+++ b/libs/langchain/langchain/chat_models/meta.py@@ -1,5 +1,25 @@-from langchain_community.chat_models.meta import (- convert_messages_to_prompt_llama,-)+from typing import TYPE_CHECKING, Any-__all__ = ["convert_messages_to_prompt_llama"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.meta import convert_messages_to_prompt_llama++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "convert_messages_to_prompt_llama": "langchain_community.chat_models.meta"+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "convert_messages_to_prompt_llama",+]diff --git a/libs/langchain/langchain/chat_models/minimax.py b/libs/langchain/langchain/chat_models/minimax.pyindex 7363e27fee..3c4f791b5b 100644--- a/libs/langchain/langchain/chat_models/minimax.py+++ b/libs/langchain/langchain/chat_models/minimax.py@@ -1,5 +1,23 @@-from langchain_community.chat_models.minimax import (- MiniMaxChat,-)+from typing import TYPE_CHECKING, Any-__all__ = ["MiniMaxChat"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.minimax import MiniMaxChat++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"MiniMaxChat": "langchain_community.chat_models.minimax"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "MiniMaxChat",+]diff --git a/libs/langchain/langchain/chat_models/mlflow.py b/libs/langchain/langchain/chat_models/mlflow.pyindex 380b9505b1..3877e8b98a 100644--- a/libs/langchain/langchain/chat_models/mlflow.py+++ b/libs/langchain/langchain/chat_models/mlflow.py@@ -1,3 +1,23 @@-from langchain_community.chat_models.mlflow import ChatMlflow+from typing import TYPE_CHECKING, Any-__all__ = ["ChatMlflow"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.mlflow import ChatMlflow++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"ChatMlflow": "langchain_community.chat_models.mlflow"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "ChatMlflow",+]diff --git a/libs/langchain/langchain/chat_models/mlflow_ai_gateway.py b/libs/langchain/langchain/chat_models/mlflow_ai_gateway.pyindex 101edb7a77..2e54df8cda 100644--- a/libs/langchain/langchain/chat_models/mlflow_ai_gateway.py+++ b/libs/langchain/langchain/chat_models/mlflow_ai_gateway.py@@ -1,6 +1,30 @@-from langchain_community.chat_models.mlflow_ai_gateway import (- ChatMLflowAIGateway,- ChatParams,-)+from typing import TYPE_CHECKING, Any-__all__ = ["ChatMLflowAIGateway", "ChatParams"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.mlflow_ai_gateway import (+ ChatMLflowAIGateway,+ ChatParams,+ )++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "ChatMLflowAIGateway": "langchain_community.chat_models.mlflow_ai_gateway",+ "ChatParams": "langchain_community.chat_models.mlflow_ai_gateway",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "ChatMLflowAIGateway",+ "ChatParams",+]diff --git a/libs/langchain/langchain/chat_models/ollama.py b/libs/langchain/langchain/chat_models/ollama.pyindex ff872b8c6b..d5a9d3f6b5 100644--- a/libs/langchain/langchain/chat_models/ollama.py+++ b/libs/langchain/langchain/chat_models/ollama.py@@ -1,5 +1,23 @@-from langchain_community.chat_models.ollama import (- ChatOllama,-)+from typing import TYPE_CHECKING, Any-__all__ = ["ChatOllama"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.ollama import ChatOllama++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"ChatOllama": "langchain_community.chat_models.ollama"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "ChatOllama",+]diff --git a/libs/langchain/langchain/chat_models/openai.py b/libs/langchain/langchain/chat_models/openai.pyindex 18922fd22b..76482f221e 100644--- a/libs/langchain/langchain/chat_models/openai.py+++ b/libs/langchain/langchain/chat_models/openai.py@@ -1,6 +1,22 @@-from langchain_community.chat_models.openai import (- ChatOpenAI,-)+from typing import TYPE_CHECKING, Any++from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.openai import ChatOpenAI++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"ChatOpenAI": "langchain_community.chat_models.openai"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+__all__ = ["ChatOpenAI",diff --git a/libs/langchain/langchain/chat_models/pai_eas_endpoint.py b/libs/langchain/langchain/chat_models/pai_eas_endpoint.pyindex 14b2fd4e74..2c3134f63e 100644--- a/libs/langchain/langchain/chat_models/pai_eas_endpoint.py+++ b/libs/langchain/langchain/chat_models/pai_eas_endpoint.py@@ -1,3 +1,25 @@-from langchain_community.chat_models.pai_eas_endpoint import PaiEasChatEndpoint+from typing import TYPE_CHECKING, Any-__all__ = ["PaiEasChatEndpoint"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.pai_eas_endpoint import PaiEasChatEndpoint++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "PaiEasChatEndpoint": "langchain_community.chat_models.pai_eas_endpoint"+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "PaiEasChatEndpoint",+]diff --git a/libs/langchain/langchain/chat_models/promptlayer_openai.py b/libs/langchain/langchain/chat_models/promptlayer_openai.pyindex cceb5702cd..b7a3bb0ddf 100644--- a/libs/langchain/langchain/chat_models/promptlayer_openai.py+++ b/libs/langchain/langchain/chat_models/promptlayer_openai.py@@ -1,3 +1,25 @@-from langchain_community.chat_models.promptlayer_openai import PromptLayerChatOpenAI+from typing import TYPE_CHECKING, Any-__all__ = ["PromptLayerChatOpenAI"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.promptlayer_openai import PromptLayerChatOpenAI++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "PromptLayerChatOpenAI": "langchain_community.chat_models.promptlayer_openai"+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "PromptLayerChatOpenAI",+]diff --git a/libs/langchain/langchain/chat_models/tongyi.py b/libs/langchain/langchain/chat_models/tongyi.pyindex 6ee9bc4f62..bb24bef388 100644--- a/libs/langchain/langchain/chat_models/tongyi.py+++ b/libs/langchain/langchain/chat_models/tongyi.py@@ -1,6 +1,22 @@-from langchain_community.chat_models.tongyi import (- ChatTongyi,-)+from typing import TYPE_CHECKING, Any++from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.tongyi import ChatTongyi++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"ChatTongyi": "langchain_community.chat_models.tongyi"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+__all__ = ["ChatTongyi",diff --git a/libs/langchain/langchain/chat_models/vertexai.py b/libs/langchain/langchain/chat_models/vertexai.pyindex a5096fcce8..b662a337ab 100644--- a/libs/langchain/langchain/chat_models/vertexai.py+++ b/libs/langchain/langchain/chat_models/vertexai.py@@ -1,6 +1,22 @@-from langchain_community.chat_models.vertexai import (- ChatVertexAI,-)+from typing import TYPE_CHECKING, Any++from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.vertexai import ChatVertexAI++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"ChatVertexAI": "langchain_community.chat_models.vertexai"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+__all__ = ["ChatVertexAI",diff --git a/libs/langchain/langchain/chat_models/volcengine_maas.py b/libs/langchain/langchain/chat_models/volcengine_maas.pyindex b6628ef1ae..9c4571140c 100644--- a/libs/langchain/langchain/chat_models/volcengine_maas.py+++ b/libs/langchain/langchain/chat_models/volcengine_maas.py@@ -1,6 +1,30 @@-from langchain_community.chat_models.volcengine_maas import (- VolcEngineMaasChat,- convert_dict_to_message,-)+from typing import TYPE_CHECKING, Any-__all__ = ["convert_dict_to_message", "VolcEngineMaasChat"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.volcengine_maas import (+ VolcEngineMaasChat,+ convert_dict_to_message,+ )++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "convert_dict_to_message": "langchain_community.chat_models.volcengine_maas",+ "VolcEngineMaasChat": "langchain_community.chat_models.volcengine_maas",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "convert_dict_to_message",+ "VolcEngineMaasChat",+]diff --git a/libs/langchain/langchain/chat_models/yandex.py b/libs/langchain/langchain/chat_models/yandex.pyindex 05cb4cbea5..af2a440293 100644--- a/libs/langchain/langchain/chat_models/yandex.py+++ b/libs/langchain/langchain/chat_models/yandex.py@@ -1,5 +1,23 @@-from langchain_community.chat_models.yandex import (- ChatYandexGPT,-)+from typing import TYPE_CHECKING, Any-__all__ = ["ChatYandexGPT"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.chat_models.yandex import ChatYandexGPT++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"ChatYandexGPT": "langchain_community.chat_models.yandex"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "ChatYandexGPT",+]