Getting information about available foundation models programmatically
Find out what foundation models are available for use in IBM watsonx.ai.
To get a list of the deployed foundation models, use the following method. Note that https://cpd-cpd-instance.apps.example.com is the namespace for the installed software.
Python code
from ibm_watsonx_ai.foundation_models import get_model_specs
get_model_specs("https://cpd-cpd-instance.apps.example.com")
Sample output
{
'total_count': 1,
'limit': 100,
'first': {'href': 'url'},
'resources': [{'model_id': 'ibm/granite-3-3-8b-instruct',
...
}]
}
Find the model_id value for the model that you want to use from the models available.