Opaque Gateway Library API reference
This module exposes wrappers around API calls to the Opaque Gateway service.
DesanitizeResponse
dataclass
Class representing the return value of the desanitize method.
Attributes:
| Name | Type | Description |
|---|---|---|
desanitized_text |
str
|
The desanitized form of the input text with PII added back in. |
SanitizeResponse
dataclass
Class representing the return value of the sanitize method
Attributes:
| Name | Type | Description |
|---|---|---|
sanitized_texts |
list of str
|
The sanitized form of the input texts without PII. List has the same dimensions as the input_texts list. |
secret_entropy |
str
|
A set of bytes encoded as a string that contains the context needed to desanitize the entities in sanitized_text; it must be passed along to the desanitize endpoint. |
desanitize
Takes in a sanitized response and returns the desanitized text with PII added back to it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sanitized_text |
str
|
Sanitized response that you want to be desanitized. |
required |
secure_context |
str
|
Secret entropy value that should have been returned by the call to sanitize. |
required |
retries |
int
|
The number of times to resubmit a request to the service before giving up when errors occur. |
None
|
timeout |
int
|
The number of seconds to wait until a request to the service times out. |
None
|
Returns:
| Type | Description |
|---|---|
DesanitizeResponse
|
The de-anonymized version of |
sanitize
Takes in a list of prompts and returns a list of sanitized prompts with PII redacted from it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_texts |
list of str
|
List of prompts to sanitize together. |
required |
retries |
int
|
The number of retries to submit a request to the service before giving up when errors occur. |
None
|
timeout |
int
|
The number of seconds to wait until a request to the service times out. |
None
|
Returns:
| Type | Description |
|---|---|
SanitizeResponse
|
The anonymized version of |