@@ -16,12 +16,12 @@ function init_chatqna() {
16
16
# replace the repository "image: opea/*" with "image: $IMAGE_REPO/opea/"
17
17
find . -name ' *.yaml' -type f -exec sed -i " s#image: opea/*#image: $IMAGE_REPO /opea/#g" {} \;
18
18
# set huggingface token
19
- find . -name ' *.yaml' -type f -exec sed -i " s#insert-your-huggingface-token-here #$( cat /home/$USER_ID /.cache/huggingface/token) #g" {} \;
19
+ find . -name ' *.yaml' -type f -exec sed -i " s#\$ {HUGGINGFACEHUB_API_TOKEN} #$( cat /home/$USER_ID /.cache/huggingface/token) #g" {} \;
20
20
}
21
21
22
22
function install_chatqna {
23
23
# replace namespace "default" with real namespace
24
- find . -name ' *.yaml' -type f -exec sed -i " s#svc. default#svc. $NAMESPACE #g" {} \;
24
+ find . -name ' *.yaml' -type f -exec sed -i " s#default.svc# $NAMESPACE .svc #g" {} \;
25
25
# for very yaml file in yaml_files, apply it to the k8s cluster
26
26
yaml_files=(" qna_configmap_xeon" " redis-vector-db" " tei_embedding_service" " tei_reranking_service" " tgi_service" " retriever" " embedding" " reranking" " llm" )
27
27
for yaml_file in ${yaml_files[@]} ; do
@@ -43,28 +43,28 @@ function validate_chatqna() {
43
43
-H ' Content-Type: application/json' ; do sleep 10; done
44
44
45
45
# check megaservice works
46
+ # generate a random logfile name to avoid conflict among multiple runners
47
+ LOGFILE=$LOG_PATH /curlmega_$NAMESPACE .log
46
48
curl http://chaqna-xeon-backend-server-svc.$NAMESPACE :8888/v1/chatqna -H " Content-Type: application/json" -d ' {
47
- "messages": "What is the revenue of Nike in 2023?"}' > ${LOG_PATH} /curl_megaservice.log
49
+ "messages": "What is the revenue of Nike in 2023?"}' > $LOGFILE
48
50
exit_code=$?
49
51
if [ $exit_code -ne 0 ]; then
50
- echo " Megaservice failed, please check the logs in ${LOG_PATH} !"
52
+ echo " Megaservice failed, please check the logs in $LOGFILE !"
51
53
exit 1
52
54
fi
53
- echo " Response check succeed!"
54
55
55
- # Temporarily disable response check
56
- # echo "Checking response results, make sure the output is reasonable. "
57
- # local status=false
58
- # if [[ -f $LOG_PATH/curl_megaservice.log ]] &&
59
- # [[ $(grep -c "algorithms" $LOG_PATH/curl_megaservice.log) != 0 ]]; then
60
- # status=true
61
- # fi
62
- # if [ $status == false ]; then
63
- # echo "Response check failed, please check the logs in artifacts!"
64
- # exit 1
65
- # else
66
- # echo "Response check succeed!"
67
- # fi
56
+ echo " Checking response results, make sure the output is reasonable. "
57
+ local status=false
58
+ if [[ -f $LOGFILE ]] &&
59
+ [[ $( grep -c " billion" $LOGFILE ) != 0 ]]; then
60
+ status=true
61
+ fi
62
+ if [ $status == false ]; then
63
+ echo " Response check failed, please check the logs in artifacts!"
64
+ exit 1
65
+ else
66
+ echo " Response check succeed!"
67
+ fi
68
68
}
69
69
70
70
if [ $# -eq 0 ]; then
0 commit comments