LangChain

IBM integration with LangChain is available under IBM and LangChain integration documentation.

Note

The langchain_ibm==0.3.x package relies on version 0.3.x of the langchain_core package.

For detailed migration instructions, please refer to the documentation LangChain v0.3

Installation and Setup

Install the integration package with

pip install -qU langchain-ibm

Get an IBM watsonx.ai api key and set it as an environment variable (WATSONX_APIKEY)

import os

os.environ["WATSONX_APIKEY"] = "your IBM watsonx.ai api key"

Chat Model

See a usage example

from langchain_ibm import ChatWatsonx

LLMs

See a usage example

from langchain_ibm import WatsonxLLM

Embedding Models

See a usage example

from langchain_ibm import WatsonxEmbeddings

API reference

For detailed documentation of all IBM watsonx.ai features and configurations head to the API reference: langchain-ibm