nemoguardrails.library.polygraf.request
Module for handling Polygraf PII detection requests.
Module Contents
Functions
Data
API
async
async
Send a PII detection request to the Polygraf API.
Parameters:
text
The text to analyze.
server_endpoint
The API endpoint URL.
api_key
The API key for the Polygraf service.
session
Optional shared aiohttp session. Passing a session lets callers reuse connections across multiple PII checks.
timeout
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.