> 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 full documentation content, see https://docs.nvidia.com/nemo/guardrails/llms-full.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                                                          |
| ------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------- |
| [`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        |
| [`llama_guard_check_output_mapping`](#nemoguardrails-library-llama_guard-actions-llama_guard_check_output_mapping) | Mapping for llama\_guard\_check\_output.                             |
| [`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.llama_guard_check_input(
    llm_task_manager: nemoguardrails.llm.taskmanager.LLMTaskManager,
    context: typing.Optional[dict] = None,
    llama_guard_llm: typing.Optional[nemoguardrails.types.LLMModel] = None,
    kwargs = {}
) -> dict
```

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,
    context: typing.Optional[dict] = None,
    llama_guard_llm: typing.Optional[nemoguardrails.types.LLMModel] = None
) -> dict
```

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.llama_guard_check_output_mapping(
    result: dict
) -> bool
```

Mapping for llama\_guard\_check\_output.

**Returns:** `bool`

True if the response should be blocked (i.e. if "allowed" is False),

```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__)
```