Home / Function/ is_chat_model() — langchain Function Reference

is_chat_model() — langchain Function Reference

Architecture documentation for the is_chat_model() function in prompt_selector.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  016af07a_881f_11bd_aca3_2561e6703207["is_chat_model()"]
  caf93f27_6158_f36d_37c6_2a573c4bd8b9["prompt_selector.py"]
  016af07a_881f_11bd_aca3_2561e6703207 -->|defined in| caf93f27_6158_f36d_37c6_2a573c4bd8b9
  style 016af07a_881f_11bd_aca3_2561e6703207 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/prompt_selector.py lines 56–65

def is_chat_model(llm: BaseLanguageModel) -> bool:
    """Check if the language model is a chat model.

    Args:
        llm: Language model to check.

    Returns:
        `True` if the language model is a BaseChatModel model, `False` otherwise.
    """
    return isinstance(llm, BaseChatModel)

Subdomains

Frequently Asked Questions

What does is_chat_model() do?
is_chat_model() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/prompt_selector.py.
Where is is_chat_model() defined?
is_chat_model() is defined in libs/langchain/langchain_classic/chains/prompt_selector.py at line 56.

Analyze Your Own Codebase

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

Try Supermodel Free