Skip to content

Commit

Permalink
Merge branch 'opea-project:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
kkrishTa authored Jan 19, 2025
2 parents 3f135a8 + 9d3d6d5 commit c6b281d
Show file tree
Hide file tree
Showing 258 changed files with 4,535 additions and 805 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/_helm-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,20 @@ jobs:
exit 0
fi
helm-charts/update_dependency.sh && helm dependency update ${{ env.CHART_FOLDER }}
for img in `helm template -n $NAMESPACE -f ${{ env.CHART_FOLDER }}/${value_file} $RELEASE_NAME ${{ env.CHART_FOLDER }} | grep 'image:' | grep 'opea/' | awk '{print $2}' | xargs`;
do
if ! .github/workflows/scripts/e2e/chart_test.sh check_local_opea_image "$img"; then
echo "skip_validate=true" >> $GITHUB_ENV
echo "should_cleanup=false" >> $GITHUB_ENV
exit 1
fi
done
if ! helm install --create-namespace --namespace $NAMESPACE --wait \
--timeout "$ROLLOUT_TIMEOUT_SECONDS" \
--set GOOGLE_API_KEY=${{ env.GOOGLE_API_KEY}} \
--set GOOGLE_CSE_ID=${{ env.GOOGLE_CSE_ID}} \
--set web-retriever.GOOGLE_API_KEY=${{ env.GOOGLE_API_KEY}} \
--set web-retriever.GOOGLE_CSE_ID=${{ env.GOOGLE_CSE_ID}} \
--values ${{ env.CHART_FOLDER }}/${value_file} \
$RELEASE_NAME ${{ env.CHART_FOLDER }} ; then
echo "Failed to install chart ${{ inputs.workload }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-online-doc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:

- name: Checkout
Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/pr-chart-e2e.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2024 Intel Corporation
# Copyright (C) 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

