This document outlines the deployment process for a CodeTrans application utilizing the GenAIComps microservice pipeline on Intel Gaudi server. The steps include Docker image creation, container deployment via Docker Compose, and service execution using microservices llm
. We will publish the Docker images to Docker Hub soon, it will simplify the deployment process for this service.
First of all, you need to build Docker Images locally and install the python package of it. This step can be ignored after the Docker images published to Docker hub.
git clone https://github.com/opea-project/GenAIComps.git
cd GenAIComps
docker build -t opea/llm-tgi:latest --no-cache --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/llms/text-generation/tgi/Dockerfile .
git clone https://github.com/opea-project/GenAIExamples.git
cd GenAIExamples/CodeTrans/docker
docker build -t opea/codetrans:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile .
cd GenAIExamples/CodeTrans/docker/ui
docker build -t opea/codetrans-ui:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f ./docker/Dockerfile .
Then run the command docker images
, you will have the following Docker Images:
opea/llm-tgi:latest
opea/codetrans:latest
opea/codetrans-ui:latest
Since the compose.yaml
will consume some environment variables, you need to setup them in advance as below. Notice that the LLM_MODEL_ID
indicates the LLM model used for TGI service.
export no_proxy=${your_no_proxy}
export http_proxy=${your_http_proxy}
export https_proxy=${your_http_proxy}
export LLM_MODEL_ID="HuggingFaceH4/mistral-7b-grok"
export TGI_LLM_ENDPOINT="http://${host_ip}:8008"
export HUGGINGFACEHUB_API_TOKEN=${your_hf_api_token}
export MEGA_SERVICE_HOST_IP=${host_ip}
export LLM_SERVICE_HOST_IP=${host_ip}
export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:7777/v1/codetrans"
cd GenAIExamples/CodeTrans/docker/gaudi
docker compose up -d
- TGI Service
curl http://${host_ip}:8008/generate \
-X POST \
-d '{"inputs":" ### System: Please translate the following Golang codes into Python codes. ### Original codes: '\'''\'''\''Golang \npackage main\n\nimport \"fmt\"\nfunc main() {\n fmt.Println(\"Hello, World!\");\n '\'''\'''\'' ### Translated codes:","parameters":{"max_new_tokens":17, "do_sample": true}}' \
-H 'Content-Type: application/json'
- LLM Microservice
curl http://${host_ip}:9000/v1/chat/completions\
-X POST \
-d '{"text":" ### System: Please translate the following Golang codes into Python codes. ### Original codes: '\'''\'''\''Golang \npackage main\n\nimport \"fmt\"\nfunc main() {\n fmt.Println(\"Hello, World!\");\n '\'''\'''\'' ### Translated codes:"}' \
-H 'Content-Type: application/json'
- MegaService
curl http://${host_ip}:7777/v1/codetrans \
-H "Content-Type: application/json" \
-d '{"language_from": "Golang","language_to": "Python","source_code": "package main\n\nimport \"fmt\"\nfunc main() {\n fmt.Println(\"Hello, World!\");\n}"}'
LangSmith offers tools to debug, evaluate, and monitor language models and intelligent agents. It can be used to assess benchmark data for each microservice. Before launching your services with docker compose -f compose.yaml up -d
, you need to enable LangSmith tracing by setting the LANGCHAIN_TRACING_V2
environment variable to true and configuring your LangChain API key.
Here's how you can do it:
- Install the latest version of LangSmith:
pip install -U langsmith
- Set the necessary environment variables:
export LANGCHAIN_TRACING_V2=true
export LANGCHAIN_API_KEY=ls_...
Open this URL http://{host_ip}:5173
in your browser to access the frontend.
Here is an example for summarizing a article.