Skip to content

Commit

Permalink
update codegen service port and update e2e test
Browse files Browse the repository at this point in the history
Signed-off-by: Yingchun Guo <[email protected]>
  • Loading branch information
daisy-ycguo committed Jun 5, 2024
1 parent cff4ab2 commit fca32db
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 29 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/scripts/e2e/chart_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,18 @@ function validate_codegen() {
ip_address=$(kubectl get svc $RELEASE_NAME -n $NAMESPACE -o jsonpath='{.spec.clusterIP}')
port=$(kubectl get svc $RELEASE_NAME -n $NAMESPACE -o jsonpath='{.spec.ports[0].port}')
# Curl the Mega Service
curl http://${ip_address}:${port}/v1/codegen -H "Content-Type: application/json" -d '{
"model": "ise-uiuc/Magicoder-S-DS-6.7B",
"messages": "Implement a high-level API for a TODO list application. The API takes as input an operation request and updates the TODO list in place. If the request is invalid, raise an exception."}' > curl_megaservice.log
curl http://${ip_address}:${port}/v1/codegen -H "Content-Type: application/json" \
-d '{"messages": "def print_hello_world():"}' > $LOG_PATH/curl_codegen.log
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "Megaservice codegen failed, please check the logs in ${LOG_PATH}!"
exit 1
fi

echo "Checking response results, make sure the output is reasonable. "
local status=true
if [[ -f curl_megaservice.log ]] && \
[[ $(grep -c "billion" curl_megaservice.log) != 0 ]]; then
local status=false
if [[ -f $LOG_PATH/curl_codegen.log ]] && \
[[ $(grep -c "print" $LOG_PATH/curl_codegen.log) != 0 ]]; then
status=true
fi

Expand Down
24 changes: 14 additions & 10 deletions .github/workflows/scripts/e2e/manifest_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,18 @@ function validate_codegen() {
port=$(kubectl get svc $SERVICE_NAME -n $NAMESPACE -o jsonpath='{.spec.ports[0].port}')
echo "try to curl http://${ip_address}:${port}/v1/codegen..."
# Curl the Mega Service
curl http://${ip_address}:${port}/v1/codegen -H "Content-Type: application/json" -d '{
"model": "ise-uiuc/Magicoder-S-DS-6.7B",
"messages": "Implement a high-level API for a TODO list application. The API takes as input an operation request and updates the TODO list in place. If the request is invalid, raise an exception."}' > curl_megaservice.log
curl http://${ip_address}:${port}/v1/codegen -H "Content-Type: application/json" \
-d '{"messages": "def print_hello_world():"}' > $LOG_PATH/curl_codegen.log
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "Megaservice codegen failed, please check the logs in ${LOG_PATH}!"
exit 1
fi

echo "Checking response results, make sure the output is reasonable. "
local status=true
if [[ -f curl_megaservice.log ]] && \
[[ $(grep -c "billion" curl_megaservice.log) != 0 ]]; then
local status=false
if [[ -f $LOG_PATH/curl_codegen.log ]] && \
[[ $(grep -c "print" $LOG_PATH/curl_codegen.log) != 0 ]]; then
status=true
fi

