Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

cant use langchain on vertex ai

below is my code, so i used to work in different GCP account now im running this same code in another GCP account and another project, i have followed the same steps but im getting this error

! pip install -Uq pip
! pip install langchain==0.0.340 --quiet 
!pip install -qU langchain-google-vertexai

! pip install chromadb==0.4.13 --quiet 

! pip install google-cloud-bigquery[pandas] --quiet 
! pip install --upgrade google-cloud-aiplatform --quiet 
! pip install google-auth==2.15.0 --quiet
! pip install google-cloud-core==1.7.3 --quiet
! pip install --upgrade google-cloud-translate --quiet 

import vertexai
import os

os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "keys.json"
vertexai.init(project=VERTEX_PROJECT, location=VERTEX_REGION)

 

from langchain.chat_models import ChatVertexAI
from langchain.llms import VertexAI

query_model = ChatVertexAI(model_name="codechat-bison", max_output_tokens=2048)
interpret_data_model = ChatVertexAI(max_output_tokens=2048)
agent_model = ChatVertexAI(max_output_tokens=1024)
translation_model = ChatVertexAI(model_name="chat-bison@002", max_output_tokens=1024)
classification_model = VertexAI( model_name="text-bison@002", max_output_tokens=1024)

ConfigError: field "client" not yet prepared so type is still a ForwardRef, you might need to call ChatVertexAI.update_forward_refs().

0 2 1,065
2 REPLIES 2