Guardrails are currently in beta. We are actively working to expand it.
Reach out if you have any questions or
feedback.
Guardrails vs. Tests
Guardrails complement tests, in particular in monitoring mode. While your Openlayer tests run continuously on top of your live data and trigger a notification in case of failure, guardrails validate inputs and outputs in real time and block or modify them if they don’t meet your constraints. Together, they give you both proactive coverage (through tests) and reactive protection (through guardrails).Guardrails are not a replacement for tests. They are a complementary tool to
help you ensure that your AI system is safe and compliant. Furthermore, it is
worth noting that guardrails introduce latency in your system, as they need to
validate inputs and outputs in real time.
Guardrails library
Openlayer offers an open-source Python library that you can use. You can use one of the built-in guardrails (such as the PII guardrail), or implement your own.Openlayer Guardrails GitHub repository
Check out the source code of the Openlayer Guardrails library.
With Openlayer tracing
Guardrails work well with Openlayer tracing. In this case, you can pass the desired guardrails to thetrace
decorator, and they will be applied
to the inputs and outputs of the traced function.
Prerequisites: Besides the
openlayer-guardrails
, you need to have the
openlayer
library installed and have tracing correctly configured in your
project to run the example below.