|
1 | 1 | # Copyright (C) 2024 Advanced Micro Devices, Inc.
|
2 | 2 | # SPDX-License-Identifier: Apache-2.0
|
3 | 3 |
|
4 |
| -WORKPATH=$(dirname "$PWD")/.. |
| 4 | +# Before start script: |
| 5 | +# export host_ip="your_host_ip_or_host_name" |
| 6 | +# export HUGGINGFACEHUB_API_TOKEN="your_huggingface_api_token" |
| 7 | +# export LANGCHAIN_API_KEY="your_langchain_api_key" |
| 8 | +# export LANGCHAIN_TRACING_V2="" |
| 9 | + |
| 10 | +# Set server hostname or IP address |
5 | 11 | export ip_address=${host_ip}
|
6 |
| -export HUGGINGFACEHUB_API_TOKEN=${your_hf_api_token} |
7 |
| -export AGENTQNA_TGI_IMAGE=ghcr.io/huggingface/text-generation-inference:2.4.1-rocm |
8 |
| -export AGENTQNA_TGI_SERVICE_PORT="8085" |
9 | 12 |
|
10 |
| -# LLM related environment variables |
11 |
| -export AGENTQNA_CARD_ID="card1" |
12 |
| -export AGENTQNA_RENDER_ID="renderD136" |
13 |
| -export HF_CACHE_DIR=${HF_CACHE_DIR} |
14 |
| -ls $HF_CACHE_DIR |
15 |
| -export LLM_MODEL_ID="meta-llama/Meta-Llama-3-8B-Instruct" |
16 |
| -#export NUM_SHARDS=4 |
17 |
| -export LLM_ENDPOINT_URL="http://${ip_address}:${AGENTQNA_TGI_SERVICE_PORT}" |
| 13 | +# Set services IP ports |
| 14 | +export TGI_SERVICE_PORT="18110" |
| 15 | +export WORKER_RAG_AGENT_PORT="18111" |
| 16 | +export WORKER_SQL_AGENT_PORT="18112" |
| 17 | +export SUPERVISOR_REACT_AGENT_PORT="18113" |
| 18 | +export CRAG_SERVER_PORT="18114" |
| 19 | + |
| 20 | +export WORKPATH=$(dirname "$PWD") |
| 21 | +export WORKDIR=${WORKPATH}/../../../ |
| 22 | +export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} |
| 23 | +export LLM_MODEL_ID="Intel/neural-chat-7b-v3-3" |
| 24 | +export HF_CACHE_DIR="./data" |
| 25 | +export MODEL_CACHE="./data" |
| 26 | +export TOOLSET_PATH=${WORKPATH}/../../../tools/ |
| 27 | +export recursion_limit_worker=12 |
| 28 | +export LLM_ENDPOINT_URL=http://${ip_address}:${TGI_SERVICE_PORT} |
18 | 29 | export temperature=0.01
|
19 | 30 | export max_new_tokens=512
|
20 |
| - |
21 |
| -# agent related environment variables |
22 |
| -export AGENTQNA_WORKER_AGENT_SERVICE_PORT="9095" |
23 |
| -export TOOLSET_PATH=/home/huggingface/datamonsters/amd-opea/GenAIExamples/AgentQnA/tools/ |
24 |
| -echo "TOOLSET_PATH=${TOOLSET_PATH}" |
| 31 | +export RETRIEVAL_TOOL_URL="http://${ip_address}:8889/v1/retrievaltool" |
| 32 | +export LANGCHAIN_API_KEY=${LANGCHAIN_API_KEY} |
| 33 | +export LANGCHAIN_TRACING_V2=${LANGCHAIN_TRACING_V2} |
| 34 | +export db_name=Chinook |
| 35 | +export db_path="sqlite:////home/user/chinook-db/Chinook_Sqlite.sqlite" |
25 | 36 | export recursion_limit_worker=12
|
26 | 37 | export recursion_limit_supervisor=10
|
27 |
| -export WORKER_AGENT_URL="http://${ip_address}:${AGENTQNA_WORKER_AGENT_SERVICE_PORT}/v1/chat/completions" |
28 |
| -export RETRIEVAL_TOOL_URL="http://${ip_address}:8889/v1/retrievaltool" |
29 |
| -export CRAG_SERVER=http://${ip_address}:18881 |
30 |
| - |
31 |
| -export AGENTQNA_FRONTEND_PORT="9090" |
32 |
| - |
33 |
| -#retrieval_tool |
| 38 | +export CRAG_SERVER=http://${ip_address}:${CRAG_SERVER_PORT} |
| 39 | +export WORKER_AGENT_URL="http://${ip_address}:${WORKER_RAG_AGENT_PORT}/v1/chat/completions" |
| 40 | +export SQL_AGENT_URL="http://${ip_address}:${WORKER_SQL_AGENT_PORT}/v1/chat/completions" |
| 41 | +export HF_CACHE_DIR=${HF_CACHE_DIR} |
| 42 | +export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} |
| 43 | +export no_proxy=${no_proxy} |
| 44 | +export http_proxy=${http_proxy} |
| 45 | +export https_proxy=${https_proxy} |
| 46 | +export EMBEDDING_MODEL_ID="BAAI/bge-base-en-v1.5" |
| 47 | +export RERANK_MODEL_ID="BAAI/bge-reranker-base" |
34 | 48 | export TEI_EMBEDDING_ENDPOINT="http://${host_ip}:6006"
|
35 | 49 | export TEI_RERANKING_ENDPOINT="http://${host_ip}:8808"
|
36 |
| -export REDIS_URL="redis://${host_ip}:26379" |
| 50 | +export REDIS_URL="redis://${host_ip}:6379" |
37 | 51 | export INDEX_NAME="rag-redis"
|
| 52 | +export RERANK_TYPE="tei" |
38 | 53 | export MEGA_SERVICE_HOST_IP=${host_ip}
|
39 | 54 | export EMBEDDING_SERVICE_HOST_IP=${host_ip}
|
40 | 55 | export RETRIEVER_SERVICE_HOST_IP=${host_ip}
|
41 | 56 | export RERANK_SERVICE_HOST_IP=${host_ip}
|
42 | 57 | export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:8889/v1/retrievaltool"
|
43 | 58 | export DATAPREP_SERVICE_ENDPOINT="http://${host_ip}:6007/v1/dataprep/ingest"
|
44 |
| -export DATAPREP_GET_FILE_ENDPOINT="http://${host_ip}:6007/v1/dataprep/get" |
45 |
| -export DATAPREP_DELETE_FILE_ENDPOINT="http://${host_ip}:6007/v1/dataprep/delete" |
| 59 | +export DATAPREP_GET_FILE_ENDPOINT="http://${host_ip}:6008/v1/dataprep/get" |
| 60 | +export DATAPREP_DELETE_FILE_ENDPOINT="http://${host_ip}:6009/v1/dataprep/delete" |
| 61 | + |
| 62 | +echo ${WORKER_RAG_AGENT_PORT} > ${WORKPATH}/WORKER_RAG_AGENT_PORT_tmp |
| 63 | +echo ${WORKER_SQL_AGENT_PORT} > ${WORKPATH}/WORKER_SQL_AGENT_PORT_tmp |
| 64 | +echo ${SUPERVISOR_REACT_AGENT_PORT} > ${WORKPATH}/SUPERVISOR_REACT_AGENT_PORT_tmp |
| 65 | +echo ${CRAG_SERVER_PORT} > ${WORKPATH}/CRAG_SERVER_PORT_tmp |
46 | 66 |
|
| 67 | +echo "Downloading chinook data..." |
| 68 | +echo Y | rm -R chinook-database |
| 69 | +git clone https://github.com/lerocha/chinook-database.git |
| 70 | +echo Y | rm -R ../../../../../AgentQnA/tests/Chinook_Sqlite.sqlite |
| 71 | +cp chinook-database/ChinookDatabase/DataSources/Chinook_Sqlite.sqlite ../../../../../AgentQnA/tests |
| 72 | + |
| 73 | +docker compose -f ../../../../../DocIndexRetriever/docker_compose/intel/cpu/xeon/compose.yaml up -d |
47 | 74 | docker compose -f compose.yaml up -d
|
| 75 | + |
| 76 | +n=0 |
| 77 | +until [[ "$n" -ge 100 ]]; do |
| 78 | + docker logs tgi-service > ${WORKPATH}/tgi_service_start.log |
| 79 | + if grep -q Connected ${WORKPATH}/tgi_service_start.log; then |
| 80 | + break |
| 81 | + fi |
| 82 | + sleep 10s |
| 83 | + n=$((n+1)) |
| 84 | +done |
| 85 | + |
| 86 | +echo "Starting CRAG server" |
| 87 | +docker run -d --runtime=runc --name=kdd-cup-24-crag-service -p=${CRAG_SERVER_PORT}:8000 docker.io/aicrowd/kdd-cup-24-crag-mock-api:v0 |
0 commit comments