Expand All @@ -82,17 +86,17 @@ function validate_chatqna() {

# Curl the Mega Service
curl http://chaqna-xeon-backend-server-svc.$NAMESPACE:8888/v1/chatqna -H "Content-Type: application/json" \
-d '{ "messages": "What is the revenue of Nike in 2023?" }' > $LOG_PATH/curl_megaservice.log
-d '{ "messages": "What is the revenue of Nike in 2023?" }' > $LOG_PATH/curl_chatqna.log
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "Megaservice failed, please check the logs in ${LOG_PATH}!"
echo "Megaservice chatqna failed, please check the logs in ${LOG_PATH}!"
exit 1
fi

echo "Checking response results, make sure the output is reasonable. "
local status=false
if [[ -f $LOG_PATH/curl_megaservice.log ]] && \
[[ $(grep -c "billion" $LOG_PATH/curl_megaservice.log) != 0 ]]; then
if [[ -f $LOG_PATH/curl_chatqna.log ]] && \
[[ $(grep -c "billion" $LOG_PATH/curl_chatqna.log) != 0 ]]; then
status=true
fi

Expand Down
2 changes: 1 addition & 1 deletion helm-charts/codegen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ helm install codegen codegen --set llm-uservice.HUGGINGFACEHUB_API_TOKEN=${HFTOK
| Key | Type | Default | Description |
| ------------------------------------- | ------ | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| image.repository | string | `"opea/codegen:latest"` | |
| service.port | string | `"6666"` | |
| service.port | string | `"7778"` | |
| llm-uservice.HUGGINGFACEHUB_API_TOKEN | string | `""` | Your own Hugging Face API token |
| llm-uservice.tgi.LLM_MODEL_ID | string | `"ise-uiuc/Magicoder-S-DS-6.7B"` | Models id from https://huggingface.co/, or predownloaded model directory |
| llm-uservice.tgi.volume | string | `"/mnt"` | Cached models directory, tgi will not download if the model is cached here. The "volume" will be mounted to container as /data directory |
4 changes: 2 additions & 2 deletions helm-charts/codegen/gaudi-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ image:
# Overrides the image tag whose default is the chart appVersion.
# tag: "1.0"

port: 6666
port: 7778
service:
type: ClusterIP
port: 6666
port: 7778

# To override values in subchart llm-uservice
llm-uservice:
Expand Down
4 changes: 2 additions & 2 deletions helm-charts/codegen/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ image:
# Overrides the image tag whose default is the chart appVersion.
# tag: "1.0"

port: 6666
port: 7778
service:
type: ClusterIP
port: 6666
port: 7778

# To override values in subchart llm-uservice
llm-uservice:
Expand Down
2 changes: 1 addition & 1 deletion manifests/CodeGen/gaudi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ kubectl apply -f codegen.yaml
Make sure all the pods are running, and restart the codegen-xxxx pod if necessary.

```
curl http://codegen:6666/v1/codegen -H "Content-Type: application/json" -d '{
curl http://codegen:7778/v1/codegen -H "Content-Type: application/json" -d '{
"messages": "Implement a high-level API for a TODO list application. The API takes as input an operation request and updates the TODO list in place. If the request is invalid, raise an exception."
}'
```
6 changes: 3 additions & 3 deletions manifests/CodeGen/gaudi/codegen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ metadata:
spec:
type: ClusterIP
ports:
- port: 6666
targetPort: 6666
- port: 7778
targetPort: 7778
protocol: TCP
name: codegen
selector:
Expand Down Expand Up @@ -229,7 +229,7 @@ spec:
imagePullPolicy: IfNotPresent
ports:
- name: codegen
containerPort: 6666
containerPort: 7778
protocol: TCP
resources:
null
2 changes: 1 addition & 1 deletion manifests/CodeGen/xeon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ kubectl apply -f codegen.yaml
Make sure all the pods are running, and restart the codegen-xxxx pod if necessary.

```
curl http://codegen:6666/v1/codegen -H "Content-Type: application/json" -d '{
curl http://codegen:7778/v1/codegen -H "Content-Type: application/json" -d '{
"messages": "Implement a high-level API for a TODO list application. The API takes as input an operation request and updates the TODO list in place. If the request is invalid, raise an exception."
}'
```
6 changes: 3 additions & 3 deletions manifests/CodeGen/xeon/codegen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ metadata:
spec:
type: ClusterIP
ports:
- port: 6666
targetPort: 6666
- port: 7778
targetPort: 7778
protocol: TCP
name: codegen
selector:
Expand Down Expand Up @@ -228,7 +228,7 @@ spec:
imagePullPolicy: IfNotPresent
ports:
- name: codegen
containerPort: 6666
containerPort: 7778
protocol: TCP
resources:
null

0 comments on commit fca32db

Please sign in to comment.