Initialize a chat model from any supported provider using a unified interface.
langchain.chat_models.init_chat_model insteadThis function lives in langchain-classic and is no longer actively
maintained. New features and fixes land in the langchain package.
Update your imports:
# Don't do this:
from langchain.chat_models import init_chat_model
# Do this instead:
from langchain.chat_models import init_chat_modelTwo main use cases:
config. Makes it easy to
switch between models/providers without changing your codeRequires 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.