LangChain 1 · Chat models

Create a chat model

Create a model from a provider:model string, so switching providers is a one-line change.

from langchain.chat_models import init_chat_model

model = init_chat_model("anthropic:claude-sonnet-5-5")

Official LangChain 1 documentation

More chat models commands

All chat models commands · LangChain 1 cheatsheet

Was this page helpful?