Skip to main content

check_content()

Scans a string of text against a specified or client-default policy. This is the primary method used by the platform’s tracing and guardrail system and is recommended for flexible, ad-hoc scans. Signature:
def check_content(
    self,
    content: str,
    node_subtype: Optional[NodeSubTypeEnum] = None,
    *,
    name: Optional[str] = None,
    policies: Optional[Policy] = None,
    session_id: Optional[str] = None,
    node_metadata: Optional[Dict[str, Any]] = None,
    save: Optional[bool] = None,
) -> ApiResult
Parameters:
ParameterTypeDefaultDescription
contentstr(none)Required. The text content to scan.
node_subtypeOptional[NodeSubTypeEnum]GUARDRAILSPlatform Tier Only. Specifies the subtype of the node being checked for more granular tracing.
nameOptional[str]"Policy Validation"Platform Tier Only. A descriptive name for the check, which appears in the platform observability logs.
policiesOptional[Policy]NoneA Policy object that, if provided, will be used for this scan instead of any default policy configured on the client.
session_idOptional[str]NonePlatform Tier Only. A Session ID that, if provided, overrides the client’s default session_id for this single scan.
node_metadataOptional[Dict[str, Any]]NonePlatform Tier Only. Custom metadata to attach to the trace span for this specific check.
saveOptional[bool]NonePlatform Tier Only. A boolean that, if provided, overrides the client’s default save behavior for this single scan.
Returns: An ApiResult object detailing the scan results.

check_prompt()

A specialized method that scans a user-generated prompt against the active policy. The active policy is determined by the policy override parameter if provided; otherwise, it falls back to the client’s default policy. Signature:
def check_prompt(
    self,
    prompt: str,
    *,
    policy: Optional[Policy] = None,
    asset_id: Optional[str] = None,
    session_id: Optional[str] = None,
    save: Optional[bool] = None
) -> ApiResult
Parameters:
ParameterTypeDefaultDescription
promptstr(none)Required. The user-generated prompt text to scan.
policyOptional[Policy]NoneA Policy object that, if provided, will be used for this scan instead of any default policy configured on the client.
asset_idOptional[str]NonePlatform Tier Only. An Asset ID that, if provided, overrides the client’s default asset_id for this single scan.
session_idOptional[str]NonePlatform Tier Only. A Session ID that, if provided, overrides the client’s default session_id for this single scan.
saveOptional[bool]NonePlatform Tier Only. A boolean that, if provided, overrides the client’s default save behavior for this single scan.
Returns: An ApiResult object detailing the scan results.

check_response()

A specialized method that scans an LLM-generated response against the active policy. The active policy is determined by the policy override parameter if provided; otherwise, it falls back to the client’s default policy. Signature:
def check_response(
    self,
    response: str,
    *,
    policy: Optional[Policy] = None,
    asset_id: Optional[str] = None,
    session_id: Optional[str] = None,
    save: Optional[bool] = None
) -> ApiResult
Parameters:
ParameterTypeDefaultDescription
responsestr(none)Required. The LLM-generated response text to scan.
policyOptional[Policy]NoneA Policy object that, if provided, will be used for this scan instead of any default policy configured on the client.
asset_idOptional[str]NonePlatform Tier Only. An Asset ID that, if provided, overrides the client’s default asset_id for this single scan.
session_idOptional[str]NonePlatform Tier Only. A Session ID that, if provided, overrides the client’s default session_id for this single scan.
saveOptional[bool]NonePlatform Tier Only. A boolean that, if provided, overrides the client’s default save behavior for this single scan.
Returns: An ApiResult object detailing the scan results.