Compare commits
354 Commits
v1.0
...
fix_videoq
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
abafd5de20 | ||
|
|
970b869838 | ||
|
|
87ff149f61 | ||
|
|
c39a569ab2 | ||
|
|
81b02bb947 | ||
|
|
47069ac70c | ||
|
|
6ce7730863 | ||
|
|
ad5523bac7 | ||
|
|
88a8235f21 | ||
|
|
63ad850052 | ||
|
|
9a0c547112 | ||
|
|
26a6da4123 | ||
|
|
45d5da2ddd | ||
|
|
1b3291a1c8 | ||
|
|
7ac8cf517a | ||
|
|
44a689b0bf | ||
|
|
388d3eb5c5 | ||
|
|
ef9ad61440 | ||
|
|
4c41a5db83 | ||
|
|
9adf7a6af0 | ||
|
|
a4d028e8ea | ||
|
|
32d4f714fd | ||
|
|
fdbc27a9b5 | ||
|
|
5f4b1828a5 | ||
|
|
39abef8be8 | ||
|
|
ed163087ba | ||
|
|
259099d19f | ||
|
|
9a1118730b | ||
|
|
ffce7068aa | ||
|
|
9b0f98be8b | ||
|
|
f0fea7b706 | ||
|
|
1864fac978 | ||
|
|
94f71f2322 | ||
|
|
6600c32a9b | ||
|
|
d953332f43 | ||
|
|
cbe5805f47 | ||
|
|
27fdbcab58 | ||
|
|
f07cf1dad2 | ||
|
|
ee0e5cc8d9 | ||
|
|
5c36443b11 | ||
|
|
62cea74a23 | ||
|
|
b721c256f9 | ||
|
|
927698e23e | ||
|
|
c3e84b5ffa | ||
|
|
6b2a041f25 | ||
|
|
842f46326b | ||
|
|
284db982be | ||
|
|
fc96fe83e2 | ||
|
|
0316114c4b | ||
|
|
0408453fa2 | ||
|
|
d0cd0aaf53 | ||
|
|
0ba3decb6b | ||
|
|
3d3ac59bfb | ||
|
|
f11ab458d8 | ||
|
|
f3562bef36 | ||
|
|
7a54064d65 | ||
|
|
0f7e5a37ac | ||
|
|
2d5898244c | ||
|
|
59722d2bc9 | ||
|
|
6bfd156573 | ||
|
|
528770a8d7 | ||
|
|
239995da16 | ||
|
|
f65e8d8668 | ||
|
|
a49a36cebc | ||
|
|
742cb6ddd3 | ||
|
|
00e9da9ced | ||
|
|
277222a922 | ||
|
|
5c68effc9f | ||
|
|
39409d7f61 | ||
|
|
71e3c57366 | ||
|
|
5ad24af2ee | ||
|
|
3a9a24a51a | ||
|
|
301b5e9a69 | ||
|
|
b4269d6c4f | ||
|
|
4cabd55778 | ||
|
|
698a06edbf | ||
|
|
0eae391fda | ||
|
|
23d885bf60 | ||
|
|
287f03a834 | ||
|
|
a65a1e5598 | ||
|
|
9812c2fb45 | ||
|
|
7d218b9f36 | ||
|
|
ba9892f8ee | ||
|
|
ff1310b11a | ||
|
|
ca15fe9bdb | ||
|
|
f48bd8e74f | ||
|
|
91ff520baa | ||
|
|
3ca78867eb | ||
|
|
7a3dfa90ca | ||
|
|
c795ef2203 | ||
|
|
99120f4cd2 | ||
|
|
9fe480b010 | ||
|
|
113281d073 | ||
|
|
370d6928c1 | ||
|
|
2b26450bb9 | ||
|
|
81022355a7 | ||
|
|
ddacb7e86d | ||
|
|
5128c2d650 | ||
|
|
b3c405a5f6 | ||
|
|
5638075d65 | ||
|
|
23117871c2 | ||
|
|
9970605460 | ||
|
|
28206311fd | ||
|
|
589bfb2b7a | ||
|
|
d2b49bbc82 | ||
|
|
41374d865b | ||
|
|
2c624e1f5f | ||
|
|
00241d01d2 | ||
|
|
ed2b8ed983 | ||
|
|
a6e702e4d5 | ||
|
|
aa5c91d7ee | ||
|
|
b88d09e23f | ||
|
|
464e2d3125 | ||
|
|
1f29eca288 | ||
|
|
1d7ac82979 | ||
|
|
5c7a5bd850 | ||
|
|
72f8079289 | ||
|
|
6169ea4921 | ||
|
|
75b0961a48 | ||
|
|
cc1d97f816 | ||
|
|
250ffb8b66 | ||
|
|
1e9d111982 | ||
|
|
597f17b979 | ||
|
|
b9790d809b | ||
|
|
b27b48c488 | ||
|
|
0bf1d0be65 | ||
|
|
a01729a5c2 | ||
|
|
6b6a08df78 | ||
|
|
0b23cba505 | ||
|
|
50dd959d60 | ||
|
|
05365b6140 | ||
|
|
fd706d1a70 | ||
|
|
3b9e55cb8e | ||
|
|
7d9b34cf5e | ||
|
|
84a6a6e9bc | ||
|
|
89a7f9e001 | ||
|
|
236ea6bcce | ||
|
|
67634dfd22 | ||
|
|
df7c192835 | ||
|
|
f930638844 | ||
|
|
5613add4dd | ||
|
|
e18369ba0d | ||
|
|
2af1ea0f8e | ||
|
|
c760cac2f4 | ||
|
|
a50e4e6f9f | ||
|
|
00b526c8e5 | ||
|
|
4c01e14642 | ||
|
|
6f9f6f0bad | ||
|
|
893f324d07 | ||
|
|
77e640e2f3 | ||
|
|
07e47a1f38 | ||
|
|
bde285dfce | ||
|
|
f5c08d4fbb | ||
|
|
3a371ac102 | ||
|
|
031cf6e1ff | ||
|
|
3299e5c9f5 | ||
|
|
340796bbae | ||
|
|
8182a83382 | ||
|
|
8192c3166f | ||
|
|
240054ac52 | ||
|
|
c9caf1c083 | ||
|
|
a426a9a51d | ||
|
|
bb466b3791 | ||
|
|
0f8344e4f5 | ||
|
|
ed8dbaac47 | ||
|
|
e8cffc6146 | ||
|
|
907b30b7fe | ||
|
|
545aa571bf | ||
|
|
5422bcb970 | ||
|
|
736155ca95 | ||
|
|
39fa25e03a | ||
|
|
ac470421d0 | ||
|
|
edcd7c9d6a | ||
|
|
ef2047b070 | ||
|
|
94231584aa | ||
|
|
c5177c5e2f | ||
|
|
006c61bcbb | ||
|
|
cc108b5a18 | ||
|
|
f70d9c3853 | ||
|
|
8808b51e42 | ||
|
|
17d4b0c97f | ||
|
|
3a03d31f8f | ||
|
|
179fd84362 | ||
|
|
9ba034b22d | ||
|
|
c3e6f43ece | ||
|
|
1ac756a1c7 | ||
|
|
56f770cb28 | ||
|
|
0cdeb946e4 | ||
|
|
5648839411 | ||
|
|
eb91d1f054 | ||
|
|
2587179224 | ||
|
|
7e62175c2e | ||
|
|
152adf8012 | ||
|
|
83172e9a99 | ||
|
|
fb514bb8ba | ||
|
|
b1bb6db52d | ||
|
|
7949045176 | ||
|
|
cbe952ec5e | ||
|
|
3b1a9fe9e1 | ||
|
|
e66d7fe381 | ||
|
|
6d3a017609 | ||
|
|
dbf4ba03fa | ||
|
|
4f96d9e605 | ||
|
|
a8f4245384 | ||
|
|
096a37aacc | ||
|
|
6f8fa6a689 | ||
|
|
39f68d5d6b | ||
|
|
00d9bb6128 | ||
|
|
59b624c677 | ||
|
|
2b2c7ee2f5 | ||
|
|
6b9a27dd83 | ||
|
|
5720cd45c0 | ||
|
|
73879d3cec | ||
|
|
7c9ed04132 | ||
|
|
9ff7df9202 | ||
|
|
b5f95f735e | ||
|
|
393367e9f1 | ||
|
|
7adbba6add | ||
|
|
0d52c2f003 | ||
|
|
1ff85f6a85 | ||
|
|
f7a7f8aa3f | ||
|
|
e3187be819 | ||
|
|
abd9d12937 | ||
|
|
a7353bbaa4 | ||
|
|
aa314f6757 | ||
|
|
3744bb8c1b | ||
|
|
82801d0121 | ||
|
|
f7026773b8 | ||
|
|
edc09ece5c | ||
|
|
dfed2aead2 | ||
|
|
049517f977 | ||
|
|
ee83a6d5b4 | ||
|
|
e2bdd19fd4 | ||
|
|
c9088eb824 | ||
|
|
9c3023a12e | ||
|
|
bbc95bb708 | ||
|
|
dd9623d3d5 | ||
|
|
4c27a3d30c | ||
|
|
40386d9bd6 | ||
|
|
fe97e88c7a | ||
|
|
11d8b24c8a | ||
|
|
4635a927fa | ||
|
|
1da44d99a1 | ||
|
|
e9b164505e | ||
|
|
6263b517b9 | ||
|
|
2de7c0ba89 | ||
|
|
944ae47948 | ||
|
|
2d9aeb3715 | ||
|
|
a0921f127f | ||
|
|
cf86aceb18 | ||
|
|
c2b7bd25d9 | ||
|
|
78331ee678 | ||
|
|
7f7ad0e256 | ||
|
|
0306c620b5 | ||
|
|
3372b9d480 | ||
|
|
5eb3d2869f | ||
|
|
ced68e1834 | ||
|
|
bf5c391e47 | ||
|
|
c65d7d40fb | ||
|
|
9d124161e0 | ||
|
|
0f5a9c4a5e | ||
|
|
a65640b4a5 | ||
|
|
7197286a14 | ||
|
|
960805a57b | ||
|
|
002f0e2b11 | ||
|
|
fde5996192 | ||
|
|
bc47930ce1 | ||
|
|
2332d22950 | ||
|
|
a2afce1675 | ||
|
|
89f4c5fb41 | ||
|
|
98f66405ac | ||
|
|
90c2d49050 | ||
|
|
95b58b51fa | ||
|
|
d3ce6f5357 | ||
|
|
a10b4a1f1d | ||
|
|
085d859a70 | ||
|
|
15cc457cea | ||
|
|
cfffb4c005 | ||
|
|
41955f65ad | ||
|
|
def39cfcdc | ||
|
|
35a4fef70d | ||
|
|
a3f9811f7e | ||
|
|
0eedbbfce0 | ||
|
|
9438d392b4 | ||
|
|
1929dfd3a0 | ||
|
|
c7e33647ad | ||
|
|
184e9a43b8 | ||
|
|
658867fce4 | ||
|
|
620ef76d16 | ||
|
|
23b820e740 | ||
|
|
3c164f3aa2 | ||
|
|
7669c42085 | ||
|
|
256b58c07e | ||
|
|
3c3a5bed67 | ||
|
|
37c74b232c | ||
|
|
4a265abb73 | ||
|
|
b0487fe92b | ||
|
|
d486bbbe10 | ||
|
|
b0f7c9cfc2 | ||
|
|
eeced9b31c | ||
|
|
b377c2b8f8 | ||
|
|
5dae713793 | ||
|
|
c930bea172 | ||
|
|
0edff26ee5 | ||
|
|
778afb50ac | ||
|
|
40800b0848 | ||
|
|
f2f6c09a0f | ||
|
|
c6fc92d37c | ||
|
|
c0643b71e8 | ||
|
|
088ab98f31 | ||
|
|
441f8cc6ba | ||
|
|
b056ce6617 | ||
|
|
773c32b38b | ||
|
|
619d941047 | ||
|
|
b71a12d424 | ||
|
|
12469c92d8 | ||
|
|
fbde15b40d | ||
|
|
ae10712fe8 | ||
|
|
373fa88033 | ||
|
|
e2f9037344 | ||
|
|
afc39fa4c0 | ||
|
|
e1c476c185 | ||
|
|
77920613dc | ||
|
|
7dec00176e | ||
|
|
bf28c7f098 | ||
|
|
63bad29794 | ||
|
|
36d3ef2b17 | ||
|
|
0c6b044139 | ||
|
|
d23cd799e9 | ||
|
|
644c3a67ce | ||
|
|
ffecd182db | ||
|
|
d16c80e493 | ||
|
|
2de1bfc5bb | ||
|
|
75df2c9979 | ||
|
|
62e06a0aff | ||
|
|
bd32b03e3c | ||
|
|
9d0b49c2d6 | ||
|
|
75ce2a3ca6 | ||
|
|
99c10933b4 | ||
|
|
8bcd82e82d | ||
|
|
c1038d2193 | ||
|
|
33b9d4e421 | ||
|
|
c9553c6f9a | ||
|
|
3e796ba73d | ||
|
|
5ed776709d | ||
|
|
954a22051b | ||
|
|
6f4b00f829 | ||
|
|
3fb60608b3 | ||
|
|
c35fe0b429 | ||
|
|
28f5e4a268 | ||
|
|
d55a33dda1 | ||
|
|
daf2a4fad7 | ||
|
|
3ce395582b | ||
|
|
7eaab93d0b |
36
.github/CODEOWNERS
vendored
@@ -1,13 +1,23 @@
|
||||
/AgentQnA/ xuhui.ren@intel.com
|
||||
/AudioQnA/ sihan.chen@intel.com
|
||||
/ChatQnA/ liang1.lv@intel.com
|
||||
/CodeGen/ liang1.lv@intel.com
|
||||
/CodeTrans/ sihan.chen@intel.com
|
||||
/DocSum/ letong.han@intel.com
|
||||
/DocIndexRetriever/ xuhui.ren@intel.com chendi.xue@intel.com
|
||||
/FaqGen/ xinyao.wang@intel.com
|
||||
/SearchQnA/ sihan.chen@intel.com
|
||||
/Translation/ liang1.lv@intel.com
|
||||
/VisualQnA/ liang1.lv@intel.com
|
||||
/ProductivitySuite/ hoong.tee.yeoh@intel.com
|
||||
/*/ liang1.lv@intel.com
|
||||
* liang1.lv@intel.com feng.tian@intel.com suyue.chen@intel.com
|
||||
/.github/ suyue.chen@intel.com ze.pan@intel.com
|
||||
/AgentQnA/ kaokao.lv@intel.com minmin.hou@intel.com
|
||||
/AudioQnA/ sihan.chen@intel.com wenjiao.yue@intel.com
|
||||
/AvatarChatbot/ chun.tao@intel.com kaokao.lv@intel.com
|
||||
/ChatQnA/ liang1.lv@intel.com letong.han@intel.com
|
||||
/CodeGen/ liang1.lv@intel.com xinyao.wang@intel.com
|
||||
/CodeTrans/ sihan.chen@intel.com xinyao.wang@intel.com
|
||||
/DBQnA/ supriya.krishnamurthi@intel.com liang1.lv@intel.com
|
||||
/DocIndexRetriever/ kaokao.lv@intel.com chendi.xue@intel.com
|
||||
/DocSum/ letong.han@intel.com xinyao.wang@intel.com
|
||||
/EdgeCraftRAG/ yongbo.zhu@intel.com mingyuan.qi@intel.com
|
||||
/FaqGen/ yogesh.pandey@intel.com xinyao.wang@intel.com
|
||||
/GraphRAG/ rita.brugarolas.brufau@intel.com abolfazl.shahbazi@intel.com
|
||||
/InstructionTuning/ xinyu.ye@intel.com kaokao.lv@intel.com
|
||||
/MultimodalQnA/ melanie.h.buehler@intel.com tiep.le@intel.com
|
||||
/ProductivitySuite/ jaswanth.karani@intel.com hoong.tee.yeoh@intel.com
|
||||
/RerankFinetuning/ xinyu.ye@intel.com kaokao.lv@intel.com
|
||||
/SearchQnA/ sihan.chen@intel.com letong.han@intel.com
|
||||
/Text2Image/ wenjiao.yue@intel.com xinyu.ye@intel.com
|
||||
/Translation/ liang1.lv@intel.com sihan.chen@intel.com
|
||||
/VideoQnA/ huiling.bao@intel.com xinyao.wang@intel.com
|
||||
/VisualQnA/ liang1.lv@intel.com sihan.chen@intel.com
|
||||
19
.github/ISSUE_TEMPLATE/1_bug_template.yml
vendored
@@ -4,6 +4,7 @@
|
||||
name: Report Bug
|
||||
description: Used to report bug
|
||||
title: "[Bug]"
|
||||
labels: ["bug"]
|
||||
body:
|
||||
- type: dropdown
|
||||
id: priority
|
||||
@@ -65,6 +66,7 @@ body:
|
||||
options:
|
||||
- label: Pull docker images from hub.docker.com
|
||||
- label: Build docker images from source
|
||||
- label: Other
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@@ -73,10 +75,11 @@ body:
|
||||
attributes:
|
||||
label: Deploy method
|
||||
options:
|
||||
- label: Docker compose
|
||||
- label: Docker
|
||||
- label: Kubernetes
|
||||
- label: Helm
|
||||
- label: Docker Compose
|
||||
- label: Kubernetes Helm Charts
|
||||
- label: Kubernetes GMC
|
||||
- label: Other
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@@ -87,6 +90,7 @@ body:
|
||||
options:
|
||||
- Single Node
|
||||
- Multiple Nodes
|
||||
- Other
|
||||
default: 0
|
||||
validations:
|
||||
required: true
|
||||
@@ -126,3 +130,12 @@ body:
|
||||
render: shell
|
||||
validations:
|
||||
required: false
|
||||
|
||||
|
||||
- type: textarea
|
||||
id: attachments
|
||||
attributes:
|
||||
label: Attachments
|
||||
description: Attach any relevant files or screenshots.
|
||||
validations:
|
||||
required: false
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
name: Report Feature
|
||||
description: Used to report feature
|
||||
title: "[Feature]"
|
||||
labels: ["feature"]
|
||||
body:
|
||||
- type: dropdown
|
||||
id: priority
|
||||
@@ -65,6 +66,7 @@ body:
|
||||
options:
|
||||
- Single Node
|
||||
- Multiple Nodes
|
||||
- Other
|
||||
default: 0
|
||||
validations:
|
||||
required: true
|
||||
2
.github/code_spell_ignore.txt
vendored
@@ -0,0 +1,2 @@
|
||||
ModelIn
|
||||
modelin
|
||||
|
||||
4
.github/license_template.txt
vendored
@@ -1,2 +1,2 @@
|
||||
Copyright (C) 2024 Intel Corporation
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
Copyright (C) 2025 Intel Corporation
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
44
.github/workflows/_example-workflow.yml
vendored
@@ -12,6 +12,10 @@ on:
|
||||
example:
|
||||
required: true
|
||||
type: string
|
||||
services:
|
||||
default: ""
|
||||
required: false
|
||||
type: string
|
||||
tag:
|
||||
default: "latest"
|
||||
required: false
|
||||
@@ -24,7 +28,7 @@ on:
|
||||
default: false
|
||||
required: false
|
||||
type: boolean
|
||||
test_k8s:
|
||||
test_helmchart:
|
||||
default: false
|
||||
required: false
|
||||
type: boolean
|
||||
@@ -36,6 +40,11 @@ on:
|
||||
default: "main"
|
||||
required: false
|
||||
type: string
|
||||
inject_commit:
|
||||
default: false
|
||||
required: false
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
####################################################################################################
|
||||
# Image Build
|
||||
@@ -46,33 +55,33 @@ jobs:
|
||||
- name: Clean Up Working Directory
|
||||
run: sudo rm -rf ${{github.workspace}}/*
|
||||
|
||||
- name: Get checkout ref
|
||||
- name: Get Checkout Ref
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" == "pull_request" ] || [ "${{ github.event_name }}" == "pull_request_target" ]; then
|
||||
echo "CHECKOUT_REF=refs/pull/${{ github.event.number }}/merge" >> $GITHUB_ENV
|
||||
else
|
||||
echo "CHECKOUT_REF=${{ github.ref }}" >> $GITHUB_ENV
|
||||
fi
|
||||
echo "checkout ref ${{ env.CHECKOUT_REF }}"
|
||||
|
||||
- name: Checkout out Repo
|
||||
- name: Checkout out GenAIExamples
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ env.CHECKOUT_REF }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Clone required Repo
|
||||
- name: Clone Required Repo
|
||||
run: |
|
||||
cd ${{ github.workspace }}/${{ inputs.example }}/docker_image_build
|
||||
docker_compose_path=${{ github.workspace }}/${{ inputs.example }}/docker_image_build/build.yaml
|
||||
if [[ $(grep -c "tei-gaudi:" ${docker_compose_path}) != 0 ]]; then
|
||||
git clone https://github.com/huggingface/tei-gaudi.git
|
||||
fi
|
||||
if [[ $(grep -c "vllm:" ${docker_compose_path}) != 0 ]]; then
|
||||
git clone https://github.com/vllm-project/vllm.git
|
||||
git clone --depth 1 https://github.com/vllm-project/vllm.git
|
||||
cd vllm && git rev-parse HEAD && cd ../
|
||||
fi
|
||||
git clone https://github.com/opea-project/GenAIComps.git
|
||||
cd GenAIComps && git checkout ${{ inputs.opea_branch }} && cd ../
|
||||
if [[ $(grep -c "vllm-gaudi:" ${docker_compose_path}) != 0 ]]; then
|
||||
git clone --depth 1 --branch v0.6.4.post2+Gaudi-1.19.0 https://github.com/HabanaAI/vllm-fork.git
|
||||
fi
|
||||
git clone --depth 1 --branch ${{ inputs.opea_branch }} https://github.com/opea-project/GenAIComps.git
|
||||
cd GenAIComps && git rev-parse HEAD && cd ../
|
||||
|
||||
- name: Build Image
|
||||
if: ${{ fromJSON(inputs.build) }}
|
||||
@@ -80,7 +89,9 @@ jobs:
|
||||
with:
|
||||
work_dir: ${{ github.workspace }}/${{ inputs.example }}/docker_image_build
|
||||
docker_compose_path: ${{ github.workspace }}/${{ inputs.example }}/docker_image_build/build.yaml
|
||||
service_list: ${{ inputs.services }}
|
||||
registry: ${OPEA_IMAGE_REPO}opea
|
||||
inject_commit: ${{ inputs.inject_commit }}
|
||||
tag: ${{ inputs.tag }}
|
||||
|
||||
####################################################################################################
|
||||
@@ -98,17 +109,16 @@ jobs:
|
||||
|
||||
|
||||
####################################################################################################
|
||||
# K8S Test
|
||||
# helmchart Test
|
||||
####################################################################################################
|
||||
test-k8s-manifest:
|
||||
needs: [build-images]
|
||||
if: ${{ fromJSON(inputs.test_k8s) }}
|
||||
uses: ./.github/workflows/_manifest-e2e.yml
|
||||
test-helmchart:
|
||||
if: ${{ fromJSON(inputs.test_helmchart) }}
|
||||
uses: ./.github/workflows/_helm-e2e.yml
|
||||
with:
|
||||
example: ${{ inputs.example }}
|
||||
hardware: ${{ inputs.node }}
|
||||
tag: ${{ inputs.tag }}
|
||||
context: "CD"
|
||||
mode: "CD"
|
||||
secrets: inherit
|
||||
|
||||
####################################################################################################
|
||||
|
||||
12
.github/workflows/_get-test-matrix.yml
vendored
@@ -14,7 +14,7 @@ on:
|
||||
test_mode:
|
||||
required: false
|
||||
type: string
|
||||
default: 'docker_compose'
|
||||
default: 'compose'
|
||||
outputs:
|
||||
run_matrix:
|
||||
description: "The matrix string"
|
||||
@@ -42,6 +42,12 @@ jobs:
|
||||
ref: ${{ env.CHECKOUT_REF }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Check Dangerous Command Injection
|
||||
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
|
||||
uses: opea-project/validation/actions/check-cmd@main
|
||||
with:
|
||||
work_dir: ${{ github.workspace }}
|
||||
|
||||
- name: Get test matrix
|
||||
id: get-test-matrix
|
||||
run: |
|
||||
@@ -54,9 +60,11 @@ jobs:
|
||||
base_commit=$(git rev-parse HEAD~1) # push event
|
||||
fi
|
||||
merged_commit=$(git log -1 --format='%H')
|
||||
echo "print all changed files..."
|
||||
git diff --name-only ${base_commit} ${merged_commit}
|
||||
changed_files="$(git diff --name-only ${base_commit} ${merged_commit} | \
|
||||
grep -vE '${{ inputs.diff_excluded_files }}')" || true
|
||||
echo "changed_files=$changed_files"
|
||||
echo "filtered changed_files=$changed_files"
|
||||
export changed_files=$changed_files
|
||||
export test_mode=${{ inputs.test_mode }}
|
||||
export WORKSPACE=${{ github.workspace }}
|
||||
|
||||
30
.github/workflows/_gmc-workflow.yml
vendored
@@ -67,36 +67,6 @@ jobs:
|
||||
make docker.build
|
||||
make docker.push
|
||||
|
||||
- name: Scan gmcmanager
|
||||
if: ${{ inputs.node == 'gaudi' }}
|
||||
uses: opea-project/validation/actions/trivy-scan@main
|
||||
with:
|
||||
image-ref: ${{ env.DOCKER_REGISTRY }}/gmcmanager:${{ env.VERSION }}
|
||||
output: gmcmanager-scan.txt
|
||||
|
||||
- name: Upload gmcmanager scan result
|
||||
if: ${{ inputs.node == 'gaudi' }}
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
with:
|
||||
name: gmcmanager-scan
|
||||
path: gmcmanager-scan.txt
|
||||
overwrite: true
|
||||
|
||||
- name: Scan gmcrouter
|
||||
if: ${{ inputs.node == 'gaudi' }}
|
||||
uses: opea-project/validation/actions/trivy-scan@main
|
||||
with:
|
||||
image-ref: ${{ env.DOCKER_REGISTRY }}/gmcrouter:${{ env.VERSION }}
|
||||
output: gmcrouter-scan.txt
|
||||
|
||||
- name: Upload gmcrouter scan result
|
||||
if: ${{ inputs.node == 'gaudi' }}
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
with:
|
||||
name: gmcrouter-scan
|
||||
path: gmcrouter-scan.txt
|
||||
overwrite: true
|
||||
|
||||
- name: Clean up images
|
||||
if: always()
|
||||
run: |
|
||||
|
||||
234
.github/workflows/_helm-e2e.yml
vendored
Normal file
@@ -0,0 +1,234 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: Helm Chart E2e Test For Call
|
||||
permissions: read-all
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
example:
|
||||
default: "chatqna"
|
||||
required: true
|
||||
type: string
|
||||
description: "example to test, chatqna or common/asr"
|
||||
hardware:
|
||||
default: "xeon"
|
||||
required: true
|
||||
type: string
|
||||
dockerhub:
|
||||
default: "false"
|
||||
required: false
|
||||
type: string
|
||||
description: "Set to true if you want to use released docker images at dockerhub. By default using internal docker registry."
|
||||
mode:
|
||||
default: "CD"
|
||||
description: "Whether the test range is CI, CD or CICD"
|
||||
required: false
|
||||
type: string
|
||||
tag:
|
||||
default: "latest"
|
||||
required: false
|
||||
type: string
|
||||
version:
|
||||
default: "0-latest"
|
||||
required: false
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
get-test-case:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
value_files: ${{ steps.get-test-files.outputs.value_files }}
|
||||
CHECKOUT_REF: ${{ steps.get-checkout-ref.outputs.CHECKOUT_REF }}
|
||||
steps:
|
||||
- name: Get checkout ref
|
||||
id: get-checkout-ref
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" == "pull_request" ] || [ "${{ github.event_name }}" == "pull_request_target" ]; then
|
||||
CHECKOUT_REF=refs/pull/${{ github.event.number }}/merge
|
||||
else
|
||||
CHECKOUT_REF=${{ github.ref }}
|
||||
fi
|
||||
echo "CHECKOUT_REF=${CHECKOUT_REF}" >> $GITHUB_OUTPUT
|
||||
echo "checkout ref ${CHECKOUT_REF}"
|
||||
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ steps.get-checkout-ref.outputs.CHECKOUT_REF }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get test Services
|
||||
id: get-test-files
|
||||
run: |
|
||||
set -x
|
||||
if [ "${{ inputs.mode }}" = "CI" ]; then
|
||||
base_commit=${{ github.event.pull_request.base.sha }}
|
||||
merged_commit=$(git log -1 --format='%H')
|
||||
values_files=$(git diff --name-only ${base_commit} ${merged_commit} | \
|
||||
grep "${{ inputs.example }}/kubernetes/helm" | \
|
||||
grep "values.yaml" |\
|
||||
sort -u)
|
||||
echo $values_files
|
||||
elif [ "${{ inputs.mode }}" = "CD" ]; then
|
||||
values_files=$(ls ${{ inputs.example }}/kubernetes/helm/*values.yaml || true)
|
||||
fi
|
||||
value_files="["
|
||||
for file in ${values_files}; do
|
||||
if [ -f "$file" ]; then
|
||||
filename=$(basename "$file")
|
||||
if [[ "$filename" == *"gaudi"* ]]; then
|
||||
if [[ "${{ inputs.hardware }}" == "gaudi" ]]; then
|
||||
value_files="${value_files}\"${filename}\","
|
||||
fi
|
||||
elif [[ "$filename" == *"nv"* ]]; then
|
||||
continue
|
||||
else
|
||||
if [[ "${{ inputs.hardware }}" == "xeon" ]]; then
|
||||
value_files="${value_files}\"${filename}\","
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
value_files="${value_files%,}]"
|
||||
|
||||
echo "value_files=${value_files}"
|
||||
echo "value_files=${value_files}" >> $GITHUB_OUTPUT
|
||||
|
||||
helm-test:
|
||||
needs: [get-test-case]
|
||||
if: ${{ fromJSON(needs.get-test-case.outputs.value_files).length != 0 }}
|
||||
strategy:
|
||||
matrix:
|
||||
value_file: ${{ fromJSON(needs.get-test-case.outputs.value_files) }}
|
||||
fail-fast: false
|
||||
runs-on: k8s-${{ inputs.hardware }}
|
||||
continue-on-error: true
|
||||
steps:
|
||||
- name: Clean Up Working Directory
|
||||
run: |
|
||||
echo "value_file=${{ matrix.value_file }}"
|
||||
sudo rm -rf ${{github.workspace}}/*
|
||||
|
||||
- name: Get checkout ref
|
||||
id: get-checkout-ref
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" == "pull_request" ] || [ "${{ github.event_name }}" == "pull_request_target" ]; then
|
||||
CHECKOUT_REF=refs/pull/${{ github.event.number }}/merge
|
||||
else
|
||||
CHECKOUT_REF=${{ github.ref }}
|
||||
fi
|
||||
echo "CHECKOUT_REF=${CHECKOUT_REF}" >> $GITHUB_OUTPUT
|
||||
echo "checkout ref ${CHECKOUT_REF}"
|
||||
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ steps.get-checkout-ref.outputs.CHECKOUT_REF }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set variables
|
||||
env:
|
||||
example: ${{ inputs.example }}
|
||||
run: |
|
||||
CHART_NAME="${example,,}" # CodeGen
|
||||
echo "CHART_NAME=$CHART_NAME" >> $GITHUB_ENV
|
||||
echo "RELEASE_NAME=${CHART_NAME}$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV
|
||||
echo "NAMESPACE=${CHART_NAME}-$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV
|
||||
echo "ROLLOUT_TIMEOUT_SECONDS=600s" >> $GITHUB_ENV
|
||||
echo "TEST_TIMEOUT_SECONDS=600s" >> $GITHUB_ENV
|
||||
echo "KUBECTL_TIMEOUT_SECONDS=60s" >> $GITHUB_ENV
|
||||
echo "should_cleanup=false" >> $GITHUB_ENV
|
||||
echo "skip_validate=false" >> $GITHUB_ENV
|
||||
echo "CHART_FOLDER=${example}/kubernetes/helm" >> $GITHUB_ENV
|
||||
|
||||
- name: Helm install
|
||||
id: install
|
||||
env:
|
||||
GOOGLE_CSE_ID: ${{ secrets.GOOGLE_CSE_ID }}
|
||||
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
|
||||
HUGGINGFACEHUB_API_TOKEN: ${{ secrets.HUGGINGFACEHUB_API_TOKEN }}
|
||||
HFTOKEN: ${{ secrets.HUGGINGFACEHUB_API_TOKEN }}
|
||||
value_file: ${{ matrix.value_file }}
|
||||
run: |
|
||||
set -xe
|
||||
echo "should_cleanup=true" >> $GITHUB_ENV
|
||||
if [[ ! -f ${{ github.workspace }}/${{ env.CHART_FOLDER }}/${value_file} ]]; then
|
||||
echo "No value file found, exiting test!"
|
||||
echo "skip_validate=true" >> $GITHUB_ENV
|
||||
echo "should_cleanup=false" >> $GITHUB_ENV
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for img in `helm template -n $NAMESPACE $RELEASE_NAME oci://ghcr.io/opea-project/charts/${CHART_NAME} -f ${{ inputs.example }}/kubernetes/helm/${value_file} --version ${{ inputs.version }} | grep 'image:' | grep 'opea/' | awk '{print $2}' | xargs`;
|
||||
do
|
||||
# increase helm install wait for for vllm-gaudi case
|
||||
if [[ $img == *"vllm-gaudi"* ]]; then
|
||||
ROLLOUT_TIMEOUT_SECONDS=900s
|
||||
fi
|
||||
done
|
||||
if ! helm install \
|
||||
--create-namespace \
|
||||
--namespace $NAMESPACE \
|
||||
$RELEASE_NAME \
|
||||
oci://ghcr.io/opea-project/charts/${CHART_NAME} \
|
||||
--set global.HUGGINGFACEHUB_API_TOKEN=${HFTOKEN} \
|
||||
--set global.modelUseHostPath=/home/sdp/.cache/huggingface/hub \
|
||||
--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}} \
|
||||
-f ${{ inputs.example }}/kubernetes/helm/${value_file} \
|
||||
--version ${{ inputs.version }} \
|
||||
--wait --timeout "$ROLLOUT_TIMEOUT_SECONDS"; then
|
||||
echo "Failed to install chart ${{ inputs.example }}"
|
||||
echo "skip_validate=true" >> $GITHUB_ENV
|
||||
.github/workflows/scripts/k8s-utils.sh dump_pods_status $NAMESPACE
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Validate e2e test
|
||||
if: always()
|
||||
run: |
|
||||
set -xe
|
||||
if $skip_validate; then
|
||||
echo "Skip validate"
|
||||
else
|
||||
LOG_PATH=/home/$(whoami)/helm-logs
|
||||
chart=${{ env.CHART_NAME }}
|
||||
helm test -n $NAMESPACE $RELEASE_NAME --logs --timeout "$TEST_TIMEOUT_SECONDS" | tee ${LOG_PATH}/charts-${chart}.log
|
||||
exit_code=$?
|
||||
if [ $exit_code -ne 0 ]; then
|
||||
echo "Chart ${chart} test failed, please check the logs in ${LOG_PATH}!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Checking response results, make sure the output is reasonable. "
|
||||
teststatus=false
|
||||
if [[ -f $LOG_PATH/charts-${chart}.log ]] && \
|
||||
[[ $(grep -c "^Phase:.*Failed" $LOG_PATH/charts-${chart}.log) != 0 ]]; then
|
||||
teststatus=false
|
||||
${{ github.workspace }}/.github/workflows/scripts/k8s-utils.sh dump_all_pod_logs $NAMESPACE
|
||||
else
|
||||
teststatus=true
|
||||
fi
|
||||
|
||||
if [ $teststatus == false ]; then
|
||||
echo "Response check failed, please check the logs in artifacts!"
|
||||
exit 1
|
||||
else
|
||||
echo "Response check succeeded!"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Helm uninstall
|
||||
if: always()
|
||||
run: |
|
||||
if $should_cleanup; then
|
||||
helm uninstall $RELEASE_NAME --namespace $NAMESPACE
|
||||
if ! kubectl delete ns $NAMESPACE --timeout=$KUBECTL_TIMEOUT_SECONDS; then
|
||||
kubectl delete pods --namespace $NAMESPACE --force --grace-period=0 --all
|
||||
kubectl delete ns $NAMESPACE --force --grace-period=0 --timeout=$KUBECTL_TIMEOUT_SECONDS
|
||||
fi
|
||||
fi
|
||||
111
.github/workflows/_manifest-e2e.yml
vendored
@@ -1,111 +0,0 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: Single Kubernetes Manifest E2e Test For Call
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
example:
|
||||
default: "ChatQnA"
|
||||
description: "The example to test on K8s"
|
||||
required: true
|
||||
type: string
|
||||
hardware:
|
||||
default: "xeon"
|
||||
description: "Nodes to run the test, xeon or gaudi"
|
||||
required: true
|
||||
type: string
|
||||
tag:
|
||||
default: "latest"
|
||||
description: "Tag to apply to images, default is latest"
|
||||
required: false
|
||||
type: string
|
||||
context:
|
||||
default: "CI"
|
||||
description: "CI or CD"
|
||||
required: false
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
manifest-test:
|
||||
runs-on: "k8s-${{ inputs.hardware }}"
|
||||
continue-on-error: true
|
||||
steps:
|
||||
- name: Clean Up Working Directory
|
||||
run: sudo rm -rf ${{github.workspace}}/*
|
||||
|
||||
- name: Get checkout ref
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" == "pull_request" ] || [ "${{ github.event_name }}" == "pull_request_target" ]; then
|
||||
echo "CHECKOUT_REF=refs/pull/${{ github.event.number }}/merge" >> $GITHUB_ENV
|
||||
else
|
||||
echo "CHECKOUT_REF=${{ github.ref }}" >> $GITHUB_ENV
|
||||
fi
|
||||
echo "checkout ref ${{ env.CHECKOUT_REF }}"
|
||||
|
||||
- name: Checkout out Repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ env.CHECKOUT_REF }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set variables
|
||||
run: |
|
||||
echo "IMAGE_REPO=$OPEA_IMAGE_REPO" >> $GITHUB_ENV
|
||||
echo "IMAGE_TAG=${{ inputs.tag }}" >> $GITHUB_ENV
|
||||
lower_example=$(echo "${{ inputs.example }}" | tr '[:upper:]' '[:lower:]')
|
||||
echo "NAMESPACE=$lower_example-$(tr -dc a-z0-9 </dev/urandom | head -c 16)" >> $GITHUB_ENV
|
||||
echo "ROLLOUT_TIMEOUT_SECONDS=1800s" >> $GITHUB_ENV
|
||||
echo "KUBECTL_TIMEOUT_SECONDS=60s" >> $GITHUB_ENV
|
||||
echo "continue_test=true" >> $GITHUB_ENV
|
||||
echo "should_cleanup=false" >> $GITHUB_ENV
|
||||
echo "skip_validate=true" >> $GITHUB_ENV
|
||||
echo "CONTEXT=${{ inputs.context }}" >> $GITHUB_ENV
|
||||
echo "NAMESPACE=$NAMESPACE"
|
||||
|
||||
- name: Kubectl install
|
||||
id: install
|
||||
run: |
|
||||
if [[ ! -f ${{ github.workspace }}/${{ inputs.example }}/tests/test_manifest_on_${{ inputs.hardware }}.sh ]]; then
|
||||
echo "No test script found, exist test!"
|
||||
exit 0
|
||||
else
|
||||
${{ github.workspace }}/${{ inputs.example }}/tests/test_manifest_on_${{ inputs.hardware }}.sh init_${{ inputs.example }}
|
||||
echo "should_cleanup=true" >> $GITHUB_ENV
|
||||
kubectl create ns $NAMESPACE
|
||||
${{ github.workspace }}/${{ inputs.example }}/tests/test_manifest_on_${{ inputs.hardware }}.sh install_${{ inputs.example }} $NAMESPACE
|
||||
echo "Testing ${{ inputs.example }}, waiting for pod ready..."
|
||||
if kubectl rollout status deployment --namespace "$NAMESPACE" --timeout "$ROLLOUT_TIMEOUT_SECONDS"; then
|
||||
echo "Testing manifests ${{ inputs.example }}, waiting for pod ready done!"
|
||||
echo "skip_validate=false" >> $GITHUB_ENV
|
||||
else
|
||||
echo "Timeout waiting for pods in namespace $NAMESPACE to be ready!"
|
||||
.github/workflows/scripts/k8s-utils.sh dump_pods_status $NAMESPACE
|
||||
exit 1
|
||||
fi
|
||||
sleep 60
|
||||
fi
|
||||
|
||||
- name: Validate e2e test
|
||||
if: always()
|
||||
run: |
|
||||
if $skip_validate; then
|
||||
echo "Skip validate"
|
||||
else
|
||||
if ${{ github.workspace }}/${{ inputs.example }}/tests/test_manifest_on_${{ inputs.hardware }}.sh validate_${{ inputs.example }} $NAMESPACE ; then
|
||||
echo "Validate ${{ inputs.example }} successful!"
|
||||
else
|
||||
echo "Validate ${{ inputs.example }} failure!!!"
|
||||
.github/workflows/scripts/k8s-utils.sh dump_all_pod_logs $NAMESPACE
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Kubectl uninstall
|
||||
if: always()
|
||||
run: |
|
||||
if $should_cleanup; then
|
||||
if ! kubectl delete ns $NAMESPACE --timeout=$KUBECTL_TIMEOUT_SECONDS; then
|
||||
kubectl delete pods --namespace $NAMESPACE --force --grace-period=0 --all
|
||||
kubectl delete ns $NAMESPACE --force --grace-period=0 --timeout=$KUBECTL_TIMEOUT_SECONDS
|
||||
fi
|
||||
fi
|
||||
32
.github/workflows/_run-docker-compose.yml
vendored
@@ -89,8 +89,9 @@ jobs:
|
||||
echo "test_cases=$test_cases"
|
||||
echo "test_cases=$test_cases" >> $GITHUB_OUTPUT
|
||||
|
||||
run-test:
|
||||
compose-test:
|
||||
needs: [get-test-case]
|
||||
if: ${{ needs.get-test-case.outputs.test_cases != '' }}
|
||||
strategy:
|
||||
matrix:
|
||||
test_case: ${{ fromJSON(needs.get-test-case.outputs.test_cases) }}
|
||||
@@ -111,13 +112,29 @@ jobs:
|
||||
ref: ${{ needs.get-test-case.outputs.CHECKOUT_REF }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Clean up container before test
|
||||
shell: bash
|
||||
run: |
|
||||
docker ps
|
||||
cd ${{ github.workspace }}/${{ inputs.example }}
|
||||
export test_case=${{ matrix.test_case }}
|
||||
export hardware=${{ inputs.hardware }}
|
||||
bash ${{ github.workspace }}/.github/workflows/scripts/docker_compose_clean_up.sh "containers"
|
||||
bash ${{ github.workspace }}/.github/workflows/scripts/docker_compose_clean_up.sh "ports"
|
||||
docker ps
|
||||
|
||||
- name: Run test
|
||||
shell: bash
|
||||
env:
|
||||
HUGGINGFACEHUB_API_TOKEN: ${{ secrets.HUGGINGFACEHUB_API_TOKEN }}
|
||||
HF_TOKEN: ${{ secrets.HUGGINGFACEHUB_API_TOKEN }}
|
||||
GOOGLE_CSE_ID: ${{ secrets.GOOGLE_CSE_ID }}
|
||||
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
|
||||
PINECONE_KEY: ${{ secrets.PINECONE_KEY }}
|
||||
PINECONE_KEY_LANGCHAIN_TEST: ${{ secrets.PINECONE_KEY_LANGCHAIN_TEST }}
|
||||
SDK_BASE_URL: ${{ secrets.SDK_BASE_URL }}
|
||||
SERVING_TOKEN: ${{ secrets.SERVING_TOKEN }}
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
IMAGE_REPO: ${{ inputs.registry }}
|
||||
IMAGE_TAG: ${{ inputs.tag }}
|
||||
example: ${{ inputs.example }}
|
||||
@@ -128,17 +145,14 @@ jobs:
|
||||
if [[ "$IMAGE_REPO" == "" ]]; then export IMAGE_REPO="${OPEA_IMAGE_REPO}opea"; fi
|
||||
if [ -f ${test_case} ]; then timeout 30m bash ${test_case}; else echo "Test script {${test_case}} not found, skip test!"; fi
|
||||
|
||||
- name: Clean up container
|
||||
- name: Clean up container after test
|
||||
shell: bash
|
||||
if: cancelled() || failure()
|
||||
run: |
|
||||
cd ${{ github.workspace }}/${{ inputs.example }}/docker_compose
|
||||
test_case=${{ matrix.test_case }}
|
||||
flag=${test_case%_on_*}
|
||||
flag=${flag#test_}
|
||||
yaml_file=$(find . -type f -wholename "*${{ inputs.hardware }}/${flag}.yaml")
|
||||
echo $yaml_file
|
||||
docker compose -f $yaml_file stop && docker compose -f $yaml_file rm -f || true
|
||||
cd ${{ github.workspace }}/${{ inputs.example }}
|
||||
export test_case=${{ matrix.test_case }}
|
||||
export hardware=${{ inputs.hardware }}
|
||||
bash ${{ github.workspace }}/.github/workflows/scripts/docker_compose_clean_up.sh "containers"
|
||||
docker system prune -f
|
||||
docker rmi $(docker images --filter reference="*:5000/*/*" -q) || true
|
||||
|
||||
|
||||
35
.github/workflows/check-online-doc-build.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: Check Online Document Building
|
||||
permissions: {}
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "**.md"
|
||||
- "**.rst"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: GenAIExamples
|
||||
|
||||
- name: Checkout docs
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: opea-project/docs
|
||||
path: docs
|
||||
|
||||
- name: Build Online Document
|
||||
shell: bash
|
||||
run: |
|
||||
echo "build online doc"
|
||||
cd docs
|
||||
bash scripts/build.sh
|
||||
31
.github/workflows/manual-docker-clean.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: Clean up container on manual event
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
node:
|
||||
default: "rocm"
|
||||
description: "Hardware to clean"
|
||||
required: true
|
||||
type: string
|
||||
clean_list:
|
||||
default: ""
|
||||
description: "docker command to clean"
|
||||
required: false
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
clean:
|
||||
runs-on: "${{ inputs.node }}"
|
||||
steps:
|
||||
- name: Clean up container
|
||||
run: |
|
||||
docker ps
|
||||
if [ "${{ inputs.clean_list }}" ]; then
|
||||
echo "----------stop and remove containers----------"
|
||||
docker stop ${{ inputs.clean_list }} && docker rm ${{ inputs.clean_list }}
|
||||
echo "----------container removed----------"
|
||||
docker ps
|
||||
fi
|
||||
18
.github/workflows/manual-docker-publish.yml
vendored
@@ -11,23 +11,23 @@ on:
|
||||
required: true
|
||||
type: string
|
||||
examples:
|
||||
default: "Translation"
|
||||
description: 'List of examples to publish [AudioQnA,ChatQnA,CodeGen,CodeTrans,DocSum,FaqGen,SearchQnA,Translation]'
|
||||
default: ""
|
||||
description: 'List of examples to publish [AgentQnA,AudioQnA,ChatQnA,CodeGen,CodeTrans,DocIndexRetriever,DocSum,FaqGen,InstructionTuning,MultimodalQnA,ProductivitySuite,RerankFinetuning,SearchQnA,Translation,VideoQnA,VisualQnA]'
|
||||
required: false
|
||||
type: string
|
||||
images:
|
||||
default: "gmcmanager,gmcrouter"
|
||||
description: 'List of images to publish [gmcmanager,gmcrouter, ...]'
|
||||
default: ""
|
||||
description: 'List of images to publish [gmcmanager,gmcrouter]'
|
||||
required: false
|
||||
type: string
|
||||
tag:
|
||||
default: "v0.9"
|
||||
description: "Tag to publish"
|
||||
default: "rc"
|
||||
description: "Tag to publish, like [1.0rc]"
|
||||
required: true
|
||||
type: string
|
||||
publish_tags:
|
||||
default: "latest,v0.9"
|
||||
description: 'Tag list apply to publish images'
|
||||
default: "latest,1.x"
|
||||
description: "Tag list apply to publish images, like [latest,1.0]"
|
||||
required: false
|
||||
type: string
|
||||
|
||||
@@ -41,9 +41,11 @@ jobs:
|
||||
|
||||
publish:
|
||||
needs: [get-image-list]
|
||||
if: ${{ needs.get-image-list.outputs.matrix != '' }}
|
||||
strategy:
|
||||
matrix:
|
||||
image: ${{ fromJSON(needs.get-image-list.outputs.matrix) }}
|
||||
fail-fast: false
|
||||
runs-on: "docker-build-${{ inputs.node }}"
|
||||
steps:
|
||||
- uses: docker/login-action@v3.2.0
|
||||
|
||||
9
.github/workflows/manual-docker-scan.yml
vendored
@@ -11,13 +11,13 @@ on:
|
||||
required: true
|
||||
type: string
|
||||
examples:
|
||||
default: "ChatQnA"
|
||||
description: 'List of examples to scan [AudioQnA,ChatQnA,CodeGen,CodeTrans,DocSum,FaqGen,SearchQnA,Translation]'
|
||||
default: ""
|
||||
description: 'List of examples to publish "AgentQnA,AudioQnA,ChatQnA,CodeGen,CodeTrans,DocIndexRetriever,DocSum,FaqGen,InstructionTuning,MultimodalQnA,ProductivitySuite,RerankFinetuning,SearchQnA,Translation,VideoQnA,VisualQnA"'
|
||||
required: false
|
||||
type: string
|
||||
images:
|
||||
default: "gmcmanager,gmcrouter"
|
||||
description: 'List of images to scan [gmcmanager,gmcrouter, ...]'
|
||||
default: ""
|
||||
description: 'List of images to publish "gmcmanager,gmcrouter"'
|
||||
required: false
|
||||
type: string
|
||||
tag:
|
||||
@@ -47,6 +47,7 @@ jobs:
|
||||
scan-docker:
|
||||
needs: get-image-list
|
||||
runs-on: "docker-build-${{ inputs.node }}"
|
||||
if: ${{ fromJSON(needs.get-image-list.outputs.matrix).length != 0 }}
|
||||
strategy:
|
||||
matrix:
|
||||
image: ${{ fromJson(needs.get-image-list.outputs.matrix) }}
|
||||
|
||||
20
.github/workflows/manual-example-workflow.yml
vendored
@@ -12,7 +12,7 @@ on:
|
||||
type: string
|
||||
examples:
|
||||
default: "ChatQnA"
|
||||
description: 'List of examples to test [AudioQnA,ChatQnA,CodeGen,CodeTrans,DocSum,FaqGen,SearchQnA,Translation]'
|
||||
description: 'List of examples to test [AgentQnA,AudioQnA,ChatQnA,CodeGen,CodeTrans,DocIndexRetriever,DocSum,FaqGen,InstructionTuning,MultimodalQnA,ProductivitySuite,RerankFinetuning,SearchQnA,Translation,VideoQnA,VisualQnA,AvatarChatbot,Text2Image,WorkflowExecAgent,DBQnA,EdgeCraftRAG,GraphRAG]'
|
||||
required: true
|
||||
type: string
|
||||
tag:
|
||||
@@ -35,9 +35,9 @@ on:
|
||||
description: 'Test examples with docker compose'
|
||||
required: false
|
||||
type: boolean
|
||||
test_k8s:
|
||||
default: false
|
||||
description: 'Test examples with k8s'
|
||||
test_helmchart:
|
||||
default: true
|
||||
description: 'Test examples with helm charts'
|
||||
required: false
|
||||
type: boolean
|
||||
test_gmc:
|
||||
@@ -50,6 +50,11 @@ on:
|
||||
description: 'OPEA branch for image build'
|
||||
required: false
|
||||
type: string
|
||||
inject_commit:
|
||||
default: false
|
||||
description: "inject commit to docker images true or false"
|
||||
required: false
|
||||
type: string
|
||||
|
||||
permissions: read-all
|
||||
jobs:
|
||||
@@ -71,7 +76,7 @@ jobs:
|
||||
|
||||
build-deploy-gmc:
|
||||
needs: [get-test-matrix]
|
||||
if: ${{ fromJSON(inputs.deploy_gmc) }}
|
||||
if: ${{ fromJSON(inputs.deploy_gmc) }} && ${{ fromJSON(needs.get-test-matrix.outputs.nodes).length != 0 }}
|
||||
strategy:
|
||||
matrix:
|
||||
node: ${{ fromJson(needs.get-test-matrix.outputs.nodes) }}
|
||||
@@ -85,7 +90,7 @@ jobs:
|
||||
|
||||
run-examples:
|
||||
needs: [get-test-matrix, build-deploy-gmc]
|
||||
if: always()
|
||||
if: always() && ${{ fromJSON(needs.get-test-matrix.outputs.examples).length != 0 }}
|
||||
strategy:
|
||||
matrix:
|
||||
example: ${{ fromJson(needs.get-test-matrix.outputs.examples) }}
|
||||
@@ -98,7 +103,8 @@ jobs:
|
||||
tag: ${{ inputs.tag }}
|
||||
build: ${{ fromJSON(inputs.build) }}
|
||||
test_compose: ${{ fromJSON(inputs.test_compose) }}
|
||||
test_k8s: ${{ fromJSON(inputs.test_k8s) }}
|
||||
test_helmchart: ${{ fromJSON(inputs.test_helmchart) }}
|
||||
test_gmc: ${{ fromJSON(inputs.test_gmc) }}
|
||||
opea_branch: ${{ inputs.opea_branch }}
|
||||
inject_commit: ${{ inputs.inject_commit }}
|
||||
secrets: inherit
|
||||
|
||||
21
.github/workflows/manual-freeze-tag.yml
vendored
@@ -1,13 +1,13 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: Freeze OPEA images release tag in readme on manual event
|
||||
name: Freeze OPEA images release tag
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
default: "latest"
|
||||
default: "1.1.0"
|
||||
description: "Tag to apply to images"
|
||||
required: true
|
||||
type: string
|
||||
@@ -23,21 +23,18 @@ jobs:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Set up Git
|
||||
run: |
|
||||
git config --global user.name "NeuralChatBot"
|
||||
git config --global user.email "grp_neural_chat_bot@intel.com"
|
||||
git remote set-url origin https://NeuralChatBot:"${{ secrets.ACTION_TOKEN }}"@github.com/opea-project/GenAIExamples.git
|
||||
git config --global user.name "CICD-at-OPEA"
|
||||
git config --global user.email "CICD@opea.dev"
|
||||
git remote set-url origin https://CICD-at-OPEA:"${{ secrets.ACTION_TOKEN }}"@github.com/opea-project/GenAIExamples.git
|
||||
|
||||
- name: Run script
|
||||
run: |
|
||||
find . -name "*.md" | xargs sed -i "s|^docker\ compose|TAG=${{ github.event.inputs.tag }}\ docker\ compose|g"
|
||||
find . -type f -name "*.yaml" \( -path "*/benchmark/*" -o -path "*/kubernetes/*" \) | xargs sed -i -E 's/(opea\/[A-Za-z0-9\-]*:)latest/\1${{ github.event.inputs.tag }}/g'
|
||||
find . -type f -name "*.md" \( -path "*/benchmark/*" -o -path "*/kubernetes/*" \) | xargs sed -i -E 's/(opea\/[A-Za-z0-9\-]*:)latest/\1${{ github.event.inputs.tag }}/g'
|
||||
IFS='.' read -r major minor patch <<< "${{ github.event.inputs.tag }}"
|
||||
echo "VERSION_MAJOR ${major}" > version.txt
|
||||
echo "VERSION_MINOR ${minor}" >> version.txt
|
||||
echo "VERSION_PATCH ${patch}" >> version.txt
|
||||
|
||||
- name: Commit changes
|
||||
run: |
|
||||
|
||||
67
.github/workflows/manual-image-build.yml
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: Build specific images on manual event
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
nodes:
|
||||
default: "gaudi,xeon"
|
||||
description: "Hardware to run test"
|
||||
required: true
|
||||
type: string
|
||||
example:
|
||||
default: "ChatQnA"
|
||||
description: 'Build images belong to which example? [AgentQnA,AudioQnA,ChatQnA,CodeGen,CodeTrans,DocIndexRetriever,DocSum,FaqGen,InstructionTuning,MultimodalQnA,ProductivitySuite,RerankFinetuning,SearchQnA,Translation,VideoQnA,VisualQnA,AvatarChatbot,Text2Image,WorkflowExecAgent,DBQnA,EdgeCraftRAG,GraphRAG]'
|
||||
required: true
|
||||
type: string
|
||||
services:
|
||||
default: "chatqna,chatqna-without-rerank"
|
||||
description: 'Service list to build'
|
||||
required: true
|
||||
type: string
|
||||
tag:
|
||||
default: "latest"
|
||||
description: "Tag to apply to images"
|
||||
required: true
|
||||
type: string
|
||||
opea_branch:
|
||||
default: "main"
|
||||
description: 'OPEA branch for image build'
|
||||
required: false
|
||||
type: string
|
||||
inject_commit:
|
||||
default: false
|
||||
description: "inject commit to docker images true or false"
|
||||
required: false
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
get-test-matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
nodes: ${{ steps.get-matrix.outputs.nodes }}
|
||||
steps:
|
||||
- name: Create Matrix
|
||||
id: get-matrix
|
||||
run: |
|
||||
nodes=($(echo ${{ inputs.nodes }} | tr ',' ' '))
|
||||
nodes_json=$(printf '%s\n' "${nodes[@]}" | sort -u | jq -R '.' | jq -sc '.')
|
||||
echo "nodes=$nodes_json" >> $GITHUB_OUTPUT
|
||||
|
||||
image-build:
|
||||
needs: get-test-matrix
|
||||
if: ${{ needs.get-test-matrix.outputs.nodes != '' }}
|
||||
strategy:
|
||||
matrix:
|
||||
node: ${{ fromJson(needs.get-test-matrix.outputs.nodes) }}
|
||||
fail-fast: false
|
||||
uses: ./.github/workflows/_example-workflow.yml
|
||||
with:
|
||||
node: ${{ matrix.node }}
|
||||
example: ${{ inputs.example }}
|
||||
services: ${{ inputs.services }}
|
||||
tag: ${{ inputs.tag }}
|
||||
opea_branch: ${{ inputs.opea_branch }}
|
||||
inject_commit: ${{ inputs.inject_commit }}
|
||||
secrets: inherit
|
||||
61
.github/workflows/manual-reset-local-registry.yml
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: Clean up Local Registry on manual event
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
nodes:
|
||||
default: "gaudi,xeon"
|
||||
description: "Hardware to clean up"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
env:
|
||||
EXAMPLES: ${{ vars.NIGHTLY_RELEASE_EXAMPLES }}
|
||||
|
||||
jobs:
|
||||
get-build-matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
examples: ${{ steps.get-matrix.outputs.examples }}
|
||||
nodes: ${{ steps.get-matrix.outputs.nodes }}
|
||||
steps:
|
||||
- name: Create Matrix
|
||||
id: get-matrix
|
||||
run: |
|
||||
examples=($(echo ${EXAMPLES} | tr ',' ' '))
|
||||
examples_json=$(printf '%s\n' "${examples[@]}" | sort -u | jq -R '.' | jq -sc '.')
|
||||
echo "examples=$examples_json" >> $GITHUB_OUTPUT
|
||||
nodes=($(echo ${{ inputs.nodes }} | tr ',' ' '))
|
||||
nodes_json=$(printf '%s\n' "${nodes[@]}" | sort -u | jq -R '.' | jq -sc '.')
|
||||
echo "nodes=$nodes_json" >> $GITHUB_OUTPUT
|
||||
|
||||
clean-up:
|
||||
needs: get-build-matrix
|
||||
if: ${{ fromJSON(needs.get-build-matrix.outputs.nodes).length != 0 }}
|
||||
strategy:
|
||||
matrix:
|
||||
node: ${{ fromJson(needs.get-build-matrix.outputs.nodes) }}
|
||||
fail-fast: false
|
||||
runs-on: "docker-build-${{ matrix.node }}"
|
||||
steps:
|
||||
- name: Clean Up Local Registry
|
||||
run: |
|
||||
echo "Cleaning up local registry on ${{ matrix.node }}"
|
||||
bash /home/sdp/workspace/fully_registry_cleanup.sh
|
||||
docker ps | grep registry
|
||||
|
||||
build:
|
||||
needs: [get-build-matrix, clean-up]
|
||||
if: ${{ fromJSON(needs.get-build-matrix.outputs.nodes).length != 0 }}
|
||||
strategy:
|
||||
matrix:
|
||||
example: ${{ fromJson(needs.get-build-matrix.outputs.examples) }}
|
||||
node: ${{ fromJson(needs.get-build-matrix.outputs.nodes) }}
|
||||
fail-fast: false
|
||||
uses: ./.github/workflows/_example-workflow.yml
|
||||
with:
|
||||
node: ${{ matrix.node }}
|
||||
example: ${{ matrix.example }}
|
||||
secrets: inherit
|
||||
74
.github/workflows/nightly-docker-build-publish.yml
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: Nightly build/publish latest docker images
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "30 14 * * *" # UTC time
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
EXAMPLES: ${{ vars.NIGHTLY_RELEASE_EXAMPLES }}
|
||||
TAG: "latest"
|
||||
PUBLISH_TAGS: "latest"
|
||||
|
||||
jobs:
|
||||
get-build-matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
examples_json: ${{ steps.get-matrix.outputs.examples_json }}
|
||||
EXAMPLES: ${{ steps.get-matrix.outputs.EXAMPLES }}
|
||||
TAG: ${{ steps.get-matrix.outputs.TAG }}
|
||||
PUBLISH_TAGS: ${{ steps.get-matrix.outputs.PUBLISH_TAGS }}
|
||||
steps:
|
||||
- name: Create Matrix
|
||||
id: get-matrix
|
||||
run: |
|
||||
examples=($(echo ${EXAMPLES} | tr ',' ' '))
|
||||
examples_json=$(printf '%s\n' "${examples[@]}" | sort -u | jq -R '.' | jq -sc '.')
|
||||
echo "examples_json=$examples_json" >> $GITHUB_OUTPUT
|
||||
echo "EXAMPLES=$EXAMPLES" >> $GITHUB_OUTPUT
|
||||
echo "TAG=$TAG" >> $GITHUB_OUTPUT
|
||||
echo "PUBLISH_TAGS=$PUBLISH_TAGS" >> $GITHUB_OUTPUT
|
||||
|
||||
build-and-test:
|
||||
needs: get-build-matrix
|
||||
if: ${{ needs.get-build-matrix.outputs.examples_json != '' }}
|
||||
strategy:
|
||||
matrix:
|
||||
example: ${{ fromJSON(needs.get-build-matrix.outputs.examples_json) }}
|
||||
fail-fast: false
|
||||
uses: ./.github/workflows/_example-workflow.yml
|
||||
with:
|
||||
node: gaudi
|
||||
example: ${{ matrix.example }}
|
||||
test_compose: true
|
||||
secrets: inherit
|
||||
|
||||
get-image-list:
|
||||
needs: get-build-matrix
|
||||
uses: ./.github/workflows/_get-image-list.yml
|
||||
with:
|
||||
examples: ${{ needs.get-build-matrix.outputs.EXAMPLES }}
|
||||
|
||||
publish:
|
||||
needs: [get-build-matrix, get-image-list, build-and-test]
|
||||
if: ${{ needs.get-image-list.outputs.matrix != '' }}
|
||||
strategy:
|
||||
matrix:
|
||||
image: ${{ fromJSON(needs.get-image-list.outputs.matrix) }}
|
||||
fail-fast: false
|
||||
runs-on: "docker-build-gaudi"
|
||||
steps:
|
||||
- uses: docker/login-action@v3.2.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USER }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Image Publish
|
||||
uses: opea-project/validation/actions/image-publish@main
|
||||
with:
|
||||
local_image_ref: ${OPEA_IMAGE_REPO}opea/${{ matrix.image }}:${{ needs.get-build-matrix.outputs.TAG }}
|
||||
image_name: opea/${{ matrix.image }}
|
||||
publish_tags: ${{ needs.get-build-matrix.outputs.PUBLISH_TAGS }}
|
||||
50
.github/workflows/pr-bum_list_check.yml
vendored
@@ -1,50 +0,0 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: Check Requirements
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
check-requirements:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout PR branch
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Save PR requirements
|
||||
run: |
|
||||
find . -name "requirements.txt" -exec cat {} \; | \
|
||||
grep -v '^\s*#' | \
|
||||
grep -v '^\s*$' | \
|
||||
grep -v '^\s*-' | \
|
||||
sed 's/^\s*//' | \
|
||||
awk -F'[>=<]' '{print $1}' | \
|
||||
sort -u > pr-requirements.txt
|
||||
cat pr-requirements.txt
|
||||
|
||||
- name: Checkout main branch
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: main
|
||||
path: main-branch
|
||||
|
||||
- name: Save main branch requirements
|
||||
run: |
|
||||
find ./main-branch -name "requirements.txt" -exec cat {} \; | \
|
||||
grep -v '^\s*#' | \
|
||||
grep -v '^\s*$' | \
|
||||
grep -v '^\s*-' | \
|
||||
sed 's/^\s*//' | \
|
||||
awk -F'[>=<]' '{print $1}' | \
|
||||
sort -u > main-requirements.txt
|
||||
cat main-requirements.txt
|
||||
|
||||
- name: Compare requirements
|
||||
run: |
|
||||
comm -23 pr-requirements.txt main-requirements.txt > added-packages.txt
|
||||
if [ -s added-packages.txt ]; then
|
||||
echo "New packages found in PR:" && cat added-packages.txt
|
||||
else
|
||||
echo "No new packages found😊."
|
||||
fi
|
||||
76
.github/workflows/pr-chart-e2e.yml
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: E2E Test with Helm Charts
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
branches: [main]
|
||||
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
|
||||
paths:
|
||||
- "!**.md"
|
||||
- "**/helm/**"
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
job1:
|
||||
name: Get-Test-Matrix
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
run_matrix: ${{ steps.get-test-matrix.outputs.run_matrix }}
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: "refs/pull/${{ github.event.number }}/merge"
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get Test Matrix
|
||||
id: get-test-matrix
|
||||
run: |
|
||||
set -x
|
||||
echo "base_commit=${{ github.event.pull_request.base.sha }}"
|
||||
base_commit=${{ github.event.pull_request.base.sha }}
|
||||
merged_commit=$(git log -1 --format='%H')
|
||||
values_files=$(git diff --name-only ${base_commit} ${merged_commit} | \
|
||||
grep "values.yaml" | \
|
||||
sort -u ) #CodeGen/kubernetes/helm/cpu-values.yaml
|
||||
run_matrix="{\"include\":["
|
||||
for values_file in ${values_files}; do
|
||||
if [ -f "$values_file" ]; then
|
||||
valuefile=$(basename "$values_file") # cpu-values.yaml
|
||||
example=$(echo "$values_file" | cut -d'/' -f1) # CodeGen
|
||||
if [[ "$valuefile" == *"gaudi"* ]]; then
|
||||
hardware="gaudi"
|
||||
elif [[ "$valuefile" == *"nv"* ]]; then
|
||||
continue
|
||||
else
|
||||
hardware="xeon"
|
||||
fi
|
||||
echo "example=${example}, hardware=${hardware}, valuefile=${valuefile}"
|
||||
if [[ $(echo ${run_matrix} | grep -c "{\"example\":\"${example}\",\"hardware\":\"${hardware}\"},") == 0 ]]; then
|
||||
run_matrix="${run_matrix}{\"example\":\"${example}\",\"hardware\":\"${hardware}\"},"
|
||||
echo "------------------ add one values file ------------------"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
run_matrix="${run_matrix%,}"
|
||||
run_matrix=$run_matrix"]}"
|
||||
echo "run_matrix="${run_matrix}""
|
||||
echo "run_matrix="${run_matrix}"" >> $GITHUB_OUTPUT
|
||||
|
||||
helm-chart-test:
|
||||
needs: [job1]
|
||||
if: always() && ${{ fromJSON(needs.job1.outputs.run_matrix).length != 0 }}
|
||||
uses: ./.github/workflows/_helm-e2e.yml
|
||||
strategy:
|
||||
matrix: ${{ fromJSON(needs.job1.outputs.run_matrix) }}
|
||||
with:
|
||||
example: ${{ matrix.example }}
|
||||
hardware: ${{ matrix.hardware }}
|
||||
mode: "CI"
|
||||
secrets: inherit
|
||||
40
.github/workflows/pr-check-duplicated-image.yml
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: Check Duplicated Images
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main]
|
||||
types: [opened, reopened, ready_for_review, synchronize]
|
||||
paths:
|
||||
- "**/docker_image_build/*.yaml"
|
||||
- ".github/workflows/pr-check-duplicated-image.yml"
|
||||
- ".github/workflows/scripts/check_duplicated_image.py"
|
||||
workflow_dispatch:
|
||||
|
||||
# If there is a new commit, the previous jobs will be canceled
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
check-duplicated-image:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clean Up Working Directory
|
||||
run: sudo rm -rf ${{github.workspace}}/*
|
||||
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check all the docker image build files
|
||||
run: |
|
||||
pip install PyYAML
|
||||
cd ${{github.workspace}}
|
||||
build_files=""
|
||||
for f in `find . -path "*/docker_image_build/build.yaml"`; do
|
||||
build_files="$build_files $f"
|
||||
done
|
||||
python3 .github/workflows/scripts/check_duplicated_image.py $build_files
|
||||
shell: bash
|
||||
5
.github/workflows/pr-code-scan.yml
vendored
@@ -34,6 +34,11 @@ jobs:
|
||||
- name: Checkout out Repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check Dangerous Command Injection
|
||||
uses: opea-project/validation/actions/check-cmd@main
|
||||
with:
|
||||
work_dir: ${{ github.workspace }}
|
||||
|
||||
- name: Docker Build
|
||||
run: |
|
||||
docker build -f ${{ github.workspace }}/.github/workflows/docker/${{ env.DOCKER_FILE_NAME }}.dockerfile -t ${{ env.REPO_NAME }}:${{ env.REPO_TAG }} .
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: "Dependency Review"
|
||||
on: [pull_request]
|
||||
on: [pull_request_target]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
6
.github/workflows/pr-docker-compose-e2e.yml
vendored
@@ -28,19 +28,19 @@ jobs:
|
||||
if: ${{ !github.event.pull_request.draft }}
|
||||
uses: ./.github/workflows/_get-test-matrix.yml
|
||||
with:
|
||||
diff_excluded_files: '.github|*.md|*.txt|kubernetes|manifest|gmc|assets|benchmark'
|
||||
diff_excluded_files: '\.github|\.md|\.txt|kubernetes|gmc|assets|benchmark'
|
||||
|
||||
example-test:
|
||||
needs: [get-test-matrix]
|
||||
if: ${{ needs.get-test-matrix.outputs.run_matrix != '' }}
|
||||
strategy:
|
||||
matrix: ${{ fromJSON(needs.get-test-matrix.outputs.run_matrix) }}
|
||||
fail-fast: false
|
||||
if: ${{ !github.event.pull_request.draft }}
|
||||
uses: ./.github/workflows/_run-docker-compose.yml
|
||||
with:
|
||||
registry: "opea"
|
||||
tag: "ci"
|
||||
example: ${{ matrix.example }}
|
||||
hardware: ${{ matrix.hardware }}
|
||||
diff_excluded_files: '.github|*.md|*.txt|kubernetes|manifest|gmc|assets|benchmark'
|
||||
diff_excluded_files: '\.github|\.md|\.txt|kubernetes|gmc|assets|benchmark'
|
||||
secrets: inherit
|
||||
|
||||
109
.github/workflows/pr-dockerfile-path-and-build-yaml-scan.yml
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: Compose file and dockerfile path checking
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main]
|
||||
types: [opened, reopened, ready_for_review, synchronize]
|
||||
|
||||
jobs:
|
||||
check-dockerfile-paths-in-README:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clean Up Working Directory
|
||||
run: sudo rm -rf ${{github.workspace}}/*
|
||||
|
||||
- name: Checkout Repo GenAIExamples
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Clone Repo GenAIComps
|
||||
run: |
|
||||
cd ..
|
||||
git clone --depth 1 https://github.com/opea-project/GenAIComps.git
|
||||
|
||||
- name: Check for Missing Dockerfile Paths in GenAIComps
|
||||
run: |
|
||||
cd ${{github.workspace}}
|
||||
miss="FALSE"
|
||||
while IFS=: read -r file line content; do
|
||||
dockerfile_path=$(echo "$content" | awk -F '-f ' '{print $2}' | awk '{print $1}')
|
||||
if [[ ! -f "../GenAIComps/${dockerfile_path}" ]]; then
|
||||
miss="TRUE"
|
||||
echo "Missing Dockerfile: GenAIComps/${dockerfile_path} (Referenced in GenAIExamples/${file}:${line})"
|
||||
fi
|
||||
done < <(grep -Ern 'docker build .* -f comps/.+/Dockerfile' --include='*.md' .)
|
||||
|
||||
|
||||
if [[ "$miss" == "TRUE" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shell: bash
|
||||
|
||||
check-Dockerfile-in-build-yamls:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clean Up Working Directory
|
||||
run: sudo rm -rf ${{github.workspace}}/*
|
||||
|
||||
- name: Checkout Repo GenAIExamples
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Check Dockerfile path included in image build yaml
|
||||
if: always()
|
||||
run: |
|
||||
set -e
|
||||
shopt -s globstar
|
||||
no_add="FALSE"
|
||||
cd ${{github.workspace}}
|
||||
Dockerfiles=$(realpath $(find ./ -name '*Dockerfile*' ! -path '*/tests/*'))
|
||||
if [ -n "$Dockerfiles" ]; then
|
||||
for dockerfile in $Dockerfiles; do
|
||||
service=$(echo "$dockerfile" | awk -F '/GenAIExamples/' '{print $2}' | awk -F '/' '{print $2}')
|
||||
cd ${{github.workspace}}/$service/docker_image_build
|
||||
all_paths=$(realpath $(awk ' /context:/ { context = $2 } /dockerfile:/ { dockerfile = $2; combined = context "/" dockerfile; gsub(/\/+/, "/", combined); if (index(context, ".") > 0) {print combined}}' build.yaml) 2> /dev/null || true )
|
||||
if ! echo "$all_paths" | grep -q "$dockerfile"; then
|
||||
echo "AR: Update $dockerfile to GenAIExamples/$service/docker_image_build/build.yaml. The yaml is used for release images build."
|
||||
no_add="TRUE"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ "$no_add" == "TRUE" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
check-image-and-service-names-in-build-yaml:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clean Up Working Directory
|
||||
run: sudo rm -rf ${{github.workspace}}/*
|
||||
|
||||
- name: Checkout Repo GenAIExamples
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check name agreement in build.yaml
|
||||
run: |
|
||||
pip install ruamel.yaml
|
||||
cd ${{github.workspace}}
|
||||
consistency="TRUE"
|
||||
build_yamls=$(find . -name 'build.yaml')
|
||||
for build_yaml in $build_yamls; do
|
||||
message=$(python3 .github/workflows/scripts/check-name-agreement.py "$build_yaml")
|
||||
if [[ "$message" != *"consistent"* ]]; then
|
||||
consistency="FALSE"
|
||||
echo "Inconsistent service name and image name found in file $build_yaml."
|
||||
echo "$message"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "$consistency" == "FALSE" ]]; then
|
||||
echo "Please ensure that the service and image names are consistent in build.yaml, otherwise we cannot guarantee that your image will be published correctly."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shell: bash
|
||||
@@ -8,11 +8,10 @@ on:
|
||||
branches: ["main", "*rc"]
|
||||
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
|
||||
paths:
|
||||
- "**/kubernetes/**/gmc/**"
|
||||
- "**/kubernetes/gmc/**"
|
||||
- "**/tests/test_gmc**"
|
||||
- "!**.md"
|
||||
- "!**.txt"
|
||||
- "!**/kubernetes/**/manifests/**"
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
@@ -22,7 +21,7 @@ jobs:
|
||||
job1:
|
||||
uses: ./.github/workflows/_get-test-matrix.yml
|
||||
with:
|
||||
diff_excluded_files: '.github|docker_compose|manifest|assets|*.md|*.txt'
|
||||
diff_excluded_files: '\.github|docker_compose|assets|\.md|\.txt'
|
||||
test_mode: "gmc"
|
||||
|
||||
gmc-test:
|
||||
@@ -1,7 +1,7 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: Check Paths and Hyperlinks
|
||||
name: Check hyperlinks and relative path validity
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
@@ -9,39 +9,6 @@ on:
|
||||
types: [opened, reopened, ready_for_review, synchronize]
|
||||
|
||||
jobs:
|
||||
check-dockerfile-paths:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clean Up Working Directory
|
||||
run: sudo rm -rf ${{github.workspace}}/*
|
||||
|
||||
- name: Checkout Repo GenAIExamples
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Clone Repo GenAIComps
|
||||
run: |
|
||||
cd ..
|
||||
git clone https://github.com/opea-project/GenAIComps.git
|
||||
|
||||
- name: Check for Missing Dockerfile Paths in GenAIComps
|
||||
run: |
|
||||
cd ${{github.workspace}}
|
||||
miss="FALSE"
|
||||
while IFS=: read -r file line content; do
|
||||
dockerfile_path=$(echo "$content" | awk -F '-f ' '{print $2}' | awk '{print $1}')
|
||||
if [[ ! -f "../GenAIComps/${dockerfile_path}" ]]; then
|
||||
miss="TRUE"
|
||||
echo "Missing Dockerfile: GenAIComps/${dockerfile_path} (Referenced in GenAIExamples/${file}:${line})"
|
||||
fi
|
||||
done < <(grep -Ern 'docker build .* -f comps/.+/Dockerfile' --include='*.md' .)
|
||||
|
||||
|
||||
if [[ "$miss" == "TRUE" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shell: bash
|
||||
|
||||
check-the-validity-of-hyperlinks-in-README:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -50,28 +17,40 @@ jobs:
|
||||
|
||||
- name: Checkout Repo GenAIExamples
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Check the Validity of Hyperlinks
|
||||
run: |
|
||||
cd ${{github.workspace}}
|
||||
fail="FALSE"
|
||||
url_lines=$(grep -Eo '\]\(http[s]?://[^)]+\)' --include='*.md' -r .)
|
||||
if [ -n "$url_lines" ]; then
|
||||
for url_line in $url_lines; do
|
||||
url=$(echo "$url_line"|cut -d '(' -f2 | cut -d ')' -f1|sed 's/\.git$//')
|
||||
path=$(echo "$url_line"|cut -d':' -f1 | cut -d'/' -f2-)
|
||||
response=$(curl -L -s -o /dev/null -w "%{http_code}" "$url")
|
||||
if [ "$response" -ne 200 ]; then
|
||||
echo "**********Validation failed, try again**********"
|
||||
response_retry=$(curl -s -o /dev/null -w "%{http_code}" "$url")
|
||||
if [ "$response_retry" -eq 200 ]; then
|
||||
echo "*****Retry successfully*****"
|
||||
else
|
||||
echo "Invalid link from ${{github.workspace}}/$path: $url"
|
||||
fail="TRUE"
|
||||
fi
|
||||
merged_commit=$(git log -1 --format='%H')
|
||||
changed_files="$(git diff --name-status --diff-filter=ARM ${{ github.event.pull_request.base.sha }} ${merged_commit} | awk '/\.md$/ {print $NF}')"
|
||||
if [ -n "$changed_files" ]; then
|
||||
for changed_file in $changed_files; do
|
||||
# echo $changed_file
|
||||
url_lines=$(grep -H -Eo '\]\(http[s]?://[^)]+\)' "$changed_file" | grep -Ev 'GenAIExamples/blob/main') || true
|
||||
if [ -n "$url_lines" ]; then
|
||||
for url_line in $url_lines; do
|
||||
# echo $url_line
|
||||
url=$(echo "$url_line"|cut -d '(' -f2 | cut -d ')' -f1|sed 's/\.git$//')
|
||||
path=$(echo "$url_line"|cut -d':' -f1 | cut -d'/' -f2-)
|
||||
response=$(curl -L -s -o /dev/null -w "%{http_code}" "$url")|| true
|
||||
if [ "$response" -ne 200 ]; then
|
||||
echo "**********Validation failed, try again**********"
|
||||
response_retry=$(curl -s -o /dev/null -w "%{http_code}" "$url")
|
||||
if [ "$response_retry" -eq 200 ]; then
|
||||
echo "*****Retry successfully*****"
|
||||
else
|
||||
echo "Invalid link from ${{github.workspace}}/$path: $url"
|
||||
fail="TRUE"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "No changed .md file."
|
||||
fi
|
||||
|
||||
if [[ "$fail" == "TRUE" ]]; then
|
||||
@@ -89,6 +68,8 @@ jobs:
|
||||
|
||||
- name: Checkout Repo GenAIExamples
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Checking Relative Path Validity
|
||||
run: |
|
||||
@@ -102,33 +83,34 @@ jobs:
|
||||
branch="https://github.com/opea-project/GenAIExamples/blob/${{ github.event.pull_request.head.ref }}"
|
||||
fi
|
||||
link_head="https://github.com/opea-project/GenAIExamples/blob/main"
|
||||
|
||||
merged_commit=$(git log -1 --format='%H')
|
||||
changed_files="$(git diff --name-status --diff-filter=ARM ${{ github.event.pull_request.base.sha }} ${merged_commit} | awk '/\.md$/ {print $NF}')"
|
||||
png_lines=$(grep -Eo '\]\([^)]+\)' --include='*.md' -r .|grep -Ev 'http')
|
||||
if [ -n "$png_lines" ]; then
|
||||
for png_line in $png_lines; do
|
||||
refer_path=$(echo "$png_line"|cut -d':' -f1 | cut -d'/' -f2-)
|
||||
png_path=$(echo "$png_line"|cut -d '(' -f2 | cut -d ')' -f1)
|
||||
|
||||
if [[ "${png_path:0:1}" == "/" ]]; then
|
||||
check_path=${{github.workspace}}$png_path
|
||||
elif [[ "${png_path:0:1}" == "#" ]]; then
|
||||
check_path=${{github.workspace}}/$refer_path$png_path
|
||||
check_path=$png_path
|
||||
elif [[ "$png_path" == *#* ]]; then
|
||||
relative_path=$(echo "$png_path" | cut -d '#' -f1)
|
||||
if [ -n "$relative_path" ]; then
|
||||
check_path=$(dirname "$refer_path")/$relative_path
|
||||
png_path=$(echo "$png_path" | awk -F'#' '{print "#" $2}')
|
||||
else
|
||||
check_path=$refer_path
|
||||
fi
|
||||
else
|
||||
check_path=${{github.workspace}}/$(dirname "$refer_path")/$png_path
|
||||
check_path=$(dirname "$refer_path")/$png_path
|
||||
fi
|
||||
real_path=$(realpath $check_path)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Path $png_path in file ${{github.workspace}}/$refer_path does not exist"
|
||||
fail="TRUE"
|
||||
else
|
||||
url=$link_head$(echo "$real_path" | sed 's|.*/GenAIExamples||')
|
||||
response=$(curl -I -L -s -o /dev/null -w "%{http_code}" "$url")
|
||||
if [ "$response" -ne 200 ]; then
|
||||
echo "**********Validation failed, try again**********"
|
||||
response_retry=$(curl -s -o /dev/null -w "%{http_code}" "$url")
|
||||
if [ "$response_retry" -eq 200 ]; then
|
||||
echo "*****Retry successfully*****"
|
||||
else
|
||||
echo "Retry failed. Check branch ${{ github.event.pull_request.head.ref }}"
|
||||
url_dev=$branch$(echo "$real_path" | sed 's|.*/GenAIExamples||')
|
||||
|
||||
if [ -e "$check_path" ]; then
|
||||
real_path=$(realpath $check_path)
|
||||
if [[ "$png_line" == *#* ]]; then
|
||||
if [ -n "changed_files" ] && echo "$changed_files" | grep -q "^${refer_path}$"; then
|
||||
url_dev=$branch$(echo "$real_path" | sed 's|.*/GenAIExamples||')$png_path
|
||||
response=$(curl -I -L -s -o /dev/null -w "%{http_code}" "$url_dev")
|
||||
if [ "$response" -ne 200 ]; then
|
||||
echo "**********Validation failed, try again**********"
|
||||
@@ -140,10 +122,13 @@ jobs:
|
||||
fail="TRUE"
|
||||
fi
|
||||
else
|
||||
echo "Check branch ${{ github.event.pull_request.head.ref }} successfully."
|
||||
echo "Validation succeed $png_line"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "${{github.workspace}}/$refer_path:$png_path does not exist"
|
||||
fail="TRUE"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
40
.github/workflows/pr-manifest-e2e.yml
vendored
@@ -1,40 +0,0 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: E2E test with manifests
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
branches: ["main", "*rc"]
|
||||
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
|
||||
paths:
|
||||
- "**/kubernetes/**/manifests/**"
|
||||
- "**/tests/test_manifest**"
|
||||
- "!**.md"
|
||||
- "!**.txt"
|
||||
- "!**/kubernetes/**/gmc/**"
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
job1:
|
||||
uses: ./.github/workflows/_get-test-matrix.yml
|
||||
with:
|
||||
diff_excluded_files: '.github|docker_compose|gmc|assets|*.md|*.txt|benchmark'
|
||||
test_mode: "manifest"
|
||||
|
||||
run-example:
|
||||
needs: job1
|
||||
strategy:
|
||||
matrix: ${{ fromJSON(needs.job1.outputs.run_matrix) }}
|
||||
fail-fast: false
|
||||
uses: ./.github/workflows/_example-workflow.yml
|
||||
with:
|
||||
node: ${{ matrix.hardware }}
|
||||
example: ${{ matrix.example }}
|
||||
tag: ${{ github.event.pull_request.head.sha }}
|
||||
test_k8s: true
|
||||
secrets: inherit
|
||||
54
.github/workflows/pr-manifest-validate.yml
vendored
@@ -1,54 +0,0 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: Manifests Validate
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main]
|
||||
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
|
||||
paths:
|
||||
- "**/kubernetes/manifests/**"
|
||||
- .github/workflows/manifest-validate.yml
|
||||
workflow_dispatch:
|
||||
|
||||
# If there is a new commit, the previous jobs will be canceled
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
MANIFEST_DIR: "manifests"
|
||||
|
||||
jobs:
|
||||
manifests-validate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout out Repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: changed files
|
||||
id: changed_files
|
||||
run: |
|
||||
set -xe
|
||||
changed_folder=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | \
|
||||
grep "kubernetes/manifests" | grep -vE '.github|README.md|*.txt|*.sh' | cut -d'/' -f1 | sort -u )
|
||||
echo "changed_folder: $changed_folder"
|
||||
if [ -z "$changed_folder" ]; then
|
||||
echo "No changes in manifests folder"
|
||||
echo "SKIP=true" >> $GITHUB_OUTPUT
|
||||
exit 0
|
||||
fi
|
||||
echo "SKIP=false" >> $GITHUB_OUTPUT
|
||||
for folder in $changed_folder; do
|
||||
folder_str="$folder_str $folder/kubernetes/manifests/"
|
||||
done
|
||||
echo "folder_str=$folder_str"
|
||||
echo "folder_str=$folder_str" >> $GITHUB_ENV
|
||||
|
||||
- uses: docker://ghcr.io/yannh/kubeconform:latest
|
||||
if: steps.changed_files.outputs.SKIP == 'false'
|
||||
with:
|
||||
args: "-summary -output json ${{env.folder_str}}"
|
||||
14
.github/workflows/push-image-build.yml
vendored
@@ -8,8 +8,9 @@ on:
|
||||
branches: [ 'main' ]
|
||||
paths:
|
||||
- "**.py"
|
||||
- "**Dockerfile"
|
||||
workflow_dispatch:
|
||||
- "**Dockerfile*"
|
||||
- "**docker_image_build/build.yaml"
|
||||
- "**/ui/**"
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-on-push
|
||||
@@ -19,17 +20,16 @@ jobs:
|
||||
job1:
|
||||
uses: ./.github/workflows/_get-test-matrix.yml
|
||||
with:
|
||||
test_mode: "docker_image_build/build.yaml"
|
||||
test_mode: "docker_image_build"
|
||||
|
||||
image-build:
|
||||
needs: job1
|
||||
if: ${{ fromJSON(needs.job1.outputs.run_matrix).length != 0 }}
|
||||
strategy:
|
||||
matrix:
|
||||
example: ${{ fromJSON(needs.job1.outputs.run_matrix).include.*.example }}
|
||||
node: ["gaudi","xeon"]
|
||||
matrix: ${{ fromJSON(needs.job1.outputs.run_matrix) }}
|
||||
fail-fast: false
|
||||
uses: ./.github/workflows/_example-workflow.yml
|
||||
with:
|
||||
node: ${{ matrix.node }}
|
||||
node: ${{ matrix.hardware }}
|
||||
example: ${{ matrix.example }}
|
||||
secrets: inherit
|
||||
|
||||
@@ -40,7 +40,7 @@ jobs:
|
||||
- name: Create Issue
|
||||
uses: daisy-ycguo/create-issue-action@stable
|
||||
with:
|
||||
token: ${{ secrets.Infra_Issue_Token }}
|
||||
token: ${{ secrets.ACTION_TOKEN }}
|
||||
owner: opea-project
|
||||
repo: GenAIInfra
|
||||
title: |
|
||||
@@ -54,6 +54,6 @@ jobs:
|
||||
|
||||
${{ env.changed_files }}
|
||||
|
||||
Please verify if the helm charts and manifests need to be changed accordingly.
|
||||
Please verify if the helm charts need to be changed accordingly.
|
||||
|
||||
> This issue was created automatically by CI.
|
||||
|
||||
46
.github/workflows/scripts/check-name-agreement.py
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import argparse
|
||||
|
||||
from ruamel.yaml import YAML
|
||||
|
||||
|
||||
def parse_yaml_file(file_path):
|
||||
yaml = YAML()
|
||||
with open(file_path, "r") as file:
|
||||
data = yaml.load(file)
|
||||
return data
|
||||
|
||||
|
||||
def check_service_image_consistency(data):
|
||||
inconsistencies = []
|
||||
for service_name, service_details in data.get("services", {}).items():
|
||||
image_name = service_details.get("image", "")
|
||||
# Extract the image name part after the last '/'
|
||||
image_name_part = image_name.split("/")[-1].split(":")[0]
|
||||
# Check if the service name is a substring of the image name part
|
||||
if service_name not in image_name_part:
|
||||
# Get the line number of the service name
|
||||
line_number = service_details.lc.line + 1
|
||||
inconsistencies.append((service_name, image_name, line_number))
|
||||
return inconsistencies
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Check service name and image name consistency in a YAML file.")
|
||||
parser.add_argument("file_path", type=str, help="The path to the YAML file.")
|
||||
args = parser.parse_args()
|
||||
|
||||
data = parse_yaml_file(args.file_path)
|
||||
|
||||
inconsistencies = check_service_image_consistency(data)
|
||||
if inconsistencies:
|
||||
for service_name, image_name, line_number in inconsistencies:
|
||||
print(f"Service name: {service_name}, Image name: {image_name}, Line number: {line_number}")
|
||||
else:
|
||||
print("All consistent")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
79
.github/workflows/scripts/check_duplicated_image.py
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import argparse
|
||||
import os.path
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import yaml
|
||||
|
||||
images = {}
|
||||
dockerfiles = {}
|
||||
errors = []
|
||||
|
||||
|
||||
def check_docker_compose_build_definition(file_path):
|
||||
with open(file_path, "r") as f:
|
||||
data = yaml.load(f, Loader=yaml.FullLoader)
|
||||
for service in data["services"]:
|
||||
if "build" in data["services"][service] and "image" in data["services"][service]:
|
||||
bash_command = "echo " + data["services"][service]["image"]
|
||||
image = (
|
||||
subprocess.run(["bash", "-c", bash_command], check=True, capture_output=True)
|
||||
.stdout.decode("utf-8")
|
||||
.strip()
|
||||
)
|
||||
build = data["services"][service]["build"]
|
||||
context = build.get("context", "")
|
||||
dockerfile = os.path.normpath(
|
||||
os.path.join(os.path.dirname(file_path), context, build.get("dockerfile", ""))
|
||||
)
|
||||
if not os.path.isfile(dockerfile):
|
||||
# dockerfile not exists in the current repo context, assume it's in 3rd party context
|
||||
dockerfile = os.path.normpath(os.path.join(context, build.get("dockerfile", "")))
|
||||
item = {"file_path": file_path, "service": service, "dockerfile": dockerfile, "image": image}
|
||||
if image in images and dockerfile != images[image]["dockerfile"]:
|
||||
errors.append(
|
||||
f"ERROR: !!! Found Conflicts !!!\n"
|
||||
f"Image: {image}, Dockerfile: {dockerfile}, defined in Service: {service}, File: {file_path}\n"
|
||||
f"Image: {image}, Dockerfile: {images[image]['dockerfile']}, defined in Service: {images[image]['service']}, File: {images[image]['file_path']}"
|
||||
)
|
||||
else:
|
||||
# print(f"Add Image: {image} Dockerfile: {dockerfile}")
|
||||
images[image] = item
|
||||
|
||||
if dockerfile in dockerfiles and image != dockerfiles[dockerfile]["image"]:
|
||||
errors.append(
|
||||
f"WARNING: Different images using the same Dockerfile\n"
|
||||
f"Dockerfile: {dockerfile}, Image: {image}, defined in Service: {service}, File: {file_path}\n"
|
||||
f"Dockerfile: {dockerfile}, Image: {dockerfiles[dockerfile]['image']}, defined in Service: {dockerfiles[dockerfile]['service']}, File: {dockerfiles[dockerfile]['file_path']}"
|
||||
)
|
||||
else:
|
||||
dockerfiles[dockerfile] = item
|
||||
|
||||
|
||||
def parse_arg():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Check for conflicts in image build definition in docker-compose.yml files"
|
||||
)
|
||||
parser.add_argument("files", nargs="+", help="list of files to be checked")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_arg()
|
||||
for file_path in args.files:
|
||||
check_docker_compose_build_definition(file_path)
|
||||
print("SUCCESS: No Conlicts Found.")
|
||||
if errors:
|
||||
for error in errors:
|
||||
print(error)
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("SUCCESS: No Conflicts Found.")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
48
.github/workflows/scripts/docker_compose_clean_up.sh
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# The test machine used by several opea projects, so the test scripts can't use `docker compose down` to clean up
|
||||
# the all the containers, ports and networks directly.
|
||||
# So we need to use the following script to minimize the impact of the clean up.
|
||||
|
||||
test_case=${test_case:-"test_compose_on_gaudi.sh"}
|
||||
hardware=${hardware:-"gaudi"}
|
||||
flag=${test_case%_on_*}
|
||||
flag=${flag#test_}
|
||||
yaml_file=$(find . -type f -wholename "*${hardware}/${flag}.yaml")
|
||||
echo $yaml_file
|
||||
|
||||
case "$1" in
|
||||
containers)
|
||||
echo "Stop and remove all containers used by the services in $yaml_file ..."
|
||||
containers=$(cat $yaml_file | grep container_name | cut -d':' -f2)
|
||||
for container_name in $containers; do
|
||||
cid=$(docker ps -aq --filter "name=$container_name")
|
||||
if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid && sleep 1s; fi
|
||||
done
|
||||
;;
|
||||
ports)
|
||||
echo "Release all ports used by the services in $yaml_file ..."
|
||||
pip install jq yq
|
||||
ports=$(yq '.services[].ports[] | split(":")[0]' $yaml_file | grep -o '[0-9a-zA-Z_-]\+')
|
||||
echo "All ports list..."
|
||||
echo "$ports"
|
||||
for port in $ports; do
|
||||
if [[ $port =~ [a-zA-Z_-] ]]; then
|
||||
port=$(grep -E "export $port=" tests/$test_case | cut -d'=' -f2)
|
||||
fi
|
||||
if [[ $port =~ [0-9] ]]; then
|
||||
if [[ $port == 5000 ]]; then
|
||||
echo "Error: Port 5000 is used by local docker registry, please DO NOT use it in docker compose deployment!!!"
|
||||
exit 1
|
||||
fi
|
||||
cid=$(docker ps --filter "publish=${port}" --format "{{.ID}}")
|
||||
if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid && echo "release $port"; fi
|
||||
fi
|
||||
done
|
||||
;;
|
||||
*)
|
||||
echo "Unknown function: $1"
|
||||
;;
|
||||
esac
|
||||
12
.github/workflows/scripts/get_test_matrix.sh
vendored
@@ -9,15 +9,23 @@ set -e
|
||||
changed_files=$changed_files
|
||||
test_mode=$test_mode
|
||||
run_matrix="{\"include\":["
|
||||
hardware_list="xeon gaudi" # current support hardware list
|
||||
|
||||
examples=$(printf '%s\n' "${changed_files[@]}" | grep '/' | cut -d'/' -f1 | sort -u)
|
||||
for example in ${examples}; do
|
||||
cd $WORKSPACE/$example
|
||||
if [[ ! $(find . -type f | grep ${test_mode}) ]]; then continue; fi
|
||||
cd tests
|
||||
ls -l
|
||||
if [[ "$test_mode" == "docker_image_build" ]]; then
|
||||
hardware_list="gaudi xeon"
|
||||
else
|
||||
find_name="test_${test_mode}*_on_*.sh"
|
||||
hardware_list=$(find . -type f -name "${find_name}" | cut -d/ -f2 | cut -d. -f1 | awk -F'_on_' '{print $2}'| sort -u)
|
||||
fi
|
||||
echo -e "Test supported hardware list: \n${hardware_list}"
|
||||
|
||||
run_hardware=""
|
||||
if [[ $(printf '%s\n' "${changed_files[@]}" | grep ${example} | cut -d'/' -f2 | grep -E '*.py|Dockerfile*|ui|docker_image_build' ) ]]; then
|
||||
if [[ $(printf '%s\n' "${changed_files[@]}" | grep ${example} | cut -d'/' -f2 | grep -E '\.py|Dockerfile*|ui|docker_image_build' ) ]]; then
|
||||
# run test on all hardware if megaservice or ui code change
|
||||
run_hardware=$hardware_list
|
||||
else
|
||||
|
||||
11
.github/workflows/scripts/k8s-utils.sh
vendored
@@ -2,7 +2,7 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#set -xe
|
||||
set -e
|
||||
|
||||
function dump_pod_log() {
|
||||
pod_name=$1
|
||||
@@ -12,7 +12,7 @@ function dump_pod_log() {
|
||||
kubectl describe pod $pod_name -n $namespace
|
||||
echo "-----------------------------------"
|
||||
echo "#kubectl logs $pod_name -n $namespace"
|
||||
kubectl logs $pod_name -n $namespace
|
||||
kubectl logs $pod_name -n $namespace --all-containers --prefix=true
|
||||
echo "-----------------------------------"
|
||||
}
|
||||
|
||||
@@ -44,8 +44,13 @@ function dump_pods_status() {
|
||||
|
||||
function dump_all_pod_logs() {
|
||||
namespace=$1
|
||||
echo "------SUMMARY of POD STATUS in NS $namespace------"
|
||||
kubectl get pods -n $namespace -o wide
|
||||
echo "------SUMMARY of SVC STATUS in NS $namespace------"
|
||||
kubectl get services -n $namespace -o wide
|
||||
echo "------SUMMARY of endpoint STATUS in NS $namespace------"
|
||||
kubectl get endpoints -n $namespace -o wide
|
||||
echo "-----DUMP POD STATUS AND LOG in NS $namespace------"
|
||||
|
||||
pods=$(kubectl get pods -n $namespace -o jsonpath='{.items[*].metadata.name}')
|
||||
for pod_name in $pods
|
||||
do
|
||||
|
||||
4
.github/workflows/weekly-update-images.yml
vendored
@@ -16,8 +16,8 @@ jobs:
|
||||
freeze-images:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
USER_NAME: "NeuralChatBot"
|
||||
USER_EMAIL: "grp_neural_chat_bot@intel.com"
|
||||
USER_NAME: "CICD-at-OPEA"
|
||||
USER_EMAIL: "CICD@opea.dev"
|
||||
BRANCH_NAME: "update_images_tag"
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
|
||||
2
.gitignore
vendored
@@ -5,4 +5,4 @@
|
||||
**/playwright/.cache/
|
||||
**/test-results/
|
||||
|
||||
__pycache__/
|
||||
__pycache__/
|
||||
|
||||
@@ -7,7 +7,7 @@ ci:
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.6.0
|
||||
rev: v5.0.0
|
||||
hooks:
|
||||
- id: end-of-file-fixer
|
||||
files: (.*\.(py|md|rst|yaml|yml|json|ts|js|html|svelte|sh))$
|
||||
@@ -18,8 +18,6 @@ repos:
|
||||
SearchQnA/ui/svelte/tsconfig.json|
|
||||
DocSum/ui/svelte/tsconfig.json
|
||||
)$
|
||||
- id: check-yaml
|
||||
args: [--allow-multiple-documents]
|
||||
- id: debug-statements
|
||||
- id: requirements-txt-fixer
|
||||
- id: trailing-whitespace
|
||||
@@ -81,7 +79,7 @@ repos:
|
||||
- id: isort
|
||||
|
||||
- repo: https://github.com/PyCQA/docformatter
|
||||
rev: v1.7.5
|
||||
rev: 06907d0
|
||||
hooks:
|
||||
- id: docformatter
|
||||
args: [
|
||||
@@ -102,18 +100,18 @@ repos:
|
||||
- prettier@3.2.5
|
||||
|
||||
- repo: https://github.com/psf/black.git
|
||||
rev: 24.4.2
|
||||
rev: 24.10.0
|
||||
hooks:
|
||||
- id: black
|
||||
files: (.*\.py)$
|
||||
|
||||
- repo: https://github.com/asottile/blacken-docs
|
||||
rev: 1.18.0
|
||||
rev: 1.19.1
|
||||
hooks:
|
||||
- id: blacken-docs
|
||||
args: [--line-length=120, --skip-errors]
|
||||
additional_dependencies:
|
||||
- black==24.4.2
|
||||
- black==24.10.0
|
||||
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.3.0
|
||||
@@ -124,7 +122,7 @@ repos:
|
||||
- tomli
|
||||
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.5.0
|
||||
rev: v0.8.6
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [--fix, --exit-non-zero-on-fix, --no-cache]
|
||||
|
||||
@@ -1 +1 @@
|
||||
**/kubernetes/
|
||||
**/kubernetes/
|
||||
|
||||
16
.set_env.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
#To anounce the version of the codes, please create a version.txt and have following format.
|
||||
#VERSION_MAJOR 1
|
||||
#VERSION_MINOR 0
|
||||
#VERSION_PATCH 0
|
||||
|
||||
VERSION_FILE="version.txt"
|
||||
if [ -f $VERSION_FILE ]; then
|
||||
VER_OPEA_MAJOR=$(grep "VERSION_MAJOR" $VERSION_FILE | cut -d " " -f 2)
|
||||
VER_OPEA_MINOR=$(grep "VERSION_MINOR" $VERSION_FILE | cut -d " " -f 2)
|
||||
VER_OPEA_PATCH=$(grep "VERSION_PATCH" $VERSION_FILE | cut -d " " -f 2)
|
||||
export TAG=$VER_OPEA_MAJOR.$VER_OPEA_MINOR
|
||||
echo OPEA Version:$TAG
|
||||
fi
|
||||
@@ -2,105 +2,274 @@
|
||||
|
||||
## Overview
|
||||
|
||||
This example showcases a hierarchical multi-agent system for question-answering applications. The architecture diagram is shown below. The supervisor agent interfaces with the user and dispatch tasks to the worker agent and other tools to gather information and come up with answers. The worker agent uses the retrieval tool to generate answers to the queries posted by the supervisor agent. Other tools used by the supervisor agent may include APIs to interface knowledge graphs, SQL databases, external knowledge bases, etc.
|
||||

|
||||
This example showcases a hierarchical multi-agent system for question-answering applications. The architecture diagram is shown below. The supervisor agent interfaces with the user and dispatch tasks to two worker agents to gather information and come up with answers. The worker RAG agent uses the retrieval tool to retrieve relevant documents from the knowledge base (a vector database). The worker SQL agent retrieve relevant data from the SQL database. Although not included in this example, but other tools such as a web search tool or a knowledge graph query tool can be used by the supervisor agent to gather information from additional sources.
|
||||

|
||||
|
||||
The AgentQnA example is implemented using the component-level microservices defined in [GenAIComps](https://github.com/opea-project/GenAIComps). The flow chart below shows the information flow between different microservices for this example.
|
||||
|
||||
```mermaid
|
||||
---
|
||||
config:
|
||||
flowchart:
|
||||
nodeSpacing: 400
|
||||
rankSpacing: 100
|
||||
curve: linear
|
||||
themeVariables:
|
||||
fontSize: 50px
|
||||
---
|
||||
flowchart LR
|
||||
%% Colors %%
|
||||
classDef blue fill:#ADD8E6,stroke:#ADD8E6,stroke-width:2px,fill-opacity:0.5
|
||||
classDef orange fill:#FBAA60,stroke:#ADD8E6,stroke-width:2px,fill-opacity:0.5
|
||||
classDef orchid fill:#C26DBC,stroke:#ADD8E6,stroke-width:2px,fill-opacity:0.5
|
||||
classDef invisible fill:transparent,stroke:transparent;
|
||||
|
||||
%% Subgraphs %%
|
||||
subgraph DocIndexRetriever-MegaService["DocIndexRetriever MegaService "]
|
||||
direction LR
|
||||
EM([Embedding MicroService]):::blue
|
||||
RET([Retrieval MicroService]):::blue
|
||||
RER([Rerank MicroService]):::blue
|
||||
end
|
||||
subgraph UserInput[" User Input "]
|
||||
direction LR
|
||||
a([User Input Query]):::orchid
|
||||
Ingest([Ingest data]):::orchid
|
||||
end
|
||||
AG_REACT([Agent MicroService - react]):::blue
|
||||
AG_RAG([Agent MicroService - rag]):::blue
|
||||
AG_SQL([Agent MicroService - sql]):::blue
|
||||
LLM_gen{{LLM Service <br>}}
|
||||
DP([Data Preparation MicroService]):::blue
|
||||
TEI_RER{{Reranking service<br>}}
|
||||
TEI_EM{{Embedding service <br>}}
|
||||
VDB{{Vector DB<br><br>}}
|
||||
R_RET{{Retriever service <br>}}
|
||||
|
||||
|
||||
|
||||
%% Questions interaction
|
||||
direction LR
|
||||
a[User Input Query] --> AG_REACT
|
||||
AG_REACT --> AG_RAG
|
||||
AG_REACT --> AG_SQL
|
||||
AG_RAG --> DocIndexRetriever-MegaService
|
||||
EM ==> RET
|
||||
RET ==> RER
|
||||
Ingest[Ingest data] --> DP
|
||||
|
||||
%% Embedding service flow
|
||||
direction LR
|
||||
AG_RAG <-.-> LLM_gen
|
||||
AG_SQL <-.-> LLM_gen
|
||||
AG_REACT <-.-> LLM_gen
|
||||
EM <-.-> TEI_EM
|
||||
RET <-.-> R_RET
|
||||
RER <-.-> TEI_RER
|
||||
|
||||
direction TB
|
||||
%% Vector DB interaction
|
||||
R_RET <-.-> VDB
|
||||
DP <-.-> VDB
|
||||
|
||||
|
||||
```
|
||||
|
||||
### Why Agent for question answering?
|
||||
|
||||
1. Improve relevancy of retrieved context.
|
||||
Agent can rephrase user queries, decompose user queries, and iterate to get the most relevant context for answering user's questions. Compared to conventional RAG, RAG agent can significantly improve the correctness and relevancy of the answer.
|
||||
2. Use tools to get additional knowledge.
|
||||
For example, knowledge graphs and SQL databases can be exposed as APIs for Agents to gather knowledge that may be missing in the retrieval vector database.
|
||||
3. Hierarchical agent can further improve performance.
|
||||
Expert worker agents, such as retrieval agent, knowledge graph agent, SQL agent, etc., can provide high-quality output for different aspects of a complex query, and the supervisor agent can aggregate the information together to provide a comprehensive answer.
|
||||
RAG agent can rephrase user queries, decompose user queries, and iterate to get the most relevant context for answering user's questions. Compared to conventional RAG, RAG agent can significantly improve the correctness and relevancy of the answer.
|
||||
2. Expand scope of the agent.
|
||||
The supervisor agent can interact with multiple worker agents that specialize in different domains with different skills (e.g., retrieve documents, write SQL queries, etc.), and thus can answer questions in multiple domains.
|
||||
3. Hierarchical multi-agents can improve performance.
|
||||
Expert worker agents, such as RAG agent and SQL agent, can provide high-quality output for different aspects of a complex query, and the supervisor agent can aggregate the information together to provide a comprehensive answer. If we only use one agent and provide all the tools to this single agent, it may get overwhelmed and not able to provide accurate answers.
|
||||
|
||||
### Roadmap
|
||||
## Deployment with docker
|
||||
|
||||
- v0.9: Worker agent uses open-source websearch tool (duckduckgo), agents use OpenAI GPT-4o-mini as llm backend.
|
||||
- v1.0: Worker agent uses OPEA retrieval megaservice as tool.
|
||||
- v1.0 or later: agents use open-source llm backend.
|
||||
- v1.1 or later: add safeguards
|
||||
1. Build agent docker image [Optional]
|
||||
|
||||
## Getting started
|
||||
> [!NOTE]
|
||||
> the step is optional. The docker images will be automatically pulled when running the docker compose commands. This step is only needed if pulling images failed.
|
||||
|
||||
1. Build agent docker image </br>
|
||||
First, clone the opea GenAIComps repo
|
||||
First, clone the opea GenAIComps repo.
|
||||
|
||||
```
|
||||
export WORKDIR=<your-work-directory>
|
||||
cd $WORKDIR
|
||||
git clone https://github.com/opea-project/GenAIComps.git
|
||||
```
|
||||
|
||||
Then build the agent docker image. Both the supervisor agent and the worker agent will use the same docker image, but when we launch the two agents we will specify different strategies and register different tools.
|
||||
|
||||
```
|
||||
cd GenAIComps
|
||||
docker build -t opea/agent:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/agent/src/Dockerfile .
|
||||
```
|
||||
|
||||
2. Set up environment for this example </br>
|
||||
|
||||
First, clone this repo.
|
||||
|
||||
```
|
||||
export WORKDIR=<your-work-directory>
|
||||
cd $WORKDIR
|
||||
git clone https://github.com/opea-project/GenAIComps.git
|
||||
git clone https://github.com/opea-project/GenAIExamples.git
|
||||
```
|
||||
|
||||
Then build the agent docker image. Both the supervisor agent and the worker agent will use the same docker image, but when we launch the two agents we will specify different strategies and register different tools.
|
||||
Second, set up env vars.
|
||||
|
||||
```
|
||||
cd GenAIComps
|
||||
docker build -t opea/agent-langchain:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/agent/langchain/Dockerfile .
|
||||
# Example: host_ip="192.168.1.1" or export host_ip="External_Public_IP"
|
||||
export host_ip=$(hostname -I | awk '{print $1}')
|
||||
# if you are in a proxy environment, also set the proxy-related environment variables
|
||||
export http_proxy="Your_HTTP_Proxy"
|
||||
export https_proxy="Your_HTTPs_Proxy"
|
||||
# Example: no_proxy="localhost, 127.0.0.1, 192.168.1.1"
|
||||
export no_proxy="Your_No_Proxy"
|
||||
|
||||
export TOOLSET_PATH=$WORKDIR/GenAIExamples/AgentQnA/tools/
|
||||
# for using open-source llms
|
||||
export HUGGINGFACEHUB_API_TOKEN=<your-HF-token>
|
||||
export HF_CACHE_DIR=<directory-where-llms-are-downloaded> #so that no need to redownload every time
|
||||
|
||||
# optional: OPANAI_API_KEY if you want to use OpenAI models
|
||||
export OPENAI_API_KEY=<your-openai-key>
|
||||
```
|
||||
|
||||
2. Launch tool services </br>
|
||||
3. Deploy the retrieval tool (i.e., DocIndexRetriever mega-service)
|
||||
|
||||
First, launch the mega-service.
|
||||
|
||||
```
|
||||
cd $WORKDIR/GenAIExamples/AgentQnA/retrieval_tool
|
||||
bash launch_retrieval_tool.sh
|
||||
```
|
||||
|
||||
Then, ingest data into the vector database. Here we provide an example. You can ingest your own data.
|
||||
|
||||
```
|
||||
bash run_ingest_data.sh
|
||||
```
|
||||
|
||||
4. Prepare SQL database
|
||||
In this example, we will use the Chinook SQLite database. Run the commands below.
|
||||
|
||||
```
|
||||
# Download data
|
||||
cd $WORKDIR
|
||||
git clone https://github.com/lerocha/chinook-database.git
|
||||
cp chinook-database/ChinookDatabase/DataSources/Chinook_Sqlite.sqlite $WORKDIR/GenAIExamples/AgentQnA/tests/
|
||||
```
|
||||
|
||||
5. Launch other tools. </br>
|
||||
In this example, we will use some of the mock APIs provided in the Meta CRAG KDD Challenge to demonstrate the benefits of gaining additional context from mock knowledge graphs.
|
||||
|
||||
```
|
||||
docker run -d -p=8080:8000 docker.io/aicrowd/kdd-cup-24-crag-mock-api:v0
|
||||
```
|
||||
|
||||
3. Set up environment for this example </br>
|
||||
First, clone this repo
|
||||
6. Launch multi-agent system. </br>
|
||||
We provide two options for `llm_engine` of the agents: 1. open-source LLMs on Intel Gaudi2, 2. OpenAI models via API calls.
|
||||
|
||||
```
|
||||
::::{tab-set}
|
||||
:::{tab-item} Gaudi
|
||||
:sync: Gaudi
|
||||
|
||||
On Gaudi2 we will serve `meta-llama/Meta-Llama-3.1-70B-Instruct` using vllm.
|
||||
|
||||
First build vllm-gaudi docker image.
|
||||
|
||||
```bash
|
||||
cd $WORKDIR
|
||||
git clone https://github.com/opea-project/GenAIExamples.git
|
||||
git clone https://github.com/vllm-project/vllm.git
|
||||
cd ./vllm
|
||||
git checkout v0.6.6
|
||||
docker build --no-cache -f Dockerfile.hpu -t opea/vllm-gaudi:latest --shm-size=128g . --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy
|
||||
```
|
||||
|
||||
Second, set up env vars
|
||||
Then launch vllm on Gaudi2 with the command below.
|
||||
|
||||
```bash
|
||||
vllm_port=8086
|
||||
model="meta-llama/Meta-Llama-3.1-70B-Instruct"
|
||||
docker run -d --runtime=habana --rm --name "vllm-gaudi-server" -e HABANA_VISIBLE_DEVICES=0,1,2,3 -p $vllm_port:8000 -v $vllm_volume:/data -e HF_TOKEN=$HF_TOKEN -e HUGGING_FACE_HUB_TOKEN=$HF_TOKEN -e HF_HOME=/data -e OMPI_MCA_btl_vader_single_copy_mechanism=none -e PT_HPU_ENABLE_LAZY_COLLECTIVES=true -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy -e VLLM_SKIP_WARMUP=true --cap-add=sys_nice --ipc=host opea/vllm-gaudi:latest --model ${model} --max-seq-len-to-capture 16384 --tensor-parallel-size 4
|
||||
```
|
||||
|
||||
Then launch Agent microservices.
|
||||
|
||||
```bash
|
||||
cd $WORKDIR/GenAIExamples/AgentQnA/docker_compose/intel/hpu/gaudi/
|
||||
bash launch_agent_service_gaudi.sh
|
||||
```
|
||||
|
||||
:::
|
||||
:::{tab-item} Xeon
|
||||
:sync: Xeon
|
||||
|
||||
To use OpenAI models, run commands below.
|
||||
|
||||
```
|
||||
export TOOLSET_PATH=$WORKDIR/GenAIExamples/AgentQnA/tools/
|
||||
# optional: OPANAI_API_KEY
|
||||
export OPENAI_API_KEY=<your-openai-key>
|
||||
```
|
||||
|
||||
4. Launch agent services</br>
|
||||
The configurations of the supervisor agent and the worker agent are defined in the docker-compose yaml file. We currently use openAI GPT-4o-mini as LLM, and we plan to add support for llama3.1-70B-instruct (served by TGI-Gaudi) in a subsequent release.
|
||||
To use openai llm, run command below.
|
||||
|
||||
```
|
||||
cd docker_compose/intel/cpu/xeon
|
||||
cd $WORKDIR/GenAIExamples/AgentQnA/docker_compose/intel/cpu/xeon
|
||||
bash launch_agent_service_openai.sh
|
||||
```
|
||||
|
||||
:::
|
||||
::::
|
||||
|
||||
## Deploy using Helm Chart
|
||||
|
||||
Refer to the [AgentQnA helm chart](./kubernetes/helm/README.md) for instructions on deploying AgentQnA on Kubernetes.
|
||||
|
||||
## Validate services
|
||||
|
||||
First look at logs of the agent docker containers:
|
||||
|
||||
```
|
||||
docker logs docgrader-agent-endpoint
|
||||
# worker RAG agent
|
||||
docker logs rag-agent-endpoint
|
||||
|
||||
# worker SQL agent
|
||||
docker logs sql-agent-endpoint
|
||||
```
|
||||
|
||||
```
|
||||
# supervisor agent
|
||||
docker logs react-agent-endpoint
|
||||
```
|
||||
|
||||
You should see something like "HTTP server setup successful" if the docker containers are started successfully.</p>
|
||||
|
||||
Second, validate worker agent:
|
||||
Second, validate worker RAG agent:
|
||||
|
||||
```
|
||||
curl http://${ip_address}:9095/v1/chat/completions -X POST -H "Content-Type: application/json" -d '{
|
||||
"query": "Most recent album by Taylor Swift"
|
||||
curl http://${host_ip}:9095/v1/chat/completions -X POST -H "Content-Type: application/json" -d '{
|
||||
"messages": "Michael Jackson song Thriller"
|
||||
}'
|
||||
```
|
||||
|
||||
Third, validate supervisor agent:
|
||||
Third, validate worker SQL agent:
|
||||
|
||||
```
|
||||
curl http://${ip_address}:9090/v1/chat/completions -X POST -H "Content-Type: application/json" -d '{
|
||||
"query": "Most recent album by Taylor Swift"
|
||||
curl http://${host_ip}:9096/v1/chat/completions -X POST -H "Content-Type: application/json" -d '{
|
||||
"messages": "How many employees are in the company"
|
||||
}'
|
||||
```
|
||||
|
||||
Finally, validate supervisor agent:
|
||||
|
||||
```
|
||||
curl http://${host_ip}:9090/v1/chat/completions -X POST -H "Content-Type: application/json" -d '{
|
||||
"messages": "How many albums does Iron Maiden have?"
|
||||
}'
|
||||
```
|
||||
|
||||
## Deploy AgentQnA UI
|
||||
|
||||
The AgentQnA UI can be deployed locally or using Docker.
|
||||
|
||||
For detailed instructions on deploying AgentQnA UI, refer to the [AgentQnA UI Guide](./ui/svelte/README.md).
|
||||
|
||||
## How to register your own tools with agent
|
||||
|
||||
You can take a look at the tools yaml and python files in this example. For more details, please refer to the "Provide your own tools" section in the instructions [here](https://github.com/opea-project/GenAIComps/tree/main/comps/agent/langchain#5-customize-agent-strategy).
|
||||
You can take a look at the tools yaml and python files in this example. For more details, please refer to the "Provide your own tools" section in the instructions [here](https://github.com/opea-project/GenAIComps/tree/main/comps/agent/src/README.md).
|
||||
|
||||
|
Before Width: | Height: | Size: 69 KiB |
BIN
AgentQnA/assets/img/agent_qna_arch.png
Normal file
|
After Width: | Height: | Size: 207 KiB |
BIN
AgentQnA/assets/img/agent_ui.png
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
AgentQnA/assets/img/agent_ui_result.png
Normal file
|
After Width: | Height: | Size: 57 KiB |
101
AgentQnA/docker_compose/amd/gpu/rocm/README.md
Normal file
@@ -0,0 +1,101 @@
|
||||
# Single node on-prem deployment with Docker Compose on AMD GPU
|
||||
|
||||
This example showcases a hierarchical multi-agent system for question-answering applications. We deploy the example on Xeon. For LLMs, we use OpenAI models via API calls. For instructions on using open-source LLMs, please refer to the deployment guide [here](../../../../README.md).
|
||||
|
||||
## Deployment with docker
|
||||
|
||||
1. First, clone this repo.
|
||||
```
|
||||
export WORKDIR=<your-work-directory>
|
||||
cd $WORKDIR
|
||||
git clone https://github.com/opea-project/GenAIExamples.git
|
||||
```
|
||||
2. Set up environment for this example </br>
|
||||
|
||||
```
|
||||
# Example: host_ip="192.168.1.1" or export host_ip="External_Public_IP"
|
||||
export host_ip=$(hostname -I | awk '{print $1}')
|
||||
# if you are in a proxy environment, also set the proxy-related environment variables
|
||||
export http_proxy="Your_HTTP_Proxy"
|
||||
export https_proxy="Your_HTTPs_Proxy"
|
||||
# Example: no_proxy="localhost, 127.0.0.1, 192.168.1.1"
|
||||
export no_proxy="Your_No_Proxy"
|
||||
|
||||
export TOOLSET_PATH=$WORKDIR/GenAIExamples/AgentQnA/tools/
|
||||
#OPANAI_API_KEY if you want to use OpenAI models
|
||||
export OPENAI_API_KEY=<your-openai-key>
|
||||
# Set AMD GPU settings
|
||||
export AGENTQNA_CARD_ID="card1"
|
||||
export AGENTQNA_RENDER_ID="renderD136"
|
||||
```
|
||||
|
||||
3. Deploy the retrieval tool (i.e., DocIndexRetriever mega-service)
|
||||
|
||||
First, launch the mega-service.
|
||||
|
||||
```
|
||||
cd $WORKDIR/GenAIExamples/AgentQnA/retrieval_tool
|
||||
bash launch_retrieval_tool.sh
|
||||
```
|
||||
|
||||
Then, ingest data into the vector database. Here we provide an example. You can ingest your own data.
|
||||
|
||||
```
|
||||
bash run_ingest_data.sh
|
||||
```
|
||||
|
||||
4. Launch Tool service
|
||||
In this example, we will use some of the mock APIs provided in the Meta CRAG KDD Challenge to demonstrate the benefits of gaining additional context from mock knowledge graphs.
|
||||
```
|
||||
docker run -d -p=8080:8000 docker.io/aicrowd/kdd-cup-24-crag-mock-api:v0
|
||||
```
|
||||
5. Launch `Agent` service
|
||||
|
||||
```
|
||||
cd $WORKDIR/GenAIExamples/AgentQnA/docker_compose/amd/gpu/rocm
|
||||
bash launch_agent_service_tgi_rocm.sh
|
||||
```
|
||||
|
||||
6. [Optional] Build `Agent` docker image if pulling images failed.
|
||||
|
||||
```
|
||||
git clone https://github.com/opea-project/GenAIComps.git
|
||||
cd GenAIComps
|
||||
docker build -t opea/agent:latest -f comps/agent/src/Dockerfile .
|
||||
```
|
||||
|
||||
## Validate services
|
||||
|
||||
First look at logs of the agent docker containers:
|
||||
|
||||
```
|
||||
# worker agent
|
||||
docker logs rag-agent-endpoint
|
||||
```
|
||||
|
||||
```
|
||||
# supervisor agent
|
||||
docker logs react-agent-endpoint
|
||||
```
|
||||
|
||||
You should see something like "HTTP server setup successful" if the docker containers are started successfully.</p>
|
||||
|
||||
Second, validate worker agent:
|
||||
|
||||
```
|
||||
curl http://${host_ip}:9095/v1/chat/completions -X POST -H "Content-Type: application/json" -d '{
|
||||
"query": "Most recent album by Taylor Swift"
|
||||
}'
|
||||
```
|
||||
|
||||
Third, validate supervisor agent:
|
||||
|
||||
```
|
||||
curl http://${host_ip}:9090/v1/chat/completions -X POST -H "Content-Type: application/json" -d '{
|
||||
"query": "Most recent album by Taylor Swift"
|
||||
}'
|
||||
```
|
||||
|
||||
## How to register your own tools with agent
|
||||
|
||||
You can take a look at the tools yaml and python files in this example. For more details, please refer to the "Provide your own tools" section in the instructions [here](https://github.com/opea-project/GenAIComps/tree/main/comps/agent/src/README.md).
|
||||
97
AgentQnA/docker_compose/amd/gpu/rocm/compose.yaml
Normal file
@@ -0,0 +1,97 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
services:
|
||||
agent-tgi-server:
|
||||
image: ${AGENTQNA_TGI_IMAGE}
|
||||
container_name: agent-tgi-server
|
||||
ports:
|
||||
- "${AGENTQNA_TGI_SERVICE_PORT-8085}:80"
|
||||
volumes:
|
||||
- /var/opea/agent-service/:/data
|
||||
environment:
|
||||
no_proxy: ${no_proxy}
|
||||
http_proxy: ${http_proxy}
|
||||
https_proxy: ${https_proxy}
|
||||
TGI_LLM_ENDPOINT: "http://${HOST_IP}:${AGENTQNA_TGI_SERVICE_PORT}"
|
||||
HUGGING_FACE_HUB_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
|
||||
HUGGINGFACEHUB_API_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
|
||||
shm_size: 1g
|
||||
devices:
|
||||
- /dev/kfd:/dev/kfd
|
||||
- /dev/dri/${AGENTQNA_CARD_ID}:/dev/dri/${AGENTQNA_CARD_ID}
|
||||
- /dev/dri/${AGENTQNA_RENDER_ID}:/dev/dri/${AGENTQNA_RENDER_ID}
|
||||
cap_add:
|
||||
- SYS_PTRACE
|
||||
group_add:
|
||||
- video
|
||||
security_opt:
|
||||
- seccomp:unconfined
|
||||
ipc: host
|
||||
command: --model-id ${LLM_MODEL_ID} --max-input-length 4096 --max-total-tokens 8192
|
||||
|
||||
worker-rag-agent:
|
||||
image: opea/agent:latest
|
||||
container_name: rag-agent-endpoint
|
||||
volumes:
|
||||
# - ${WORKDIR}/GenAIExamples/AgentQnA/docker_image_build/GenAIComps/comps/agent/langchain/:/home/user/comps/agent/langchain/
|
||||
- ${TOOLSET_PATH}:/home/user/tools/
|
||||
ports:
|
||||
- "9095:9095"
|
||||
ipc: host
|
||||
environment:
|
||||
ip_address: ${ip_address}
|
||||
strategy: rag_agent_llama
|
||||
recursion_limit: ${recursion_limit_worker}
|
||||
llm_engine: tgi
|
||||
HUGGINGFACEHUB_API_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
|
||||
llm_endpoint_url: ${LLM_ENDPOINT_URL}
|
||||
model: ${LLM_MODEL_ID}
|
||||
temperature: ${temperature}
|
||||
max_new_tokens: ${max_new_tokens}
|
||||
stream: false
|
||||
tools: /home/user/tools/worker_agent_tools.yaml
|
||||
require_human_feedback: false
|
||||
RETRIEVAL_TOOL_URL: ${RETRIEVAL_TOOL_URL}
|
||||
no_proxy: ${no_proxy}
|
||||
http_proxy: ${http_proxy}
|
||||
https_proxy: ${https_proxy}
|
||||
LANGCHAIN_API_KEY: ${LANGCHAIN_API_KEY}
|
||||
LANGCHAIN_TRACING_V2: ${LANGCHAIN_TRACING_V2}
|
||||
LANGCHAIN_PROJECT: "opea-worker-agent-service"
|
||||
port: 9095
|
||||
|
||||
supervisor-react-agent:
|
||||
image: opea/agent:latest
|
||||
container_name: react-agent-endpoint
|
||||
depends_on:
|
||||
- agent-tgi-server
|
||||
- worker-rag-agent
|
||||
volumes:
|
||||
# - ${WORKDIR}/GenAIExamples/AgentQnA/docker_image_build/GenAIComps/comps/agent/langchain/:/home/user/comps/agent/langchain/
|
||||
- ${TOOLSET_PATH}:/home/user/tools/
|
||||
ports:
|
||||
- "${AGENTQNA_FRONTEND_PORT}:9090"
|
||||
ipc: host
|
||||
environment:
|
||||
ip_address: ${ip_address}
|
||||
strategy: react_langgraph
|
||||
recursion_limit: ${recursion_limit_supervisor}
|
||||
llm_engine: tgi
|
||||
HUGGINGFACEHUB_API_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
|
||||
llm_endpoint_url: ${LLM_ENDPOINT_URL}
|
||||
model: ${LLM_MODEL_ID}
|
||||
temperature: ${temperature}
|
||||
max_new_tokens: ${max_new_tokens}
|
||||
stream: false
|
||||
tools: /home/user/tools/supervisor_agent_tools.yaml
|
||||
require_human_feedback: false
|
||||
no_proxy: ${no_proxy}
|
||||
http_proxy: ${http_proxy}
|
||||
https_proxy: ${https_proxy}
|
||||
LANGCHAIN_API_KEY: ${LANGCHAIN_API_KEY}
|
||||
LANGCHAIN_TRACING_V2: ${LANGCHAIN_TRACING_V2}
|
||||
LANGCHAIN_PROJECT: "opea-supervisor-agent-service"
|
||||
CRAG_SERVER: $CRAG_SERVER
|
||||
WORKER_AGENT_URL: $WORKER_AGENT_URL
|
||||
port: 9090
|
||||
@@ -0,0 +1,47 @@
|
||||
# Copyright (C) 2024 Advanced Micro Devices, Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
WORKPATH=$(dirname "$PWD")/..
|
||||
export ip_address=${host_ip}
|
||||
export HUGGINGFACEHUB_API_TOKEN=${your_hf_api_token}
|
||||
export AGENTQNA_TGI_IMAGE=ghcr.io/huggingface/text-generation-inference:2.3.1-rocm
|
||||
export AGENTQNA_TGI_SERVICE_PORT="8085"
|
||||
|
||||
# LLM related environment variables
|
||||
export AGENTQNA_CARD_ID="card1"
|
||||
export AGENTQNA_RENDER_ID="renderD136"
|
||||
export HF_CACHE_DIR=${HF_CACHE_DIR}
|
||||
ls $HF_CACHE_DIR
|
||||
export LLM_MODEL_ID="meta-llama/Meta-Llama-3-8B-Instruct"
|
||||
#export NUM_SHARDS=4
|
||||
export LLM_ENDPOINT_URL="http://${ip_address}:${AGENTQNA_TGI_SERVICE_PORT}"
|
||||
export temperature=0.01
|
||||
export max_new_tokens=512
|
||||
|
||||
# agent related environment variables
|
||||
export AGENTQNA_WORKER_AGENT_SERVICE_PORT="9095"
|
||||
export TOOLSET_PATH=/home/huggingface/datamonsters/amd-opea/GenAIExamples/AgentQnA/tools/
|
||||
echo "TOOLSET_PATH=${TOOLSET_PATH}"
|
||||
export recursion_limit_worker=12
|
||||
export recursion_limit_supervisor=10
|
||||
export WORKER_AGENT_URL="http://${ip_address}:${AGENTQNA_WORKER_AGENT_SERVICE_PORT}/v1/chat/completions"
|
||||
export RETRIEVAL_TOOL_URL="http://${ip_address}:8889/v1/retrievaltool"
|
||||
export CRAG_SERVER=http://${ip_address}:18881
|
||||
|
||||
export AGENTQNA_FRONTEND_PORT="9090"
|
||||
|
||||
#retrieval_tool
|
||||
export TEI_EMBEDDING_ENDPOINT="http://${host_ip}:6006"
|
||||
export TEI_RERANKING_ENDPOINT="http://${host_ip}:8808"
|
||||
export REDIS_URL="redis://${host_ip}:26379"
|
||||
export INDEX_NAME="rag-redis"
|
||||
export MEGA_SERVICE_HOST_IP=${host_ip}
|
||||
export EMBEDDING_SERVICE_HOST_IP=${host_ip}
|
||||
export RETRIEVER_SERVICE_HOST_IP=${host_ip}
|
||||
export RERANK_SERVICE_HOST_IP=${host_ip}
|
||||
export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:8889/v1/retrievaltool"
|
||||
export DATAPREP_SERVICE_ENDPOINT="http://${host_ip}:6007/v1/dataprep/ingest"
|
||||
export DATAPREP_GET_FILE_ENDPOINT="http://${host_ip}:6007/v1/dataprep/get"
|
||||
export DATAPREP_DELETE_FILE_ENDPOINT="http://${host_ip}:6007/v1/dataprep/delete"
|
||||
|
||||
docker compose -f compose.yaml up -d
|
||||
46
AgentQnA/docker_compose/amd/gpu/rocm/set_env.sh
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (C) 2024 Advanced Micro Devices, Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
WORKPATH=$(dirname "$PWD")/..
|
||||
export ip_address=${host_ip}
|
||||
export HUGGINGFACEHUB_API_TOKEN=${your_hf_api_token}
|
||||
export AGENTQNA_TGI_IMAGE=ghcr.io/huggingface/text-generation-inference:2.3.1-rocm
|
||||
export AGENTQNA_TGI_SERVICE_PORT="19001"
|
||||
|
||||
# LLM related environment variables
|
||||
export AGENTQNA_CARD_ID="card1"
|
||||
export AGENTQNA_RENDER_ID="renderD136"
|
||||
export HF_CACHE_DIR=${HF_CACHE_DIR}
|
||||
ls $HF_CACHE_DIR
|
||||
export LLM_MODEL_ID="meta-llama/Meta-Llama-3-8B-Instruct"
|
||||
export NUM_SHARDS=4
|
||||
export LLM_ENDPOINT_URL="http://${ip_address}:${AGENTQNA_TGI_SERVICE_PORT}"
|
||||
export temperature=0.01
|
||||
export max_new_tokens=512
|
||||
|
||||
# agent related environment variables
|
||||
export AGENTQNA_WORKER_AGENT_SERVICE_PORT="9095"
|
||||
export TOOLSET_PATH=$WORKDIR/GenAIExamples/AgentQnA/tools/
|
||||
export recursion_limit_worker=12
|
||||
export recursion_limit_supervisor=10
|
||||
export WORKER_AGENT_URL="http://${ip_address}:${AGENTQNA_WORKER_AGENT_SERVICE_PORT}/v1/chat/completions"
|
||||
export RETRIEVAL_TOOL_URL="http://${ip_address}:8889/v1/retrievaltool"
|
||||
export CRAG_SERVER=http://${ip_address}:18881
|
||||
|
||||
export AGENTQNA_FRONTEND_PORT="15557"
|
||||
|
||||
#retrieval_tool
|
||||
export TEI_EMBEDDING_ENDPOINT="http://${host_ip}:6006"
|
||||
export TEI_RERANKING_ENDPOINT="http://${host_ip}:8808"
|
||||
export REDIS_URL="redis://${host_ip}:26379"
|
||||
export INDEX_NAME="rag-redis"
|
||||
export MEGA_SERVICE_HOST_IP=${host_ip}
|
||||
export EMBEDDING_SERVICE_HOST_IP=${host_ip}
|
||||
export RETRIEVER_SERVICE_HOST_IP=${host_ip}
|
||||
export RERANK_SERVICE_HOST_IP=${host_ip}
|
||||
export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:8889/v1/retrievaltool"
|
||||
export DATAPREP_SERVICE_ENDPOINT="http://${host_ip}:6007/v1/dataprep/ingest"
|
||||
export DATAPREP_GET_FILE_ENDPOINT="http://${host_ip}:6007/v1/dataprep/get"
|
||||
export DATAPREP_DELETE_FILE_ENDPOINT="http://${host_ip}:6007/v1/dataprep/delete"
|
||||
123
AgentQnA/docker_compose/intel/cpu/xeon/README.md
Normal file
@@ -0,0 +1,123 @@
|
||||
# Single node on-prem deployment with Docker Compose on Xeon Scalable processors
|
||||
|
||||
This example showcases a hierarchical multi-agent system for question-answering applications. We deploy the example on Xeon. For LLMs, we use OpenAI models via API calls. For instructions on using open-source LLMs, please refer to the deployment guide [here](../../../../README.md).
|
||||
|
||||
## Deployment with docker
|
||||
|
||||
1. First, clone this repo.
|
||||
```
|
||||
export WORKDIR=<your-work-directory>
|
||||
cd $WORKDIR
|
||||
git clone https://github.com/opea-project/GenAIExamples.git
|
||||
```
|
||||
2. Set up environment for this example </br>
|
||||
|
||||
```
|
||||
# Example: host_ip="192.168.1.1" or export host_ip="External_Public_IP"
|
||||
export host_ip=$(hostname -I | awk '{print $1}')
|
||||
# if you are in a proxy environment, also set the proxy-related environment variables
|
||||
export http_proxy="Your_HTTP_Proxy"
|
||||
export https_proxy="Your_HTTPs_Proxy"
|
||||
# Example: no_proxy="localhost, 127.0.0.1, 192.168.1.1"
|
||||
export no_proxy="Your_No_Proxy"
|
||||
|
||||
export TOOLSET_PATH=$WORKDIR/GenAIExamples/AgentQnA/tools/
|
||||
#OPANAI_API_KEY if you want to use OpenAI models
|
||||
export OPENAI_API_KEY=<your-openai-key>
|
||||
```
|
||||
|
||||
3. Deploy the retrieval tool (i.e., DocIndexRetriever mega-service)
|
||||
|
||||
First, launch the mega-service.
|
||||
|
||||
```
|
||||
cd $WORKDIR/GenAIExamples/AgentQnA/retrieval_tool
|
||||
bash launch_retrieval_tool.sh
|
||||
```
|
||||
|
||||
Then, ingest data into the vector database. Here we provide an example. You can ingest your own data.
|
||||
|
||||
```
|
||||
bash run_ingest_data.sh
|
||||
```
|
||||
|
||||
4. Prepare SQL database
|
||||
In this example, we will use the SQLite database provided in the [TAG-Bench](https://github.com/TAG-Research/TAG-Bench/tree/main). Run the commands below.
|
||||
|
||||
```
|
||||
# Download data
|
||||
cd $WORKDIR
|
||||
git clone https://github.com/TAG-Research/TAG-Bench.git
|
||||
cd TAG-Bench/setup
|
||||
chmod +x get_dbs.sh
|
||||
./get_dbs.sh
|
||||
```
|
||||
|
||||
5. Launch Tool service
|
||||
In this example, we will use some of the mock APIs provided in the Meta CRAG KDD Challenge to demonstrate the benefits of gaining additional context from mock knowledge graphs.
|
||||
```
|
||||
docker run -d -p=8080:8000 docker.io/aicrowd/kdd-cup-24-crag-mock-api:v0
|
||||
```
|
||||
6. Launch multi-agent system
|
||||
|
||||
The configurations of the supervisor agent and the worker agents are defined in the docker-compose yaml file. We currently use openAI GPT-4o-mini as LLM.
|
||||
|
||||
```
|
||||
cd $WORKDIR/GenAIExamples/AgentQnA/docker_compose/intel/cpu/xeon
|
||||
bash launch_agent_service_openai.sh
|
||||
```
|
||||
|
||||
7. [Optional] Build `Agent` docker image if pulling images failed.
|
||||
|
||||
```
|
||||
git clone https://github.com/opea-project/GenAIComps.git
|
||||
cd GenAIComps
|
||||
docker build -t opea/agent:latest -f comps/agent/src/Dockerfile .
|
||||
```
|
||||
|
||||
## Validate services
|
||||
|
||||
First look at logs of the agent docker containers:
|
||||
|
||||
```
|
||||
# worker RAG agent
|
||||
docker logs rag-agent-endpoint
|
||||
|
||||
# worker SQL agent
|
||||
docker logs sql-agent-endpoint
|
||||
```
|
||||
|
||||
```
|
||||
# supervisor agent
|
||||
docker logs react-agent-endpoint
|
||||
```
|
||||
|
||||
You should see something like "HTTP server setup successful" if the docker containers are started successfully.</p>
|
||||
|
||||
Second, validate worker RAG agent:
|
||||
|
||||
```
|
||||
curl http://${host_ip}:9095/v1/chat/completions -X POST -H "Content-Type: application/json" -d '{
|
||||
"messages": "Michael Jackson song Thriller"
|
||||
}'
|
||||
```
|
||||
|
||||
Third, validate worker SQL agent:
|
||||
|
||||
```
|
||||
curl http://${host_ip}:9095/v1/chat/completions -X POST -H "Content-Type: application/json" -d '{
|
||||
"messages": "How many employees are in the company?"
|
||||
}'
|
||||
```
|
||||
|
||||
Finally, validate supervisor agent:
|
||||
|
||||
```
|
||||
curl http://${host_ip}:9090/v1/chat/completions -X POST -H "Content-Type: application/json" -d '{
|
||||
"messages": "How many albums does Iron Maiden have?"
|
||||
}'
|
||||
```
|
||||
|
||||
## How to register your own tools with agent
|
||||
|
||||
You can take a look at the tools yaml and python files in this example. For more details, please refer to the "Provide your own tools" section in the instructions [here](https://github.com/opea-project/GenAIComps/tree/main/comps/agent/src/README.md).
|
||||
@@ -2,11 +2,10 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
services:
|
||||
worker-docgrader-agent:
|
||||
image: opea/agent-langchain:latest
|
||||
container_name: docgrader-agent-endpoint
|
||||
worker-rag-agent:
|
||||
image: opea/agent:latest
|
||||
container_name: rag-agent-endpoint
|
||||
volumes:
|
||||
- ${WORKDIR}/GenAIComps/comps/agent/langchain/:/home/user/comps/agent/langchain/
|
||||
- ${TOOLSET_PATH}:/home/user/tools/
|
||||
ports:
|
||||
- "9095:9095"
|
||||
@@ -20,7 +19,7 @@ services:
|
||||
model: ${model}
|
||||
temperature: ${temperature}
|
||||
max_new_tokens: ${max_new_tokens}
|
||||
streaming: false
|
||||
stream: false
|
||||
tools: /home/user/tools/worker_agent_tools.yaml
|
||||
require_human_feedback: false
|
||||
RETRIEVAL_TOOL_URL: ${RETRIEVAL_TOOL_URL}
|
||||
@@ -32,12 +31,40 @@ services:
|
||||
LANGCHAIN_PROJECT: "opea-worker-agent-service"
|
||||
port: 9095
|
||||
|
||||
worker-sql-agent:
|
||||
image: opea/agent:latest
|
||||
container_name: sql-agent-endpoint
|
||||
volumes:
|
||||
- ${WORKDIR}/TAG-Bench/:/home/user/TAG-Bench # SQL database
|
||||
ports:
|
||||
- "9096:9096"
|
||||
ipc: host
|
||||
environment:
|
||||
ip_address: ${ip_address}
|
||||
strategy: sql_agent
|
||||
db_name: ${db_name}
|
||||
db_path: ${db_path}
|
||||
use_hints: false
|
||||
hints_file: /home/user/TAG-Bench/${db_name}_hints.csv
|
||||
recursion_limit: ${recursion_limit_worker}
|
||||
llm_engine: openai
|
||||
OPENAI_API_KEY: ${OPENAI_API_KEY}
|
||||
model: ${model}
|
||||
temperature: 0
|
||||
max_new_tokens: ${max_new_tokens}
|
||||
stream: false
|
||||
require_human_feedback: false
|
||||
no_proxy: ${no_proxy}
|
||||
http_proxy: ${http_proxy}
|
||||
https_proxy: ${https_proxy}
|
||||
port: 9096
|
||||
|
||||
supervisor-react-agent:
|
||||
image: opea/agent-langchain:latest
|
||||
image: opea/agent:latest
|
||||
container_name: react-agent-endpoint
|
||||
depends_on:
|
||||
- worker-rag-agent
|
||||
volumes:
|
||||
- ${WORKDIR}/GenAIComps/comps/agent/langchain/:/home/user/comps/agent/langchain/
|
||||
- ${TOOLSET_PATH}:/home/user/tools/
|
||||
ports:
|
||||
- "9090:9090"
|
||||
@@ -51,7 +78,7 @@ services:
|
||||
model: ${model}
|
||||
temperature: ${temperature}
|
||||
max_new_tokens: ${max_new_tokens}
|
||||
streaming: false
|
||||
stream: false
|
||||
tools: /home/user/tools/supervisor_agent_tools.yaml
|
||||
require_human_feedback: false
|
||||
no_proxy: ${no_proxy}
|
||||
|
||||
@@ -1,16 +1,22 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
pushd "../../../../../" > /dev/null
|
||||
source .set_env.sh
|
||||
popd > /dev/null
|
||||
export TOOLSET_PATH=$WORKDIR/GenAIExamples/AgentQnA/tools/
|
||||
export ip_address=$(hostname -I | awk '{print $1}')
|
||||
export recursion_limit_worker=12
|
||||
export recursion_limit_supervisor=10
|
||||
export model="gpt-4o-mini-2024-07-18"
|
||||
export temperature=0
|
||||
export max_new_tokens=512
|
||||
export max_new_tokens=4096
|
||||
export OPENAI_API_KEY=${OPENAI_API_KEY}
|
||||
export WORKER_AGENT_URL="http://${ip_address}:9095/v1/chat/completions"
|
||||
export SQL_AGENT_URL="http://${ip_address}:9096/v1/chat/completions"
|
||||
export RETRIEVAL_TOOL_URL="http://${ip_address}:8889/v1/retrievaltool"
|
||||
export CRAG_SERVER=http://${ip_address}:8080
|
||||
export db_name=california_schools
|
||||
export db_path="sqlite:////home/user/TAG-Bench/dev_folder/dev_databases/${db_name}/${db_name}.sqlite"
|
||||
|
||||
docker compose -f compose_openai.yaml up -d
|
||||
|
||||
147
AgentQnA/docker_compose/intel/hpu/gaudi/README.md
Normal file
@@ -0,0 +1,147 @@
|
||||
# Single node on-prem deployment AgentQnA on Gaudi
|
||||
|
||||
This example showcases a hierarchical multi-agent system for question-answering applications. We deploy the example on Gaudi using open-source LLMs.
|
||||
For more details, please refer to the deployment guide [here](../../../../README.md).
|
||||
|
||||
## Deployment with docker
|
||||
|
||||
1. First, clone this repo.
|
||||
```
|
||||
export WORKDIR=<your-work-directory>
|
||||
cd $WORKDIR
|
||||
git clone https://github.com/opea-project/GenAIExamples.git
|
||||
```
|
||||
2. Set up environment for this example </br>
|
||||
|
||||
```
|
||||
# Example: host_ip="192.168.1.1" or export host_ip="External_Public_IP"
|
||||
export host_ip=$(hostname -I | awk '{print $1}')
|
||||
# if you are in a proxy environment, also set the proxy-related environment variables
|
||||
export http_proxy="Your_HTTP_Proxy"
|
||||
export https_proxy="Your_HTTPs_Proxy"
|
||||
# Example: no_proxy="localhost, 127.0.0.1, 192.168.1.1"
|
||||
export no_proxy="Your_No_Proxy"
|
||||
|
||||
export TOOLSET_PATH=$WORKDIR/GenAIExamples/AgentQnA/tools/
|
||||
# for using open-source llms
|
||||
export HUGGINGFACEHUB_API_TOKEN=<your-HF-token>
|
||||
# Example export HF_CACHE_DIR=$WORKDIR so that no need to redownload every time
|
||||
export HF_CACHE_DIR=<directory-where-llms-are-downloaded>
|
||||
|
||||
```
|
||||
|
||||
3. Deploy the retrieval tool (i.e., DocIndexRetriever mega-service)
|
||||
|
||||
First, launch the mega-service.
|
||||
|
||||
```
|
||||
cd $WORKDIR/GenAIExamples/AgentQnA/retrieval_tool
|
||||
bash launch_retrieval_tool.sh
|
||||
```
|
||||
|
||||
Then, ingest data into the vector database. Here we provide an example. You can ingest your own data.
|
||||
|
||||
```
|
||||
bash run_ingest_data.sh
|
||||
```
|
||||
|
||||
4. Prepare SQL database
|
||||
In this example, we will use the Chinook SQLite database. Run the commands below.
|
||||
|
||||
```
|
||||
# Download data
|
||||
cd $WORKDIR
|
||||
git clone https://github.com/lerocha/chinook-database.git
|
||||
cp chinook-database/ChinookDatabase/DataSources/Chinook_Sqlite.sqlite $WORKDIR/GenAIExamples/AgentQnA/tests/
|
||||
```
|
||||
|
||||
5. Launch Tool service
|
||||
In this example, we will use some of the mock APIs provided in the Meta CRAG KDD Challenge to demonstrate the benefits of gaining additional context from mock knowledge graphs.
|
||||
```
|
||||
docker run -d -p=8080:8000 docker.io/aicrowd/kdd-cup-24-crag-mock-api:v0
|
||||
```
|
||||
6. Launch multi-agent system
|
||||
|
||||
On Gaudi2 we will serve `meta-llama/Meta-Llama-3.1-70B-Instruct` using vllm.
|
||||
|
||||
First build vllm-gaudi docker image.
|
||||
|
||||
```bash
|
||||
cd $WORKDIR
|
||||
git clone https://github.com/vllm-project/vllm.git
|
||||
cd ./vllm
|
||||
git checkout v0.6.6
|
||||
docker build --no-cache -f Dockerfile.hpu -t opea/vllm-gaudi:latest --shm-size=128g . --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy
|
||||
```
|
||||
|
||||
Then launch vllm on Gaudi2 with the command below.
|
||||
|
||||
```bash
|
||||
vllm_port=8086
|
||||
model="meta-llama/Meta-Llama-3.1-70B-Instruct"
|
||||
docker run -d --runtime=habana --rm --name "vllm-gaudi-server" -e HABANA_VISIBLE_DEVICES=0,1,2,3 -p $vllm_port:8000 -v $vllm_volume:/data -e HF_TOKEN=$HF_TOKEN -e HUGGING_FACE_HUB_TOKEN=$HF_TOKEN -e HF_HOME=/data -e OMPI_MCA_btl_vader_single_copy_mechanism=none -e PT_HPU_ENABLE_LAZY_COLLECTIVES=true -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy -e VLLM_SKIP_WARMUP=true --cap-add=sys_nice --ipc=host opea/vllm-gaudi:latest --model ${model} --max-seq-len-to-capture 16384 --tensor-parallel-size 4
|
||||
```
|
||||
|
||||
Then launch Agent microservices.
|
||||
|
||||
```bash
|
||||
cd $WORKDIR/GenAIExamples/AgentQnA/docker_compose/intel/hpu/gaudi/
|
||||
bash launch_agent_service_gaudi.sh
|
||||
```
|
||||
|
||||
7. [Optional] Build `Agent` docker image if pulling images failed.
|
||||
|
||||
If docker image pulling failed in Step 6 above, build the agent docker image with the commands below. After image build, try Step 6 again.
|
||||
|
||||
```
|
||||
git clone https://github.com/opea-project/GenAIComps.git
|
||||
cd GenAIComps
|
||||
docker build -t opea/agent:latest -f comps/agent/src/Dockerfile .
|
||||
```
|
||||
|
||||
## Validate services
|
||||
|
||||
First look at logs of the agent docker containers:
|
||||
|
||||
```
|
||||
# worker RAG agent
|
||||
docker logs rag-agent-endpoint
|
||||
|
||||
# worker SQL agent
|
||||
docker logs sql-agent-endpoint
|
||||
```
|
||||
|
||||
```
|
||||
# supervisor agent
|
||||
docker logs react-agent-endpoint
|
||||
```
|
||||
|
||||
You should see something like "HTTP server setup successful" if the docker containers are started successfully.</p>
|
||||
|
||||
Second, validate worker RAG agent:
|
||||
|
||||
```
|
||||
curl http://${host_ip}:9095/v1/chat/completions -X POST -H "Content-Type: application/json" -d '{
|
||||
"messages": "Michael Jackson song Thriller"
|
||||
}'
|
||||
```
|
||||
|
||||
Third, validate worker SQL agent:
|
||||
|
||||
```
|
||||
curl http://${host_ip}:9095/v1/chat/completions -X POST -H "Content-Type: application/json" -d '{
|
||||
"messages": "How many employees are in the company?"
|
||||
}'
|
||||
```
|
||||
|
||||
Finally, validate supervisor agent:
|
||||
|
||||
```
|
||||
curl http://${host_ip}:9090/v1/chat/completions -X POST -H "Content-Type: application/json" -d '{
|
||||
"messages": "How many albums does Iron Maiden have?"
|
||||
}'
|
||||
```
|
||||
|
||||
## How to register your own tools with agent
|
||||
|
||||
You can take a look at the tools yaml and python files in this example. For more details, please refer to the "Provide your own tools" section in the instructions [here](https://github.com/opea-project/GenAIComps/tree/main/comps/agent/src/README.md).
|
||||
@@ -2,50 +2,25 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
services:
|
||||
tgi-server:
|
||||
image: ghcr.io/huggingface/tgi-gaudi:2.0.4
|
||||
container_name: tgi-server
|
||||
ports:
|
||||
- "8085:80"
|
||||
worker-rag-agent:
|
||||
image: opea/agent:latest
|
||||
container_name: rag-agent-endpoint
|
||||
volumes:
|
||||
- ${HF_CACHE_DIR}:/data
|
||||
environment:
|
||||
no_proxy: ${no_proxy}
|
||||
http_proxy: ${http_proxy}
|
||||
https_proxy: ${https_proxy}
|
||||
HF_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
|
||||
HF_HUB_DISABLE_PROGRESS_BARS: 1
|
||||
HF_HUB_ENABLE_HF_TRANSFER: 0
|
||||
HABANA_VISIBLE_DEVICES: all
|
||||
OMPI_MCA_btl_vader_single_copy_mechanism: none
|
||||
PT_HPU_ENABLE_LAZY_COLLECTIVES: true
|
||||
runtime: habana
|
||||
cap_add:
|
||||
- SYS_NICE
|
||||
ipc: host
|
||||
command: --model-id ${LLM_MODEL_ID} --max-input-length 4096 --max-total-tokens 8192 --sharded true --num-shard ${NUM_SHARDS}
|
||||
worker-docgrader-agent:
|
||||
image: opea/agent-langchain:latest
|
||||
container_name: docgrader-agent-endpoint
|
||||
depends_on:
|
||||
- tgi-server
|
||||
volumes:
|
||||
# - ${WORKDIR}/GenAIExamples/AgentQnA/docker_image_build/GenAIComps/comps/agent/langchain/:/home/user/comps/agent/langchain/
|
||||
- ${TOOLSET_PATH}:/home/user/tools/
|
||||
ports:
|
||||
- "9095:9095"
|
||||
ipc: host
|
||||
environment:
|
||||
ip_address: ${ip_address}
|
||||
strategy: rag_agent
|
||||
strategy: rag_agent_llama
|
||||
recursion_limit: ${recursion_limit_worker}
|
||||
llm_engine: tgi
|
||||
llm_engine: vllm
|
||||
HUGGINGFACEHUB_API_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
|
||||
llm_endpoint_url: ${LLM_ENDPOINT_URL}
|
||||
model: ${LLM_MODEL_ID}
|
||||
temperature: ${temperature}
|
||||
max_new_tokens: ${max_new_tokens}
|
||||
streaming: false
|
||||
stream: false
|
||||
tools: /home/user/tools/worker_agent_tools.yaml
|
||||
require_human_feedback: false
|
||||
RETRIEVAL_TOOL_URL: ${RETRIEVAL_TOOL_URL}
|
||||
@@ -57,30 +32,56 @@ services:
|
||||
LANGCHAIN_PROJECT: "opea-worker-agent-service"
|
||||
port: 9095
|
||||
|
||||
worker-sql-agent:
|
||||
image: opea/agent:latest
|
||||
container_name: sql-agent-endpoint
|
||||
volumes:
|
||||
- ${WORKDIR}/GenAIExamples/AgentQnA/tests:/home/user/chinook-db # test db
|
||||
ports:
|
||||
- "9096:9096"
|
||||
ipc: host
|
||||
environment:
|
||||
ip_address: ${ip_address}
|
||||
strategy: sql_agent_llama
|
||||
db_name: ${db_name}
|
||||
db_path: ${db_path}
|
||||
use_hints: false
|
||||
recursion_limit: ${recursion_limit_worker}
|
||||
llm_engine: vllm
|
||||
HUGGINGFACEHUB_API_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
|
||||
llm_endpoint_url: ${LLM_ENDPOINT_URL}
|
||||
model: ${LLM_MODEL_ID}
|
||||
temperature: ${temperature}
|
||||
max_new_tokens: ${max_new_tokens}
|
||||
stream: false
|
||||
require_human_feedback: false
|
||||
no_proxy: ${no_proxy}
|
||||
http_proxy: ${http_proxy}
|
||||
https_proxy: ${https_proxy}
|
||||
port: 9096
|
||||
|
||||
supervisor-react-agent:
|
||||
image: opea/agent-langchain:latest
|
||||
image: opea/agent:latest
|
||||
container_name: react-agent-endpoint
|
||||
depends_on:
|
||||
- tgi-server
|
||||
- worker-docgrader-agent
|
||||
- worker-rag-agent
|
||||
- worker-sql-agent
|
||||
volumes:
|
||||
# - ${WORKDIR}/GenAIExamples/AgentQnA/docker_image_build/GenAIComps/comps/agent/langchain/:/home/user/comps/agent/langchain/
|
||||
- ${TOOLSET_PATH}:/home/user/tools/
|
||||
ports:
|
||||
- "9090:9090"
|
||||
ipc: host
|
||||
environment:
|
||||
ip_address: ${ip_address}
|
||||
strategy: react_langgraph
|
||||
strategy: react_llama
|
||||
recursion_limit: ${recursion_limit_supervisor}
|
||||
llm_engine: tgi
|
||||
llm_engine: vllm
|
||||
HUGGINGFACEHUB_API_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
|
||||
llm_endpoint_url: ${LLM_ENDPOINT_URL}
|
||||
model: ${LLM_MODEL_ID}
|
||||
temperature: ${temperature}
|
||||
max_new_tokens: ${max_new_tokens}
|
||||
streaming: false
|
||||
stream: false
|
||||
tools: /home/user/tools/supervisor_agent_tools.yaml
|
||||
require_human_feedback: false
|
||||
no_proxy: ${no_proxy}
|
||||
@@ -91,4 +92,5 @@ services:
|
||||
LANGCHAIN_PROJECT: "opea-supervisor-agent-service"
|
||||
CRAG_SERVER: $CRAG_SERVER
|
||||
WORKER_AGENT_URL: $WORKER_AGENT_URL
|
||||
SQL_AGENT_URL: $SQL_AGENT_URL
|
||||
port: 9090
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
pushd "../../../../../" > /dev/null
|
||||
source .set_env.sh
|
||||
popd > /dev/null
|
||||
WORKPATH=$(dirname "$PWD")/..
|
||||
# export WORKDIR=$WORKPATH/../../
|
||||
echo "WORKDIR=${WORKDIR}"
|
||||
@@ -13,9 +16,9 @@ ls $HF_CACHE_DIR
|
||||
export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
|
||||
export LLM_MODEL_ID="meta-llama/Meta-Llama-3.1-70B-Instruct"
|
||||
export NUM_SHARDS=4
|
||||
export LLM_ENDPOINT_URL="http://${ip_address}:8085"
|
||||
export temperature=0.01
|
||||
export max_new_tokens=512
|
||||
export LLM_ENDPOINT_URL="http://${ip_address}:8086"
|
||||
export temperature=0
|
||||
export max_new_tokens=4096
|
||||
|
||||
# agent related environment variables
|
||||
export TOOLSET_PATH=$WORKDIR/GenAIExamples/AgentQnA/tools/
|
||||
@@ -23,21 +26,11 @@ echo "TOOLSET_PATH=${TOOLSET_PATH}"
|
||||
export recursion_limit_worker=12
|
||||
export recursion_limit_supervisor=10
|
||||
export WORKER_AGENT_URL="http://${ip_address}:9095/v1/chat/completions"
|
||||
export SQL_AGENT_URL="http://${ip_address}:9096/v1/chat/completions"
|
||||
export RETRIEVAL_TOOL_URL="http://${ip_address}:8889/v1/retrievaltool"
|
||||
export CRAG_SERVER=http://${ip_address}:8080
|
||||
|
||||
docker compose -f compose.yaml up -d
|
||||
export db_name=Chinook
|
||||
export db_path="sqlite:////home/user/chinook-db/Chinook_Sqlite.sqlite"
|
||||
|
||||
sleep 5s
|
||||
echo "Waiting tgi gaudi ready"
|
||||
n=0
|
||||
until [[ "$n" -ge 100 ]] || [[ $ready == true ]]; do
|
||||
docker logs tgi-server &> tgi-gaudi-service.log
|
||||
n=$((n+1))
|
||||
if grep -q Connected tgi-gaudi-service.log; then
|
||||
break
|
||||
fi
|
||||
sleep 5s
|
||||
done
|
||||
sleep 5s
|
||||
echo "Service started successfully"
|
||||
docker compose -f compose.yaml up -d
|
||||
25
AgentQnA/docker_compose/intel/hpu/gaudi/launch_tgi_gaudi.sh
Normal file
@@ -0,0 +1,25 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# LLM related environment variables
|
||||
export HF_CACHE_DIR=${HF_CACHE_DIR}
|
||||
ls $HF_CACHE_DIR
|
||||
export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
|
||||
export LLM_MODEL_ID="meta-llama/Meta-Llama-3.1-70B-Instruct"
|
||||
export NUM_SHARDS=4
|
||||
|
||||
docker compose -f tgi_gaudi.yaml up -d
|
||||
|
||||
sleep 5s
|
||||
echo "Waiting tgi gaudi ready"
|
||||
n=0
|
||||
until [[ "$n" -ge 100 ]] || [[ $ready == true ]]; do
|
||||
docker logs tgi-server &> tgi-gaudi-service.log
|
||||
n=$((n+1))
|
||||
if grep -q Connected tgi-gaudi-service.log; then
|
||||
break
|
||||
fi
|
||||
sleep 5s
|
||||
done
|
||||
sleep 5s
|
||||
echo "Service started successfully"
|
||||
30
AgentQnA/docker_compose/intel/hpu/gaudi/tgi_gaudi.yaml
Normal file
@@ -0,0 +1,30 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
services:
|
||||
tgi-server:
|
||||
image: ghcr.io/huggingface/tgi-gaudi:2.0.6
|
||||
container_name: tgi-server
|
||||
ports:
|
||||
- "8085:80"
|
||||
volumes:
|
||||
- ${HF_CACHE_DIR}:/data
|
||||
environment:
|
||||
no_proxy: ${no_proxy}
|
||||
http_proxy: ${http_proxy}
|
||||
https_proxy: ${https_proxy}
|
||||
HUGGING_FACE_HUB_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
|
||||
HF_HUB_DISABLE_PROGRESS_BARS: 1
|
||||
HF_HUB_ENABLE_HF_TRANSFER: 0
|
||||
HABANA_VISIBLE_DEVICES: all
|
||||
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
|
||||
runtime: habana
|
||||
cap_add:
|
||||
- SYS_NICE
|
||||
ipc: host
|
||||
command: --model-id ${LLM_MODEL_ID} --max-input-length 4096 --max-total-tokens 8192 --sharded true --num-shard ${NUM_SHARDS}
|
||||
@@ -2,12 +2,18 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
services:
|
||||
agent-langchain:
|
||||
agent:
|
||||
build:
|
||||
context: GenAIComps
|
||||
dockerfile: comps/agent/langchain/Dockerfile
|
||||
dockerfile: comps/agent/src/Dockerfile
|
||||
args:
|
||||
http_proxy: ${http_proxy}
|
||||
https_proxy: ${https_proxy}
|
||||
no_proxy: ${no_proxy}
|
||||
image: ${REGISTRY:-opea}/agent-langchain:${TAG:-latest}
|
||||
image: ${REGISTRY:-opea}/agent:${TAG:-latest}
|
||||
agent-ui:
|
||||
build:
|
||||
context: ../ui
|
||||
dockerfile: ./docker/Dockerfile
|
||||
extends: agent
|
||||
image: ${REGISTRY:-opea}/agent-ui:${TAG:-latest}
|
||||
|
||||
11
AgentQnA/kubernetes/helm/README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Deploy AgentQnA on Kubernetes cluster
|
||||
|
||||
- You should have Helm (version >= 3.15) installed. Refer to the [Helm Installation Guide](https://helm.sh/docs/intro/install/) for more information.
|
||||
- For more deploy options, refer to [helm charts README](https://github.com/opea-project/GenAIInfra/tree/main/helm-charts#readme).
|
||||
|
||||
## Deploy on Gaudi
|
||||
|
||||
```
|
||||
export HFTOKEN="insert-your-huggingface-token-here"
|
||||
helm install agentqna oci://ghcr.io/opea-project/charts/agentqna --set global.HUGGINGFACEHUB_API_TOKEN=${HFTOKEN} -f gaudi-values.yaml
|
||||
```
|
||||
16
AgentQnA/kubernetes/helm/gaudi-values.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Accelerate inferencing in heaviest components to improve performance
|
||||
# by overriding their subchart values
|
||||
|
||||
vllm:
|
||||
enabled: true
|
||||
image:
|
||||
repository: opea/vllm-gaudi
|
||||
supervisor:
|
||||
llm_endpoint_url: http://{{ .Release.Name }}-vllm
|
||||
ragagent:
|
||||
llm_endpoint_url: http://{{ .Release.Name }}-vllm
|
||||
sqlagent:
|
||||
llm_endpoint_url: http://{{ .Release.Name }}-vllm
|
||||
@@ -53,7 +53,7 @@ def main():
|
||||
host_ip = args.host_ip
|
||||
port = args.port
|
||||
proxies = {"http": ""}
|
||||
url = "http://{host_ip}:{port}/v1/dataprep".format(host_ip=host_ip, port=port)
|
||||
url = "http://{host_ip}:{port}/v1/dataprep/ingest".format(host_ip=host_ip, port=port)
|
||||
|
||||
# Split jsonl file into json files
|
||||
files = split_jsonl_into_txts(os.path.join(args.filedir, args.filename))
|
||||
|
||||
@@ -13,13 +13,14 @@ export TEI_EMBEDDING_ENDPOINT="http://${host_ip}:6006"
|
||||
export TEI_RERANKING_ENDPOINT="http://${host_ip}:8808"
|
||||
export REDIS_URL="redis://${host_ip}:6379"
|
||||
export INDEX_NAME="rag-redis"
|
||||
export RERANK_TYPE="tei"
|
||||
export MEGA_SERVICE_HOST_IP=${host_ip}
|
||||
export EMBEDDING_SERVICE_HOST_IP=${host_ip}
|
||||
export RETRIEVER_SERVICE_HOST_IP=${host_ip}
|
||||
export RERANK_SERVICE_HOST_IP=${host_ip}
|
||||
export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:8889/v1/retrievaltool"
|
||||
export DATAPREP_SERVICE_ENDPOINT="http://${host_ip}:6007/v1/dataprep"
|
||||
export DATAPREP_GET_FILE_ENDPOINT="http://${host_ip}:6008/v1/dataprep/get_file"
|
||||
export DATAPREP_DELETE_FILE_ENDPOINT="http://${host_ip}:6009/v1/dataprep/delete_file"
|
||||
export DATAPREP_SERVICE_ENDPOINT="http://${host_ip}:6007/v1/dataprep/ingest"
|
||||
export DATAPREP_GET_FILE_ENDPOINT="http://${host_ip}:6008/v1/dataprep/get"
|
||||
export DATAPREP_DELETE_FILE_ENDPOINT="http://${host_ip}:6009/v1/dataprep/delete"
|
||||
|
||||
docker compose -f $WORKDIR/GenAIExamples/DocIndexRetriever/docker_compose/intel/cpu/xeon/compose.yaml up -d
|
||||
|
||||
@@ -15,7 +15,7 @@ function stop_agent_and_api_server() {
|
||||
echo "Stopping CRAG server"
|
||||
docker stop $(docker ps -q --filter ancestor=docker.io/aicrowd/kdd-cup-24-crag-mock-api:v0)
|
||||
echo "Stopping Agent services"
|
||||
docker stop $(docker ps -q --filter ancestor=opea/agent-langchain:latest)
|
||||
docker stop $(docker ps -q --filter ancestor=opea/agent:latest)
|
||||
}
|
||||
|
||||
function stop_retrieval_tool() {
|
||||
|
||||
6
AgentQnA/tests/sql_agent_test/run_data_split.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
DATAPATH=$WORKDIR/TAG-Bench/tag_queries.csv
|
||||
OUTFOLDER=$WORKDIR/TAG-Bench/query_by_db
|
||||
python3 split_data.py --path $DATAPATH --output $OUTFOLDER
|
||||
27
AgentQnA/tests/sql_agent_test/split_data.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import argparse
|
||||
import os
|
||||
|
||||
import pandas as pd
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--path", type=str, required=True)
|
||||
parser.add_argument("--output", type=str, required=True)
|
||||
args = parser.parse_args()
|
||||
|
||||
# if output folder does not exist, create it
|
||||
if not os.path.exists(args.output):
|
||||
os.makedirs(args.output)
|
||||
|
||||
# Load the data
|
||||
data = pd.read_csv(args.path)
|
||||
|
||||
# Split the data by domain
|
||||
domains = data["DB used"].unique()
|
||||
for domain in domains:
|
||||
domain_data = data[data["DB used"] == domain]
|
||||
out = os.path.join(args.output, f"query_{domain}.csv")
|
||||
domain_data.to_csv(out, index=False)
|
||||
@@ -11,17 +11,16 @@ export ip_address=$(hostname -I | awk '{print $1}')
|
||||
|
||||
function get_genai_comps() {
|
||||
if [ ! -d "GenAIComps" ] ; then
|
||||
git clone https://github.com/opea-project/GenAIComps.git && cd GenAIComps && git checkout "${opea_branch:-"main"}" && cd ../
|
||||
git clone --depth 1 --branch ${opea_branch:-"main"} https://github.com/opea-project/GenAIComps.git
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function build_docker_images_for_retrieval_tool(){
|
||||
cd $WORKDIR/GenAIExamples/DocIndexRetriever/docker_image_build/
|
||||
# git clone https://github.com/opea-project/GenAIComps.git && cd GenAIComps && git checkout "${opea_branch:-"main"}" && cd ../
|
||||
get_genai_comps
|
||||
echo "Build all the images with --no-cache..."
|
||||
service_list="doc-index-retriever dataprep-redis embedding-tei retriever-redis reranking-tei"
|
||||
service_list="doc-index-retriever dataprep embedding retriever reranking"
|
||||
docker compose -f build.yaml build ${service_list} --no-cache
|
||||
docker pull ghcr.io/huggingface/text-embeddings-inference:cpu-1.5
|
||||
|
||||
@@ -35,6 +34,25 @@ function build_agent_docker_image() {
|
||||
docker compose -f build.yaml build --no-cache
|
||||
}
|
||||
|
||||
function build_vllm_docker_image() {
|
||||
echo "Building the vllm docker image"
|
||||
cd $WORKPATH
|
||||
echo $WORKPATH
|
||||
if [ ! -d "./vllm-fork" ]; then
|
||||
git clone https://github.com/HabanaAI/vllm-fork.git
|
||||
fi
|
||||
cd ./vllm-fork
|
||||
git checkout v0.6.4.post2+Gaudi-1.19.0
|
||||
docker build --no-cache -f Dockerfile.hpu -t opea/vllm-gaudi:ci --shm-size=128g . --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "opea/vllm-gaudi:ci failed"
|
||||
exit 1
|
||||
else
|
||||
echo "opea/vllm-gaudi:ci successful"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function main() {
|
||||
echo "==================== Build docker images for retrieval tool ===================="
|
||||
build_docker_images_for_retrieval_tool
|
||||
@@ -43,6 +61,12 @@ function main() {
|
||||
echo "==================== Build agent docker image ===================="
|
||||
build_agent_docker_image
|
||||
echo "==================== Build agent docker image completed ===================="
|
||||
|
||||
echo "==================== Build vllm docker image ===================="
|
||||
build_vllm_docker_image
|
||||
echo "==================== Build vllm docker image completed ===================="
|
||||
|
||||
docker image ls | grep vllm
|
||||
}
|
||||
|
||||
main
|
||||
@@ -7,6 +7,7 @@ WORKPATH=$(dirname "$PWD")
|
||||
export WORKDIR=$WORKPATH/../../
|
||||
echo "WORKDIR=${WORKDIR}"
|
||||
export ip_address=$(hostname -I | awk '{print $1}')
|
||||
export host_ip=${ip_address}
|
||||
|
||||
export HF_CACHE_DIR=$WORKDIR/hf_cache
|
||||
if [ ! -d "$HF_CACHE_DIR" ]; then
|
||||
196
AgentQnA/tests/step4_launch_and_validate_agent_tgi.sh
Normal file
@@ -0,0 +1,196 @@
|
||||
#!/bin/bash
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -e
|
||||
|
||||
WORKPATH=$(dirname "$PWD")
|
||||
export WORKDIR=$WORKPATH/../../
|
||||
echo "WORKDIR=${WORKDIR}"
|
||||
export ip_address=$(hostname -I | awk '{print $1}')
|
||||
export TOOLSET_PATH=$WORKPATH/tools/
|
||||
export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
|
||||
HF_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
|
||||
model="meta-llama/Meta-Llama-3.1-70B-Instruct"
|
||||
|
||||
export HF_CACHE_DIR=/data2/huggingface
|
||||
if [ ! -d "$HF_CACHE_DIR" ]; then
|
||||
HF_CACHE_DIR=$WORKDIR/hf_cache
|
||||
mkdir -p "$HF_CACHE_DIR"
|
||||
fi
|
||||
echo "HF_CACHE_DIR=$HF_CACHE_DIR"
|
||||
ls $HF_CACHE_DIR
|
||||
|
||||
vllm_port=8086
|
||||
vllm_volume=${HF_CACHE_DIR}
|
||||
|
||||
function start_tgi(){
|
||||
echo "Starting tgi-gaudi server"
|
||||
cd $WORKDIR/GenAIExamples/AgentQnA/docker_compose/intel/hpu/gaudi
|
||||
bash launch_tgi_gaudi.sh
|
||||
|
||||
}
|
||||
|
||||
function start_vllm_service_70B() {
|
||||
|
||||
echo "token is ${HF_TOKEN}"
|
||||
|
||||
echo "start vllm gaudi service"
|
||||
echo "**************model is $model**************"
|
||||
vllm_image=opea/vllm-gaudi:ci
|
||||
docker run -d --runtime=habana --rm --name "vllm-gaudi-server" -e HABANA_VISIBLE_DEVICES=0,1,2,3 -p $vllm_port:8000 -v $vllm_volume:/data -e HF_TOKEN=$HF_TOKEN -e HUGGING_FACE_HUB_TOKEN=$HF_TOKEN -e HF_HOME=/data -e OMPI_MCA_btl_vader_single_copy_mechanism=none -e PT_HPU_ENABLE_LAZY_COLLECTIVES=true -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy -e VLLM_SKIP_WARMUP=true --cap-add=sys_nice --ipc=host $vllm_image --model ${model} --max-seq-len-to-capture 16384 --tensor-parallel-size 4
|
||||
sleep 5s
|
||||
echo "Waiting vllm gaudi ready"
|
||||
n=0
|
||||
LOG_PATH=$PWD
|
||||
until [[ "$n" -ge 100 ]] || [[ $ready == true ]]; do
|
||||
docker logs vllm-gaudi-server
|
||||
docker logs vllm-gaudi-server &> ${LOG_PATH}/vllm-gaudi-service.log
|
||||
n=$((n+1))
|
||||
if grep -q "Uvicorn running on" ${LOG_PATH}/vllm-gaudi-service.log; then
|
||||
break
|
||||
fi
|
||||
if grep -q "No such container" ${LOG_PATH}/vllm-gaudi-service.log; then
|
||||
echo "container vllm-gaudi-server not found"
|
||||
exit 1
|
||||
fi
|
||||
sleep 5s
|
||||
done
|
||||
sleep 5s
|
||||
echo "Service started successfully"
|
||||
}
|
||||
|
||||
|
||||
function prepare_data() {
|
||||
cd $WORKDIR
|
||||
|
||||
echo "Downloading data..."
|
||||
git clone https://github.com/TAG-Research/TAG-Bench.git
|
||||
cd TAG-Bench/setup
|
||||
chmod +x get_dbs.sh
|
||||
./get_dbs.sh
|
||||
|
||||
echo "Split data..."
|
||||
cd $WORKPATH/tests/sql_agent_test
|
||||
bash run_data_split.sh
|
||||
|
||||
echo "Data preparation done!"
|
||||
}
|
||||
|
||||
function download_chinook_data(){
|
||||
echo "Downloading chinook data..."
|
||||
cd $WORKDIR
|
||||
git clone https://github.com/lerocha/chinook-database.git
|
||||
cp chinook-database/ChinookDatabase/DataSources/Chinook_Sqlite.sqlite $WORKDIR/GenAIExamples/AgentQnA/tests/
|
||||
}
|
||||
|
||||
function start_agent_and_api_server() {
|
||||
echo "Starting CRAG server"
|
||||
docker run -d --runtime=runc --name=kdd-cup-24-crag-service -p=8080:8000 docker.io/aicrowd/kdd-cup-24-crag-mock-api:v0
|
||||
|
||||
echo "Starting Agent services"
|
||||
cd $WORKDIR/GenAIExamples/AgentQnA/docker_compose/intel/hpu/gaudi
|
||||
bash launch_agent_service_gaudi.sh
|
||||
sleep 2m
|
||||
}
|
||||
|
||||
function validate() {
|
||||
local CONTENT="$1"
|
||||
local EXPECTED_RESULT="$2"
|
||||
local SERVICE_NAME="$3"
|
||||
|
||||
if echo "$CONTENT" | grep -q "$EXPECTED_RESULT"; then
|
||||
echo "[ $SERVICE_NAME ] Content is as expected: $CONTENT"
|
||||
echo 0
|
||||
else
|
||||
echo "[ $SERVICE_NAME ] Content does not match the expected result: $CONTENT"
|
||||
echo 1
|
||||
fi
|
||||
}
|
||||
|
||||
function validate_agent_service() {
|
||||
# # test worker rag agent
|
||||
echo "======================Testing worker rag agent======================"
|
||||
export agent_port="9095"
|
||||
prompt="Tell me about Michael Jackson song Thriller"
|
||||
local CONTENT=$(python3 $WORKDIR/GenAIExamples/AgentQnA/tests/test.py --prompt "$prompt")
|
||||
# echo $CONTENT
|
||||
local EXIT_CODE=$(validate "$CONTENT" "Thriller" "rag-agent-endpoint")
|
||||
echo $EXIT_CODE
|
||||
local EXIT_CODE="${EXIT_CODE:0-1}"
|
||||
if [ "$EXIT_CODE" == "1" ]; then
|
||||
docker logs rag-agent-endpoint
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# # test worker sql agent
|
||||
echo "======================Testing worker sql agent======================"
|
||||
export agent_port="9096"
|
||||
prompt="How many employees are there in the company?"
|
||||
local CONTENT=$(python3 $WORKDIR/GenAIExamples/AgentQnA/tests/test.py --prompt "$prompt")
|
||||
local EXIT_CODE=$(validate "$CONTENT" "8" "sql-agent-endpoint")
|
||||
echo $CONTENT
|
||||
# echo $EXIT_CODE
|
||||
local EXIT_CODE="${EXIT_CODE:0-1}"
|
||||
if [ "$EXIT_CODE" == "1" ]; then
|
||||
docker logs sql-agent-endpoint
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# test supervisor react agent
|
||||
echo "======================Testing supervisor react agent======================"
|
||||
export agent_port="9090"
|
||||
prompt="How many albums does Iron Maiden have?"
|
||||
local CONTENT=$(python3 $WORKDIR/GenAIExamples/AgentQnA/tests/test.py --prompt "$prompt")
|
||||
local EXIT_CODE=$(validate "$CONTENT" "21" "react-agent-endpoint")
|
||||
# echo $CONTENT
|
||||
echo $EXIT_CODE
|
||||
local EXIT_CODE="${EXIT_CODE:0-1}"
|
||||
if [ "$EXIT_CODE" == "1" ]; then
|
||||
docker logs react-agent-endpoint
|
||||
exit 1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function remove_data() {
|
||||
echo "Removing data..."
|
||||
cd $WORKDIR
|
||||
if [ -d "TAG-Bench" ]; then
|
||||
rm -rf TAG-Bench
|
||||
fi
|
||||
echo "Data removed!"
|
||||
}
|
||||
|
||||
function remove_chinook_data(){
|
||||
echo "Removing chinook data..."
|
||||
cd $WORKDIR
|
||||
if [ -d "chinook-database" ]; then
|
||||
rm -rf chinook-database
|
||||
fi
|
||||
echo "Chinook data removed!"
|
||||
}
|
||||
|
||||
function main() {
|
||||
echo "==================== Prepare data ===================="
|
||||
download_chinook_data
|
||||
echo "==================== Data prepare done ===================="
|
||||
|
||||
echo "==================== Start VLLM service ===================="
|
||||
start_vllm_service_70B
|
||||
echo "==================== VLLM service started ===================="
|
||||
|
||||
echo "==================== Start agent ===================="
|
||||
start_agent_and_api_server
|
||||
echo "==================== Agent started ===================="
|
||||
|
||||
echo "==================== Validate agent service ===================="
|
||||
validate_agent_service
|
||||
echo "==================== Agent service validated ===================="
|
||||
}
|
||||
|
||||
remove_data
|
||||
remove_chinook_data
|
||||
main
|
||||
remove_data
|
||||
remove_chinook_data
|
||||
@@ -2,7 +2,7 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -e
|
||||
set -ex
|
||||
|
||||
WORKPATH=$(dirname "$PWD")
|
||||
export WORKDIR=$WORKPATH/../../
|
||||
@@ -23,8 +23,8 @@ function start_agent_and_api_server() {
|
||||
docker run -d --runtime=runc --name=kdd-cup-24-crag-service -p=8080:8000 docker.io/aicrowd/kdd-cup-24-crag-mock-api:v0
|
||||
|
||||
echo "Starting Agent services"
|
||||
cd $WORKDIR/GenAIExamples/AgentQnA/docker_compose/intel/hpu/gaudi
|
||||
bash launch_agent_service_tgi_gaudi.sh
|
||||
cd $WORKDIR/GenAIExamples/AgentQnA/docker_compose/amd/gpu/rocm
|
||||
bash launch_agent_service_tgi_rocm.sh
|
||||
}
|
||||
|
||||
function validate() {
|
||||
@@ -47,7 +47,7 @@ function validate_agent_service() {
|
||||
"query": "Tell me about Michael Jackson song thriller"
|
||||
}')
|
||||
local EXIT_CODE=$(validate "$CONTENT" "Thriller" "react-agent-endpoint")
|
||||
docker logs docgrader-agent-endpoint
|
||||
docker logs rag-agent-endpoint
|
||||
if [ "$EXIT_CODE" == "1" ]; then
|
||||
exit 1
|
||||
fi
|
||||
56
AgentQnA/tests/test.py
Normal file
@@ -0,0 +1,56 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import argparse
|
||||
import os
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
def generate_answer_agent_api(url, prompt):
|
||||
proxies = {"http": ""}
|
||||
payload = {
|
||||
"messages": prompt,
|
||||
}
|
||||
response = requests.post(url, json=payload, proxies=proxies)
|
||||
answer = response.json()["text"]
|
||||
return answer
|
||||
|
||||
|
||||
def process_request(url, query, is_stream=False):
|
||||
proxies = {"http": ""}
|
||||
|
||||
payload = {
|
||||
"messages": query,
|
||||
}
|
||||
|
||||
try:
|
||||
resp = requests.post(url=url, json=payload, proxies=proxies, stream=is_stream)
|
||||
if not is_stream:
|
||||
ret = resp.json()["text"]
|
||||
print(ret)
|
||||
else:
|
||||
for line in resp.iter_lines(decode_unicode=True):
|
||||
print(line)
|
||||
ret = None
|
||||
|
||||
resp.raise_for_status() # Raise an exception for unsuccessful HTTP status codes
|
||||
return ret
|
||||
except requests.exceptions.RequestException as e:
|
||||
ret = f"An error occurred:{e}"
|
||||
print(ret)
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--prompt", type=str)
|
||||
parser.add_argument("--stream", action="store_true")
|
||||
args = parser.parse_args()
|
||||
|
||||
ip_address = os.getenv("ip_address", "localhost")
|
||||
agent_port = os.getenv("agent_port", "9090")
|
||||
url = f"http://{ip_address}:{agent_port}/v1/chat/completions"
|
||||
prompt = args.prompt
|
||||
|
||||
process_request(url, prompt, args.stream)
|
||||
@@ -1,8 +1,7 @@
|
||||
#!/bin/bash
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -e
|
||||
set -xe
|
||||
|
||||
WORKPATH=$(dirname "$PWD")
|
||||
export WORKDIR=$WORKPATH/../../
|
||||
@@ -19,7 +18,6 @@ function stop_crag() {
|
||||
|
||||
function stop_agent_docker() {
|
||||
cd $WORKPATH/docker_compose/intel/hpu/gaudi/
|
||||
# docker compose -f compose.yaml down
|
||||
container_list=$(cat compose.yaml | grep container_name | cut -d':' -f2)
|
||||
for container_name in $container_list; do
|
||||
cid=$(docker ps -aq --filter "name=$container_name")
|
||||
@@ -28,11 +26,29 @@ function stop_agent_docker() {
|
||||
done
|
||||
}
|
||||
|
||||
function stop_llm(){
|
||||
cd $WORKPATH/docker_compose/intel/hpu/gaudi/
|
||||
container_list=$(cat tgi_gaudi.yaml | grep container_name | cut -d':' -f2)
|
||||
for container_name in $container_list; do
|
||||
cid=$(docker ps -aq --filter "name=$container_name")
|
||||
echo "Stopping container $container_name"
|
||||
if [[ ! -z "$cid" ]]; then docker rm $cid -f && sleep 1s; fi
|
||||
done
|
||||
|
||||
cid=$(docker ps -aq --filter "name=vllm-gaudi-server")
|
||||
echo "Stopping container $cid"
|
||||
if [[ ! -z "$cid" ]]; then docker rm $cid -f && sleep 1s; fi
|
||||
|
||||
cid=$(docker ps -aq --filter "name=test-comps-vllm-gaudi-service")
|
||||
echo "Stopping container $cid"
|
||||
if [[ ! -z "$cid" ]]; then docker rm $cid -f && sleep 1s; fi
|
||||
|
||||
}
|
||||
|
||||
function stop_retrieval_tool() {
|
||||
echo "Stopping Retrieval tool"
|
||||
local RETRIEVAL_TOOL_PATH=$WORKPATH/../DocIndexRetriever
|
||||
cd $RETRIEVAL_TOOL_PATH/docker_compose/intel/cpu/xeon/
|
||||
# docker compose -f compose.yaml down
|
||||
container_list=$(cat compose.yaml | grep container_name | cut -d':' -f2)
|
||||
for container_name in $container_list; do
|
||||
cid=$(docker ps -aq --filter "name=$container_name")
|
||||
@@ -43,31 +59,35 @@ function stop_retrieval_tool() {
|
||||
echo "workpath: $WORKPATH"
|
||||
echo "=================== Stop containers ===================="
|
||||
stop_crag
|
||||
stop_llm
|
||||
stop_agent_docker
|
||||
stop_retrieval_tool
|
||||
|
||||
cd $WORKPATH/tests
|
||||
|
||||
echo "=================== #1 Building docker images===================="
|
||||
bash 1_build_images.sh
|
||||
bash step1_build_images.sh
|
||||
echo "=================== #1 Building docker images completed===================="
|
||||
|
||||
echo "=================== #2 Start retrieval tool===================="
|
||||
bash 2_start_retrieval_tool.sh
|
||||
bash step2_start_retrieval_tool.sh
|
||||
echo "=================== #2 Retrieval tool started===================="
|
||||
|
||||
echo "=================== #3 Ingest data and validate retrieval===================="
|
||||
bash 3_ingest_data_and_validate_retrieval.sh
|
||||
bash step3_ingest_data_and_validate_retrieval.sh
|
||||
echo "=================== #3 Data ingestion and validation completed===================="
|
||||
|
||||
echo "=================== #4 Start agent and API server===================="
|
||||
bash 4_launch_and_validate_agent_tgi.sh
|
||||
bash step4_launch_and_validate_agent_tgi.sh
|
||||
echo "=================== #4 Agent test passed ===================="
|
||||
|
||||
echo "=================== #5 Stop agent and API server===================="
|
||||
stop_crag
|
||||
stop_agent_docker
|
||||
stop_retrieval_tool
|
||||
stop_llm
|
||||
echo "=================== #5 Agent and API server stopped===================="
|
||||
|
||||
echo "ALL DONE!"
|
||||
echo y | docker system prune
|
||||
|
||||
echo "ALL DONE!!"
|
||||
|
||||
75
AgentQnA/tests/test_compose_on_rocm.sh
Normal file
@@ -0,0 +1,75 @@
|
||||
#!/bin/bash
|
||||
# Copyright (C) 2024 Advanced Micro Devices, Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -xe
|
||||
|
||||
WORKPATH=$(dirname "$PWD")
|
||||
export WORKDIR=$WORKPATH/../../
|
||||
echo "WORKDIR=${WORKDIR}"
|
||||
export ip_address=$(hostname -I | awk '{print $1}')
|
||||
export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
|
||||
export TOOLSET_PATH=$WORKDIR/GenAIExamples/AgentQnA/tools/
|
||||
|
||||
function stop_crag() {
|
||||
cid=$(docker ps -aq --filter "name=kdd-cup-24-crag-service")
|
||||
echo "Stopping container kdd-cup-24-crag-service with cid $cid"
|
||||
if [[ ! -z "$cid" ]]; then docker rm $cid -f && sleep 1s; fi
|
||||
}
|
||||
|
||||
function stop_agent_docker() {
|
||||
cd $WORKPATH/docker_compose/amd/gpu/rocm
|
||||
# docker compose -f compose.yaml down
|
||||
container_list=$(cat compose.yaml | grep container_name | cut -d':' -f2)
|
||||
for container_name in $container_list; do
|
||||
cid=$(docker ps -aq --filter "name=$container_name")
|
||||
echo "Stopping container $container_name"
|
||||
if [[ ! -z "$cid" ]]; then docker rm $cid -f && sleep 1s; fi
|
||||
done
|
||||
}
|
||||
|
||||
function stop_retrieval_tool() {
|
||||
echo "Stopping Retrieval tool"
|
||||
local RETRIEVAL_TOOL_PATH=$WORKPATH/../DocIndexRetriever
|
||||
cd $RETRIEVAL_TOOL_PATH/docker_compose/intel/cpu/xeon/
|
||||
# docker compose -f compose.yaml down
|
||||
container_list=$(cat compose.yaml | grep container_name | cut -d':' -f2)
|
||||
for container_name in $container_list; do
|
||||
cid=$(docker ps -aq --filter "name=$container_name")
|
||||
echo "Stopping container $container_name"
|
||||
if [[ ! -z "$cid" ]]; then docker rm $cid -f && sleep 1s; fi
|
||||
done
|
||||
}
|
||||
echo "workpath: $WORKPATH"
|
||||
echo "=================== Stop containers ===================="
|
||||
stop_crag
|
||||
stop_agent_docker
|
||||
stop_retrieval_tool
|
||||
|
||||
cd $WORKPATH/tests
|
||||
|
||||
echo "=================== #1 Building docker images===================="
|
||||
bash step1_build_images.sh
|
||||
echo "=================== #1 Building docker images completed===================="
|
||||
|
||||
echo "=================== #2 Start retrieval tool===================="
|
||||
bash step2_start_retrieval_tool.sh
|
||||
echo "=================== #2 Retrieval tool started===================="
|
||||
|
||||
echo "=================== #3 Ingest data and validate retrieval===================="
|
||||
bash step3_ingest_data_and_validate_retrieval.sh
|
||||
echo "=================== #3 Data ingestion and validation completed===================="
|
||||
|
||||
echo "=================== #4 Start agent and API server===================="
|
||||
bash step4a_launch_and_validate_agent_tgi_on_rocm.sh
|
||||
echo "=================== #4 Agent test passed ===================="
|
||||
|
||||
echo "=================== #5 Stop agent and API server===================="
|
||||
stop_crag
|
||||
stop_agent_docker
|
||||
stop_retrieval_tool
|
||||
echo "=================== #5 Agent and API server stopped===================="
|
||||
|
||||
echo y | docker system prune
|
||||
|
||||
echo "ALL DONE!!"
|
||||
@@ -2,7 +2,7 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
search_knowledge_base:
|
||||
description: Search knowledge base for a given query. Returns text related to the query.
|
||||
description: Search a knowledge base for a given query. Returns text related to the query.
|
||||
callable_api: tools.py:search_knowledge_base
|
||||
args_schema:
|
||||
query:
|
||||
@@ -10,6 +10,15 @@ search_knowledge_base:
|
||||
description: query
|
||||
return_output: retrieved_data
|
||||
|
||||
search_artist_database:
|
||||
description: Search a SQL database on artists and their music with a natural language query. Returns text related to the query.
|
||||
callable_api: tools.py:search_sql_database
|
||||
args_schema:
|
||||
query:
|
||||
type: str
|
||||
description: natural language query
|
||||
return_output: retrieved_data
|
||||
|
||||
get_artist_birth_place:
|
||||
description: Get the birth place of an artist.
|
||||
callable_api: tools.py:get_artist_birth_place
|
||||
@@ -25,7 +34,7 @@ get_billboard_rank_date:
|
||||
args_schema:
|
||||
rank:
|
||||
type: int
|
||||
description: song name
|
||||
description: the rank of interest, for example 1 for top 1
|
||||
date:
|
||||
type: str
|
||||
description: date
|
||||
|
||||
@@ -8,13 +8,30 @@ from tools.pycragapi import CRAG
|
||||
|
||||
|
||||
def search_knowledge_base(query: str) -> str:
|
||||
"""Search the knowledge base for a specific query."""
|
||||
# use worker agent (DocGrader) to search the knowledge base
|
||||
"""Search a knowledge base about music and singers for a given query.
|
||||
|
||||
Returns text related to the query.
|
||||
"""
|
||||
url = os.environ.get("WORKER_AGENT_URL")
|
||||
print(url)
|
||||
proxies = {"http": ""}
|
||||
payload = {
|
||||
"query": query,
|
||||
"messages": query,
|
||||
}
|
||||
response = requests.post(url, json=payload, proxies=proxies)
|
||||
return response.json()["text"]
|
||||
|
||||
|
||||
def search_sql_database(query: str) -> str:
|
||||
"""Search a SQL database on artists and their music with a natural language query.
|
||||
|
||||
Returns text related to the query.
|
||||
"""
|
||||
url = os.environ.get("SQL_AGENT_URL")
|
||||
print(url)
|
||||
proxies = {"http": ""}
|
||||
payload = {
|
||||
"messages": query,
|
||||
}
|
||||
response = requests.post(url, json=payload, proxies=proxies)
|
||||
return response.json()["text"]
|
||||
|
||||
@@ -16,12 +16,27 @@ def search_knowledge_base(query: str) -> str:
|
||||
}
|
||||
response = requests.post(url, json=payload, proxies=proxies)
|
||||
print(response)
|
||||
docs = response.json()["documents"]
|
||||
context = ""
|
||||
for i, doc in enumerate(docs):
|
||||
if i == 0:
|
||||
context = doc
|
||||
else:
|
||||
context += "\n" + doc
|
||||
print(context)
|
||||
return context
|
||||
if "documents" in response.json():
|
||||
docs = response.json()["documents"]
|
||||
context = ""
|
||||
for i, doc in enumerate(docs):
|
||||
if i == 0:
|
||||
context = doc
|
||||
else:
|
||||
context += "\n" + doc
|
||||
# print(context)
|
||||
return context
|
||||
elif "text" in response.json():
|
||||
return response.json()["text"]
|
||||
elif "reranked_docs" in response.json():
|
||||
docs = response.json()["reranked_docs"]
|
||||
context = ""
|
||||
for i, doc in enumerate(docs):
|
||||
if i == 0:
|
||||
context = doc["text"]
|
||||
else:
|
||||
context += "\n" + doc["text"]
|
||||
# print(context)
|
||||
return context
|
||||
else:
|
||||
return "Error parsing response from the knowledge base."
|
||||
|
||||
26
AgentQnA/ui/docker/Dockerfile
Normal file
@@ -0,0 +1,26 @@
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Use node 20.11.1 as the base image
|
||||
FROM node:20.11.1
|
||||
|
||||
# Update package manager and install Git
|
||||
RUN apt-get update -y && apt-get install -y git
|
||||
|
||||
# Copy the front-end code repository
|
||||
COPY svelte /home/user/svelte
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /home/user/svelte
|
||||
|
||||
# Install front-end dependencies
|
||||
RUN npm install
|
||||
|
||||
# Build the front-end application
|
||||
RUN npm run build
|
||||
|
||||
# Expose the port of the front-end application
|
||||
EXPOSE 5173
|
||||
|
||||
# Run the front-end application in preview mode
|
||||
CMD ["npm", "run", "preview", "--", "--port", "5173", "--host", "0.0.0.0"]
|
||||
10
AgentQnA/ui/svelte/.editorconfig
Normal file
@@ -0,0 +1,10 @@
|
||||
[*]
|
||||
indent_style = tab
|
||||
|
||||
[package.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.md]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
1
AgentQnA/ui/svelte/.env
Normal file
@@ -0,0 +1 @@
|
||||
AGENT_URL = '/v1/chat/completions'
|
||||
13
AgentQnA/ui/svelte/.eslintignore
Normal file
@@ -0,0 +1,13 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/build
|
||||
/.svelte-kit
|
||||
/package
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
|
||||
# Ignore files for PNPM, NPM and YARN
|
||||
pnpm-lock.yaml
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
20
AgentQnA/ui/svelte/.eslintrc.cjs
Normal file
@@ -0,0 +1,20 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
parser: "@typescript-eslint/parser",
|
||||
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
|
||||
plugins: ["svelte3", "@typescript-eslint", "neverthrow"],
|
||||
ignorePatterns: ["*.cjs"],
|
||||
overrides: [{ files: ["*.svelte"], processor: "svelte3/svelte3" }],
|
||||
settings: {
|
||||
"svelte3/typescript": () => require("typescript"),
|
||||
},
|
||||
parserOptions: {
|
||||
sourceType: "module",
|
||||
ecmaVersion: 2020,
|
||||
},
|
||||
env: {
|
||||
browser: true,
|
||||
es2017: true,
|
||||
node: true,
|
||||
},
|
||||
};
|
||||
13
AgentQnA/ui/svelte/.prettierignore
Normal file
@@ -0,0 +1,13 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/build
|
||||
/.svelte-kit
|
||||
/package
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
|
||||
# Ignore files for PNPM, NPM and YARN
|
||||
pnpm-lock.yaml
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
13
AgentQnA/ui/svelte/.prettierrc
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"pluginSearchDirs": [
|
||||
"."
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": "*.svelte",
|
||||
"options": {
|
||||
"parser": "svelte"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
60
AgentQnA/ui/svelte/README.md
Normal file
@@ -0,0 +1,60 @@
|
||||
# AgentQnA
|
||||
|
||||
## 📸 Project Screenshots
|
||||
|
||||

|
||||

|
||||
|
||||
## 🧐 Features
|
||||
|
||||
Here're some of the project's features:
|
||||
|
||||
- Create Agent:Provide more precise answers based on user queries, showcase the high-quality output process of complex queries across different dimensions, and consolidate information to present comprehensive answers.
|
||||
|
||||
## 🛠️ Get it Running
|
||||
|
||||
1. Clone the repo.
|
||||
|
||||
2. cd command to the current folder.
|
||||
|
||||
```
|
||||
cd AgentQnA/ui/svelte
|
||||
```
|
||||
|
||||
3. Modify the required .env variables.
|
||||
|
||||
```
|
||||
AGENT_URL = ''
|
||||
```
|
||||
|
||||
4. **For Local Development:**
|
||||
|
||||
- Install the dependencies:
|
||||
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
- Start the development server:
|
||||
|
||||
```
|
||||
npm run dev
|
||||
```
|
||||
|
||||
- The application will be available at `http://localhost:5173`.
|
||||
|
||||
5. **For Docker Setup:**
|
||||
|
||||
- Build the Docker image:
|
||||
|
||||
```
|
||||
docker build -t opea:agent-ui .
|
||||
```
|
||||
|
||||
- Run the Docker container:
|
||||
|
||||
```
|
||||
docker run -d -p 5173:5173 --name agent-ui opea:agent-ui
|
||||
```
|
||||
|
||||
- The application will be available at `http://localhost:5173`.
|
||||
60
AgentQnA/ui/svelte/package.json
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "agent-example",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite dev --host 0.0.0.0",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
"lint": "prettier --check . && eslint .",
|
||||
"format": "prettier --write ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fortawesome/free-solid-svg-icons": "6.2.0",
|
||||
"@sveltejs/adapter-auto": "1.0.0-next.75",
|
||||
"@sveltejs/kit": "^1.20.1",
|
||||
"@tailwindcss/typography": "0.5.7",
|
||||
"@types/debug": "4.1.7",
|
||||
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
||||
"@typescript-eslint/parser": "^5.27.0",
|
||||
"autoprefixer": "^10.4.7",
|
||||
"daisyui": "^2.52.0",
|
||||
"debug": "4.3.4",
|
||||
"eslint": "^8.16.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-neverthrow": "1.1.4",
|
||||
"eslint-plugin-svelte3": "^4.0.0",
|
||||
"neverthrow": "5.0.0",
|
||||
"pocketbase": "0.7.0",
|
||||
"postcss": "^8.4.23",
|
||||
"postcss-load-config": "^4.0.1",
|
||||
"postcss-preset-env": "^8.3.2",
|
||||
"prettier": "^2.8.8",
|
||||
"prettier-plugin-svelte": "^2.7.0",
|
||||
"prettier-plugin-tailwindcss": "^0.3.0",
|
||||
"svelte": "^3.59.1",
|
||||
"svelte-check": "^2.7.1",
|
||||
"svelte-fa": "3.0.3",
|
||||
"svelte-preprocess": "^4.10.7",
|
||||
"tailwindcss": "^3.1.5",
|
||||
"ts-pattern": "4.0.5",
|
||||
"tslib": "^2.3.1",
|
||||
"typescript": "^4.7.4",
|
||||
"vite": "^4.3.9"
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@heroicons/vue": "^2.1.5",
|
||||
"echarts": "^5.4.2",
|
||||
"flowbite-svelte": "^0.38.5",
|
||||
"flowbite-svelte-icons": "^0.3.6",
|
||||
"fuse.js": "^6.6.2",
|
||||
"marked": "^15.0.0",
|
||||
"ramda": "^0.29.0",
|
||||
"sjcl": "^1.0.8",
|
||||
"sse.js": "^0.6.1",
|
||||
"svelte-notifications": "^0.9.98"
|
||||
}
|
||||
}
|
||||
13
AgentQnA/ui/svelte/postcss.config.cjs
Normal file
@@ -0,0 +1,13 @@
|
||||
const tailwindcss = require("tailwindcss");
|
||||
const autoprefixer = require("autoprefixer");
|
||||
|
||||
const config = {
|
||||
plugins: [
|
||||
//Some plugins, like tailwindcss/nesting, need to run before Tailwind,
|
||||
tailwindcss(),
|
||||
//But others, like autoprefixer, need to run after,
|
||||
autoprefixer,
|
||||
],
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
50
AgentQnA/ui/svelte/src/app.d.ts
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
// Copyright (C) 2025 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// See: https://kit.svelte.dev/docs/types#app
|
||||
// import { Result} from "neverthrow";
|
||||
|
||||
declare namespace App {
|
||||
interface Locals {
|
||||
user?: User;
|
||||
}
|
||||
// interface PageData { }
|
||||
// interface PageError {}
|
||||
// interface Platform {}
|
||||
}
|
||||
|
||||
interface User {
|
||||
id?: string;
|
||||
email: string;
|
||||
password?: string;
|
||||
token?: string;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
type AuthResponse = Result<User>;
|
||||
|
||||
interface AuthAdapter {
|
||||
login(props: { email: string; password: string }): Promise<AuthResponse>;
|
||||
signup(props: { email: string; password: string; password_confirm: string }): Promise<AuthResponse>;
|
||||
validate_session(props: { token: string }): Promise<AuthResponse>;
|
||||
logout(props: { token: string; email: string }): Promise<Result<void>>;
|
||||
forgotPassword(props: { email: string; password: string }): Promise<Result<void>>;
|
||||
}
|
||||
|
||||
interface ChatAdapter {
|
||||
modelList(props: {}): Promise<Result<void>>;
|
||||
txt2img(props: {}): Promise<Result<void>>;
|
||||
}
|
||||
|
||||
interface ChatMessage {
|
||||
role: string;
|
||||
content: string;
|
||||
}
|
||||
|
||||
interface ChatMessageType {
|
||||
model: string;
|
||||
knowledge: string;
|
||||
temperature: string;
|
||||
max_new_tokens: string;
|
||||
topk: string;
|
||||
}
|
||||
17
AgentQnA/ui/svelte/src/app.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<!--
|
||||
Copyright (C) 2025 Intel Corporation
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
<body>
|
||||
<div>%sveltekit.body%</div>
|
||||
</body>
|
||||
</html>
|
||||
82
AgentQnA/ui/svelte/src/app.postcss
Normal file
@@ -0,0 +1,82 @@
|
||||
/* Write your global styles here, in PostCSS syntax */
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
.btn {
|
||||
@apply flex-nowrap;
|
||||
}
|
||||
a.btn {
|
||||
@apply no-underline;
|
||||
}
|
||||
.input {
|
||||
@apply text-base;
|
||||
}
|
||||
|
||||
.bg-dark-blue {
|
||||
background-color: #004a86;
|
||||
}
|
||||
|
||||
.bg-light-blue {
|
||||
background-color: #0068b5;
|
||||
}
|
||||
|
||||
.bg-turquoise {
|
||||
background-color: #00a3f6;
|
||||
}
|
||||
|
||||
.bg-header {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.bg-button {
|
||||
background-color: #0068b5;
|
||||
}
|
||||
|
||||
.bg-title {
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
|
||||
.text-header {
|
||||
color: #0068b5;
|
||||
}
|
||||
|
||||
.text-button {
|
||||
color: #0071c5;
|
||||
}
|
||||
|
||||
.text-title-color {
|
||||
color: rgb(38,38,38);
|
||||
}
|
||||
|
||||
.font-intel {
|
||||
font-family: "intel-clear","tahoma",Helvetica,"helvetica",Arial,sans-serif;
|
||||
}
|
||||
|
||||
.font-title-intel {
|
||||
font-family: "intel-one","intel-clear",Helvetica,Arial,sans-serif;
|
||||
}
|
||||
|
||||
.bg-footer {
|
||||
background-color: #e7e7e7;
|
||||
}
|
||||
|
||||
.bg-light-green {
|
||||
background-color: #d7f3a1;
|
||||
}
|
||||
|
||||
.bg-purple {
|
||||
background-color: #653171;
|
||||
}
|
||||
|
||||
.bg-dark-blue {
|
||||
background-color: #224678;
|
||||
}
|
||||
|
||||
.border-input-color {
|
||||
border-color: #605e5c;
|
||||
}
|
||||
|
||||
.w-12\/12 {
|
||||
width: 100%
|
||||
}
|
||||
25
AgentQnA/ui/svelte/src/lib/assets/Agent/createSub.svelte
Normal file
@@ -0,0 +1,25 @@
|
||||
<!--
|
||||
Copyright (C) 2025 Intel Corporation
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
|
||||
<svg
|
||||
t="1731984271860"
|
||||
class="w-8 h-8"
|
||||
viewBox="0 0 1024 1024"
|
||||
version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
p-id="11418"
|
||||
width="200"
|
||||
height="200"
|
||||
><path
|
||||
d="M0 0m170.666667 0l682.666666 0q170.666667 0 170.666667 170.666667l0 682.666666q0 170.666667-170.666667 170.666667l-682.666666 0q-170.666667 0-170.666667-170.666667l0-682.666666q0-170.666667 170.666667-170.666667Z"
|
||||
fill="#1890FF"
|
||||
fill-opacity=".1"
|
||||
p-id="11419"
|
||||
/><path
|
||||
d="M404.352 552.661333a63.018667 63.018667 0 1 0 0-125.994666 63.018667 63.018667 0 0 0 0 125.994666z m0 213.333334a63.018667 63.018667 0 1 0 0-125.994667 63.018667 63.018667 0 0 0 0 125.994667z m-213.333333-426.666667a63.018667 63.018667 0 1 0 0-125.994667 63.018667 63.018667 0 0 0 0 125.994667z m669.653333-10.88H376.362667a35.669333 35.669333 0 0 1-35.114667-36.096c0-19.882667 15.786667-36.096 35.114667-36.096h484.394666c19.370667 0 35.157333 16.213333 35.157334 36.096a35.669333 35.669333 0 0 1-35.242667 36.096z m16.384 213.034667h-260.821333c-10.410667 0-18.901333-16.213333-18.901334-36.096 0-19.925333 8.490667-36.138667 18.901334-36.138667h260.864c10.410667 0 18.901333 16.213333 18.901333 36.138667-0.042667 19.882667-8.490667 36.096-18.944 36.096z m0 212.992h-260.821333c-10.410667 0-18.901333-16.213333-18.901334-36.096 0-19.925333 8.490667-36.096 18.901334-36.096h260.864c10.410667 0 18.901333 16.213333 18.901333 36.096-0.042667 19.882667-8.490667 36.096-18.944 36.096z"
|
||||
fill="#1890FF"
|
||||
p-id="11420"
|
||||
/></svg
|
||||
>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
9
AgentQnA/ui/svelte/src/lib/assets/Agent/download.svelte
Normal file
@@ -0,0 +1,9 @@
|
||||
<!--
|
||||
Copyright (C) 2025 Intel Corporation
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
|
||||
<svg class="w-3.5 h-3.5 me-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M14.707 7.793a1 1 0 0 0-1.414 0L11 10.086V1.5a1 1 0 0 0-2 0v8.586L6.707 7.793a1 1 0 1 0-1.414 1.414l4 4a1 1 0 0 0 1.416 0l4-4a1 1 0 0 0-.002-1.414Z"/>
|
||||
<path d="M18 12h-2.55l-2.975 2.975a3.5 3.5 0 0 1-4.95 0L4.55 12H2a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2Zm-3 5a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 559 B |
16
AgentQnA/ui/svelte/src/lib/assets/Agent/eye.svelte
Normal file
@@ -0,0 +1,16 @@
|
||||
<!--
|
||||
Copyright (C) 2025 Intel Corporation
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
|
||||
<svg
|
||||
class="me-2 h-3 w-3"
|
||||
aria-hidden="true"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="currentColor"
|
||||
viewBox="0 0 20 14"
|
||||
>
|
||||
<path
|
||||
d="M10 0C4.612 0 0 5.336 0 7c0 1.742 3.546 7 10 7 6.454 0 10-5.258 10-7 0-1.664-4.612-7-10-7Zm0 10a3 3 0 1 1 0-6 3 3 0 0 1 0 6Z"
|
||||
/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 413 B |
97
AgentQnA/ui/svelte/src/lib/assets/Agent/newAI.svelte
Normal file
@@ -0,0 +1,97 @@
|
||||
<!--
|
||||
Copyright (C) 2025 Intel Corporation
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
|
||||
<!-- <svg class="h-11 w-11 flex-none overflow-visible" fill="none"
|
||||
><defs
|
||||
><filter
|
||||
id="step-icon-2"
|
||||
x="-3"
|
||||
y="-1"
|
||||
width="50"
|
||||
height="50"
|
||||
filterUnits="userSpaceOnUse"
|
||||
color-interpolation-filters="sRGB"
|
||||
><feFlood flood-opacity="0" result="BackgroundImageFix" /><feColorMatrix
|
||||
in="SourceAlpha"
|
||||
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
|
||||
result="hardAlpha"
|
||||
/><feOffset dy="2" /><feGaussianBlur stdDeviation="2.5" /><feComposite
|
||||
in2="hardAlpha"
|
||||
operator="out"
|
||||
/><feColorMatrix
|
||||
values="0 0 0 0 0.054902 0 0 0 0 0.647059 0 0 0 0 0.913725 0 0 0 0.12 0"
|
||||
/><feBlend
|
||||
in2="BackgroundImageFix"
|
||||
result="effect1_dropShadow_804_95228"
|
||||
/><feBlend
|
||||
in="SourceGraphic"
|
||||
in2="effect1_dropShadow_804_95228"
|
||||
result="shape"
|
||||
/></filter
|
||||
></defs
|
||||
><g filter="url(#step-icon-2)"
|
||||
><path
|
||||
d="M2.75 10A7.25 7.25 0 0 1 10 2.75h24A7.25 7.25 0 0 1 41.25 10v24A7.25 7.25 0 0 1 34 41.25H10A7.25 7.25 0 0 1 2.75 34V10Z"
|
||||
fill="#EEF2FF"
|
||||
/><path
|
||||
d="M2.75 10A7.25 7.25 0 0 1 10 2.75h24A7.25 7.25 0 0 1 41.25 10v24A7.25 7.25 0 0 1 34 41.25H10A7.25 7.25 0 0 1 2.75 34V10Z"
|
||||
stroke="#6366F1"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/></g
|
||||
><path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
d="M23 35.25c.69 0 1.25-.56 1.25-1.25A3.75 3.75 0 0 1 28 30.25a1.25 1.25 0 1 0 0-2.5A3.75 3.75 0 0 1 24.25 24a1.25 1.25 0 1 0-2.5 0A3.75 3.75 0 0 1 18 27.75a1.25 1.25 0 0 0 0 2.5A3.75 3.75 0 0 1 21.75 34c0 .69.56 1.25 1.25 1.25Z"
|
||||
fill="#fff"
|
||||
/><path
|
||||
d="M28 27a.75.75 0 0 0 0 1.5V27Zm-4.5 7a.5.5 0 0 1-.5.5V36a2 2 0 0 0 2-2h-1.5Zm5-5a.5.5 0 0 1-.5.5V31a2 2 0 0 0 2-2h-1.5Zm-.5-.5a.5.5 0 0 1 .5.5H30a2 2 0 0 0-2-2v1.5Zm-5-5a.5.5 0 0 1 .5.5H25a2 2 0 0 0-2-2v1.5Zm-.5.5a.5.5 0 0 1 .5-.5V22a2 2 0 0 0-2 2h1.5Zm-5 5a.5.5 0 0 1 .5-.5V27a2 2 0 0 0-2 2h1.5Zm.5.5a.5.5 0 0 1-.5-.5H16a2 2 0 0 0 2 2v-1.5Zm5 5a.5.5 0 0 1-.5-.5H21a2 2 0 0 0 2 2v-1.5ZM18 31a3 3 0 0 1 3 3h1.5a4.5 4.5 0 0 0-4.5-4.5V31Zm3-7a3 3 0 0 1-3 3v1.5a4.5 4.5 0 0 0 4.5-4.5H21Zm7 3a3 3 0 0 1-3-3h-1.5a4.5 4.5 0 0 0 4.5 4.5V27Zm-3 7a3 3 0 0 1 3-3v-1.5a4.5 4.5 0 0 0-4.5 4.5H25Z"
|
||||
fill="#6366F1"
|
||||
/><path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
d="M13 27.25c.69 0 1.25-.56 1.25-1.25 0-.966.784-1.75 1.75-1.75a1.25 1.25 0 1 0 0-2.5A1.75 1.75 0 0 1 14.25 20a1.25 1.25 0 1 0-2.5 0A1.75 1.75 0 0 1 10 21.75a1.25 1.25 0 0 0 0 2.5c.966 0 1.75.784 1.75 1.75 0 .69.56 1.25 1.25 1.25Z"
|
||||
fill="#fff"
|
||||
/><path
|
||||
d="M16 21a.75.75 0 0 0 0 1.5V21Zm-2.5 5a.5.5 0 0 1-.5.5V28a2 2 0 0 0 2-2h-1.5Zm3-3a.5.5 0 0 1-.5.5V25a2 2 0 0 0 2-2h-1.5Zm-.5-.5a.5.5 0 0 1 .5.5H18a2 2 0 0 0-2-2v1.5Zm-3-3a.5.5 0 0 1 .5.5H15a2 2 0 0 0-2-2v1.5Zm-.5.5a.5.5 0 0 1 .5-.5V18a2 2 0 0 0-2 2h1.5Zm-3 3a.5.5 0 0 1 .5-.5V21a2 2 0 0 0-2 2h1.5Zm.5.5a.5.5 0 0 1-.5-.5H8a2 2 0 0 0 2 2v-1.5Zm3 3a.5.5 0 0 1-.5-.5H11a2 2 0 0 0 2 2v-1.5ZM10 25a1 1 0 0 1 1 1h1.5a2.5 2.5 0 0 0-2.5-2.5V25Zm1-5a1 1 0 0 1-1 1v1.5a2.5 2.5 0 0 0 2.5-2.5H11Zm5 1a1 1 0 0 1-1-1h-1.5a2.5 2.5 0 0 0 2.5 2.5V21Zm-1 5a1 1 0 0 1 1-1v-1.5a2.5 2.5 0 0 0-2.5 2.5H15Z"
|
||||
fill="#6366F1"
|
||||
/><path
|
||||
opacity=".4"
|
||||
d="M29.75 35.25h2.5a3 3 0 0 0 3-3v-20.5a3 3 0 0 0-3-3h-20.5a3 3 0 0 0-3 3v5.5M12.75 14.25h18.5"
|
||||
stroke="#6366F1"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/></svg
|
||||
> -->
|
||||
|
||||
<svg
|
||||
t="1731984480564"
|
||||
class="h-10 w-10"
|
||||
viewBox="0 0 1114 1024"
|
||||
version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
p-id="29550"
|
||||
width="200"
|
||||
height="200"
|
||||
><path
|
||||
d="M1081.916235 788.781176H909.312v172.634353a24.696471 24.696471 0 0 1-49.332706 0V788.781176H687.314824a24.696471 24.696471 0 0 1 0-49.362823H859.949176V566.814118a24.696471 24.696471 0 0 1 49.332706 0v172.634353h172.664471a24.696471 24.696471 0 0 1 0 49.362823z"
|
||||
fill="#0972E7"
|
||||
p-id="29551"
|
||||
/><path
|
||||
d="M174.772706 143.028706h509.831529c43.550118 0 78.516706 35.689412 78.516706 80.173176v280.576c0 44.453647-34.966588 80.173176-78.516706 80.173177H174.772706c-43.550118 0-78.516706-35.719529-78.516706-80.173177V223.171765c0-43.851294 34.966588-80.173176 78.516706-80.173177z"
|
||||
fill="#CAE4FF"
|
||||
p-id="29552"
|
||||
/><path
|
||||
d="M335.600941 910.637176H104.899765c-24.545882 0-43.550118-20.028235-43.550118-45.086117V107.098353c0-25.057882 19.636706-45.086118 44.182588-45.086118h742.912c23.913412 0 44.182588 20.028235 44.182589 44.453647V282.503529c0 16.896 13.492706 31.322353 30.659764 31.322353a30.72 30.72 0 0 0 30.689883-31.322353V106.465882C953.976471 47.585882 906.721882 0 849.046588 0H104.899765C47.224471 0 0 48.218353 0 107.098353v758.452706c0 58.88 46.622118 107.098353 104.297412 107.098353h230.671059c16.564706 0 30.659765-13.793882 30.659764-31.322353a30.027294 30.027294 0 0 0-30.057411-30.689883z"
|
||||
fill="#0972E7"
|
||||
p-id="29553"
|
||||
/><path
|
||||
d="M709.180235 219.196235c0-16.896-13.492706-31.322353-30.659764-31.322353H171.760941c-16.564706 0-30.659765 13.793882-30.659765 31.322353 0 16.926118 13.492706 31.322353 30.659765 31.322353h506.75953a30.72 30.72 0 0 0 30.659764-31.322353zM171.760941 436.525176c-16.564706 0-30.659765 13.793882-30.659765 31.322353 0 16.896 13.492706 31.322353 30.659765 31.322353h344.786824c16.564706 0 30.689882-13.793882 30.689882-31.322353 0-16.926118-13.522824-31.322353-30.689882-31.322353H171.760941z"
|
||||
fill="#0972E7"
|
||||
p-id="29554"
|
||||
/></svg
|
||||
>
|
||||
8
AgentQnA/ui/svelte/src/lib/assets/Agent/resource.svelte
Normal file
@@ -0,0 +1,8 @@
|
||||
<!--
|
||||
Copyright (C) 2025 Intel Corporation
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
|
||||
<svg class="h-5 w-5 flex-shrink-0 text-[#1d4dd5]" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" data-slot="icon">
|
||||
<path fill-rule="evenodd" d="M15.621 4.379a3 3 0 0 0-4.242 0l-7 7a3 3 0 0 0 4.241 4.243h.001l.497-.5a.75.75 0 0 1 1.064 1.057l-.498.501-.002.002a4.5 4.5 0 0 1-6.364-6.364l7-7a4.5 4.5 0 0 1 6.368 6.36l-3.455 3.553A2.625 2.625 0 1 1 9.52 9.52l3.45-3.451a.75.75 0 1 1 1.061 1.06l-3.45 3.451a1.125 1.125 0 0 0 1.587 1.595l3.454-3.553a3 3 0 0 0 0-4.242Z" clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 601 B |
13
AgentQnA/ui/svelte/src/lib/assets/Agent/search.svelte
Normal file
@@ -0,0 +1,13 @@
|
||||
<!--
|
||||
Copyright (C) 2025 Intel Corporation
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
|
||||
<svg
|
||||
class="pointer-events-none absolute left-0 ml-4 hidden h-4 w-4 fill-current text-gray-500 group-hover:text-gray-400 sm:block"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 20 20"
|
||||
><path
|
||||
d="M12.9 14.32a8 8 0 1 1 1.41-1.41l5.35 5.33-1.42 1.42-5.33-5.34zM8 14A6 6 0 1 0 8 2a6 6 0 0 0 0 12z"
|
||||
/></svg
|
||||
>
|
||||
|
After Width: | Height: | Size: 413 B |