Integrate Guardrails into Your Application
The NeMo Guardrails library provides the following tools to integrate guardrails into your applications.
-
Use the NeMo Guardrails Python SDK to add guardrails directly into your Python application.
-
Use the NeMo Guardrails LangChain integration to wrap guardrails around LangChain chains or use chains within guardrails.
Starting in 0.22, the LangChain integration is opt-in. To enable it, set the
NEMOGUARDRAILS_LLM_FRAMEWORK=langchainenvironment variable or callset_default_framework("langchain"). Installlangchainandlangchain-community(or the matchinglangchain-<provider>package) before importing. For background, see Migrating to 0.22.For more information, refer to the LangChain Integration Guide.
-
Integrate the NeMo Guardrails API server into your application to add protection to applications in any programming language.
You can then use the API server in your application by sending requests to the server’s endpoint.
For more information, refer to Guardrails API Server.
-
Use the NeMo Guardrails Docker deployment capabilities to deploy guardrails as a containerized service. For more information, refer to Docker.
For more examples and detailed integration patterns, refer to the examples directory in the NeMo Guardrails GitHub repository.