name: E2E test with helm charts
Expand Down Expand Up @@ -50,8 +50,14 @@ jobs:
cut -d'/' -f3 | sort -u )
run_matrix="{\"include\":["
for chart in ${e2e_charts}; do
for file in "$CHARTS_DIR/$chart"/ci-*values.yaml; do
for file in "$CHARTS_DIR/$chart"/*values.yaml; do
if [ -f "$file" ]; then
if [[ "$file" == *"nv-values.yaml" ]] || [[ "$file" == *"hpa-values.yaml" ]] || [[ "$file" == *"/values.yaml" ]]; then
continue
fi
if [[ "$file" == *"variant_"* ]] || [[ "$file" == *"milvus"* ]]; then
continue
fi
filename=$(basename "$file" .yaml)
if [[ "$filename" == *"gaudi"* ]]; then
run_matrix="${run_matrix}{\"example\":\"${chart}\",\"hardware\":\"gaudi\", \"valuefile\":\"${filename}\"},"
Expand All @@ -62,8 +68,14 @@ jobs:
done
done
for chart in ${common_charts}; do
for file in "$CHARTS_DIR/common/$chart"/ci-*values.yaml; do
for file in "$CHARTS_DIR/common/$chart"/*values.yaml; do
if [ -f "$file" ]; then
if [[ "$file" == *"nv-values.yaml" ]] || [[ "$file" == *"hpa-values.yaml" ]] || [[ "$file" == *"/values.yaml" ]]; then
continue
fi
if [[ "$file" == *"variant_"* ]] || [[ "$file" == *"milvus"* ]]; then
continue
fi
filename=$(basename "$file" .yaml)
if [[ "$filename" == *"gaudi"* ]]; then
run_matrix="${run_matrix}{\"example\":\"${chart}\",\"hardware\":\"gaudi\", \"valuefile\":\"${filename}\",\"directory\":\"common\"},"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-path-detection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:
fi
fi
else
echo "$check_path does not exist"
echo "Invalid reference path from $refer_path, reference path: $(echo $png_line | cut -d ']' -f2)"
fail="TRUE"
fi
done
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@
name: Update the helm charts 0-latest

on:
pull_request:
push:
branches:
- main
types: [closed]
paths:
- helm-charts/**
env:
CHARTS_DIR: "helm-charts"

jobs:
run-on-merge:
if: github.event.pull_request.merged == true
release-on-push:
runs-on: ubuntu-latest

steps:
Expand All @@ -32,7 +30,7 @@ jobs:
echo "Version check failed, only update 0-latest"
exit 1
fi
base_commit=${{ github.event.pull_request.base.sha }}
base_commit=$(git rev-parse HEAD~1) # push event
merged_commit=$(git log -1 --format='%H')
# Update components
common_charts=$(git diff --name-only ${base_commit} ${merged_commit} | \
Expand All @@ -51,8 +49,8 @@ jobs:
popd
# Update Examples
e2e_charts=$(git diff --name-only ${base_commit} ${merged_commit} | \
grep -v "common" | \
grep -vE 'README.md|*.sh' | \
grep "^$CHARTS_DIR" | \
grep -vE 'README.md|common|*.sh' | \
cut -d'/' -f2 | sort -u )
echo "Charts to be updated: $e2e_charts"
echo "${{ secrets.ACTION_TOKEN }}" | helm registry login ghcr.io -u opea --password-stdin
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/scripts/e2e/chart_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,27 @@ function dump_all_pod_logs() {
done
}

function check_local_opea_image() {
origimg=$1
img=$(echo $origimg | xargs)
host=$(echo $img | awk 'BEGIN {FS="opea/"} {print $1}')
if [ -z "$host" ]; then
echo "Skip none CI local image $origimg"
exit 0
fi
image=$(echo $img | awk 'BEGIN {FS="opea/"} {print $2}')
image_name=$(echo $image | awk 'BEGIN {FS=":"} {print $1}')
image_tag=$(echo $image | awk 'BEGIN {FS=":"} {print $2}')
image_tag=${image_tag:-latest}
resp=$(curl -s -f -X GET "${host}v2/opea/${image_name}/manifests/${image_tag}")
if [ -z "$resp" ]; then
echo "Failed to get image manifest $origimg"
exit 1
fi
DATE=$(echo "$resp" | jq -r '.history[0].v1Compatibility' | jq -r '.created')
echo "Found image $origimg created at $DATE"
}

if [ $# -eq 0 ]; then
echo "Usage: $0 <function_name>"
exit 1
Expand All @@ -88,6 +109,9 @@ case "$1" in
dump_all_pod_logs)
dump_all_pod_logs $2
;;
check_local_opea_image)
check_local_opea_image $2
;;
*)
echo "Unknown function: $1"
;;
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: end-of-file-fixer
files: (.*\.(py|md|rst|yaml|yml|json|ts|js|html|svelte|sh))$
Expand Down Expand Up @@ -82,29 +82,29 @@ repos:
- [email protected]

- repo: https://github.com/psf/black.git
rev: 24.3.0
rev: 24.10.0
hooks:
- id: black
files: (.*\.py)$

- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
rev: 1.19.1
hooks:
- id: blacken-docs
args: [--line-length=120, --skip-errors]
additional_dependencies:
- black==24.3.0

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
args: [-w]
additional_dependencies:
- tomli

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
rev: v0.8.6
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --no-cache]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ The following steps are optional. They're only required if you want to run the w

4. [Install Intel Gaudi device plugin for Kubernetes](https://docs.habana.ai/en/latest/Installation_Guide/Additional_Installation/Kubernetes_Installation/index.html).

Alternatively, Intel provides a base operator to manage the Gaudi software stack. Refer to [this file](kubernetes-addons/Intel-Gaudi-Base-Operator/README.md) for details.
Alternatively, Intel provides a [base operator](https://docs.habana.ai/en/latest/Installation_Guide/Additional_Installation/Kubernetes_Installation/Kubernetes_Operator.html) to manage the Gaudi software stack.

## Usages

### Use GenAI Microservices Connector (GMC) to deploy and adjust GenAIExamples

Follow [GMC README](microservices-connector/README.md)
to install GMC into your kubernetes cluster. [GenAIExamples](https://github.com/opea-project/GenAIExamples) contains several sample GenAI example use case pipelines such as ChatQnA, DocSum, etc.
Once you have deployed GMC in your Kubernetes cluster, you can deploy any of the example pipelines by following its Readme file (e.g. [Docsum](https://github.com/opea-project/GenAIExamples/blob/main/DocSum/kubernetes/intel/README_gmc.md)).
Once you have deployed GMC in your Kubernetes cluster, you can deploy any of the example pipelines by following its Readme file (e.g. [Docsum](https://github.com/opea-project/GenAIExamples/blob/main/DocSum/kubernetes/gmc/README.md)).

### Use helm charts to deploy

Expand Down
10 changes: 9 additions & 1 deletion helm-charts/agentqna/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ type: application
dependencies:
- name: agent
version: 0-latest
alias: worker
alias: ragagent
repository: "file://../common/agent"
- name: agent
version: 0-latest
alias: sqlagent
repository: "file://../common/agent"
- name: agent
version: 0-latest
Expand All @@ -18,6 +22,10 @@ dependencies:
version: 0-latest
repository: "file://../common/tgi"
condition: tgi.enabled
- name: vllm
version: 0-latest
repository: "file://../common/vllm"
condition: vllm.enabled
- name: tei
version: 0-latest
repository: "file://../common/tei"
Expand Down
27 changes: 10 additions & 17 deletions helm-charts/agentqna/gaudi-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,7 @@
# by overriding their subchart values

tgi:
accelDevice: "gaudi"
image:
repository: ghcr.io/huggingface/tgi-gaudi
tag: "2.0.6"
resources:
limits:
habana.ai/gaudi: 4
MAX_INPUT_LENGTH: "4096"
MAX_TOTAL_TOKENS: "8192"
CUDA_GRAPHS: ""
OMPI_MCA_btl_vader_single_copy_mechanism: "none"
PT_HPU_ENABLE_LAZY_COLLECTIVES: "true"
ENABLE_HPU_GRAPH: "true"
LIMIT_HPU_GRAPH: "true"
USE_FLASH_ATTENTION: "true"
FLASH_ATTENTION_RECOMPUTE: "true"
extraCmdArgs: ["--sharded","true","--num-shard","4"]
enabled: true
livenessProbe:
initialDelaySeconds: 5
periodSeconds: 5
Expand All @@ -35,3 +19,12 @@ tgi:
periodSeconds: 5
timeoutSeconds: 1
failureThreshold: 120
supervisor:
llm_endpoint_url: http://{{ .Release.Name }}-tgi
llm_engine: tgi
ragagent:
llm_endpoint_url: http://{{ .Release.Name }}-tgi
llm_engine: tgi
sqlagent:
llm_endpoint_url: http://{{ .Release.Name }}-tgi
llm_engine: tgi
42 changes: 41 additions & 1 deletion helm-charts/agentqna/templates/tests/test-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,54 @@ spec:
command: ['bash', '-c']
args:
- |
# Ingest data
cd /mnt/tools
pip install requests tqdm
./ingest_data.sh
# Test ragagent
max_retry=10;
for ((i=1; i<=max_retry; i++)); do
curl http://{{ include "agentqna.fullname" (index .Subcharts "ragagent") }}:{{ .Values.ragagent.service.port }}/v1/chat/completions -sS --fail-with-body \
-X POST \
-d '{"messages": "Tell me about Michael Jackson song Thriller"}' \
-H 'Content-Type: application/json' && break;
curlcode=$?
if [[ $curlcode -eq 7 ]]; then sleep 10; else echo "curl failed with code $curlcode"; exit 1; fi;
done;
if [ $i -gt $max_retry ]; then echo "test failed with maximum retry"; exit 1; fi
# Test sqlagent
max_retry=10;
for ((i=1; i<=max_retry; i++)); do
curl http://{{ include "agentqna.fullname" (index .Subcharts "sqlagent") }}:{{ .Values.sqlagent.service.port }}/v1/chat/completions -sS --fail-with-body \
-X POST \
-d '{"messages": "How many employees are there in the company?"}' \
-H 'Content-Type: application/json' && break;
curlcode=$?
if [[ $curlcode -eq 7 ]]; then sleep 10; else echo "curl failed with code $curlcode"; exit 1; fi;
done;
if [ $i -gt $max_retry ]; then echo "test failed with maximum retry"; exit 1; fi
# Test supervisor
max_retry=20;
for ((i=1; i<=max_retry; i++)); do
curl http://{{ include "agentqna.fullname" (index .Subcharts "supervisor") }}:{{ .Values.supervisor.service.port }}/v1/chat/completions -sS --fail-with-body \
-X POST \
-d '{"query": "Tell me three songs of Michael Jackson."}' \
-d '{"messages": "How many albums does Iron Maiden have?"}' \
-H 'Content-Type: application/json' && break;
curlcode=$?
if [[ $curlcode -eq 7 ]]; then sleep 10; else echo "curl failed with code $curlcode"; exit 1; fi;
done;
if [ $i -gt $max_retry ]; then echo "test failed with maximum retry"; exit 1; fi
volumeMounts:
- mountPath: /mnt/tools
name: test
volumes:
- name: test
hostPath:
path: /mnt/tools
type: Directory
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}

restartPolicy: Never
Loading

0 comments on commit c6b281d

Please sign in to comment.