Integrating with NeMo Guardrails
NeMo Guardrails uses the LangChain ChatNVIDIA connector to connect to a locally running NIM microservice like Llama 3.1 NemoGuard 8B ContentSafety NIM.
The content safety microservice exposes the standard OpenAI interface on the v1/completions and v1/chat/completions endpoints.
NeMo Guardrails simplifies the complexity of building the prompt template, parsing the content safety model responses, and provides a programmable method to build a chatbot with content safety rails.
To integrate NeMo Guardrails with the content safety microservice, create a config.yml file that is similar to the following example:
-
Field
enginespecifiesnim. -
Field
parameters.base_urlspecifies the IP address and port of the Llama 3.1 NemoGuard 8B ContentSafety NIM host. -
Field
parameters.model_namein the Guardrails configuration must match the model name served by the Llama 3.1 NemoGuard 8B ContentSafety NIM. -
The rails definition specifies
content_safetyas the model.
Refer to NVIDIA NeMo Guardrails documentation for more information about the configuration file.