> This page is for version v0.24.1.
> For other versions, use one of these documentation indexes:
> - Latest (default): https://docs.nvidia.com/nemo/guardrails/latest/llms.txt
> - v0.24.1: https://docs.nvidia.com/nemo/guardrails/v0.24.1/llms.txt
> - v0.24.0: https://docs.nvidia.com/nemo/guardrails/v0.24.0/llms.txt
> - v0.23.0: https://docs.nvidia.com/nemo/guardrails/v0.23.0/llms.txt
> - v0.22.0: https://docs.nvidia.com/nemo/guardrails/v0.22.0/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/guardrails/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/guardrails/_mcp/server.

# nemoguardrails.library.llama_guard.actions

## Module Contents

### Functions

| Name                                                                                                   | Description                                                          |
| ------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------- |
| [`_get_llama_guard_model`](#nemoguardrails-library-llama_guard-actions-_get_llama_guard_model)         | -                                                                    |
| [`_llama_guard_outcome`](#nemoguardrails-library-llama_guard-actions-_llama_guard_outcome)             | -                                                                    |
| [`llama_guard_check_input`](#nemoguardrails-library-llama_guard-actions-llama_guard_check_input)       | Checks user messages using the configured Llama Guard model          |
| [`llama_guard_check_output`](#nemoguardrails-library-llama_guard-actions-llama_guard_check_output)     | Check the bot response using the configured Llama Guard model        |
| [`parse_llama_guard_response`](#nemoguardrails-library-llama_guard-actions-parse_llama_guard_response) | Parses the response from the Llama Guard LLM and returns a tuple of: |

### Data

[`log`](#nemoguardrails-library-llama_guard-actions-log)

### API

```python
nemoguardrails.library.llama_guard.actions._get_llama_guard_model(
    llms: collections.abc.Mapping[str, nemoguardrails.types.LLMModel],
    model_name: str
) -> nemoguardrails.types.LLMModel
```

```python
nemoguardrails.library.llama_guard.actions._llama_guard_outcome(
    allowed: bool,
    policy_violations: typing.Optional[typing.List[str]]
) -> nemoguardrails.actions.rail_outcome.RailOutcome
```

```python
nemoguardrails.library.llama_guard.actions.llama_guard_check_input(
    llm_task_manager: nemoguardrails.llm.taskmanager.LLMTaskManager,
    llms: collections.abc.Mapping[str, nemoguardrails.types.LLMModel],
    model_name: str,
    context: typing.Optional[dict] = None,
    user_message: typing.Optional[str] = None,
    kwargs = {}
) -> nemoguardrails.actions.rail_outcome.RailOutcome
```

async

Checks user messages using the configured Llama Guard model
and the configured prompt containing the safety guidelines.

```python
nemoguardrails.library.llama_guard.actions.llama_guard_check_output(
    llm_task_manager: nemoguardrails.llm.taskmanager.LLMTaskManager,
    llms: collections.abc.Mapping[str, nemoguardrails.types.LLMModel],
    model_name: str,
    context: typing.Optional[dict] = None,
    user_message: typing.Optional[str] = None,
    bot_message: typing.Optional[str] = None
) -> nemoguardrails.actions.rail_outcome.RailOutcome
```

async

Check the bot response using the configured Llama Guard model
and the configured prompt containing the safety guidelines.

```python
nemoguardrails.library.llama_guard.actions.parse_llama_guard_response(
    response: str
) -> typing.Tuple[bool, typing.Optional[typing.List[str]]]
```

Parses the response from the Llama Guard LLM and returns a tuple of:

* Whether the response is safe or not.
* If not safe, a list of the violated policies.

```python
nemoguardrails.library.llama_guard.actions.log = logging.getLogger(__name__)
```