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

Module for handling GLiNER detection requests.

## Module Contents

### Functions

| Name                                                                      | Description                                     |
| ------------------------------------------------------------------------- | ----------------------------------------------- |
| [`gliner_request`](#nemoguardrails-library-gliner-request-gliner_request) | Send a PII detection request to the GLiNER API. |

### Data

[`log`](#nemoguardrails-library-gliner-request-log)

### API

```python
nemoguardrails.library.gliner.request.gliner_request(
    text: str,
    server_endpoint: str,
    enabled_entities: typing.Optional[typing.List[str]] = None,
    threshold: typing.Optional[float] = None,
    chunk_length: typing.Optional[int] = None,
    overlap: typing.Optional[int] = None,
    flat_ner: typing.Optional[bool] = None,
    api_key: typing.Optional[str] = None,
    model: str = 'nvidia/gliner-pii'
) -> typing.Dict[str, typing.Any]
```

async

Send a PII detection request to the GLiNER API.

Supports two server formats:

* Custom server (/v1/extract): plain JSON request, no auth required.
* NIM API (/v1/chat/completions): OpenAI-compatible chat completions format,
  used by both the locally-run NIM container and the NVIDIA-hosted endpoint.
  Requires an API key for the hosted endpoint.

**Parameters:**

The text to analyze.

The API endpoint URL.

List of entity types to detect. If None, uses server defaults.

Confidence threshold for entity detection (0.0 to 1.0).

Length of text chunks for processing.

Overlap between chunks.

Whether to use flat NER mode.

Optional Bearer token for authenticated endpoints.

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

Normalized response dict with keys:

**Raises:**

* `ValueError`: If the API call fails or the response cannot be parsed.

```python
nemoguardrails.library.gliner.request.log = logging.getLogger(__name__)
```