> 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.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:**

**`text`** `str`

The text to analyze.

---

**`server_endpoint`** `str`

The API endpoint URL.

---

**`enabled_entities`** `Optional[List[str]]` — default: None

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

---

**`threshold`** `Optional[float]` — default: None

Confidence threshold for entity detection (0.0 to 1.0).

---

**`chunk_length`** `Optional[int]` — default: None

Length of text chunks for processing.

---

**`overlap`** `Optional[int]` — default: None

Overlap between chunks.

---

**`flat_ner`** `Optional[bool]` — default: None

Whether to use flat NER mode.

---

**`api_key`** `Optional[str]` — default: None

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