> This page is for version v0.25.0.
> For other versions, use one of these documentation indexes:
> - Latest (default): https://docs.nvidia.com/nemo/guardrails/latest/llms.txt
> - v0.25.0: https://docs.nvidia.com/nemo/guardrails/v0.25.0/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.

# nemoguardrails.patch_asyncio

## Module Contents

### Functions

| Name                                                                                               | Description                                                   |
| -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
| [`apply`](#nemoguardrails-patch_asyncio-apply)                                                     | Apply the optional nested-loop patch when explicitly enabled. |
| [`check_sync_call_from_async_loop`](#nemoguardrails-patch_asyncio-check_sync_call_from_async_loop) | Helper to check if a sync call is made from an async loop.    |

### Data

[`nest_asyncio_patch_applied`](#nemoguardrails-patch_asyncio-nest_asyncio_patch_applied)

### API

```python
nemoguardrails.patch_asyncio.apply()
```

Apply the optional nested-loop patch when explicitly enabled.

**Raises:**

* `ImportError`: If patching is enabled without the optional dependency.

> **Warning**
>
> \[\<griffe.\_internal.docstrings.models.DocstringWarn object at 0xffffacab5eb0>]

```python
nemoguardrails.patch_asyncio.check_sync_call_from_async_loop()
```

Helper to check if a sync call is made from an async loop.

Returns
True if a sync call is made from an async loop.

```python
nemoguardrails.patch_asyncio.nest_asyncio_patch_applied = False
```