-
-
Notifications
You must be signed in to change notification settings - Fork 44
Add enovy ai gateway (helm dependencies + doc) #360
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,101 @@ | ||
| # Envoy AI Gateway | ||
|
|
||
| [Envoy AI Gateway](https://aigateway.envoyproxy.io/) is an open source project for using Envoy Gateway | ||
| to handle request traffic from application clients to Generative AI services. | ||
|
|
||
| ## How to use | ||
|
|
||
| ### 1. Enable Envoy Gateway and Envoy AI Gateway in llmaz Helm | ||
|
|
||
| Enable Envoy Gateway and Envoy AI Gateway in the `values.global.yaml` file, envoy gateway and envoy ai gateway are disabled by default. | ||
|
|
||
| ```yaml | ||
| envoy-gateway: | ||
| enabled: true | ||
| envoy-ai-gateway: | ||
| enabled: true | ||
| ``` | ||
|
|
||
| Note: [Envoy Gateway installation](https://gateway.envoyproxy.io/latest/install/install-helm/) and [Envoy AI Gateway installation](https://aigateway.envoyproxy.io/docs/getting-started/) can be done standalone. | ||
|
|
||
| ### 2. Check Envoy Gateway and Envoy AI Gateway | ||
|
|
||
| Run `kubectl wait --timeout=5m -n envoy-gateway-system deployment/envoy-gateway --for=condition=Available` to wait for the envoy gateway to be ready. | ||
|
|
||
| Run `kubectl wait --timeout=2m -n envoy-ai-gateway-system deployment/ai-gateway-controller --for=condition=Available` to wait for the envoy ai gateway to be ready. | ||
|
|
||
| ### 3. Basic AI Gateway example | ||
|
|
||
| To expose your model(Playground) to Envoy Gateway, you need to create a GatewayClass, Gateway, and AIGatewayRoute. The following example shows how to do this. | ||
|
|
||
| Example [qwen playground](docs/examples/llamacpp/playground.yaml) configuration for a basic AI Gateway. | ||
| The model name is `qwen2-0.5b`, so the backend ref name is `qwen2-0--5b`, and the model lb service: `qwen2-0--5b-lb` | ||
| - Playground in [docs/examples/llamacpp/playground.yaml](docs/examples/llamacpp/playground.yaml) | ||
| - GatewayClass in [docs/examples/envoy-ai-gateway/basic.yaml](docs/examples/envoy-ai-gateway/basic.yaml) | ||
|
|
||
| Check if the gateway pod to be ready: | ||
|
|
||
| ```bash | ||
| kubectl wait pods --timeout=2m \ | ||
| -l gateway.envoyproxy.io/owning-gateway-name=envoy-ai-gateway-basic \ | ||
| -n envoy-gateway-system \ | ||
| --for=condition=Ready | ||
| ``` | ||
|
|
||
| ### 4. Check Envoy AI Gateway APIs | ||
|
|
||
| - For local test with port forwarding, use `export GATEWAY_URL="http://localhost:8080"`. | ||
| - Using external IP, use `export GATEWAY_URL=$(kubectl get gateway/envoy-ai-gateway-basic -o jsonpath='{.status.addresses[0].value}')` | ||
|
|
||
| See https://aigateway.envoyproxy.io/docs/getting-started/basic-usage for more details. | ||
|
|
||
| `$GATEWAY_URL/v1/models` will show the models that are available in the Envoy AI Gateway. The response will look like this: | ||
|
|
||
| ```json | ||
| { | ||
| "data": [ | ||
| { | ||
| "id": "some-cool-self-hosted-model", | ||
| "created": 1744880950, | ||
| "object": "model", | ||
| "owned_by": "Envoy AI Gateway" | ||
| }, | ||
| { | ||
| "id": "qwen2-0.5b", | ||
| "created": 1744880950, | ||
| "object": "model", | ||
| "owned_by": "Envoy AI Gateway" | ||
| } | ||
| ], | ||
| "object": "list" | ||
| } | ||
| ``` | ||
|
|
||
| `$GATEWAY_URL/v1/chat/completions` will show the chat completions for the model. The request will look like this: | ||
|
|
||
| ```bash | ||
| curl -H "Content-Type: application/json" -d '{ | ||
| "model": "qwen2-0.5b", | ||
| "messages": [ | ||
| { | ||
| "role": "system", | ||
| "content": "Hi." | ||
| } | ||
| ] | ||
| }' $GATEWAY_URL/v1/chat/completions | ||
| ``` | ||
|
|
||
| Expected response will look like this: | ||
|
|
||
| ```json | ||
| { | ||
| "choices": [ | ||
| { | ||
| "message": { | ||
| "content": "I'll be back." | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
This file contains hidden or 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,54 @@ | ||
| apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: GatewayClass | ||
| metadata: | ||
| name: envoy-ai-gateway-basic | ||
| spec: | ||
| controllerName: gateway.envoyproxy.io/gatewayclass-controller | ||
| --- | ||
| apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: Gateway | ||
| metadata: | ||
| name: envoy-ai-gateway-basic | ||
| namespace: default | ||
| spec: | ||
| gatewayClassName: envoy-ai-gateway-basic | ||
| listeners: | ||
| - name: http | ||
| protocol: HTTP | ||
| port: 80 | ||
| --- | ||
| apiVersion: aigateway.envoyproxy.io/v1alpha1 | ||
| kind: AIGatewayRoute | ||
| metadata: | ||
| name: envoy-ai-gateway-basic | ||
| namespace: default | ||
| spec: | ||
| schema: | ||
| name: OpenAI | ||
| targetRefs: | ||
| - name: envoy-ai-gateway-basic | ||
| kind: Gateway | ||
| group: gateway.networking.k8s.io | ||
| rules: | ||
|
|
||
| # Above are basic config for envoy ai gateway | ||
| # Below is example for qwen2-0.5b: a matched backend ref and the AIServiceBackend | ||
| - matches: | ||
| - headers: | ||
| - type: Exact | ||
| name: x-ai-eg-model | ||
| value: qwen2-0.5b | ||
| backendRefs: | ||
| - name: envoy-ai-gateway-llmaz-model-1 | ||
| --- | ||
| apiVersion: aigateway.envoyproxy.io/v1alpha1 | ||
| kind: AIServiceBackend | ||
| metadata: | ||
| name: envoy-ai-gateway-llmaz-model-1 | ||
| namespace: default | ||
| spec: | ||
| schema: | ||
| name: OpenAI | ||
| backendRef: | ||
| name: qwen2-0--5b-lb | ||
| kind: Service |
This file contains hidden or 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,102 @@ | ||
| # Envoy AI Gateway | ||
|
|
||
| [Envoy AI Gateway](https://aigateway.envoyproxy.io/) is an open source project for using Envoy Gateway | ||
| to handle request traffic from application clients to Generative AI services. | ||
|
|
||
| ## How to use | ||
|
|
||
| ### 1. Enable Envoy Gateway and Envoy AI Gateway in llmaz Helm | ||
|
|
||
| Enable Envoy Gateway and Envoy AI Gateway in the `values.global.yaml` file, envoy gateway and envoy ai gateway are enabled by default. | ||
|
|
||
| ```yaml | ||
| envoy-gateway: | ||
| enabled: true | ||
| envoy-ai-gateway: | ||
| enabled: true | ||
| ``` | ||
|
|
||
| Note: [Envoy Gateway installation](https://gateway.envoyproxy.io/latest/install/install-helm/) and [Envoy AI Gateway installation](https://aigateway.envoyproxy.io/docs/getting-started/) can be done standalone. | ||
|
|
||
| ### 2. Check Envoy Gateway and Envoy AI Gateway | ||
|
|
||
| Run `kubectl wait --timeout=5m -n envoy-gateway-system deployment/envoy-gateway --for=condition=Available` to wait for the envoy gateway to be ready. | ||
|
|
||
| Run `kubectl wait --timeout=2m -n envoy-ai-gateway-system deployment/ai-gateway-controller --for=condition=Available` to wait for the envoy ai gateway to be ready. | ||
|
|
||
| ### 3. Basic AI Gateway example | ||
|
|
||
| To expose your model(Playground) to Envoy Gateway, you need to create a GatewayClass, Gateway, and AIGatewayRoute. The following example shows how to do this. | ||
|
|
||
| Example [qwen playground](docs/examples/llamacpp/playground.yaml) configuration for a basic AI Gateway. | ||
| The model name is `qwen2-0.5b`, so the backend ref name is `qwen2-0--5b`, and the model lb service: `qwen2-0--5b-lb` | ||
|
|
||
| - Playground in [docs/examples/llamacpp/playground.yaml](docs/examples/llamacpp/playground.yaml) | ||
| - GatewayClass in [docs/examples/envoy-ai-gateway/basic.yaml](docs/examples/envoy-ai-gateway/basic.yaml) | ||
|
|
||
| Check if the gateway pod to be ready: | ||
|
|
||
| ```bash | ||
| kubectl wait pods --timeout=2m \ | ||
| -l gateway.envoyproxy.io/owning-gateway-name=envoy-ai-gateway-basic \ | ||
| -n envoy-gateway-system \ | ||
| --for=condition=Ready | ||
| ``` | ||
|
|
||
| ### 4. Check Envoy AI Gateway APIs | ||
|
|
||
| - For local test with port forwarding, use `export GATEWAY_URL="http://localhost:8080"`. | ||
| - Using external IP, use `export GATEWAY_URL=$(kubectl get gateway/envoy-ai-gateway-basic -o jsonpath='{.status.addresses[0].value}')` | ||
|
|
||
| See https://aigateway.envoyproxy.io/docs/getting-started/basic-usage for more details. | ||
|
|
||
| `$GATEWAY_URL/v1/models` will show the models that are available in the Envoy AI Gateway. The response will look like this: | ||
|
|
||
| ```json | ||
| { | ||
| "data": [ | ||
| { | ||
| "id": "some-cool-self-hosted-model", | ||
| "created": 1744880950, | ||
| "object": "model", | ||
| "owned_by": "Envoy AI Gateway" | ||
| }, | ||
| { | ||
| "id": "qwen2-0.5b", | ||
| "created": 1744880950, | ||
| "object": "model", | ||
| "owned_by": "Envoy AI Gateway" | ||
| } | ||
| ], | ||
| "object": "list" | ||
| } | ||
| ``` | ||
|
|
||
| `$GATEWAY_URL/v1/chat/completions` will show the chat completions for the model. The request will look like this: | ||
|
|
||
| ```bash | ||
| curl -H "Content-Type: application/json" -d '{ | ||
| "model": "qwen2-0.5b", | ||
| "messages": [ | ||
| { | ||
| "role": "system", | ||
| "content": "Hi." | ||
| } | ||
| ] | ||
| }' $GATEWAY_URL/v1/chat/completions | ||
| ``` | ||
|
|
||
| Expected response will look like this: | ||
|
|
||
| ```json | ||
| { | ||
| "choices": [ | ||
| { | ||
| "message": { | ||
| "content": "I'll be back." | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.