Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
Signed-off-by: Chendi.Xue <[email protected]>
  • Loading branch information
xuechendi committed Jul 18, 2024
1 parent e9538bd commit 0d4531e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions RAGAgent/docker/gaudi/docker_compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ services:
- ${TOOLSET_PATH}:/home/user/tools/
environment:
- port=9090
- ip_address=${ip_address}
- strategy=${AGENT_STRATEGY}
- llm_endpoint_url=${LLM_ENDPOINT_URL}
- llm_engine=tgi
Expand Down
24 changes: 12 additions & 12 deletions RAGAgent/tests/test_ragagent_on_gaudi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

set -e
echo "IMAGE_REPO=${IMAGE_REPO}"
echo "HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}"

WORKPATH=$(dirname "$PWD")
LOG_PATH="$WORKPATH/tests"
Expand Down Expand Up @@ -63,14 +64,13 @@ function start_services() {
export AGENT_STRATEGY=react
export LLM_ENDPOINT_URL="http://${ip_address}:8008"
export TOOLSET_PATH=$WORKPATH/tools
export HUGGINGFACEHUB_API_TOKEN=${HF_TOKEN}
export HF_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
export EMBEDDING_MODEL_ID="BAAI/bge-base-en-v1.5"
export RERANK_MODEL_ID="BAAI/bge-reranker-base"
export TEI_EMBEDDING_ENDPOINT="http://${ip_address}:8090"
export TEI_RERANKING_ENDPOINT="http://${ip_address}:8808"
export REDIS_URL="redis://${ip_address}:6379"
export INDEX_NAME="rag-redis"
export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
export MEGA_SERVICE_HOST_IP=${ip_address}
export EMBEDDING_SERVICE_HOST_IP=${ip_address}
export RETRIEVER_SERVICE_HOST_IP=${ip_address}
Expand All @@ -82,15 +82,14 @@ function start_services() {
echo "Waiting tgi gaudi ready"
n=0
until [[ "$n" -ge 100 ]] || [[ $ready == true ]]; do
docker logs tgi-gaudi-server > ${WORKPATH}/tests/test-ragagent.log
docker logs tgi-gaudi-server > ${WORKPATH}/tests/tgi-gaudi-service.log
n=$((n+1))
if grep -q Connected ${WORKPATH}/tests/test-ragagent.log; then
if grep -q Connected ${WORKPATH}/tests/tgi-gaudi-service.log; then
break
fi
sleep 5s
done
sleep 5s
docker logs tgi-gaudi-server
echo "Service started successfully"
docker ps
}
Expand All @@ -105,34 +104,35 @@ function validate() {
echo 0
else
echo "[ $SERVICE_NAME ] Content does not match the expected result: $CONTENT"
exit 1
echo 1
fi
}

function validate_megaservice() {
echo "Testing DataPrep Service"
local CONTENT=$(curl -X POST "http://${ip_address}:6007/v1/dataprep" \
-H "Content-Type: multipart/form-data" \
-F 'link_list=["https://opea.dev"]' | tee ${LOG_PATH}/test-ragagent.log)
local EXIT_CODE=$(validate "$CONTENT" "Data preparation succeeded" "test-ragagent" )
-F 'link_list=["https://opea.dev"]' | tee -a ${LOG_PATH}/test-dataprep.log)
local EXIT_CODE=$(validate "$CONTENT" "Data preparation succeeded" "test-dataprep" )
echo "$EXIT_CODE"
local EXIT_CODE="${EXIT_CODE:0-1}"
if [ "$EXIT_CODE" == "1" ]; then
docker logs dataprep-redis-server | tee -a ${LOG_PATH}/test-ragagent.log
docker logs dataprep-redis-server >> ${LOG_PATH}/test-dataprep.log
exit 1
fi

echo "Testing agent service"
local CONTENT=$(curl http://${ip_address}:9090/v1/chat/completions -X POST -H "Content-Type: application/json" -d '{
"query": "What is Intel OPEA project?"
}' | tee ${LOG_PATH}/test-ragagent.log)
}' | tee -a ${LOG_PATH}/test-ragagent.log)
local EXIT_CODE=$(validate "$CONTENT" "OPEA" "test-ragagent")
echo "$EXIT_CODE"
local EXIT_CODE="${EXIT_CODE:0-1}"
echo "return value is $EXIT_CODE"
docker logs rag-agent-server >> ${LOG_PATH}/test-ragagent.log
docker logs doc-index-retriever-server >> ${LOG_PATH}/test-doc-index-retriever.log
if [ "$EXIT_CODE" == "1" ]; then
docker logs tgi-gaudi-server | tee -a ${LOG_PATH}/test-ragagent.log
docker logs rag-agent-server | tee -a ${LOG_PATH}/test-ragagent.log
docker logs tgi-gaudi-server >> ${LOG_PATH}/tgi-gaudi-service.log
exit 1
fi
}
Expand Down

0 comments on commit 0d4531e

Please sign in to comment.