Compare commits

...

2 Commits

Author SHA1 Message Date
ZePan110
e1f98c896b increase timeout 10s to 60s
Signed-off-by: ZePan110 <ze.pan@intel.com>
2025-04-03 22:23:42 +08:00
ZePan110
e23eb6013f only test
Signed-off-by: ZePan110 <ze.pan@intel.com>
2025-04-03 00:59:49 +08:00
3 changed files with 64 additions and 45 deletions

View File

@@ -102,7 +102,7 @@ services:
healthcheck: healthcheck:
test: ["CMD-SHELL", "curl -f http://${host_ip}:${LLM_ENDPOINT_PORT}/health || exit 1"] test: ["CMD-SHELL", "curl -f http://${host_ip}:${LLM_ENDPOINT_PORT}/health || exit 1"]
interval: 10s interval: 10s
timeout: 10s timeout: 60s
retries: 100 retries: 100
runtime: habana runtime: habana
cap_add: cap_add:

View File

@@ -4,12 +4,20 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# Function to prompt for input and set environment variables # Function to prompt for input and set environment variables
NON_INTERACTIVE=${NON_INTERACTIVE:-false}
prompt_for_env_var() { prompt_for_env_var() {
local var_name="$1" local var_name="$1"
local prompt_message="$2" local prompt_message="$2"
local default_value="$3" local default_value="$3"
local mandatory="$4" local mandatory="$4"
if [[ "$NON_INTERACTIVE" == "true" ]]; then
echo "Non-interactive environment detected. Setting $var_name to default: $default_value"
export "$var_name"="$default_value"
return
fi
if [[ "$mandatory" == "true" ]]; then if [[ "$mandatory" == "true" ]]; then
while [[ -z "$value" ]]; do while [[ -z "$value" ]]; do
read -p "$prompt_message [default: \"${default_value}\"]: " value read -p "$prompt_message [default: \"${default_value}\"]: " value
@@ -34,7 +42,7 @@ popd > /dev/null
# Prompt the user for each required environment variable # Prompt the user for each required environment variable
prompt_for_env_var "EMBEDDING_MODEL_ID" "Enter the EMBEDDING_MODEL_ID" "BAAI/bge-base-en-v1.5" false prompt_for_env_var "EMBEDDING_MODEL_ID" "Enter the EMBEDDING_MODEL_ID" "BAAI/bge-base-en-v1.5" false
prompt_for_env_var "HUGGINGFACEHUB_API_TOKEN" "Enter the HUGGINGFACEHUB_API_TOKEN" "" true prompt_for_env_var "HUGGINGFACEHUB_API_TOKEN" "Enter the HUGGINGFACEHUB_API_TOKEN" "${HF_TOKEN}" true
prompt_for_env_var "RERANK_MODEL_ID" "Enter the RERANK_MODEL_ID" "BAAI/bge-reranker-base" false prompt_for_env_var "RERANK_MODEL_ID" "Enter the RERANK_MODEL_ID" "BAAI/bge-reranker-base" false
prompt_for_env_var "LLM_MODEL_ID" "Enter the LLM_MODEL_ID" "meta-llama/Meta-Llama-3-8B-Instruct" false prompt_for_env_var "LLM_MODEL_ID" "Enter the LLM_MODEL_ID" "meta-llama/Meta-Llama-3-8B-Instruct" false
prompt_for_env_var "INDEX_NAME" "Enter the INDEX_NAME" "rag-redis" false prompt_for_env_var "INDEX_NAME" "Enter the INDEX_NAME" "rag-redis" false
@@ -42,32 +50,39 @@ prompt_for_env_var "NUM_CARDS" "Enter the number of Gaudi devices" "1" false
prompt_for_env_var "host_ip" "Enter the host_ip" "$(curl ifconfig.me)" false prompt_for_env_var "host_ip" "Enter the host_ip" "$(curl ifconfig.me)" false
#Query for enabling http_proxy #Query for enabling http_proxy
prompt_for_env_var "http_proxy" "Enter the http_proxy." "" false prompt_for_env_var "http_proxy" "Enter the http_proxy." "${http_proxy}" false
#Query for enabling https_proxy #Query for enabling https_proxy
prompt_for_env_var "https_proxy" "Enter the https_proxy." "" false prompt_for_env_var "https_proxy" "Enter the https_proxy." "${https_proxy}" false
#Query for enabling no_proxy #Query for enabling no_proxy
prompt_for_env_var "no_proxy" "Enter the no_proxy." "" false prompt_for_env_var "no_proxy" "Enter the no_proxy." "${no_proxy}" false
# Query for enabling logging if [[ "$NON_INTERACTIVE" == "true" ]]; then
read -p "Enable logging? (yes/no): " logging && logging=$(echo "$logging" | tr '[:upper:]' '[:lower:]') # Query for enabling logging
if [[ "$logging" == "yes" || "$logging" == "y" ]]; then prompt_for_env_var "LOGFLAG" "Enable logging? (yes/no): " "true" false
export LOGFLAG=true
else else
export LOGFLAG=false # Query for enabling logging
read -p "Enable logging? (yes/no): " logging && logging=$(echo "$logging" | tr '[:upper:]' '[:lower:]')
if [[ "$logging" == "yes" || "$logging" == "y" ]]; then
export LOGFLAG=true
else
export LOGFLAG=false
fi
# Query for enabling OpenTelemetry Tracing Endpoint
read -p "Enable OpenTelemetry Tracing Endpoint? (yes/no): " telemetry && telemetry=$(echo "$telemetry" | tr '[:upper:]' '[:lower:]')
if [[ "$telemetry" == "yes" || "$telemetry" == "y" ]]; then
export JAEGER_IP=$(ip route get 8.8.8.8 | grep -oP 'src \K[^ ]+')
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=grpc://$JAEGER_IP:4317
export TELEMETRY_ENDPOINT=http://$JAEGER_IP:4318/v1/traces
telemetry_flag=true
else
telemetry_flag=false
fi
fi fi
# Query for enabling OpenTelemetry Tracing Endpoint
read -p "Enable OpenTelemetry Tracing Endpoint? (yes/no): " telemetry && telemetry=$(echo "$telemetry" | tr '[:upper:]' '[:lower:]')
if [[ "$telemetry" == "yes" || "$telemetry" == "y" ]]; then
export JAEGER_IP=$(ip route get 8.8.8.8 | grep -oP 'src \K[^ ]+')
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=grpc://$JAEGER_IP:4317
export TELEMETRY_ENDPOINT=http://$JAEGER_IP:4318/v1/traces
telemetry_flag=true
else
telemetry_flag=false
fi
# Generate the .env file # Generate the .env file
cat <<EOF > .env cat <<EOF > .env

View File

@@ -13,7 +13,7 @@ export MODEL_CACHE=${model_cache:-"/data/cache"}
WORKPATH=$(dirname "$PWD") WORKPATH=$(dirname "$PWD")
LOG_PATH="$WORKPATH/tests" LOG_PATH="$WORKPATH/tests"
ip_address=$(hostname -I | awk '{print $1}') host_ip=$(hostname -I | awk '{print $1}')
function build_docker_images() { function build_docker_images() {
opea_branch=${opea_branch:-"main"} opea_branch=${opea_branch:-"main"}
@@ -44,12 +44,17 @@ function build_docker_images() {
function start_services() { function start_services() {
cd $WORKPATH/docker_compose/intel/hpu/gaudi cd $WORKPATH/docker_compose/intel/hpu/gaudi
export EMBEDDING_MODEL_ID="BAAI/bge-base-en-v1.5" export NON_INTERACTIVE=true
export RERANK_MODEL_ID="BAAI/bge-reranker-base" # export EMBEDDING_MODEL_ID="BAAI/bge-base-en-v1.5"
export LLM_MODEL_ID="meta-llama/Meta-Llama-3-8B-Instruct" # export RERANK_MODEL_ID="BAAI/bge-reranker-base"
export NUM_CARDS=1 # export LLM_MODEL_ID="meta-llama/Meta-Llama-3-8B-Instruct"
export INDEX_NAME="rag-redis" # export NUM_CARDS=1
export host_ip=${ip_address} # export INDEX_NAME="rag-redis"
# export host_ip=${host_ip}
# export LOGFLAG=True
# export http_proxy=${http_proxy}
# export https_proxy=${https_proxy}
export LLM_ENDPOINT_PORT=8010 export LLM_ENDPOINT_PORT=8010
export LLM_SERVER_PORT=9001 export LLM_SERVER_PORT=9001
export CHATQNA_BACKEND_PORT=8888 export CHATQNA_BACKEND_PORT=8888
@@ -61,10 +66,9 @@ function start_services() {
export LLM_ENDPOINT="http://${host_ip}:${LLM_ENDPOINT_PORT}" export LLM_ENDPOINT="http://${host_ip}:${LLM_ENDPOINT_PORT}"
export HF_TOKEN=${HF_TOKEN} export HF_TOKEN=${HF_TOKEN}
export VLLM_SKIP_WARMUP=true export VLLM_SKIP_WARMUP=true
export LOGFLAG=True
export http_proxy=${http_proxy} export no_proxy="${host_ip},redis-vector-db,dataprep-redis-service,tei-embedding-service,retriever,tei-reranking-service,tgi-service,vllm-service,guardrails,llm-faqgen,chatqna-gaudi-backend-server,chatqna-gaudi-ui-server,chatqna-gaudi-nginx-server"
export https_proxy=${https_proxy} source set_env.sh
export no_proxy="${ip_address},redis-vector-db,dataprep-redis-service,tei-embedding-service,retriever,tei-reranking-service,tgi-service,vllm-service,guardrails,llm-faqgen,chatqna-gaudi-backend-server,chatqna-gaudi-ui-server,chatqna-gaudi-nginx-server"
# Start Docker Containers # Start Docker Containers
docker compose -f compose_faqgen.yaml up -d > ${LOG_PATH}/start_services_with_compose.log docker compose -f compose_faqgen.yaml up -d > ${LOG_PATH}/start_services_with_compose.log
@@ -123,8 +127,8 @@ function validate_microservices() {
# tei for embedding service # tei for embedding service
validate_service \ validate_service \
"${ip_address}:8090/embed" \ "${host_ip}:8090/embed" \
"[[" \ "]]" \
"tei-embedding" \ "tei-embedding" \
"tei-embedding-gaudi-server" \ "tei-embedding-gaudi-server" \
'{"inputs":"What is Deep Learning?"}' '{"inputs":"What is Deep Learning?"}'
@@ -134,28 +138,28 @@ function validate_microservices() {
# test /v1/dataprep upload file # test /v1/dataprep upload file
echo "Deep learning is a subset of machine learning that utilizes neural networks with multiple layers to analyze various levels of abstract data representations. It enables computers to identify patterns and make decisions with minimal human intervention by learning from large amounts of data." > $LOG_PATH/dataprep_file.txt echo "Deep learning is a subset of machine learning that utilizes neural networks with multiple layers to analyze various levels of abstract data representations. It enables computers to identify patterns and make decisions with minimal human intervention by learning from large amounts of data." > $LOG_PATH/dataprep_file.txt
validate_service \ validate_service \
"http://${ip_address}:6007/v1/dataprep/ingest" \ "http://${host_ip}:6007/v1/dataprep/ingest" \
"Data preparation succeeded" \ "Data preparation succeeded" \
"dataprep_upload_file" \ "dataprep_upload_file" \
"dataprep-redis-server" "dataprep-redis-server"
# test /v1/dataprep upload link # test /v1/dataprep upload link
validate_service \ validate_service \
"http://${ip_address}:6007/v1/dataprep/ingest" \ "http://${host_ip}:6007/v1/dataprep/ingest" \
"Data preparation succeeded" \ "Data preparation succeeded" \
"dataprep_upload_link" \ "dataprep_upload_link" \
"dataprep-redis-server" "dataprep-redis-server"
# test /v1/dataprep/get_file # test /v1/dataprep/get_file
validate_service \ validate_service \
"http://${ip_address}:6007/v1/dataprep/get" \ "http://${host_ip}:6007/v1/dataprep/get" \
'{"name":' \ '{"name":' \
"dataprep_get" \ "dataprep_get" \
"dataprep-redis-server" "dataprep-redis-server"
# test /v1/dataprep/delete_file # test /v1/dataprep/delete_file
validate_service \ validate_service \
"http://${ip_address}:6007/v1/dataprep/delete" \ "http://${host_ip}:6007/v1/dataprep/delete" \
'{"status":true}' \ '{"status":true}' \
"dataprep_del" \ "dataprep_del" \
"dataprep-redis-server" "dataprep-redis-server"
@@ -163,8 +167,8 @@ function validate_microservices() {
# retrieval microservice # retrieval microservice
test_embedding=$(python3 -c "import random; embedding = [random.uniform(-1, 1) for _ in range(768)]; print(embedding)") test_embedding=$(python3 -c "import random; embedding = [random.uniform(-1, 1) for _ in range(768)]; print(embedding)")
validate_service \ validate_service \
"${ip_address}:7000/v1/retrieval" \ "${host_ip}:7000/v1/retrieval" \
" " \ "retrieved_docs" \
"retrieval" \ "retrieval" \
"retriever-redis-server" \ "retriever-redis-server" \
"{\"text\":\"What is the revenue of Nike in 2023?\",\"embedding\":${test_embedding}}" "{\"text\":\"What is the revenue of Nike in 2023?\",\"embedding\":${test_embedding}}"
@@ -172,7 +176,7 @@ function validate_microservices() {
# tei for rerank microservice # tei for rerank microservice
echo "validate tei..." echo "validate tei..."
validate_service \ validate_service \
"${ip_address}:8808/rerank" \ "${host_ip}:8808/rerank" \
'{"index":1,"score":' \ '{"index":1,"score":' \
"tei-rerank" \ "tei-rerank" \
"tei-reranking-gaudi-server" \ "tei-reranking-gaudi-server" \
@@ -181,7 +185,7 @@ function validate_microservices() {
# vllm for llm service # vllm for llm service
echo "validate vllm..." echo "validate vllm..."
validate_service \ validate_service \
"${ip_address}:${LLM_ENDPOINT_PORT}/v1/chat/completions" \ "${host_ip}:${LLM_ENDPOINT_PORT}/v1/chat/completions" \
"content" \ "content" \
"vllm-llm" \ "vllm-llm" \
"vllm-gaudi-server" \ "vllm-gaudi-server" \
@@ -190,7 +194,7 @@ function validate_microservices() {
# faqgen llm microservice # faqgen llm microservice
echo "validate llm-faqgen..." echo "validate llm-faqgen..."
validate_service \ validate_service \
"${ip_address}:${LLM_SERVER_PORT}/v1/faqgen" \ "${host_ip}:${LLM_SERVER_PORT}/v1/faqgen" \
"text" \ "text" \
"llm" \ "llm" \
"llm-faqgen-server" \ "llm-faqgen-server" \
@@ -200,14 +204,14 @@ function validate_microservices() {
function validate_megaservice() { function validate_megaservice() {
# Curl the Mega Service # Curl the Mega Service
validate_service \ validate_service \
"${ip_address}:${CHATQNA_BACKEND_PORT}/v1/chatqna" \ "${host_ip}:${CHATQNA_BACKEND_PORT}/v1/chatqna" \
"Embed" \ "Embed" \
"chatqna-megaservice" \ "chatqna-megaservice" \
"chatqna-gaudi-backend-server" \ "chatqna-gaudi-backend-server" \
'{"messages": "Text Embeddings Inference (TEI) is a toolkit for deploying and serving open source text embeddings and sequence classification models. TEI enables high-performance extraction for the most popular models, including FlagEmbedding, Ember, GTE and E5.","max_tokens":32}' '{"messages": "Text Embeddings Inference (TEI) is a toolkit for deploying and serving open source text embeddings and sequence classification models. TEI enables high-performance extraction for the most popular models, including FlagEmbedding, Ember, GTE and E5.","max_tokens":32}'
validate_service \ validate_service \
"${ip_address}:${CHATQNA_BACKEND_PORT}/v1/chatqna" \ "${host_ip}:${CHATQNA_BACKEND_PORT}/v1/chatqna" \
"Embed" \ "Embed" \
"chatqna-megaservice" \ "chatqna-megaservice" \
"chatqna-gaudi-backend-server" \ "chatqna-gaudi-backend-server" \
@@ -226,7 +230,7 @@ function validate_frontend() {
fi fi
source activate ${conda_env_name} source activate ${conda_env_name}
sed -i "s/localhost/$ip_address/g" playwright.config.ts sed -i "s/localhost/$host_ip/g" playwright.config.ts
conda install -c conda-forge nodejs=22.6.0 -y conda install -c conda-forge nodejs=22.6.0 -y
npm install && npm ci && npx playwright install --with-deps npm install && npm ci && npx playwright install --with-deps