Skip to content

Commit 5f83ad1

Browse files
dmitchsplunkjulianocosta89dependabot[bot]
authored
Add a Product Review service with GenAI-powered summaries (#2663)
* added skeleton version of the product review service * added mysql database for the product review service * added LLM with tool call to fetch product reviews * added product reviews and summaries for each product * updated LLM service to return pre-generated product summary * added llm, mysql, and product-reviews to build pipeline * changed how the product review service returns summaries * added feature flags for LLM service * added metrics to product review service * added tests for the product review service * added new services to docker-compose.minimal.yml * added product review, llm, and mysql services to k8s manifest * fixed mysql port in k8s manifest * updated versions of new services * updated README for the LLM service * added product reviews to UI * updated product review UI * added product review summary to product page * cleaned up visualization of product reviews * fixed product review score percentage calculation * added Cypress tests for product reviews * updated changelog, removed temporary images, and updated loadgen * restore kubernetes manifest to current state * reverting changes to kubernetes/opentelemetry-demo.yaml * updated product review service to use postgres instead of mysql * updated product review service to use structured outputs * build(deps): bump jvm (#2679) Bumps the gradle-production-dependencies group with 1 update in the /src/fraud-detection directory: jvm. Updates `jvm` from 2.2.20 to 2.2.21 --- updated-dependencies: - dependency-name: jvm dependency-version: 2.2.21 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: gradle-production-dependencies ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * resolved markdown lint errors and disabled the llmInaccurateResponse feature flag * resolved protobufcheck and sanitycheck issues * resolving licensecheck issues * updated product reviews to include interactive AI component * updated product review service to add AI assistant capabilities * updated frontend to use new Product AI Assistant * added tool call to AI assistant to fetch product info * Processes all tool calls in a loop * Add license * updated mock LLM logic to match product review service updates * Add line break * build(deps): bump github/codeql-action (#2698) Bumps the actions-production-dependencies group with 1 update in the / directory: [github/codeql-action](https://github.com/github/codeql-action). Updates `github/codeql-action` from 4.31.0 to 4.31.1 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@4e94bd1...5fe9434) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 4.31.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions-production-dependencies ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * updated product review service so feature flags work with real OpenAI API * Add line break * Fix tracetests * Fix yamllint --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Juliano Costa <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Juliano Costa <[email protected]>
1 parent 6eaabc9 commit 5f83ad1

File tree

74 files changed

+12800
-3357
lines changed

Some content is hidden

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

74 files changed

+12800
-3357
lines changed

.env

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ PRODUCT_CATALOG_PORT=3550
116116
PRODUCT_CATALOG_ADDR=product-catalog:${PRODUCT_CATALOG_PORT}
117117
PRODUCT_CATALOG_DOCKERFILE=./src/product-catalog/Dockerfile
118118

119+
# Product Reviews Service
120+
PRODUCT_REVIEWS_PORT=3551
121+
PRODUCT_REVIEWS_ADDR=product-reviews:${PRODUCT_REVIEWS_PORT}
122+
PRODUCT_REVIEWS_DOCKERFILE=./src/product-reviews/Dockerfile
123+
119124
# Quote Service
120125
QUOTE_PORT=8090
121126
QUOTE_ADDR=http://quote:${QUOTE_PORT}
@@ -150,6 +155,17 @@ KAFKA_HOST=kafka
150155
KAFKA_ADDR=${KAFKA_HOST}:${KAFKA_PORT}
151156
KAFKA_DOCKERFILE=./src/kafka/Dockerfile
152157

158+
# LLM service
159+
LLM_DOCKERFILE=./src/llm/Dockerfile
160+
LLM_HOST=llm
161+
LLM_PORT=8000
162+
163+
# Mock LLM - to use a real OpenAI API-compatible LLM,
164+
# configure the .env.override file
165+
LLM_BASE_URL=http://${LLM_HOST}:${LLM_PORT}/v1
166+
LLM_MODEL=astronomy-llm
167+
OPENAI_API_KEY=dummy
168+
153169
# Valkey
154170
VALKEY_PORT=6379
155171
VALKEY_ADDR=valkey-cart:${VALKEY_PORT}

.env.override

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
11
# DO NOT PUSH CHANGES OF THIS FILE TO opentelemetry/opentelemetry-demo
22
# PLACE YOUR .env ENVIRONMENT VARIABLES OVERRIDES IN THIS FILE
3+
4+
5+
# To use a real OpenAI API-compatible LLM,
6+
# set the appropriate values for the target LLM
7+
# Required permissions:
8+
# [Models and Model capabilities]
9+
10+
#LLM_BASE_URL=https://api.openai.com/v1
11+
#LLM_MODEL=gpt-4o-mini
12+
#OPENAI_API_KEY=<replace with API key>

.github/workflows/checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ permissions:
1414

1515
jobs:
1616
build_images:
17-
permissions: # required by the reusable workflow
17+
permissions: # required by the reusable workflow
1818
contents: read
1919
packages: write
2020
uses: ./.github/workflows/component-build-images.yml

.github/workflows/component-build-images.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ jobs:
106106
tag_suffix: kafka
107107
context: ./
108108
setup-qemu: true
109+
- file: ./src/llm/Dockerfile
110+
tag_suffix: llm
111+
context: ./
112+
setup-qemu: true
109113
- file: ./src/load-generator/Dockerfile
110114
tag_suffix: load-generator
111115
context: ./
@@ -126,6 +130,10 @@ jobs:
126130
tag_suffix: product-catalog
127131
context: ./
128132
setup-qemu: true
133+
- file: ./src/product-reviews/Dockerfile
134+
tag_suffix: product-reviews
135+
context: ./
136+
setup-qemu: true
129137
- file: ./src/quote/Dockerfile
130138
tag_suffix: quote
131139
context: ./

.licenserc.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
"src/checkout/genproto/",
4848
"src/flagd-ui/assets/vendor/",
4949
"src/product-catalog/genproto/",
50+
"src/product-reviews/demo_pb2.py",
51+
"src/product-reviews/demo_pb2_grpc.py",
5052
"src/react-native-app/ios/Pods/",
5153
"src/react-native-app/ios/build/",
5254
"src/react-native-app/android/app/build/",

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ the release.
1515
([#2615](https://github.com/open-telemetry/opentelemetry-demo/pull/2615))
1616
* [frontend] Fix navigation and cart math
1717
([#2660](https://github.com/open-telemetry/opentelemetry-demo/pull/2660))
18+
* [feat] Add Product Review service with AI-generated summaries
19+
([#2663](https://github.com/open-telemetry/opentelemetry-demo/pull/2663))
1820
* [chore] Upgrade OpenFeature and add fix deprecation warnings for dependency
1921
injection
2022
([#2644](https://github.com/open-telemetry/opentelemetry-demo/pull/2644))

docker-compose-tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ services:
4545
- FRONTEND_ADDR
4646
- PAYMENT_ADDR
4747
- PRODUCT_CATALOG_ADDR
48+
- PRODUCT_REVIEWS_ADDR
4849
- RECOMMENDATION_ADDR
4950
- SHIPPING_ADDR
5051
- KAFKA_ADDR
@@ -73,10 +74,14 @@ services:
7374
condition: service_started
7475
frontend:
7576
condition: service_started
77+
llm:
78+
condition: service_started
7679
payment:
7780
condition: service_started
7881
product-catalog:
7982
condition: service_started
83+
product-reviews:
84+
condition: service_started
8085
quote:
8186
condition: service_started
8287
recommendation:

docker-compose.minimal.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,47 @@ services:
430430
condition: service_started
431431
logging: *logging
432432

433+
# Product reviews service
434+
product-reviews:
435+
image: ${IMAGE_NAME}:${DEMO_VERSION}-product-reviews
436+
container_name: product-reviews
437+
build:
438+
context: ./
439+
dockerfile: ${PRODUCT_REVIEWS_DOCKERFILE}
440+
cache_from:
441+
- ${IMAGE_NAME}:${IMAGE_VERSION}-product-reviews
442+
deploy:
443+
resources:
444+
limits:
445+
memory: 500M
446+
restart: unless-stopped
447+
ports:
448+
- "${PRODUCT_REVIEWS_PORT}"
449+
environment:
450+
- PRODUCT_REVIEWS_PORT
451+
- OTEL_PYTHON_LOG_CORRELATION=true
452+
- OTEL_EXPORTER_OTLP_ENDPOINT
453+
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
454+
- OTEL_RESOURCE_ATTRIBUTES
455+
- OTEL_SERVICE_NAME=product-reviews
456+
- OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true
457+
- PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
458+
- DB_CONNECTION_STRING=host=${POSTGRES_HOST} user=otelu password=otelp dbname=${POSTGRES_DB}
459+
- LLM_BASE_URL
460+
- OPENAI_API_KEY
461+
- LLM_MODEL
462+
- PRODUCT_CATALOG_ADDR
463+
depends_on:
464+
product-catalog:
465+
condition: service_started
466+
llm:
467+
condition: service_started
468+
postgresql:
469+
condition: service_started
470+
otel-collector:
471+
condition: service_started
472+
logging: *logging
473+
433474
# Quote service
434475
quote:
435476
image: ${IMAGE_NAME}:${DEMO_VERSION}-quote
@@ -559,6 +600,27 @@ services:
559600
logging:
560601
*logging
561602

603+
# LLM used by Product Review service
604+
llm:
605+
image: ${IMAGE_NAME}:${DEMO_VERSION}-llm
606+
container_name: llm
607+
build:
608+
context: ./
609+
dockerfile: ${LLM_DOCKERFILE}
610+
cache_from:
611+
- ${IMAGE_NAME}:${IMAGE_VERSION}-llm
612+
deploy:
613+
resources:
614+
limits:
615+
memory: 50M
616+
restart: unless-stopped
617+
environment:
618+
- FLAGD_HOST
619+
- FLAGD_PORT
620+
ports:
621+
- "${LLM_PORT}"
622+
logging: *logging
623+
562624
# Valkey used by Cart service
563625
valkey-cart:
564626
image: ${VALKEY_IMAGE}

docker-compose.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ services:
288288
- CHECKOUT_ADDR
289289
- CURRENCY_ADDR
290290
- PRODUCT_CATALOG_ADDR
291+
- PRODUCT_REVIEWS_ADDR
291292
- RECOMMENDATION_ADDR
292293
- SHIPPING_ADDR
293294
- OTEL_EXPORTER_OTLP_ENDPOINT
@@ -511,6 +512,51 @@ services:
511512
condition: service_started
512513
logging: *logging
513514

515+
# Product reviews service
516+
product-reviews:
517+
image: ${IMAGE_NAME}:${DEMO_VERSION}-product-reviews
518+
container_name: product-reviews
519+
build:
520+
context: ./
521+
dockerfile: ${PRODUCT_REVIEWS_DOCKERFILE}
522+
cache_from:
523+
- ${IMAGE_NAME}:${IMAGE_VERSION}-product-reviews
524+
deploy:
525+
resources:
526+
limits:
527+
memory: 100M
528+
restart: unless-stopped
529+
ports:
530+
- "${PRODUCT_REVIEWS_PORT}"
531+
environment:
532+
- PRODUCT_REVIEWS_PORT
533+
- OTEL_PYTHON_LOG_CORRELATION=true
534+
- OTEL_EXPORTER_OTLP_ENDPOINT
535+
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
536+
- OTEL_RESOURCE_ATTRIBUTES
537+
- OTEL_SERVICE_NAME=product-reviews
538+
- OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true
539+
- PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
540+
- DB_CONNECTION_STRING=host=${POSTGRES_HOST} user=otelu password=otelp dbname=${POSTGRES_DB}
541+
- LLM_BASE_URL
542+
- OPENAI_API_KEY
543+
- LLM_MODEL
544+
- PRODUCT_CATALOG_ADDR
545+
- FLAGD_HOST
546+
- FLAGD_PORT
547+
- LLM_HOST
548+
- LLM_PORT
549+
depends_on:
550+
product-catalog:
551+
condition: service_started
552+
llm:
553+
condition: service_started
554+
postgresql:
555+
condition: service_started
556+
otel-collector:
557+
condition: service_started
558+
logging: *logging
559+
514560
# Quote service
515561
quote:
516562
image: ${IMAGE_NAME}:${DEMO_VERSION}-quote
@@ -704,6 +750,30 @@ services:
704750
retries: 10
705751
logging: *logging
706752

753+
# LLM used by Product Review service
754+
llm:
755+
image: ${IMAGE_NAME}:${DEMO_VERSION}-llm
756+
container_name: llm
757+
build:
758+
context: ./
759+
dockerfile: ${LLM_DOCKERFILE}
760+
cache_from:
761+
- ${IMAGE_NAME}:${IMAGE_VERSION}-llm
762+
deploy:
763+
resources:
764+
limits:
765+
memory: 50M
766+
restart: unless-stopped
767+
environment:
768+
- FLAGD_HOST
769+
- FLAGD_PORT
770+
ports:
771+
- "${LLM_PORT}"
772+
depends_on:
773+
flagd:
774+
condition: service_started
775+
logging: *logging
776+
707777
# Postgresql used by Accounting service
708778
postgresql:
709779
image: ${IMAGE_NAME}:${DEMO_VERSION}-postgresql

docker-gen-proto.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ if [ -z "$1" ]; then
5454
#gen_proto_js payment
5555
gen_proto_go product-catalog
5656
#gen_proto_php quote
57+
gen_proto_python product-reviews
5758
gen_proto_python recommendation
5859
#gen_proto_rust shipping
5960
else

0 commit comments

Comments
 (0)