> 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.hallucination.actions

## Module Contents

### Functions

| Name                                                                                                 | Description                                                                                               |
| ---------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| [`self_check_hallucination`](#nemoguardrails-library-hallucination-actions-self_check_hallucination) | Checks if the last bot response is a hallucination by checking multiple completions for self-consistency. |

### Data

[`HALLUCINATION_NUM_EXTRA_RESPONSES`](#nemoguardrails-library-hallucination-actions-HALLUCINATION_NUM_EXTRA_RESPONSES)

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

### API

```python
nemoguardrails.library.hallucination.actions.self_check_hallucination(
    llm: nemoguardrails.types.LLMModel,
    llm_task_manager: nemoguardrails.llm.taskmanager.LLMTaskManager,
    context: typing.Optional[dict] = None,
    use_llm_checking: bool = True,
    config: typing.Optional[nemoguardrails.RailsConfig] = None,
    kwargs = {}
)
```

async

Checks if the last bot response is a hallucination by checking multiple completions for self-consistency.

:return: True if hallucination is detected, False otherwise.

```python
nemoguardrails.library.hallucination.actions.HALLUCINATION_NUM_EXTRA_RESPONSES = 2
```

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