Just like Wasm, it's sometimes desirable to have a simple Lua filter run after the ai gateway's own ext proc so it can leverage the metadata provided by aigw's ext_proc (i.e. the x-ai-eg-model header) to add some extra internal headers based on the model's name extracted by aigw.
The Envoy Gateway allows this filter ordering via https://gateway.envoyproxy.io/docs/tasks/operations/customize-envoyproxy/#customize-filter-order, however the AI Gateway's injection of ext proc only ensures it's placed before a limited set of filters:
|
var afterExtProcFilterPrefixes = []string{ |
|
egv1a1.EnvoyFilterExtProc.String(), |
|
egv1a1.EnvoyFilterWasm.String(), |
|
egv1a1.EnvoyFilterRBAC.String(), |
|
egv1a1.EnvoyFilterLocalRateLimit.String(), |
|
egv1a1.EnvoyFilterRateLimit.String(), |
|
egv1a1.EnvoyFilterCustomResponse.String(), |
|
egv1a1.EnvoyFilterCredentialInjector.String(), |
|
egv1a1.EnvoyFilterCompressor.String(), |
|
egv1a1.EnvoyFilterRouter.String(), |
I think the same argument for allowing Wasm to run after ext_proc can also be made for Lua.
Just like Wasm, it's sometimes desirable to have a simple Lua filter run after the ai gateway's own ext proc so it can leverage the metadata provided by aigw's ext_proc (i.e. the
x-ai-eg-modelheader) to add some extra internal headers based on the model's name extracted by aigw.The Envoy Gateway allows this filter ordering via https://gateway.envoyproxy.io/docs/tasks/operations/customize-envoyproxy/#customize-filter-order, however the AI Gateway's injection of ext proc only ensures it's placed before a limited set of filters:
ai-gateway/internal/extensionserver/post_translate_modify.go
Lines 695 to 704 in 0c66077
I think the same argument for allowing Wasm to run after ext_proc can also be made for Lua.