7
7
WORKPATH=$( dirname " $PWD " )
8
8
LOG_PATH=" $WORKPATH /tests"
9
9
ip_address=$( hostname -I | awk ' {print $1}' )
10
+
10
11
function build_docker_images() {
11
12
cd $WORKPATH
12
- docker build --no-cache -t opea/llm-tgi:latest -f comps/intent_detection/langchain/Dockerfile .
13
+ docker build --no-cache -t opea/intent-detection:comps -f comps/intent_detection/langchain/Dockerfile .
13
14
}
14
15
15
16
function start_service() {
@@ -22,8 +23,19 @@ function start_service() {
22
23
export TGI_LLM_ENDPOINT=" http://${ip_address} :${tgi_endpoint} "
23
24
intent_port=5043
24
25
unset http_proxy
25
- docker run -d --name=" test-comps-intent-server" -p ${intent_port} :9000 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e TGI_LLM_ENDPOINT=$TGI_LLM_ENDPOINT -e HUGGINGFACEHUB_API_TOKEN=$HUGGINGFACEHUB_API_TOKEN opea/llm-tgi:latest
26
- sleep 5m
26
+ docker run -d --name=" test-comps-intent-server" -p ${intent_port} :9000 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e TGI_LLM_ENDPOINT=$TGI_LLM_ENDPOINT -e HUGGINGFACEHUB_API_TOKEN=$HUGGINGFACEHUB_API_TOKEN opea/intent-detection:comps
27
+
28
+ # check whether tgi is fully ready
29
+ n=0
30
+ until [[ " $n " -ge 100 ]] || [[ $ready == true ]]; do
31
+ docker logs test-comps-intent-tgi-endpoint > ${LOG_PATH} /tgi.log
32
+ n=$(( n+ 1 ))
33
+ if grep -q Connected ${LOG_PATH} /tgi.log; then
34
+ break
35
+ fi
36
+ sleep 5s
37
+ done
38
+ sleep 5s
27
39
}
28
40
29
41
function validate_microservice() {
@@ -33,11 +45,16 @@ function validate_microservice() {
33
45
-d ' {"query":"What is Deep Learning?","max_new_tokens":10,"top_k":1,"temperature":0.001,"streaming":false}' \
34
46
-H ' Content-Type: application/json' )
35
47
36
- echo " ==============="
37
- echo $result
48
+ if [[ $result == * " QA" * ]]; then
49
+ echo $result
50
+ echo " Result correct."
51
+ else
52
+ echo " Result wrong. Received was $result "
53
+ docker logs test-comps-intent-server > ${LOG_PATH} /intent_detection.log
54
+ docker logs test-comps-intent-tgi-endpoint > ${LOG_PATH} /tgi.log
55
+ exit 1
56
+ fi
38
57
39
- docker logs test-comps-intent-server >> ${LOG_PATH} /intent_detection.log
40
- docker logs test-comps-intent-tgi-endpoint >> ${LOG_PATH} /tgi-endpoint.log
41
58
}
42
59
43
60
function stop_docker() {
0 commit comments