Contextual AI¶
This document describes steps to deploy the solution.
For detailed architecture diagram and flows, please refer to this document.
Setup the solution¶
To setup the solution, follow these steps:
- Configure default Google Cloud Project and Region.
export GOOGLE_CLOUD_PROJECT="YOUR PROJECT"
export GOOGLE_GENAI_USE_VERTEXAI=True
export GOOGLE_CLOUD_LOCATION=us-central1
gcloud config set project $GOOGLE_CLOUD_PROJECT
- Enable Required Services.
gcloud services enable aiplatform.googleapis.com \
storage.googleapis.com \
compute.googleapis.com \
bigquery.googleapis.com \
run.googleapis.com \
cloudbuild.googleapis.com \
artifactregistry.googleapis.com \
discoveryengine.googleapis.com \
iam.googleapis.com
-
Ensure Organization Policy allows unauthenticated requests. Allow the following policies.
constraints/iam.allowedPolicyMemberDomains
constraints/gcp.resourceLocations
-
Provision cloud resources.
export CURRENT_DIR=$(pwd)
cd ${CURRENT_DIR}/terraform
terraform init
terraform apply -var="project_id=$(gcloud config get-value project)" \
-var="region=${GOOGLE_CLOUD_LOCATION}" \
--auto-approve
- Update
config.toml
.
Copy api/config-template.toml
to api/config.toml
and update the configuration
[gcp]
GCP_PROJECT_ID = "<PROJECT_ID>"
ECOMMERCE_DATASET_ID = "ecommerce_data"
ECOMMERCE_DATASET_ID = "<PROJECT_ID>-widget-bucket"
- Deploy the solution.
- Generate Data
cd ${CURRENT_DIR}/data
python3 -m venv .venv
source .venv/bin/activate
pip install pandas numpy
python generate_ecommerce_data.py
- Import to BigQuery