Skip to content

Commit 2932624

Browse files
bourgeoisorMukamikthagomizer
authored
Add ShoppingAssistant, and AlloyDB support to ProductCatalog (GoogleCloudPlatform#2466)
* feat: new shopping-assistant-service based on recommendation service,… (GoogleCloudPlatform#2407) * feat: new shopping-assistant-service based on recommendation service, langchain and genai packages * feat: Significantly paired down shop assist * refactor: last remnants of GRPC * Add AI Assistant service (GoogleCloudPlatform#2408) * Add bot UI * Fix * Fix * Fix: requirements.txt * Unquote query * Default ns * Change port * Change port * feat: Phase 1 complete * fix: cleanup * fix: env and rename --------- Co-authored-by: aaronmwanjala <[email protected]> * Add scripts to deploy, init, and ingest into AlloyDB (GoogleCloudPlatform#2423) * Add AlloyDB set-up * Add AlloyDB set-up * Add AlloyDB set-up * Add AlloyDB set-up * Add AlloyDB set-up * Add AlloyDB table population scripts * Generate embeddings when you import data * Fix scripts comments --------- Co-authored-by: Aja Hammerly <[email protected]> * Multi modal chat (GoogleCloudPlatform#2417) * refactor: prompt call changed to POST, to accommodate multi-modal requests. * feat: Added file upload to chat, plumbed the new post through to the end. * feat: text and image multi modal calls are supported. * Bones of retrieval are in place, still need to debug * feat: RAG very nearly implemented end to end * Revert "feat: RAG very nearly implemented end to end" This reverts commit a72e96c. * feat: last few fixes for RAG flow - Disable `readOnlyRootFilesystem` on the shoppingassistantservice - Enable a public IP for the alloydb instance - Define the id_column (wasn't documented) - Set the model name to models/embedding-001 in order to use textembedding-gecko@003, which I couldn't find anywhere but on MoMA - Use .invoke instead of .run here because .run has been deprecated since Jan 5th. - Configuring a few columns in the vector store (embedding_column, content_column, etc) * merge: apikey * fix: merge conflict * fix: merge conflict in requirements * Revert "Revert "feat: RAG very nearly implemented end to end"" This reverts commit 196e428 * feat: two step retrieval query * fix: key * chore: requirements * Update scripts/1_deploy_alloydb_infra.sh * Update kustomize/components/alloydb/kustomization.yaml * Update kustomize/components/alloydb/kustomization.yaml * Update kustomize/components/alloydb/kustomization.yaml * Update kustomize/components/alloydb/kustomization.yaml * Update kustomize/components/alloydb/kustomization.yaml * Update kustomize/components/alloydb/kustomization.yaml --------- Co-authored-by: Olivier Bourgeois <[email protected]> * Revamp bot assistant UI (GoogleCloudPlatform#2437) * Revamp frontend bot into own page * Revert temp changes * Tuning the responses to the rag implementation (GoogleCloudPlatform#2441) * Revamp frontend bot into own page * FEAT: Making it clearer what's happening * FEAT: Tweaking the prompts * REFACTOR: moving towards manual vector search * feat: Interior design flow working for demo --------- Co-authored-by: Olivier Bourgeois <[email protected]> * refactor: cleaning up logging * Add image and product rendering to frontend (GoogleCloudPlatform#2442) * Revamp frontend bot into own page * Revert temp changes * Fix file permissions * Remove placeholder variables * Fix scripts * Display user image in the chat log * Extract the product IDs from prompt response * Add product images to prompt response * Fix handler hostname * De-hardcode the assistant service host from the frontend * Turn on cymbal branding * Add Dockerfile.pip to gitignore * Add product cards to response * Add shimmer to bot text loading * Fix broken script * Add missing API to script * Add demo instructions * Add disclaimer to README notes * Polish the assistant UI * Fix file selector alignment * refactor: better comments! * fix: logs and comments for the demo * Refactor envs out of demo (GoogleCloudPlatform#2457) * First pass at extracting envs * Update requirements * Fix scripts envs * Fix wrong region env * WIP secret manager * WIP secret manager * WIP secret manager * WIP secret manager * WIP secret manager * Add disable-shopping-assistant component * Add disable-shopping-assistant component * Add disable-shopping-assistant component * Remove hero image temporarily * WIP secret manager * WIP secret manager * WIP secret manager * WIP secret manager * AlloyDB support for the products catalog (GoogleCloudPlatform#2425) * Add SA bindings for products catalog * Add initial trial of postgre connection * Fix connection envs * Fix posgres connection * Add more columns * Add missing roles * Add missing columns * Add missing columns * Remove embedding columns * Remove embedding columns * Extract envs out * Extract envs out * Refactor catalog loading * Refactor catalog loading * Refactor catalog loading * Refactor catalog loading * Refactor catalog loading * Refactor catalog loading * Add Secret Manager query * Update README * Update README * Clean up copyright headers, comments, manifests * Consolidate .gitignore files into one * Tweak README script * Move shopping assistant scripts to kustomize component --------- Co-authored-by: Aaron Wanjala <[email protected]> Co-authored-by: Aja Hammerly <[email protected]>
1 parent 84f0ad9 commit 2932624

File tree

79 files changed

+1726
-106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1726
-106
lines changed

.github/workflows/install-dependencies.sh

100644100755
File mode changed.

.gitignore

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
1-
bin/
2-
pkg/
31
.DS_Store
4-
*.pyc
5-
*.swp
6-
*.tfstate
7-
*.tfstate*
8-
*~
9-
.vscode/
10-
.vs/
11-
.idea
12-
.skaffold-*.yaml
2+
.eclipse.buildship.core.prefs
3+
.gradle/
4+
.idea/
135
.kubernetes-manifests-*/
146
.project
15-
.eclipse.buildship.core.prefs
16-
.terraform
17-
.terraform/*
7+
.skaffold-*.yaml
188
.terraform.lock.hcl
9+
.terraform/*
10+
.venv/
11+
.vs/
12+
.vscode/
13+
*.iml
14+
*.ipr
15+
*.iws
16+
*.pyc
17+
*.swp
18+
*.tfstate*
1919
*.tfvars
20+
*~
21+
bin/
22+
build/
23+
Dockerfile.pip
24+
node_modules/
25+
obj/
26+
pkg/
2027
release/wi-kubernetes-manifests.yaml
28+
vendor/

docs/releasing/README.md

100755100644
File mode changed.

kubernetes-manifests/frontend.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ spec:
8080
value: "checkoutservice:5050"
8181
- name: AD_SERVICE_ADDR
8282
value: "adservice:9555"
83+
- name: SHOPPING_ASSISTANT_SERVICE_ADDR
84+
value: "shoppingassistantservice:80"
8385
# # ENV_PLATFORM: One of: local, gcp, aws, azure, onprem, alibaba
8486
# # When not set, defaults to "local" unless running in GKE, otherwies auto-sets to gcp
8587
# - name: ENV_PLATFORM
@@ -88,6 +90,8 @@ spec:
8890
value: "0"
8991
# - name: CYMBAL_BRANDING
9092
# value: "true"
93+
- name: ENABLE_ASSISTANT
94+
value: "true"
9195
# - name: FRONTEND_MESSAGE
9296
# value: "Replace this with a message you want to display on all pages."
9397
# As part of an optional Google Cloud demo, you can run an optional microservice called the "packaging service".

kubernetes-manifests/kustomization.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,18 @@ resources:
2525
- paymentservice.yaml
2626
- productcatalogservice.yaml
2727
- recommendationservice.yaml
28+
- shoppingassistantservice.yaml
2829
- redis.yaml
2930
- shippingservice.yaml
30-
# components:
31+
components:
3132
# - ../kustomize/components/cymbal-branding
3233
# - ../kustomize/components/google-cloud-operations
3334
# - ../kustomize/components/memorystore
3435
# - ../kustomize/components/network-policies
3536
# - ../kustomize/components/service-accounts
37+
# - ../kustomize/components/alloydb
3638
# - ../kustomize/components/spanner
3739
# - ../kustomize/components/container-images-tag
3840
# - ../kustomize/components/container-images-tag-suffix
3941
# - ../kustomize/components/container-images-registry
42+
- ../kustomize/components/disable-shopping-assistant
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: apps/v1
16+
kind: Deployment
17+
metadata:
18+
name: shoppingassistantservice
19+
labels:
20+
app: shoppingassistantservice
21+
spec:
22+
selector:
23+
matchLabels:
24+
app: shoppingassistantservice
25+
template:
26+
metadata:
27+
labels:
28+
app: shoppingassistantservice
29+
spec:
30+
serviceAccountName: default
31+
terminationGracePeriodSeconds: 5
32+
securityContext:
33+
fsGroup: 1000
34+
runAsGroup: 1000
35+
runAsNonRoot: true
36+
runAsUser: 1000
37+
containers:
38+
- name: server
39+
securityContext:
40+
allowPrivilegeEscalation: false
41+
capabilities:
42+
drop:
43+
- ALL
44+
privileged: false
45+
readOnlyRootFilesystem: false
46+
image: shoppingassistantservice
47+
ports:
48+
- name: http
49+
containerPort: 8080
50+
env:
51+
- name: GOOGLE_API_KEY
52+
value: GOOGLE_API_KEY_VAL
53+
- name: ALLOYDB_CLUSTER_NAME
54+
value: ALLOYDB_CLUSTER_NAME_VAL
55+
- name: ALLOYDB_INSTANCE_NAME
56+
value: ALLOYDB_INSTANCE_NAME_VAL
57+
- name: ALLOYDB_DATABASE_NAME
58+
value: ALLOYDB_DATABASE_NAME_VAL
59+
- name: ALLOYDB_TABLE_NAME
60+
value: ALLOYDB_TABLE_NAME_VAL
61+
- name: ALLOYDB_SECRET_NAME
62+
value: ALLOYDB_SECRET_NAME_VAL
63+
- name: PROJECT_ID
64+
value: PROJECT_ID_VAL
65+
- name: REGION
66+
value: REGION_VAL
67+
resources:
68+
requests:
69+
cpu: 100m
70+
memory: 64Mi
71+
limits:
72+
cpu: 200m
73+
memory: 128Mi
74+
---
75+
apiVersion: v1
76+
kind: Service
77+
metadata:
78+
name: shoppingassistantservice
79+
labels:
80+
app: shoppingassistantservice
81+
spec:
82+
type: ClusterIP
83+
selector:
84+
app: shoppingassistantservice
85+
ports:
86+
- name: http
87+
port: 80
88+
targetPort: 8080

kustomize/base/frontend.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ spec:
7878
value: "checkoutservice:5050"
7979
- name: AD_SERVICE_ADDR
8080
value: "adservice:9555"
81+
- name: SHOPPING_ASSISTANT_SERVICE_ADDR
82+
value: "shoppingassistantservice:80"
8183
# # ENV_PLATFORM: One of: local, gcp, aws, azure, onprem, alibaba
8284
# # When not set, defaults to "local" unless running in GKE, otherwies auto-sets to gcp
8385
# - name: ENV_PLATFORM
@@ -86,6 +88,8 @@ spec:
8688
value: "0"
8789
# - name: CYMBAL_BRANDING
8890
# value: "true"
91+
- name: ENABLE_ASSISTANT
92+
value: "true"
8993
# - name: FRONTEND_MESSAGE
9094
# value: "Replace this with a message you want to display on all pages."
9195
# As part of an optional Google Cloud demo, you can run an optional microservice called the "packaging service".

kustomize/components/alloydb/kustomization.yaml

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ patches:
3434
- name: ALLOYDB_PRIMARY_IP
3535
value: ALLOYDB_PRIMARY_IP_VAL
3636
- name: ALLOYDB_DATABASE_NAME
37-
value: ALLOYDB_DATABASE_NAME_VAL
37+
value: ALLOYDB_CARTS_DATABASE_NAME
3838
- name: ALLOYDB_TABLE_NAME
39-
value: ALLOYDB_TABLE_NAME_VAL
39+
value: ALLOYDB_CARTS_TABLE_NAME_VAL
4040
- name: ALLOYDB_SECRET_NAME
4141
value: ALLOYDB_SECRET_NAME_VAL
4242
- name: PROJECT_ID
@@ -49,6 +49,48 @@ patches:
4949
name: cartservice
5050
annotations:
5151
iam.gke.io/gcp-service-account: ALLOYDB_USER_GSA_ID
52+
# productcatalogservice - replace ALLOYDB environments
53+
- patch: |-
54+
apiVersion: apps/v1
55+
kind: Deployment
56+
metadata:
57+
name: productcatalogservice
58+
spec:
59+
template:
60+
spec:
61+
containers:
62+
- name: server
63+
env:
64+
- name: ALLOYDB_CLUSTER_NAME
65+
value: ALLOYDB_CLUSTER_NAME_VAL
66+
- name: ALLOYDB_INSTANCE_NAME
67+
value: ALLOYDB_INSTANCE_NAME_VAL
68+
- name: ALLOYDB_DATABASE_NAME
69+
value: ALLOYDB_PRODUCTS_DATABASE_NAME_VAL
70+
- name: ALLOYDB_TABLE_NAME
71+
value: ALLOYDB_PRODUCTS_TABLE_NAME_VAL
72+
- name: ALLOYDB_SECRET_NAME
73+
value: ALLOYDB_SECRET_NAME_VAL
74+
- name: PROJECT_ID
75+
value: PROJECT_ID_VAL
76+
- name: REGION
77+
value: REGION_VAL
78+
# productcatalogservice - add the GSA annotation for the productcatalogservice KSA
79+
- patch: |-
80+
apiVersion: v1
81+
kind: ServiceAccount
82+
metadata:
83+
name: productcatalogservice
84+
annotations:
85+
iam.gke.io/gcp-service-account: ALLOYDB_USER_GSA_ID
86+
# shoppingassistantservice - add the GSA annotation for the shoppingassistantservice KSA
87+
- patch: |-
88+
apiVersion: v1
89+
kind: ServiceAccount
90+
metadata:
91+
name: shoppingassistantservice
92+
annotations:
93+
iam.gke.io/gcp-service-account: ALLOYDB_USER_GSA_ID
5294
# redis - remove the redis-cart Deployment
5395
- patch: |-
5496
apiVersion: apps/v1
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: kustomize.config.k8s.io/v1alpha1
16+
kind: Component
17+
patches:
18+
# shoppingassistantservice - remove Deployment
19+
- patch: |-
20+
apiVersion: apps/v1
21+
kind: Deployment
22+
metadata:
23+
name: shoppingassistantservice
24+
$patch: delete
25+
# shoppingassistantservice - remove Service
26+
- patch: |-
27+
apiVersion: v1
28+
kind: Service
29+
metadata:
30+
name: shoppingassistantservice
31+
$patch: delete
32+
# frontend - set ENABLE_ASSISTANT to false
33+
- patch: |-
34+
apiVersion: apps/v1
35+
kind: Deployment
36+
metadata:
37+
name: frontend
38+
spec:
39+
template:
40+
spec:
41+
containers:
42+
- name: server
43+
env:
44+
- name: ENABLE_ASSISTANT
45+
value: "false"

kustomize/components/service-accounts/kustomization.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ resources:
2626
- service-account-productcatalogservice.yaml
2727
- service-account-recommendationservice.yaml
2828
- service-account-shippingservice.yaml
29+
- service-account-shoppingassistantservice.yaml
2930
patches:
3031
- target:
3132
kind: Deployment
@@ -41,6 +42,13 @@ patches:
4142
- op: replace
4243
path: /spec/template/spec/serviceAccountName
4344
value: cartservice
45+
- target:
46+
kind: Deployment
47+
name: shoppingassistantservice
48+
patch: |-
49+
- op: replace
50+
path: /spec/template/spec/serviceAccountName
51+
value: shoppingassistantservice
4452
- target:
4553
kind: Deployment
4654
name: checkoutservice
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: v1
16+
kind: ServiceAccount
17+
metadata:
18+
name: shoppingassistantservice

0 commit comments

Comments
 (0)