Home / File/ __init__.py — langchain Source File

__init__.py — langchain Source File

Architecture documentation for __init__.py, a python file in the langchain codebase. 5 imports, 0 dependents.

File python CoreAbstractions MessageSchema 5 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  f4d00b58_f952_529f_ddba_48465b8e05a8["__init__.py"]
  0c635125_6987_b8b3_7ff7_d60249aecde7["warnings"]
  f4d00b58_f952_529f_ddba_48465b8e05a8 --> 0c635125_6987_b8b3_7ff7_d60249aecde7
  b19a8b7e_fbee_95b1_65b8_509a1ed3cad7["langchain_core._api"]
  f4d00b58_f952_529f_ddba_48465b8e05a8 --> b19a8b7e_fbee_95b1_65b8_509a1ed3cad7
  38f8ae75_22d8_c191_ce06_b3bf6df6902f["langchain_classic._api.interactive_env"]
  f4d00b58_f952_529f_ddba_48465b8e05a8 --> 38f8ae75_22d8_c191_ce06_b3bf6df6902f
  7070a07a_e84d_7ed0_4f0a_9831438449cb["langchain_classic.chat_models.base"]
  f4d00b58_f952_529f_ddba_48465b8e05a8 --> 7070a07a_e84d_7ed0_4f0a_9831438449cb
  fe02b965_408f_d86e_9e2e_4b9ad88c7cb7["langchain_community"]
  f4d00b58_f952_529f_ddba_48465b8e05a8 --> fe02b965_408f_d86e_9e2e_4b9ad88c7cb7
  style f4d00b58_f952_529f_ddba_48465b8e05a8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"""**Chat Models** are a variation on language models.

While Chat Models use language models under the hood, the interface they expose
is a bit different. Rather than expose a "text in, text out" API, they expose
an interface where "chat messages" are the inputs and outputs.
"""

import warnings

from langchain_core._api import LangChainDeprecationWarning

from langchain_classic._api.interactive_env import is_interactive_env
from langchain_classic.chat_models.base import init_chat_model


def __getattr__(name: str) -> None:
    from langchain_community import chat_models

    # If not in interactive env, raise warning.
    if not is_interactive_env():
        warnings.warn(
            "Importing chat models from langchain is deprecated. Importing from "
            "langchain will no longer be supported as of langchain==0.2.0. "
            "Please import from langchain-community instead:\n\n"
            f"`from langchain_community.chat_models import {name}`.\n\n"
            "To install langchain-community run `pip install -U langchain-community`.",
            stacklevel=2,
            category=LangChainDeprecationWarning,
        )

    return getattr(chat_models, name)


__all__ = [
    "AzureChatOpenAI",
    "BedrockChat",
    "ChatAnthropic",
    "ChatAnyscale",
    "ChatBaichuan",
    "ChatCohere",
    "ChatDatabricks",
    "ChatEverlyAI",
    "ChatFireworks",
    "ChatGooglePalm",
    "ChatHunyuan",
    "ChatJavelinAIGateway",
    "ChatKonko",
    "ChatLiteLLM",
    "ChatMLflowAIGateway",
    "ChatMlflow",
    "ChatOllama",
    "ChatOpenAI",
    "ChatVertexAI",
    "ChatYandexGPT",
    "ErnieBotChat",
    "FakeListChatModel",
    "GigaChat",
    "HumanInputChatModel",
    "JinaChat",
    "MiniMaxChat",
    "PaiEasChatEndpoint",
    "PromptLayerChatOpenAI",
    "QianfanChatEndpoint",
    "VolcEngineMaasChat",
    "init_chat_model",
]

Subdomains

Functions

Dependencies

  • langchain_classic._api.interactive_env
  • langchain_classic.chat_models.base
  • langchain_community
  • langchain_core._api
  • warnings

Frequently Asked Questions

What does __init__.py do?
__init__.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, MessageSchema subdomain.
What functions are defined in __init__.py?
__init__.py defines 1 function(s): __getattr__.
What does __init__.py depend on?
__init__.py imports 5 module(s): langchain_classic._api.interactive_env, langchain_classic.chat_models.base, langchain_community, langchain_core._api, warnings.
Where is __init__.py in the architecture?
__init__.py is located at libs/langchain/langchain_classic/chat_models/__init__.py (domain: CoreAbstractions, subdomain: MessageSchema, directory: libs/langchain/langchain_classic/chat_models).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free