> 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.polygraf.request

Module for handling Polygraf PII detection requests.

## Module Contents

### Functions

| Name                                                                                        | Description                                       |
| ------------------------------------------------------------------------------------------- | ------------------------------------------------- |
| [`_send_polygraf_request`](#nemoguardrails-library-polygraf-request-_send_polygraf_request) | -                                                 |
| [`polygraf_request`](#nemoguardrails-library-polygraf-request-polygraf_request)             | Send a PII detection request to the Polygraf API. |

### Data

[`DEFAULT_TIMEOUT_SECONDS`](#nemoguardrails-library-polygraf-request-DEFAULT_TIMEOUT_SECONDS)

### API

```python
nemoguardrails.library.polygraf.request._send_polygraf_request(
    session: aiohttp.ClientSession,
    server_endpoint: str,
    payload: typing.Dict[str, typing.Any],
    headers: typing.Dict[str, str],
    timeout: aiohttp.ClientTimeout
) -> typing.List[typing.Dict[str, typing.Any]]
```

async

```python
nemoguardrails.library.polygraf.request.polygraf_request(
    text: str,
    server_endpoint: str,
    api_key: typing.Optional[str] = None,
    session: typing.Optional[aiohttp.ClientSession] = None,
    timeout: float = DEFAULT_TIMEOUT_SECONDS
) -> typing.List[typing.Dict[str, typing.Any]]
```

async

Send a PII detection request to the Polygraf API.

**Parameters:**

The text to analyze.

The API endpoint URL.

The API key for the Polygraf service.

Optional shared aiohttp session. Passing a session lets callers
reuse connections across multiple PII checks.

Per-request timeout in seconds. Applied to both caller-provided
and internally created sessions.

**Returns:** `List[Dict[str, Any]]`

The list of entities detected by the Polygraf server.

**Raises:**

* `ValueError`: If the API call fails, times out, or the response cannot
  be parsed as JSON.

```python
nemoguardrails.library.polygraf.request.DEFAULT_TIMEOUT_SECONDS = 30
```