LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • MCP Adapters
    • Overview
    • Agents
    • Callbacks
    • Chains
    • Chat models
    • Embeddings
    • Evaluation
    • Globals
    • Hub
    • Memory
    • Output parsers
    • Retrievers
    • Runnables
    • LangSmith
    • Storage
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    MCP Adapters
    OverviewAgentsCallbacksChainsChat modelsEmbeddingsEvaluationGlobalsHubMemoryOutput parsersRetrieversRunnablesLangSmithStorage
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-classicchat_modelsbase
    Module●Since v1.0

    base

    Functions

    function
    init_chat_model

    Initialize a chat model from any supported provider using a unified interface.

    Two main use cases:

    1. Fixed model – specify the model upfront and get back a ready-to-use chat model.
    2. Configurable model – choose to specify parameters (including model name) at runtime via config. Makes it easy to switch between models/providers without changing your code
    Note

    Requires the integration package for the chosen model provider to be installed.

    See the model_provider parameter below for specific package names (e.g., pip install langchain-openai).

    Refer to the provider integration's API reference for supported model parameters to use as **kwargs.

    View source on GitHub