0 / 0
Python library

Python library

You can inference and tune foundation models in IBM watsonx.ai programmatically by using the Python library. For more information, See Foundation models Python library.

You can also work with watsonx.ai foundation models from LangChain. For more information, see IBM extension in LangChain.

Using the Python library

The ibm-watsonx-ai Python library is available on PyPI from the url: https://pypi.org/project/ibm-watsonx-ai/.

You can install the ibm-watsonx-ai Python library in your development environment by using the following command:

pip install ibm-watsonx-ai

If you already have the library installed, include the -U parameter to pick up any updates and work with the latest version of the library.

pip install -U ibm-watsonx-ai


You need credentials and a project ID or deployment space ID before you can use the Python library. For more information, see Authenticating for programmatic access to a project or space.

Learn from available sample notebooks

Sample notebooks are available that you can use as a guide as you create notebooks of your own to do common tasks such as inferencing or tuning a foundation model. See the following topics for more information:

Parent topic: Coding generative AI solutions

Generative AI search and answer
These answers are generated by a large language model in watsonx.ai based on content from the product documentation. Learn more