An authentication error occurs when specifying a Vertex AI
Describe the bug
An authentication error occurs during the build process when using components of Vertex AI and Chat Vertex AI with a service account issued in Google Cloud.
case : Vertex AI
ValueError: Error building nodeVertexAI(ID:VertexAI-t4VC4):Unable to authenticate your request.
Depending on your runtime environment, you can complete authentication by:
- if in local JupyterLab instance: `!gcloud auth login`- if in Colab:
-`from google.colab import auth` -`auth.authenticate_user()`
- if in service account or other: please follow guidance inhttps://cloud.google.com/docs/authentic ation
case : Chat Vertex AI
LangChainDeprecationWarning: The class `langchain_community.chat_models.vertexai.ChatVertexAI` was deprecated in langchain-community 0.0.12 and will be removed in 0.2.0. An updated version of the class exists in the langchain-google-vertexai package and should be used instead. To use it run `pip install -U langchain-google-vertexai` and import as `from langchain_google_vertexai import ChatVertexAI`.
Browser and Version
- Browser [e.g. chrome, safari]
- chrome
- Browser Version
- 121
- Langflow Version
- 0.6.7
To Reproduce Steps to reproduce the behavior:
- Use components of "Chat Vertex AI" or "Vertex AI" with a service account issued in Google Cloud
- Build a flow
- See error in log
Screenshots
Additional context
🤖
Hey @goudon! Good to see you back. Ran into a bit of a snag, I see?
Thank you for bringing this to our attention. The authentication error you're experiencing seems to be due to missing or incorrect credentials when initiating the build process with Vertex AI and Chat Vertex AI components.
In the Langflow codebase, the authentication process when using these components with a service account issued in Google Cloud is handled by the VertexAIEmbeddings class from the langchain.embeddings module. This class expects a credentials parameter, which should be a path to a JSON file containing the service account key from Google Cloud.
The error message suggests that the credentials parameter might not have been provided or is incorrect. Please ensure that you're providing the correct path to the service account key JSON file when initiating the build process.
As for the LangChainDeprecationWarning, it appears that the class langchain_community.chat_models.vertexai.ChatVertexAI was deprecated in langchain-community 0.6.7 and an updated version of the class exists in the langchain-google-vertexai package. You should use the updated class by running pip install -U langchain-google-vertexai and importing as from langchain_google_vertexai import ChatVertexAI.
Regarding the screenshot you've shared, I'm sorry but I'm unable to view images. If there's additional information in the screenshot that wasn't included in your message, please provide it in text form.
If you continue to experience issues, please provide more details about your setup and the steps you're taking so I can better assist you.
Sources
- src/backend/langflow/components/llms/VertexAI.py
- src/backend/langflow/components/embeddings/VertexAIEmbeddings.py
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.