Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helm Chart for AgentQnA #539

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions helm-charts/agentqna/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
43 changes: 43 additions & 0 deletions helm-charts/agentqna/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: v2
name: agentqna
description: The Helm chart to deploy AgentQnA
type: application
dependencies:
- name: agent
version: 1.0.0
alias: worker
repository: "file://../common/agent"
- name: agent
version: 1.0.0
alias: supervisor
repository: "file://../common/agent"
- name: tgi
version: 1.0.0
repository: "file://../common/tgi"
condition: tgi.enabled
- name: tei
version: 1.0.0
repository: "file://../common/tei"
- name: embedding-usvc
version: 1.0.0
repository: "file://../common/embedding-usvc"
- name: teirerank
version: 1.0.0
repository: "file://../common/teirerank"
- name: reranking-usvc
version: 1.0.0
repository: "file://../common/reranking-usvc"
- name: redis-vector-db
version: 1.0.0
repository: "file://../common/redis-vector-db"
- name: retriever-usvc
version: 1.0.0
repository: "file://../common/retriever-usvc"
- name: data-prep
version: 1.0.0
repository: "file://../common/data-prep"
version: 1.0.0
appVersion: "v1.0"
26 changes: 26 additions & 0 deletions helm-charts/agentqna/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# AgentQnA

Helm chart for deploying AgentQnA service.

## Deploy

helm repo add opea https://opea-project.github.io/GenAIInfra

helm install agentqna opea/agentqna --set global.HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} --set tgi.enabled=True

## Verify

To verify the installation, run the command `kubectl get pod` to make sure all pods are running.

### Verify the workload through curl command

Run the command `kubectl port-forward svc/agentqna-supervisor 9090:9090` to expose the service for access.

Open another terminal and run the following command to verify the service if working:

```console
curl http://localhost:9090/v1/chat/completions \
-X POST \
-H "Content-Type: application/json" \
-d '{"query": "Most recent album by Michael Jackson"}'
```
37 changes: 37 additions & 0 deletions helm-charts/agentqna/gaudi-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

# Accelerate inferencing in heaviest components to improve performance
# by overriding their subchart values

tgi:
accelDevice: "gaudi"
image:
repository: ghcr.io/huggingface/tgi-gaudi
tag: "2.0.5"
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"]
livenessProbe:
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 1
readinessProbe:
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 1
startupProbe:
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 1
failureThreshold: 120
62 changes: 62 additions & 0 deletions helm-charts/agentqna/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "agentqna.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "agentqna.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "agentqna.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "agentqna.labels" -}}
helm.sh/chart: {{ include "agentqna.chart" . }}
{{ include "agentqna.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "agentqna.selectorLabels" -}}
app.kubernetes.io/name: {{ include "agentqna.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "agentqna.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "agentqna.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
94 changes: 94 additions & 0 deletions helm-charts/agentqna/templates/crag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-crag
labels:
{{- include "agentqna.labels" . | nindent 4 }}
app: {{ .Release.Name }}-crag
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "agentqna.selectorLabels" . | nindent 6 }}
app: {{ .Release.Name }}-crag
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "agentqna.selectorLabels" . | nindent 8 }}
app: {{ .Release.Name }}-crag
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Release.Name }}
env:
{{- if .Values.LOGFLAG }}
- name: LOGFLAG
value: {{ .Values.LOGFLAG | quote }}
{{- end }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.crag.image.repository }}:{{ .Values.crag.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.crag.image.pullPolicy }}
volumeMounts:
- mountPath: /tmp
name: tmp
ports:
- name: crag
containerPort: 8000
protocol: TCP
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: tmp
emptyDir: {}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.evenly_distributed }}
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
{{- include "agentqna.selectorLabels" . | nindent 14 }}
app: {{ .Release.Name }}-crag
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-crag
labels:
{{- include "agentqna.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- port: 8080
targetPort: 8000
protocol: TCP
name: crag
selector:
{{- include "agentqna.selectorLabels" . | nindent 4 }}
app: {{ .Release.Name }}-crag
Loading