ValueError
google.cloud.aiplatform.models.chat_model.ChatModelError
Stack trace
ValueError: The model 'palm-bison' is deprecated and cannot be used with ChatModel. Please switch to a supported model like 'chat-bison@001'.
File "main.py", line 15, in <module>
response = chat_model.predict(messages)
File "/usr/local/lib/python3.9/site-packages/google/cloud/aiplatform/models/chat_model.py", line 120, in predict
raise ValueError("The model 'palm-bison' is deprecated and cannot be used.") Why it happens
Google deprecated the Palm Bison model in Vertex AI ChatModel due to updates in their model lineup. Using this deprecated model name causes the client to raise a ValueError to prevent usage of unsupported models.
Detection
Check for ValueError exceptions when instantiating or calling ChatModel with 'palm-bison' as the model name. Logging the model parameter before calls helps catch deprecated usage early.
Causes & fixes
Using the deprecated 'palm-bison' model name in ChatModel client instantiation or calls
Update the model parameter to a supported model like 'chat-bison@001' or another current Vertex AI chat model.
Outdated google-cloud-aiplatform SDK version that does not warn about deprecated models
Upgrade google-cloud-aiplatform to the latest version (>=1.30.0) which enforces model deprecation checks.
Hardcoded model name strings in code or config files referencing 'palm-bison'
Refactor code and configuration to replace all 'palm-bison' references with supported model names.
Code: broken vs fixed
from google.cloud import aiplatform
chat_model = aiplatform.ChatModel(model_name="palm-bison") # This line triggers the error
response = chat_model.predict(messages=[{"content": "Hello"}])
print(response) import os
from google.cloud import aiplatform
os.environ["GOOGLE_CLOUD_PROJECT"] = "your-project-id"
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "/path/to/your/credentials.json"
chat_model = aiplatform.ChatModel(model_name="chat-bison@001") # Updated model name fixes error
response = chat_model.predict(messages=[{"content": "Hello"}])
print(response) Workaround
If immediate code changes are not possible, catch the ValueError exception and log a clear message instructing to update the model name before retrying.
Prevention
Always use the latest google-cloud-aiplatform SDK and consult the official Vertex AI model documentation to ensure your model names are current and supported.