forked from letonghan/GenAIExamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Agent example for v1.0 release (opea-project#684)
Signed-off-by: minmin-intel <[email protected]> Signed-off-by: Chendi.Xue <[email protected]>
- Loading branch information
1 parent
e48532e
commit 262a6f6
Showing
21 changed files
with
753 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
AgentQnA/docker_compose/intel/cpu/xeon/launch_agent_service_openai.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
# Copyright (C) 2024 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
export TOOLSET_PATH=$WORKDIR/GenAIExamples/AgentQnA/tools/ | ||
export ip_address=$(hostname -I | awk '{print $1}') | ||
export recursion_limit=12 | ||
export recursion_limit_worker=12 | ||
export recursion_limit_supervisor=10 | ||
export model="gpt-4o-mini-2024-07-18" | ||
export temperature=0 | ||
export max_new_tokens=512 | ||
export OPENAI_API_KEY=${OPENAI_API_KEY} | ||
export WORKER_AGENT_URL="http://${ip_address}:9095/v1/chat/completions" | ||
export RETRIEVAL_TOOL_URL="http://${ip_address}:8889/v1/retrievaltool" | ||
export CRAG_SERVER=http://${ip_address}:8080 | ||
|
||
docker compose -f compose_openai.yaml up -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Copyright (C) 2024 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
services: | ||
tgi-server: | ||
image: ghcr.io/huggingface/tgi-gaudi:2.0.4 | ||
container_name: tgi-server | ||
ports: | ||
- "8085:80" | ||
volumes: | ||
- ${HF_CACHE_DIR}:/data | ||
environment: | ||
no_proxy: ${no_proxy} | ||
http_proxy: ${http_proxy} | ||
https_proxy: ${https_proxy} | ||
HF_TOKEN: ${HUGGINGFACEHUB_API_TOKEN} | ||
HF_HUB_DISABLE_PROGRESS_BARS: 1 | ||
HF_HUB_ENABLE_HF_TRANSFER: 0 | ||
HABANA_VISIBLE_DEVICES: all | ||
OMPI_MCA_btl_vader_single_copy_mechanism: none | ||
PT_HPU_ENABLE_LAZY_COLLECTIVES: true | ||
runtime: habana | ||
cap_add: | ||
- SYS_NICE | ||
ipc: host | ||
command: --model-id ${LLM_MODEL_ID} --max-input-length 4096 --max-total-tokens 8192 --sharded true --num-shard ${NUM_SHARDS} | ||
worker-docgrader-agent: | ||
image: opea/comps-agent-langchain:latest | ||
container_name: docgrader-agent-endpoint | ||
depends_on: | ||
- tgi-server | ||
volumes: | ||
# - ${WORKDIR}/GenAIExamples/AgentQnA/docker_image_build/GenAIComps/comps/agent/langchain/:/home/user/comps/agent/langchain/ | ||
- ${TOOLSET_PATH}:/home/user/tools/ | ||
ports: | ||
- "9095:9095" | ||
ipc: host | ||
environment: | ||
ip_address: ${ip_address} | ||
strategy: rag_agent | ||
recursion_limit: ${recursion_limit_worker} | ||
llm_engine: tgi | ||
HUGGINGFACEHUB_API_TOKEN: ${HUGGINGFACEHUB_API_TOKEN} | ||
llm_endpoint_url: ${LLM_ENDPOINT_URL} | ||
model: ${LLM_MODEL_ID} | ||
temperature: ${temperature} | ||
max_new_tokens: ${max_new_tokens} | ||
streaming: false | ||
tools: /home/user/tools/worker_agent_tools.yaml | ||
require_human_feedback: false | ||
RETRIEVAL_TOOL_URL: ${RETRIEVAL_TOOL_URL} | ||
no_proxy: ${no_proxy} | ||
http_proxy: ${http_proxy} | ||
https_proxy: ${https_proxy} | ||
LANGCHAIN_API_KEY: ${LANGCHAIN_API_KEY} | ||
LANGCHAIN_TRACING_V2: ${LANGCHAIN_TRACING_V2} | ||
LANGCHAIN_PROJECT: "opea-worker-agent-service" | ||
port: 9095 | ||
|
||
|
||
supervisor-react-agent: | ||
image: opea/comps-agent-langchain:latest | ||
container_name: react-agent-endpoint | ||
depends_on: | ||
- tgi-server | ||
- worker-docgrader-agent | ||
volumes: | ||
# - ${WORKDIR}/GenAIExamples/AgentQnA/docker_image_build/GenAIComps/comps/agent/langchain/:/home/user/comps/agent/langchain/ | ||
- ${TOOLSET_PATH}:/home/user/tools/ | ||
ports: | ||
- "9090:9090" | ||
ipc: host | ||
environment: | ||
ip_address: ${ip_address} | ||
strategy: react_langgraph | ||
recursion_limit: ${recursion_limit_supervisor} | ||
llm_engine: tgi | ||
HUGGINGFACEHUB_API_TOKEN: ${HUGGINGFACEHUB_API_TOKEN} | ||
llm_endpoint_url: ${LLM_ENDPOINT_URL} | ||
model: ${LLM_MODEL_ID} | ||
temperature: ${temperature} | ||
max_new_tokens: ${max_new_tokens} | ||
streaming: false | ||
tools: /home/user/tools/supervisor_agent_tools.yaml | ||
require_human_feedback: false | ||
no_proxy: ${no_proxy} | ||
http_proxy: ${http_proxy} | ||
https_proxy: ${https_proxy} | ||
LANGCHAIN_API_KEY: ${LANGCHAIN_API_KEY} | ||
LANGCHAIN_TRACING_V2: ${LANGCHAIN_TRACING_V2} | ||
LANGCHAIN_PROJECT: "opea-supervisor-agent-service" | ||
CRAG_SERVER: $CRAG_SERVER | ||
WORKER_AGENT_URL: $WORKER_AGENT_URL | ||
port: 9090 |
43 changes: 43 additions & 0 deletions
43
AgentQnA/docker_compose/intel/hpu/gaudi/launch_agent_service_tgi_gaudi.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright (C) 2024 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
WORKPATH=$(dirname "$PWD")/.. | ||
# export WORKDIR=$WORKPATH/../../ | ||
echo "WORKDIR=${WORKDIR}" | ||
export ip_address=$(hostname -I | awk '{print $1}') | ||
export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} | ||
|
||
# LLM related environment variables | ||
export HF_CACHE_DIR=${HF_CACHE_DIR} | ||
ls $HF_CACHE_DIR | ||
export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} | ||
export LLM_MODEL_ID="meta-llama/Meta-Llama-3.1-70B-Instruct" | ||
export NUM_SHARDS=4 | ||
export LLM_ENDPOINT_URL="http://${ip_address}:8085" | ||
export temperature=0.01 | ||
export max_new_tokens=512 | ||
|
||
# agent related environment variables | ||
export TOOLSET_PATH=$WORKDIR/GenAIExamples/AgentQnA/tools/ | ||
echo "TOOLSET_PATH=${TOOLSET_PATH}" | ||
export recursion_limit_worker=12 | ||
export recursion_limit_supervisor=10 | ||
export WORKER_AGENT_URL="http://${ip_address}:9095/v1/chat/completions" | ||
export RETRIEVAL_TOOL_URL="http://${ip_address}:8889/v1/retrievaltool" | ||
export CRAG_SERVER=http://${ip_address}:8080 | ||
|
||
docker compose -f compose.yaml up -d | ||
|
||
sleep 5s | ||
echo "Waiting tgi gaudi ready" | ||
n=0 | ||
until [[ "$n" -ge 100 ]] || [[ $ready == true ]]; do | ||
docker logs tgi-server &> tgi-gaudi-service.log | ||
n=$((n+1)) | ||
if grep -q Connected tgi-gaudi-service.log; then | ||
break | ||
fi | ||
sleep 5s | ||
done | ||
sleep 5s | ||
echo "Service started successfully" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright (C) 2024 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
services: | ||
agent-endpoint: | ||
build: | ||
context: GenAIComps | ||
dockerfile: comps/agent/langchain/Dockerfile | ||
args: | ||
http_proxy: ${http_proxy} | ||
https_proxy: ${https_proxy} | ||
no_proxy: ${no_proxy} | ||
image: ${REGISTRY:-opea}/comps-agent-langchain:${TAG:-latest} |
Oops, something went wrong.