Setting up GCP with langchain
- For this we need to install gcloud sdk Refer Here
- Navigate to gcp console
- Make the note of project id and navigate to agent platform overview.

- Note: Enable api’s if asked

- Then open the terminal and execute the following
gcloud init
gcloud auth application-default login
-
Refer Here for instructions for application-default login
-
Lets setup a new folder and use gemini models from gcp cloud
mkdir rag_learning_gcp
cd rag_learning_gcp
uv init .
uv add langchain python-dotenv langchain-google-genai ipykernel
# code .
- Now select interpretor
rag_learning_gcp - Now create a .env file with following data and fill your project id
GOOGLE_CLOUD_PROJECT=''
GOOGLE_CLOUD_LOCATION='us-central1'
GOOGLE_GENAI_USE_VERTEXAI=true
- Refer Here for the changes done
ChatPromptTemplate
- Refer Here for the template guide
Output Parsers
-
Refer Here for docs
-
Refer Here for the notebook with changes
