NGF: Add guardrails doc - #2191
Conversation
mjang
left a comment
There was a problem hiding this comment.
Some of my comments depend on whether / where we refer to F5 AI Guardrails or NGF guardrails
|
|
||
| ## Before you begin | ||
|
|
||
| You need an F5 AI Guardrails API endpoint to inspect payloads. This can be an F5 hosted service or a service running inside your cluster. |
There was a problem hiding this comment.
We have many F5 AI Guardrails API endpoints
I think the right endpoint might be: https://docs.aisecurity.f5.com/operations/get_prompts.html ?
There was a problem hiding this comment.
Oh yea those are endpoints/paths on a specific F5 AI Guardrails service. I guess I was talking about the F5 AI Guardrails service. such as us1.calypsoai.app / eu1.calypsoai.app, or a self hosted endpoint.
There was a problem hiding this comment.
When a doc says:
"You need an F5 AI Guardrails API endpoint to inspect payloads."
I think: "Which endpoint"? I made my best guess.
Oh yea those are endpoints/paths on a specific F5 AI Guardrails service. I guess I was talking about the F5 AI Guardrails service. such as us1.calypsoai.app / eu1.calypsoai.app, or a self hosted endpoint.
As you can see from the link, you can include the server in the URL. The (changeable) default shown in the AI Security API doc is us1.calypsoai.app.
There was a problem hiding this comment.
So do you think I should give the example us1.calypsoai.app to help clarify what endpoint means?
There was a problem hiding this comment.
because that endpoint can be different per user. they should/would know the answer to "which endpoint?"
There was a problem hiding this comment.
Actually the base URL depends on the deployment -- which varies per customer (not user?)
us1.calypsoai.app or eu1.calypsoai.app would correspond to a SaaS install. For on prem, the base URL depends on the deploying customer. Ref: https://docs.aisecurity.f5.com/integrations/_base_vars.html
There was a problem hiding this comment.
Sorry yea the base url can vary per customer, how would you suggest this portion be changed to account for that?
There was a problem hiding this comment.
I differentiate between BASE_URL and endpoint.
- BASE_URL = something like us1.calypsoai.app
- Endpoint = what's added to the end of the BASE_URL
- Based on what I see, I'm guessing it's based on the scans endpoint
- With examples such as https://docs.aisecurity.f5.com/api-docs/scan-request-streaming.html#scan-a-request-body-before-you-send-it
| You need an F5 AI Guardrails API endpoint to inspect payloads. This can be an F5 hosted service or a service running inside your cluster. | |
| To inspect payloads, you can use the F5 AI Guardrails [scans](https://docs.aisecurity.f5.com/operations/get_scans.html) endpoint. Specifically, this can be an F5 hosted service or a service running inside your cluster. | |
| With the `scans/` endpoint, the server URL varies depending on whether you've deployed AI Security on your system, or use the AI Security SaaS deployment. For more information, see our description of [BASE_VARS](https://docs.aisecurity.f5.com/integrations/_base_vars.html). |
There was a problem hiding this comment.
Yea, though currently NGF doesn't allow for any other endpoint besides the scans endpoint. We don't allow the user to configure any endpoint and it almost feels like an implementation detail that is unnecessary to bring up.
I'd rather hide that part of the implementation and perhaps add a small line just saying something like "NGINX Gateway Fabric uses the scans/ endpoint when communicating with the F5 AI Guardrails API for both requests and responses (and link to the docs just so they can look into it if they want)" than insinuate that the user can configure this endpoint.
| The `cluster.local` suffix in the in-cluster URL is the cluster's DNS domain. If your cluster uses a different domain, configure it with the `--cluster-domain` flag on the NGINX Gateway Fabric controller (default: `cluster.local`). | ||
| {{< /call-out >}} | ||
|
|
||
| For an external backend, create an `ExternalName` Service pointing at your hosted Guardrails API: |
There was a problem hiding this comment.
Question: with the Guardrails API, are we referring to some F5 API? (That may change some of my comments)
There was a problem hiding this comment.
If it isn't an F5 API, we need to figure out how to clarify:
- What's a NGF guardrail
- What's used for F5 AI Guardrails
There was a problem hiding this comment.
Guardrails API is referring to this product https://docs.aisecurity.f5.com/api-docs/getting-started-defend.html. and this https://docs.aisecurity.f5.com/api-docs/prompts-scans.html.
There is no NGF guardrails.
There was a problem hiding this comment.
But in that section I don't put the full "F5 AI Guardrails" because they are self-hosted, meaning they aren't sending requests to https://us1.calypsoai.app/, they are sending to their own hosted version of F5 AI Guardrails. I can adjust if necessary.
There was a problem hiding this comment.
I've added a suggstion earlier (and will add one for the end of the page)
mjang
left a comment
There was a problem hiding this comment.
I've suggested a few other changes. Thanks for clarifying how NGF integrates
|
|
||
| ## Before you begin | ||
|
|
||
| You need an F5 AI Guardrails API endpoint to inspect payloads. This can be an F5 hosted service or a service running inside your cluster. |
There was a problem hiding this comment.
I differentiate between BASE_URL and endpoint.
- BASE_URL = something like us1.calypsoai.app
- Endpoint = what's added to the end of the BASE_URL
- Based on what I see, I'm guessing it's based on the scans endpoint
- With examples such as https://docs.aisecurity.f5.com/api-docs/scan-request-streaming.html#scan-a-request-body-before-you-send-it
| You need an F5 AI Guardrails API endpoint to inspect payloads. This can be an F5 hosted service or a service running inside your cluster. | |
| To inspect payloads, you can use the F5 AI Guardrails [scans](https://docs.aisecurity.f5.com/operations/get_scans.html) endpoint. Specifically, this can be an F5 hosted service or a service running inside your cluster. | |
| With the `scans/` endpoint, the server URL varies depending on whether you've deployed AI Security on your system, or use the AI Security SaaS deployment. For more information, see our description of [BASE_VARS](https://docs.aisecurity.f5.com/integrations/_base_vars.html). |
| The `cluster.local` suffix in the in-cluster URL is the cluster's DNS domain. If your cluster uses a different domain, configure it with the `--cluster-domain` flag on the NGINX Gateway Fabric controller (default: `cluster.local`). | ||
| {{< /call-out >}} | ||
|
|
||
| For an external backend, create an `ExternalName` Service pointing at your hosted Guardrails API: |
There was a problem hiding this comment.
I've added a suggstion earlier (and will add one for the end of the page)
|
I'm going to follow up with the AI Security PM on Tuesday Aug 11 (we have a weekly meeting). |
| {{< call-out "note" >}} | ||
| The `cluster.local` suffix in the in-cluster URL is the cluster's DNS domain. If your cluster uses a different domain, configure it with the `--cluster-domain` flag on the NGINX Gateway Fabric controller (default: `cluster.local`). | ||
| {{< /call-out >}} |
There was a problem hiding this comment.
I wonder if we should make a reference to this section in the "Before you begin" section. If a user is following this document, they would have first installed NGF with nginxGateway.payloadProcessor.enable=true, then by the time they get to this step, the realize they need to set their own cluster domain, and then need to upgrade/reinstall NGF again.
It might be fine though as I think about it. What do you think?
There was a problem hiding this comment.
I just don't think they should install NGF in the before you begin section.
There was a problem hiding this comment.
I personally don't think its a big enough issue to make the change. Though it would be solved if we don't install NGF in the before you begin section.
@sjberman did you have a place in mind to install NGF? Technically we could Deploy the LLM, create the gateway, secret, guardrails backend Service before deploying NGF.
There was a problem hiding this comment.
That sounds fine to me. Maybe do the gateway after installing NGF
|
|
||
| ## Before you begin | ||
|
|
||
| You need an F5 AI Guardrails API endpoint to inspect payloads. This can be an F5 hosted service or a service running inside your cluster. |
There was a problem hiding this comment.
Are there Guardrails installation/usage docs? Feels like we should link out to them.
There was a problem hiding this comment.
added a small link. It's difficult since guardrails doesn't have guides on using the dashboard, which is what I think users would be using.
| For an external backend, create an `ExternalName` Service pointing at your hosted Guardrails API: | ||
|
|
||
| ```yaml | ||
| kubectl apply -f - <<EOF | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: guardrails-api | ||
| spec: | ||
| type: ExternalName | ||
| externalName: <GUARDRAILS_API_HOSTNAME> | ||
| ports: | ||
| - name: https | ||
| port: 443 | ||
| protocol: TCP | ||
| EOF | ||
| ``` | ||
|
|
||
| For an in-cluster backend, your AI Guardrail backend pods will most likely have an existing Service which you can point the PayloadProcessor backendRef to. |
There was a problem hiding this comment.
could we use tabs for the external/internal differing configs? Kind of nice, concise way to display multiple options in a doc, similar to our installation docs with OSS/Plus
|
|
||
| {{%tab name="External"%}} | ||
|
|
||
| To configure a Guardrails backend Service which is external, create an `ExternalName` Service pointing at your hosted Guardrails API: |
There was a problem hiding this comment.
should this not be...
| To configure a Guardrails backend Service which is external, create an `ExternalName` Service pointing at your hosted Guardrails API: | |
| To configure a AI Guardrails backend Service which is external, create an `ExternalName` Service pointing at your hosted Guardrails API: |
?
or the backend service is just "Guardrails" ?
|
|
||
| {{%tab name="In-cluster"%}} | ||
|
|
||
| For an in-cluster backend, your AI Guardrail backend pods will most likely have an existing Service which you can point the PayloadProcessor backendRef to, otherwise create a Service configured to expose your guardrail backends: |
There was a problem hiding this comment.
| For an in-cluster backend, your AI Guardrail backend pods will most likely have an existing Service which you can point the PayloadProcessor backendRef to, otherwise create a Service configured to expose your guardrail backends: | |
| For an in-cluster backend, your AI Guardrails backend pods will most likely have an existing Service which you can point the PayloadProcessor backendRef to, otherwise create a Service configured to expose your guardrail backends: |
See also my other question
There was a problem hiding this comment.
If it's the name of a product of service, it needs to be consistent (AI Guardrails) across the document. If it's not a product or service it needs to be lowercase...
| ## Send traffic | ||
|
|
||
| {{< call-out "note" >}} | ||
| Whether a given value is blocked depends entirely on your Guardrails backend's detector configuration. Enable the relevant detectors on your Guardrails service to see the block responses above. |
There was a problem hiding this comment.
| Whether a given value is blocked depends entirely on your Guardrails backend's detector configuration. Enable the relevant detectors on your Guardrails service to see the block responses above. | |
| Whether a given value is blocked depends entirely on your AI Guardrails backend's detector configuration. Enable the relevant detectors on your Guardrails service to see the block responses above. |
| ``` | ||
|
|
||
|
|
||
| If the request payload contains content that your Guardrails backend is configured to block, the request never reaches the LLM and returns `HTTP 403`: |
There was a problem hiding this comment.
| If the request payload contains content that your Guardrails backend is configured to block, the request never reaches the LLM and returns `HTTP 403`: | |
| If the request payload contains content that your AI Guardrails backend is configured to block, the request never reaches the LLM and returns `HTTP 403`: |
| {"error":{"code":"content_policy_violation","message":"Request blocked by guardrails policy.","param":null,"type":"invalid_request_error"} | ||
| ``` | ||
|
|
||
| If the model's *output* contains content that your Guardrails backend blocks, the response is withheld from the client and returns `HTTP 403` with `error.type: api_error`: |
There was a problem hiding this comment.
| If the model's *output* contains content that your Guardrails backend blocks, the response is withheld from the client and returns `HTTP 403` with `error.type: api_error`: | |
| If the model's *output* contains content that your AI Guardrails backend blocks, the response is withheld from the client and returns `HTTP 403` with `error.type: api_error`: |
|
btw, waiting on some ongoing changes in nginx/nginx-gateway-fabric#5697 before merging. Will merge after that PR is merged. |
Add document for NGF's integration with F5 AI Guardrails.
Checklist
Before sharing this pull request, I completed the following checklist:
Footnotes
Potentially sensitive information includes personally identify information (PII), authentication credentials, and live URLs. Refer to the style guide for guidance about placeholder content. ↩