-
Notifications
You must be signed in to change notification settings - Fork 690
feat: example routing between different models using inference gateway #1981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -138,8 +138,10 @@ export GATEWAY_URL=<Gateway-URL> | |
|
|
||
| To test the gateway in minikube, use the following command: | ||
| ```bash | ||
| minikube tunnel & | ||
| # start minikube tunnel | ||
| minikube tunnel | ||
|
|
||
| # in a separate terminal | ||
| GATEWAY_URL=$(kubectl get svc inference-gateway -o yaml -o jsonpath='{.spec.clusterIP}') | ||
| echo $GATEWAY_URL | ||
|
Comment on lines
145
to
146
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested fix: -# in a separate terminal
-GATEWAY_URL=$(kubectl get svc inference-gateway -o yaml -o jsonpath='{.spec.clusterIP}')
+# in a separate terminal
+# grab the external IP assigned by the tunnel
+GATEWAY_URL=$(kubectl get svc inference-gateway \
+ -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo $GATEWAY_URLor, for simplicity: GATEWAY_URL=$(minikube service inference-gateway --url | head -n1)🤖 Prompt for AI Agents |
||
| ``` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| Get Gatewaty URL | ||
| ```bash | ||
| GATEWAY_URL=$(kubectl get svc inference-gateway -o yaml -o jsonpath='{.spec.clusterIP}') | ||
| echo $GATEWAY_URL | ||
| ``` | ||
|
|
||
| Get models | ||
| ```bash | ||
| curl $GATEWAY_URL/v1/models | jq . | ||
|
|
||
| # Sample response | ||
| { | ||
| "object": "list", | ||
| "data": [ | ||
| { | ||
| "id": "google/gemma-3-1b-it", | ||
| "object": "object", | ||
| "created": 1752695871, | ||
| "owned_by": "nvidia" | ||
| }, | ||
| { | ||
| "id": "Qwen/Qwen3-0.6B", | ||
| "object": "object", | ||
| "created": 1752695871, | ||
| "owned_by": "nvidia" | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
|
|
||
| Send inference request to Qwen model: | ||
|
|
||
| ```bash | ||
| curl $GATEWAY_URL/v1/chat/completions \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "model": "Qwen/Qwen3-0.6B", | ||
| "messages": [ | ||
| { | ||
| "role": "user", | ||
| "content": "In the heart of Eldoria, an ancient land of boundless magic and mysterious creatures, lies the long-forgotten city of Aeloria. Once a beacon of knowledge and power, Aeloria was buried beneath the shifting sands of time, lost to the world for centuries. You are an intrepid explorer, known for your unparalleled curiosity and courage, who has stumbled upon an ancient map hinting at ests that Aeloria holds a secret so profound that it has the potential to reshape the very fabric of reality. Your journey will take you through treacherous deserts, enchanted forests, and across perilous mountain ranges. Your Task: Character Background: Develop a detailed background for your character. Describe their motivations for seeking out Aeloria, their skills and weaknesses, and any personal connections to the ancient city or its legends. Are they driven by a quest for knowledge, a search for lost familt clue is hidden." | ||
| } | ||
| ], | ||
| "stream":false, | ||
| "max_tokens": 30 | ||
| }' | ||
| ``` | ||
|
|
||
|
|
||
| Send inference request to Gemma model: | ||
|
|
||
|
|
||
| ```bash | ||
| curl $GATEWAY_URL/v1/chat/completions \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "model": "google/gemma-3-1b-it", | ||
| "messages": [ | ||
| { | ||
| "role": "user", | ||
| "content": "In the heart of Eldoria, an ancient land of boundless magic and mysterious creatures, lies the long-forgotten city of Aeloria. Once a beacon of knowledge and power, Aeloria was buried beneath the shifting sands of time, lost to the world for centuries. You are an intrepid explorer, known for your unparalleled curiosity and courage, who has stumbled upon an ancient map hinting at ests that Aeloria holds a secret so profound that it has the potential to reshape the very fabric of reality. Your journey will take you through treacherous deserts, enchanted forests, and across perilous mountain ranges. Your Task: Character Background: Develop a detailed background for your character. Describe their motivations for seeking out Aeloria, their skills and weaknesses, and any personal connections to the ancient city or its legends. Are they driven by a quest for knowledge, a search for lost familt clue is hidden." | ||
| } | ||
| ], | ||
| "stream":false, | ||
| "max_tokens": 30 | ||
| }' | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| apiVersion: inference.networking.x-k8s.io/v1alpha2 | ||
| kind: InferenceModel | ||
| metadata: | ||
| name: qwen3 | ||
| namespace: default | ||
| spec: | ||
| criticality: Critical | ||
| modelName: Qwen/Qwen3-0.6B | ||
| poolRef: | ||
| group: inference.networking.x-k8s.io | ||
| kind: InferencePool | ||
| name: dynamo-deepseek |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,140 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| apiVersion: nvidia.com/v1alpha1 | ||
| kind: DynamoGraphDeployment | ||
| metadata: | ||
| name: vllm-v1-agg | ||
| spec: | ||
| services: | ||
| Frontend: | ||
| livenessProbe: | ||
| httpGet: | ||
| path: /health | ||
| port: 8000 | ||
| initialDelaySeconds: 60 | ||
| periodSeconds: 60 | ||
| timeoutSeconds: 30 | ||
| failureThreshold: 10 | ||
| readinessProbe: | ||
| exec: | ||
| command: | ||
| - /bin/sh | ||
| - -c | ||
| - "exit 0" | ||
| initialDelaySeconds: 60 | ||
| periodSeconds: 60 | ||
| timeoutSeconds: 30 | ||
| failureThreshold: 10 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Readiness probe always succeeds – loses rollout safety.
🤖 Prompt for AI Agents |
||
| dynamoNamespace: vllm-v1-agg | ||
| componentType: main | ||
| replicas: 1 | ||
| resources: | ||
| requests: | ||
| cpu: "1" | ||
| memory: "2Gi" | ||
| limits: | ||
| cpu: "1" | ||
| memory: "2Gi" | ||
| extraPodSpec: | ||
| mainContainer: | ||
| image: gitlab-master.nvidia.com:5005/aire/microservices/compoundai/dynamo:1c03404f2624186523529b8d4ca04731b60aa8b9-31776852-vllm_v1-amd64 | ||
| workingDir: /workspace/examples/vllm | ||
| args: | ||
| - dynamo | ||
| - run | ||
| - in=http | ||
| - out=dyn | ||
| - --http-port | ||
| - "8000" | ||
| - --router-mode | ||
| - kv | ||
| GemmaDecodeWorker: | ||
| envFromSecret: hf-token-secret | ||
| livenessProbe: | ||
| exec: | ||
| command: | ||
| - /bin/sh | ||
| - -c | ||
| - "exit 0" | ||
| periodSeconds: 60 | ||
| timeoutSeconds: 30 | ||
| failureThreshold: 10 | ||
| readinessProbe: | ||
| exec: | ||
| command: | ||
| - /bin/sh | ||
| - -c | ||
| - "exit 0" | ||
| initialDelaySeconds: 60 | ||
| periodSeconds: 60 | ||
| timeoutSeconds: 30 | ||
| failureThreshold: 10 | ||
| dynamoNamespace: vllm-v1-agg | ||
| componentType: worker | ||
| replicas: 1 | ||
| resources: | ||
| requests: | ||
| cpu: "10" | ||
| memory: "20Gi" | ||
| gpu: "1" | ||
| limits: | ||
| cpu: "10" | ||
| memory: "20Gi" | ||
| gpu: "1" | ||
| extraPodSpec: | ||
| mainContainer: | ||
| image: gitlab-master.nvidia.com:5005/aire/microservices/compoundai/dynamo:1c03404f2624186523529b8d4ca04731b60aa8b9-31776852-vllm_v1-amd64 | ||
| workingDir: /workspace/examples/vllm | ||
| args: | ||
| - "python3 components/main.py --model google/gemma-3-1b-it --enforce-eager --endpoint dyn://dynamo.gemma.generate 2>&1 | tee /tmp/vllm.log" | ||
| QwenDecodeWorker: | ||
| envFromSecret: hf-token-secret | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Worker args executed without shell – redirection & pipes break. The whole string is one argv element; Either wrap with an explicit shell: command:
- /bin/sh
- -c
args:
- |
python3 components/main.py --model google/gemma-3-1b-it \
--enforce-eager --endpoint dyn://dynamo.gemma.generate 2>&1 | tee /tmp/vllm.logor drop redirection/pipe. 🤖 Prompt for AI Agents |
||
| livenessProbe: | ||
| exec: | ||
| command: | ||
| - /bin/sh | ||
| - -c | ||
| - "exit 0" | ||
| periodSeconds: 60 | ||
| timeoutSeconds: 30 | ||
| failureThreshold: 10 | ||
| readinessProbe: | ||
| exec: | ||
| command: | ||
| - /bin/sh | ||
| - -c | ||
| - "exit 0" | ||
| initialDelaySeconds: 60 | ||
| periodSeconds: 60 | ||
| timeoutSeconds: 30 | ||
| failureThreshold: 10 | ||
| dynamoNamespace: vllm-v1-agg | ||
| componentType: worker | ||
| replicas: 1 | ||
| resources: | ||
| requests: | ||
| cpu: "10" | ||
| memory: "20Gi" | ||
| gpu: "1" | ||
| limits: | ||
| cpu: "10" | ||
| memory: "20Gi" | ||
| gpu: "1" | ||
| extraPodSpec: | ||
| mainContainer: | ||
| image: gitlab-master.nvidia.com:5005/aire/microservices/compoundai/dynamo:1c03404f2624186523529b8d4ca04731b60aa8b9-31776852-vllm_v1-amd64 | ||
| workingDir: /workspace/examples/vllm | ||
| args: | ||
| - "python3 components/main.py --model Qwen/Qwen3-0.6B --enforce-eager --endpoint dyn://dynamo.qwen.generate 2>&1 | tee /tmp/vllm.log" | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 35 has obsolete data:
export DEPLOYMENT_NAME=llm-agg1
yq eval '
.metadata.name = env(DEPLOYMENT_NAME) |
.spec.services[].extraPodSpec.mainContainer.image = env(VLLM_RUNTIME_IMAGE)
' examples/vllm_v0/deploy/agg.yaml > examples/vllm_v0/deploy/agg1.yaml